Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.2
xmms2
xmms2-0.7-vorbis-picture-support.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File xmms2-0.7-vorbis-picture-support.patch of Package xmms2
Description: Add support for METADATA_BLOCK_PICTURE in Vorbis plugin Bug-Debian: http://bugs.debian.org/565479 Author: anomie@users.sourceforge.net Forwarded: no Index: debian.git/src/plugins/vorbis_common/common.c =================================================================== --- debian.git.orig/src/plugins/vorbis_common/common.c 2010-02-20 13:02:52.314149734 +0100 +++ debian.git/src/plugins/vorbis_common/common.c 2010-02-20 13:03:10.212899779 +0100 @@ -243,6 +243,74 @@ } } +static void +handle_image_comment (xmms_xform_t *xform, const gchar *value, gsize len) +{ + guint32 typ, mime_len, desc_len, img_len; + guchar *pos, *end, *mime_data, *img_data; + gchar hash[33]; + + pos = value; + end = value + len; + + if (pos + 4 > end) { + XMMS_DBG ("Malformed picture comment"); + return; + } + typ = GUINT32_FROM_BE (*(guint32 *)pos); + if (typ != 0 && typ != 3) { + XMMS_DBG ("Picture type %d not handled", typ); + return; + } + pos += 4; + + if (pos + 4 > end) { + XMMS_DBG ("Malformed picture comment"); + return; + } + mime_len = GUINT32_FROM_BE (*(guint32 *)pos); + pos += 4; + mime_data = pos; + pos += mime_len; + + if (pos + 4 > end) { + XMMS_DBG ("Malformed picture comment"); + return; + } + desc_len = GUINT32_FROM_BE (*(guint32 *)pos); + pos += 4; + pos += desc_len; + + pos += 4; /* width */ + pos += 4; /* height */ + pos += 4; /* depth */ + pos += 4; /* indexed palette length */ + + if (pos + 4 > end) { + XMMS_DBG ("Malformed picture comment"); + return; + } + img_len = GUINT32_FROM_BE (*(guint32 *)pos); + pos += 4; + img_data = pos; + + if (img_data + img_len > end) { + XMMS_DBG ("Malformed picture comment"); + return; + } + + if (xmms_bindata_plugin_add ((const guchar *)img_data, img_len, hash)) { + const gchar *metakey; + + metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_PICTURE_FRONT; + xmms_xform_metadata_set_str (xform, metakey, hash); + + metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_PICTURE_FRONT_MIME; + mime_data[mime_len] = '\0'; + xmms_xform_metadata_set_str (xform, metakey, mime_data); + } +} + /* note that "key" is NOT NUL-terminated here, * but "value" is. */ @@ -253,6 +321,14 @@ { gint i; + if (!g_ascii_strncasecmp (key, "METADATA_BLOCK_PICTURE", key_len)) { + gsize dlen; + gchar *dvalue = g_base64_decode (value, &dlen); + handle_image_comment (xform, dvalue, dlen); + g_free (dvalue); + return; + } + for (i = 0; i < G_N_ELEMENTS (properties); i++) { if ((!g_ascii_strncasecmp (key, "MUSICBRAINZ_ALBUMARTISTID", key_len)) && (!g_ascii_strcasecmp (value, MUSICBRAINZ_VA_ID))) {
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor