GNOME Bugzilla – Bug 512333
[gstvorbistag] Retrieve Ogg/Vorbis cover art as image metadata
Last modified: 2008-06-04 10:43:54 UTC
There is no fixed, official standard for embedding cover art in Ogg/Vorbis files. However, a de-facto standard has emerged among both Free and proprietary software vendors for using the COVERART and COVERARTMIME comments to store cover art metadata. The COVERART comment contains the raw binary data, encoded in Base64. The optional COVERARTMIME comment contains the MIME-type of the contained image, or "-->" if the image data is a URI to the actual image. It would be nice if this data was made available through the standard GStreamer image tag mechanism, rather than manually parsing extended comments.
Created attachment 103801 [details] [review] Extract Ogg/Vorbis cover art metadata Define two new libgst utility functions, gst_normalize_image_mime_type and gst_add_image_tag. Both functions are based on code found in the ID3 and FLAC demuxers[1]. gst_normalize_image_mime_type is used to convert from the various formats found to the standard "image/*" form. gst_add_image_tag accepts as parameters the raw MIME-type, image data, and image type. It constructs a GstBuffer and adds it to a GstTagList. Also define a function gst_vorbis_extract_cover_art, which will be called after all tags have been read from a Vorbis comment buffer. If the buffer contained COVERART comments, the last such comment will be used to construct the image tag buffer. [1] A second patch shall be attached, to refactor the ID3 and FLAC demuxers to use the new utility functions.
Created attachment 103802 [details] [review] Refactoring of the ID3 and FLAC code to use new utility functions Replace much of the implementation of ID3's parse_picture_frame and FLAC's gst_flac_extract_picture_buffer with calls to gst_add_image_tag.
Created attachment 103803 [details] Test case Test case, 5 seconds of silence with embedded JPEG cover art.
Created attachment 104090 [details] [review] Extract Ogg/Vorbis cover art metadata (v2) Updated patch to fix two minor issues with the last one. * Tags are not normalized to upper-case in gst_tag_list_from_vorbiscomment_buffer, so use case-insensitive comparisons. * Bump Glib dependency to 2.12 for g_base64_decode.
Created attachment 112048 [details] [review] API: add gst_tag_image_data_to_image_buffer() and gst_tag_list_add_id3_image() I'd prefer something like this API-wise.
Committed the above, but without the declared_mime_type parameters, since we can't really trust/use them: 2008-06-03 Tim-Philipp Müller <tim.muller at collabora co uk> * gst-libs/gst/tag/gstid3tag.c: (gst_tag_list_add_id3_image): * gst-libs/gst/tag/tag.h: (GST_TAG_IMAGE_TYPE_NONE), * gst-libs/gst/tag/tags.c: (register_tag_image_type_enum), (gst_tag_image_type_get_type), (gst_tag_image_type_is_valid), (gst_tag_image_data_to_image_buffer): Add two utility functions to avoid code duplication (#512333): API: add gst_tag_image_data_to_image_buffer() API: add gst_tag_list_add_id3_image()
2008-06-03 Tim-Philipp Müller <tim.muller at collabora co uk> Based on patch by: John Millikin <jmillikin gmail com> * gst-libs/gst/tag/gstvorbistag.c: (tag_matches), (gst_vorbis_tag_add), (gst_vorbis_tag_add_coverart): Retrieve COVERART tags from vorbis comments (#512333) 2008-06-04 Tim-Philipp Müller <tim.muller at collabora co uk> * ext/flac/gstflacdec.c: (gst_flac_extract_picture_buffer): * gst/id3demux/id3v2frames.c: (parse_picture_frame): Use new utility functions in libgsttag to process coverart (#512333).