[gst-devel] how to package media data into fakesrc

Tim Müller t.i.m at zen.co.uk
Fri May 19 07:50:03 CEST 2006


On Fri, 2006-05-19 at 17:17 +0800, ma.xiaobo at zte.com.cn wrote:

> I want pass my media data into a pipe line, but I am not family how to
> package the media data into a source. I have studied some information
> about fakesrc, want package the media data into it. but did not get
> any idea how to do it from the Web page. 
> 
> So, is there any body can kindly give me a way about it? 

Using fakesrc for this isn't really the best way. A much better and more
flexible solution would be to derive your own source element (from
GstPushSrc), implementing the 'create', 'start' and 'stop virtual
functions. This is fairly easy and should not require much more code
than the fakesrc solution.


However, if you do want to go down the fakesrc route, you need to set
the following properties:

  signal-handoffs = TRUE

and then g_signal_connect() to the 'handoff' signal. Then you'll get an
empty buffer in your callback function which you can set your
data/size/caps on (those three are required at the minimum).

If you want to, you can also set the size-type property to '2' (=fixed)
and then set the 'sizemax' property to a size of your choice, then
fakesrc will allocate a buffer of that size for you, so then you just
need to memcpy() your data into it.
  
 Cheers
  -Tim






More information about the gstreamer-devel mailing list