After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 512333 - [gstvorbistag] Retrieve Ogg/Vorbis cover art as image metadata
[gstvorbistag] Retrieve Ogg/Vorbis cover art as image metadata
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other All
: Normal enhancement
: 0.10.20
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2008-01-27 05:56 UTC by John Millikin
Modified: 2008-06-04 10:43 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
Extract Ogg/Vorbis cover art metadata (8.27 KB, patch)
2008-01-27 05:56 UTC, John Millikin
none Details | Review
Refactoring of the ID3 and FLAC code to use new utility functions (9.49 KB, patch)
2008-01-27 05:57 UTC, John Millikin
none Details | Review
Test case (6.15 KB, audio/x-vorbis+ogg)
2008-01-27 06:01 UTC, John Millikin
  Details
Extract Ogg/Vorbis cover art metadata (v2) (8.85 KB, patch)
2008-01-31 03:13 UTC, John Millikin
none Details | Review
API: add gst_tag_image_data_to_image_buffer() and gst_tag_list_add_id3_image() (11.79 KB, patch)
2008-06-03 11:22 UTC, Tim-Philipp Müller
none Details | Review

Description John Millikin 2008-01-27 05:56:21 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.
Comment 1 John Millikin 2008-01-27 05:56:48 UTC
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.
Comment 2 John Millikin 2008-01-27 05:57:23 UTC
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.
Comment 3 John Millikin 2008-01-27 06:01:22 UTC
Created attachment 103803 [details]
Test case

Test case, 5 seconds of silence with embedded JPEG cover art.
Comment 4 John Millikin 2008-01-31 03:13:11 UTC
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.
Comment 5 Tim-Philipp Müller 2008-06-03 11:22:50 UTC
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.
Comment 6 Tim-Philipp Müller 2008-06-03 19:33:20 UTC
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()

Comment 7 Tim-Philipp Müller 2008-06-04 10:43:54 UTC
 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).