jpegenc a theora playbin2 buffer?
t.i.m at zen.co.uk
Tue Sep 20 01:29:53 PDT 2011
On Mon, 2011-09-19 at 21:06 -0400, Erik Blankinship wrote:
> Here is the code I use to extract a pixbuf:
> caps = last_frame.get_caps( )
> width = int(caps["width"])
> height = int(caps["height"])
> r4 = width * 3
> r4 = (r4 + 3) & ~ 3
> pixBuf = gtk.gdk.pixbuf_new_from_data( last_frame.data,
> gtk.gdk.COLORSPACE_RGB, False, 8, width, height, r4 )
> and here are the results with rowstride set to width * 2: (..)
> and with width * 3: (...)
> and with width * 4: (...)
> Hopefully some can suggest what the rowstride should be based on these
> images, or suggest how I would determine what it should be?
Rowstrides are implicit, but there are helper function in libgstvideo
 which will tell you what the strides are.
*However*, what you're doing here isn't really going to work reliably.
If you get the last frame via the last-frame property, you have very
little control over what format it will be in. It may be RGB24, RGB32,
RGB15, BGR*, some YUV layout, AYUV, ARGB - pretty much anything (unless
you know exactly what sink is used and that sink only accepts exactly
It's best not to use the last-frame property at all.
If you want to get an RGB buffer, use the "convert-frame" action signal
to get an RGB buffer in the exact format you need for GdkPixbuf, like
the totem code I linked to does.
More information about the gstreamer-devel