dynamic control of tee paths

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

dynamic control of tee paths

fabiano


Hi to all,

I'm writing an application that taking an audio source as input will stream it over the net and, at the same time, will code it in mp3 format to a file.

I use tee plugin to split audio source in two path. In gst-lanch language my pipeline is something like this:

alsasrc .... ! tee name=t  \
             t. ! queue ! ....stream ...  \
             t. ! queue ! .... mp3_coder ... ! filesink


My problem is that I need to start/stop one path, let say the stream path, while the other path, let say the coder path, still run.

Which is the best way to get this?

Thanks in advance for any suggestion
fabiano





Reply | Threaded
Open this post in threaded view
|

Re: dynamic control of tee paths

Brendan Long
On 07/02/2013 03:48 PM, fabiano wrote:
> My problem is that I need to start/stop one path, let say the stream path,
> while the other path, let say the coder path, still run.
You might want to look at valve or output-selector:

http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-plugins/html/gstreamer-plugins-valve.html

http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-plugins/html/gstreamer-plugins-output-selector.html
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: dynamic control of tee paths

fabiano


Hi,

thanks for your answer.
valve plugin works as I need.

In the meantime I also tried to link/unlink tee src pad and queue sink pad with gst_pad_link() and gst_pad_unlink() functions.

Also this solution seems work; do you see any drawback in this approach?

fabiano
Reply | Threaded
Open this post in threaded view
|

Re: dynamic control of tee paths

Brendan Long
On 07/03/2013 09:14 AM, fabiano wrote:
> In the meantime I also tried to link/unlink tee src pad and queue sink pad
> with gst_pad_link() and gst_pad_unlink() functions.
>
> Also this solution seems work; do you see any drawback in this approach?
It's just more complicated, and you need to remember to block and
unblock pads. Either way works though.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: dynamic control of tee paths

Olivier Crête-3
Hi,

On Wed, 2013-07-03 at 12:51 -0600, Brendan Long wrote:
> On 07/03/2013 09:14 AM, fabiano wrote:
> > In the meantime I also tried to link/unlink tee src pad and queue sink pad
> > with gst_pad_link() and gst_pad_unlink() functions.
> >
> > Also this solution seems work; do you see any drawback in this approach?
> It's just more complicated, and you need to remember to block and
> unblock pads. Either way works though.

In this case you don't need to pad block or to use a valve. To add
something, you can link to the tee pad as the last thing in you adding
operation, and it should work dynamically.

To remove, you first release the tee pad with
gst_element_release_request_pad(), and then you can just stop what is
after the tee without problem, as the tee will ignore an error. You
probably want to inject an EOS and wait for the EOS message from the
sink though.

--
Olivier Crête
[hidden email]

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

Re: dynamic control of tee paths

fabiano

Hi and thanks for your answers.

I have another doubt:
after the tee I have the following elements:   -> queue ! encoder ! filesink

During adding operation, after linking tee pad, I set to PLAYING state this three elements:

gst_element_set_state(queueEnc, GST_STATE_PLAYING);
gst_element_set_state(encoder, GST_STATE_PLAYING);
gst_element_set_state(filesink, GST_STATE_PLAYING);

When I do this the entire pipeline, that was in PLAYING state, goes to PAUSED state.
Do you have any idea of the reason?

fabiano
Reply | Threaded
Open this post in threaded view
|

Re: dynamic control of tee paths

fabiano


ok, I changed the order of putting the elements in PLAYING state and now it works.

Now the order is:

gst_element_set_state(sinkFile, GST_STATE_PLAYING);
gst_element_set_state(queueEnc, GST_STATE_PLAYING);
gst_element_set_state(encoder1, GST_STATE_PLAYING);

Actually, after some experiments, it seems that the problematic element is the encoder.
It seems that when it changes to PLAYING state it wants the queue already playing.

Hi
fabiano