Get image from mp3 id3 tags
Tim-Philipp Müller
t.i.m at zen.co.uk
Sat Aug 3 04:47:08 PDT 2013
On Fri, 2013-08-02 at 15:35 -0700, svalente wrote:
> Is it possible to use the gstreamer C API to extract the image (APIC tag)
> from an mp3 file's id3 tags? I don't necessarily want to display the image.
> I mostly want the data.
Sure.
> It appears that gst_tag_list_get_string_index() can't do it, since that
> returns a UTF-8-encoded, null-terminated string. I don't see any function
> that returns raw data.
That's because those image tags are GstSamples (GstBuffers in 0.10). You
need to use
const GValue *val;
GstSample *sample;
GstBuffer *buffer;
val = gst_tag_list_get_value*(..)
sample = g_value_get_boxed (val);
buffer = gst_sample_get_buffer (sample);
...
or in 0.10:
const GValue *val;
GstBuffer *buffer;
val = gst_tag_list_get_value*(..)
buffer = gst_value_get_buffer (val);
...
You can find some code to turn the images into e.g. GdkPixbufs in totem
(bacon-video-widget*c).
Cheers
-Tim
More information about the gstreamer-devel
mailing list