Event driven source

Sebastian Dröge sebastian at centricular.com
Tue Nov 29 10:39:04 UTC 2016


On Tue, 2016-11-29 at 10:46 +0100, Petr Kulhavy wrote:
> Hi,
> 
> the GstBaseSrc class implies the use of polling the source in the create 
> and fill methods. I.e. the create/fill waits for data from the source, 
> reads it and returns it.
> Is there an existing mechanism for event driven sources? I.e. to 
> register a callback function, which is called every time data appears.

You could use appsrc for that, or something similar like other sources
based on callbacks are doing (e.g. decklinkvideosrc). You would get
your callback and then queue the data for some other thread to put it
into the GStreamer pipeline. You probably don't want to do that
directly from the callback as that callback would then be blocked until
the data was consumed.

In some cases you probably want that, in which case you could iterate
an event loop inside the GstBaseSrc::create() function. souphttpsrc is
doing that for example.

-- 
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 963 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20161129/b6c721d3/attachment.sig>


More information about the gstreamer-devel mailing list