questions upon the "unlock" and "unlock_stop" interfaces in GstBaseSrc class

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

questions upon the "unlock" and "unlock_stop" interfaces in GstBaseSrc class

caoxi
I'm looking into these 2 interfaces for days, but I still don't get the rhythm.
Per my understanding(so far), these 2 interfaces are used combined with "create" interface, that "unlock" will flush the stream and restart streaming, while "unlock_stop" will pause the streaming.
Is my understanding correct?
Reply | Threaded
Open this post in threaded view
|

Re: questions upon the "unlock" and "unlock_stop" interfaces in GstBaseSrc class

Sebastian Dröge-3
On Tue, 2017-04-18 at 02:02 -0700, caoxi wrote:
> I'm looking into these 2 interfaces for days, but I still don't get the
> rhythm.
> Per my understanding(so far), these 2 interfaces are used combined with
> "create" interface, that "unlock" will flush the stream and restart
> streaming, while "unlock_stop" will pause the streaming.
> Is my understanding correct?

They're conceptually like FLUSH_START/STOP. unlock() is supposed to
unlock/unblock the streaming thread as soon as possible (so that the
element can be shut down, etc). unlock_stop() is called afterwards once
the streaming thread is shut down and just signals the element that so
it can resume normal operation afterwards.

--
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 (1019 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: questions upon the "unlock" and "unlock_stop" interfaces in GstBaseSrc class

caoxi
Thanks for your reply Sebastian. Like you said, element will be shut down after calling "unlock" function, does it mean the pipeline is paused(or ceased streaming and pipeline is exited)? If it does, how could "unlock_stop" resume the normal operations?
Reply | Threaded
Open this post in threaded view
|

Re: questions upon the "unlock" and "unlock_stop" interfaces in GstBaseSrc class

Sebastian Dröge-3
On Tue, 2017-04-18 at 02:37 -0700, caoxi wrote:
> Thanks for your reply Sebastian. Like you said, element will be shut
> down after calling "unlock" function, does it mean the pipeline is
> paused(or ceased streaming and pipeline is exited)? If it does, how
> could "unlock_stop" resume the normal operations?

unlock() is only supposed to unlock/unblock the streaming thread,
nothing else. After unlock_stop() it should be possible to call
create()/fill() again.

Take a look at existing GstBaseSrc elements that implement those
functions. Generally they just cancel a synchronous IO function call
there, e.g. a read() from some socket.

--
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 (1019 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: questions upon the "unlock" and "unlock_stop" interfaces in GstBaseSrc class

caoxi
Got it, Thanks! so these 2 interfaces are better used in applications with UI above Gstreamer (like GTK), such as pause/play a video file.

I was confused by their name at first, though... why not call them: flush_stream and resume_stream, that would be easier to understand(just my personal thoughts~~)
Reply | Threaded
Open this post in threaded view
|

Re: questions upon the "unlock" and "unlock_stop" interfaces in GstBaseSrc class

Sebastian Dröge-3
On Tue, 2017-04-18 at 02:57 -0700, caoxi wrote:
> Got it, Thanks! so these 2 interfaces are better used in applications
> with UI above Gstreamer (like GTK), such as pause/play a video file.

They are not to be called from the application but used for ensuring
that e.g. flushing seeks happen as fast as possible and shutting down
of the element (going down to READY/NULL state) is as fast as possible.

> I was confused by their name at first, though... why not call them:
> flush_stream and resume_stream, that would be easier to
> understand(just my personal thoughts~~)

They don't necessarily flush anything, they just make sure that the
streaming thread is stopping as soon as possible.

--
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 (1019 bytes) Download Attachment