Event driven source

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Event driven source

Petr Kulhavy
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.

Thanks
Petr
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Event driven source

Sebastian Dröge-3
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
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (981 bytes) Download Attachment