What the best way for mix two streams, when they may start/stop independent from each other
Dmitry Valento
va.dimon at tut.by
Mon Nov 21 16:46:27 UTC 2016
Hello
I couldn’t find out the easiest way for control mixing of two streams.
Pipeline looks like:
In most cases, audio flows from audiotestsrc and WAV-files are played
periodically.
There are three major moments during the pipeline work:
1) start wav-file playing when audiotestsrc is already running
2) stop wav-file playing manually
3) normal wav-file playing finishing (EOS)
4) play another wav-file when previous file isn’t finished yet
I’ve already implemented next logic:
0) on application start-up all elements are created, but elements related to
WAV-playing aren’t added to BIN
1) upon request of start wav-file playing, elements related to WAV-playing
are added to BIN, linked with each other, probe is added to sink_1 (element
adder) for catch EOS
2) on manual stop, filesrc is set to NULL state, elements related to
WAV-playing are moved outside BIN (not removed completely), pad sink_1 is
removed (element adder)
3) on EOS, the probe is removed from sink_1 and a EOS message sent to BUS -
in another procedure (seems like in another thread) the message is caught
and the step 2 is started
4) on start playing another file when a previous isn’t finished yet, the
filesrc is set to NULL state, location is changed and finally filesrc is set
to PLAYING state.
Advantages of this logic: settings of audiodynamic and equalizer (and
another filters) aren’t lost.
Disadvantages: it needs to store in private struct pointers to elements
related to WAV-playing and it needs to move these elements to/outside BIN
and relink all pads.
I suppose, there is should be more elegant solution for realize these
requirements, but I don’t know how. May be it is possible to create some
“fake” source element which will replace filesrc when wav-files aren’t
played. I’ve tried to use fakesrc element, but couldn’t find out how to
configure it properly.
Could you please give me suggestions about how to make logic more elegant?
Thank you.
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/What-the-best-way-for-mix-two-streams-when-they-may-start-stop-independent-from-each-other-tp4680810.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list