Getting image buffer data from audio file tags.
Tim-Philipp Müller
t.i.m at zen.co.uk
Tue Dec 18 15:15:36 PST 2012
On Tue, 2012-12-18 at 18:53 +0000, Nox Deleo wrote:
Hi,
> I'm trying to pull the image tag data from an audio file. I can pull a
> GstSample from the TagList, and a GstBuffer from that, but I don't
> know how to get the data out of that into something I can use in
> Python. I found an example (in the comments)
> here: http://www.jezra.net/blog/use_python_and_gstreamer_to_get_the_tags_of_an_audio_file, but I'm guessing it's for an older version of GStreamer since GstBuffer doesn't seem to have a 'data' attribute in GStreamer 1.0.
Yes, that's currently a bit of a problem, due to some missing bits in
gobject-introspection, which doesn't allow bindings to access byte
arrays in structures (you would get at the data in C by 'mapping' the
buffer and then accessing mapinfo.data and mapinfo.size). See
https://bugzilla.gnome.org/show_bug.cgi?id=678663
for the whole story.
It looks like we'll have to add a utility function to get the data from
bindings until this is fixed on the g-i/bindings side. Someone remind me
if I forget.
I don't know if there's a clever way to get at the data some other way,
other than what you're trying to do, or serialising it to a strings and
parsing the hex values. (ugh)
> I tried briefly to push the buffer into an appsrc->encoder->filesink
> pipeline, but this segfaulted on me (I haven't read up on using
> appsrc, so that's no surprise, but I'm hoping there's an easier way of
> doing this).
Sounds like you might be running into an annotation/bindings bug we've
just fixed in the 1.0.4 release that's just come out (should hopefully
land in your distro soon). A workaround for that was to not use the
explicit push_sample API on appsrc, but pass the sample with the buffer
using the signal_emit_by_name API (not sure about exact py-gi syntax).
Cheers
-Tim
More information about the gstreamer-devel
mailing list