Putting Video Frames Into a Buffer for Appsrc

Andrey Nechypurenko andreynech at googlemail.com
Thu Jun 16 09:43:46 PDT 2011


Hi,

> Now I am trying to take this void* buffer
> and move its contents into a GstBuffer so that I can push it to an appsrc
> element.

I am also not very experienced gstreamer user, so I can not say for
sure whether your approach with gst_app_src_push_buffer() is feasible
in this situation. However, in our project we were facing very similar
problem. The difference is that the data arrived from the network.
Here is how we solve it.

Gstreamer pipeline is running in own thread. We register callback
function for the AppSrc's "need-data" signal [1]. Networking thread
(in your case it might be the capturing thread) store received frames
into the simple thread-safe queue [2,3]. When the need-data callback
function is invoked, we retrieve the next frame from the queue and use
g_signal_emit_by_name(); to feed the data to appsrc [4]. You can also
take a look at [5] to see how to create the GstBuffer instance out of
raw byte array.

[1] https://www.gitorious.org/veter/cockpit/blobs/master/src/GstMainThread.cpp#line189
[2] https://www.gitorious.org/veter/cockpit/blobs/master/src/BufferQueue.h
[3] https://www.gitorious.org/veter/cockpit/blobs/master/src/Queue.h
[4] https://www.gitorious.org/veter/cockpit/blobs/master/src/GstMainThread.cpp#line142
[5] https://www.gitorious.org/veter/cockpit/blobs/master/src/BufferQueue.cpp#line14

Hope this helps,
Andrey.

----------------------------------------------
http://veter-project.blogspot.com


More information about the gstreamer-devel mailing list