Automatically set pipeline to paused after X frames

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

Automatically set pipeline to paused after X frames

mdb
I setup the following pipeline /v4l2src device=/dev/video0 num-buffers=5 !
filesink location=/tmp/foo.bar/ in a function, which returns a GStreamer
element (writing in OCaml) in *paused* state. I then set the state to
*playing* manually and see the expected files in /tmp. However, the pipeline
remains in *playing* after the 5 buffers have been stored in /foo.bar/. I
would like the pipeline to reset itself to *stop* after the 5 buffers have
been collected. I have not found anything to achieve this yet; I briefly
read through  position tracking and seeking
<https://gstreamer.freedesktop.org/documentation/application-development/advanced/queryevents.html?gi-language=c#position-tracking-and-seeking>  
&  pipeline manipulation
<https://gstreamer.freedesktop.org/documentation/application-development/advanced/pipeline-manipulation.html?gi-language=c>
. I am comfortable stubbing C functions in OCaml, I just cannot figure out
what to stub.



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Automatically set pipeline to paused after X frames

gotsring
Could you just add a pad probe to v4l2src to monitor buffer events, then
pause the pipeline after the count of 5 (or x).



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
mdb
Reply | Threaded
Open this post in threaded view
|

Re: Automatically set pipeline to paused after X frames

mdb
Thanks for the suggestion. A quick solution was to use gst_element_query_position. In OCaml, it's something like let get_position () = Gstreamer.Element.position dev Gstreamer.Format.Default You just recursively loop over that until get_position == X

Sent from the GStreamer-devel mailing list archive at Nabble.com.

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel