Handling multiple bins dynamically

Lee Matthews lma at spaceapplications.com
Thu Jun 26 03:03:32 PDT 2014


I'm streaming video and I wish to be able to record that video on receiving a command. I'm currently looking at setting up two bins, one for the stream and the other for recording.

The streaming bin has a tee in it which I need to connect to the recording bin dynamically. I also need to be able to disconnect the recording bin when I need to stop recording.

Here are my bins :

bin_stream = gst_parse_launch ("v4l2src name=v4l2src device=/dev/video0 ! video/x-raw,format=(string)YUY2,width=(int)320,height=(int)240, depth=(int)8, framerate=(fraction)20/1 ! videoconvert  ! vp8enc deadline=1 threads=3 token-partitions=2 cpu-used=1 end-usage=cbr target-bitrate=4096000 ! webmmux streamable=true ! tee name=tee tee. ! queue name=stream", &err); 

bin_videoRecord = gst_parse_launch ("queue name=record ! filesink name=filesink location=/data/data/com.mobinet.mobinetbootapp/files/test.webm", &err); 

A few questions :

1) Do both of these bins need to go into the same pipeline ? 

2) In order to link the record bin to the stream bin, do I need to create ghostpads within the bins, ie one for tee (src) and another for queue (sink) ?

3) To add the record bin to the stream bin, do I ?

A) Request a pad from tee on the stream bin
B) Set it to blocked 
C) Link the tee to the queue 
D) Set the record bin to playing 
E) Remove the pad-block on the stream bin tee

4) To remove the link from record bin to the stream bin and correctly close the file, do I ?

A) Set the stream bin's tee src pad that sends data to record bin, to blocked
B) Send an EOS event to the record bin
C) Wait for the EOS message on the record bin bus
D) Remove the stream bin tee pad used to provide video to the record bin

Thanks again


More information about the gstreamer-devel mailing list