[gst-devel] How to deal with multiple dynamic sources?
Henk Kok
henk at pret-met-latex.nl
Thu Aug 23 13:50:01 CEST 2007
Hi, all,
For a project we are doing, we need a filter graph that has multiple
audio sources, which can be selected or which can be mixed. The sources
are not necessarilly all active. To get a feeling of how to do this with
gstreamer, I have been toying around a bit, but so far I have not been
able to get it to do what I want it to do.
In my test application, I have two file sources with mad-decoders, which
connect through a convertor and volume controle, to an adder. The adder
connects to another volume control, and that connects to the sink.
When I change the state to playing, this works. However, pausing goes
horribly wrong. There have been situations in which everything blocks if
I pause only one of the two playbacks, or a situation where both
playbacks simply continue when the state changes to paused. I have made
a modification to the architecture, which now looks like this:
+--------------------------------------------------------------------------------------------------+
|
PIPELINE |
|
+---------------------------------------------------+
|
| | BIN[0]
| |
| |+---------+ +---------+ +---------+ +---------+
| |
| || filesrc |->| decoder |->| conv |->| volume
|-+-+ |
| |+---------+ +---------+ +---------+ +---------+ | | +---------+
+---------+ +---------+ |
| +---------------------------------------------------+ +->| |
| | | | |
| | ADDER
|->| VOLUME |->| SINK | |
| +---------------------------------------------------+ +->| |
| | | | |
| | BIN[1] | | +---------+
+---------+ +---------+ |
| |+---------+ +---------+ +---------+ +---------+ |
| |
| || filesrc |->| decoder |->| conv |->| volume
|-+-+ |
| |+---------+ +---------+ +---------+ +---------+
| |
|
+---------------------------------------------------+
|
+--------------------------------------------------------------------------------------------------+
The 'BIN's are also pipelines, btw, at the moment running their own main
loop. Also in this situation, when I set the state of a BIN to paused,
that branch will keep playing. When I set it to ready, it does stop, but
blocks (probably on the adder) the playback of the other branch.
Disconnecting the BIN from the adder (and cleaning up the pad that was
created when connecting) lifts that problem. But then, when I want to
resume playback of the "paused" branch, it will start playing from the
wrong location. It will start playing from the time 'current time minus
time we paused'. I have been trying to lift that particular problem with
gst_element_set_base_time, (on about any element in the BIN and the BIN
itself) but that doesn't seem to make any difference.
I have also considered of putting the adder, volume and sink in Yet
Another Pipeline, but then that pipeline must have a dynamic number of
sink pads and I am not entirely sure how to handle this. I also doubt it
would help much.
Another question: is there a means of fading out before going to paused,
and fading in after going to playing? I would like to prevent plops from
occuring. The only option I see for this at the moment, is to modify the
volume element for this.
I have zillions of other questions, but for now, let's leave it at this. :-)
Hope someone can help me out here,
Best regards,
- Henk.
More information about the gstreamer-devel
mailing list