Dynamically updating filesink location at run-time, on the fly

Paddy pat.blanchon at gmail.com
Sun Jun 16 10:20:23 PDT 2013


I had much pain in getting this to work for audio & video - for one tho it
was quite easy.

Assuming you have a pipeline that looks like this:
audiosrc -->  encoder --> mux --> filesink

then you'll need to change it to:
audiosrc --> encoder --> queue --> muxsink_bin
where muxsink_bin is a bin
ghostpad --> mux --> filesink

then the procedure is:
1 - Block the queue srcpad using gst_pad_set_blocked_async()
2 - In the blocked callback:
2a - unlink muxsink_bin with gst_pad_unlink()
2b - send an EOS event to the muxsink_bin sink pad with gst_pad_send_event()
2b - create a new muxsink_bin
2c - set filesink location
2d - add the new bin to the pipeline with gst_bin_add()
2e - sync with parent using gst_element_sync_state_with_parent()
2f - link it to the queue srcpad with gst_pad_link()
2g - unblock the queue srcpad with gst_pad_set_blocked_async(). When the
unblocked callback occurs you're recording again & no data has been lost. No
action is required in the unblocked callback

3 - handle the EOS & delete the old muxsink_bin. I had a msg handler that I
installed in my bin_init() function using "gstbin_class->handle_message =
GST_DEBUG_FUNCPTR(msg_handler)" & in the handler:
3a - lock the bin state with gst_element_set_locked_state()
3b - set the state to NULL with gst_element_set_state()
3c - remove it from the pipeline with gst_bin_remove()

That's it. The only thing to be mindful of is that data must be flowing thru
the pipeline for this to work.

Cheers

Paddy



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Dynamically-updating-filesink-location-at-run-time-on-the-fly-tp4660569p4660577.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list