Gstreamer dev : custom source based on basesrc

Duchassin Frederic duchassin at sefram.fr
Tue Jan 22 09:13:39 UTC 2019


Hello,


I try to make my own gstreamer source which take MPEG2-TS from Pcie.

I start from a template based on basesrc in order to create my source.

But now i have to understand the memory / buffer allocation in my source 
code. I can't find any good example on the web...

Somebody can explain me the basic of these 3 function (example if 
possible too) :


/* ask the subclass to create a buffer with offset and size, the default
  * implementation will call alloc and fill. */
static GstFlowReturn
gst_pciesrc_create (GstBaseSrc * src, guint64 offset, guint size,
     GstBuffer ** buf)
{
   GstPciesrc *pciesrc = GST_PCIESRC (src);

   GST_DEBUG_OBJECT (pciesrc, "create");

   return GST_FLOW_OK;
}

/* ask the subclass to allocate an output buffer. The default implementation
  * will use the negotiated allocator. */
static GstFlowReturn
gst_pciesrc_alloc (GstBaseSrc * src, guint64 offset, guint size,
     GstBuffer ** buf)
{
   GstPciesrc *pciesrc = GST_PCIESRC (src);

   GST_DEBUG_OBJECT (pciesrc, "alloc");

   return GST_FLOW_OK;
}

/* ask the subclass to fill the buffer with data from offset and size */
static GstFlowReturn
gst_pciesrc_fill (GstBaseSrc * src, guint64 offset, guint size, 
GstBuffer * buf)
{
   GstPciesrc *pciesrc = GST_PCIESRC (src);

   GST_DEBUG_OBJECT (pciesrc, "fill");

   return GST_FLOW_OK;
}


Many thanks in advance.


Frederic



More information about the gstreamer-devel mailing list