How to extract the assoc gstbuffer from gstelement
Tim-Philipp Müller
t.i.m at zen.co.uk
Wed Dec 12 06:17:32 PST 2012
On Tue, 2012-12-11 at 09:57 -0800, jlancaster wrote:
> I have a function in which one of the arguments is GstElement *element as
> shown below:
>
> GstStateChangeReturn QVideoSurfaceGstSink::change_state( GstElement
> *element, GstStateChange transition);
>
> On a pause event I want to write out the data in the associated GstBuffer of
> that element to disk for further processing in some future time.
>
> Is there a way to 'get' the GstBuffer from the element in some way?
I'm not familiar with the QVideoSurfaceGstSink API, but it appears to
derive from GstVideoSink which in turn derives from GstBaseSink, so you
might be able to retrieve the last buffer using something like:
GstBuffer *buf;
g_object_get (element, "last-buffer", &buf, NULL);
GST_BUFFER_CAPS should then contain the caps (format) of the buffer, and
GST_BUFFER_DATA/SIZE the data and size, but QVideoSurfaceGstSink also
seems to have a member with the caps info.
There is some helper API in libgstvideo that allows you to convert the
buffer to a raw video format of your choice, or encode it to jpeg/png:
see gst_video_convert_frame().
Cheers
-Tim
More information about the gstreamer-devel
mailing list