Hello everyone!<div><br></div><div>I'm very new to GStreamer, i'm experimenting with the framework since a week. My current goal would be to write a radio scheduler application which can handle audio playback required for a web radio, stream the result with different encoders and optionally do audio output on a local audio hardware.</div>
<div>I did some tests about how can i plugin different sources to an Adder so i can use the pipeline as an audio mixer. After finding the pad blocking capability of GStreamer, i could add and remove audio sources into the pipeline without stopping it. <a href="http://stackoverflow.com/questions/3899666/adding-and-removing-audio-sources-to-from-gstreamer-pipeline-on-the-go">http://stackoverflow.com/questions/3899666/adding-and-removing-audio-sources-to-from-gstreamer-pipeline-on-the-go</a> I want to do this with the audio outputs as well, i like to add and remove different audio sinks while the pipeline is running.</div>
<div><br></div><div>I've added a Tee after the Adder so i can split up sources to many outputs. If i fire up the pipeline with an autoaudiosink (with it's own queue), playback works fine. If i add a fakesink to the Tee's output on the go (requesting a new src request pad an linking it with an another queue in the middle), one of my audio sources pauses the pipeline with a </div>
<div><br></div><div>basesrc gstbasesrc.c:2447:gst_base_src_loop:<Buzzer1> pausing after gst_pad_push() = wrong-state </div><div><br></div><div>error message in the debug output.</div><div><br></div><div>I've tried to put a block on the Adder's source output while adding the new audio sink, but it wouldn't help me.</div>
<div><br></div><div>Here is the code i'm working with), it's the Java rewrite of the StackOverflow Python script what i linked above. I don't know what to try next. If i put the pipeline together with two sinks before the first start, everything works fine.</div>
<div><br></div><div><div>package test;</div><div><br></div><div>import java.io.IOException;</div><div>import java.util.logging.Level;</div><div>import java.util.logging.Logger;</div><div>import org.gstreamer.Element;</div>
<div>import org.gstreamer.ElementFactory;</div><div>import org.gstreamer.Gst;</div><div>import org.gstreamer.Pad;</div><div>import org.gstreamer.Pipeline;</div><div>import org.gstreamer.State;</div><div>public class Main {</div>
<div><br></div><div> public static void main(String[] args) {</div><div> Gst.init("RadioBeans", args);</div><div> Pipeline pipe = new Pipeline("Scheduler");</div><div><br></div><div> Element mixer = ElementFactory.make("adder", "Mixer");</div>
<div> pipe.add(mixer);</div><div><br></div><div> Element tee = ElementFactory.make("tee", "Splitter");</div><div> pipe.add(tee);</div><div><br></div><div> mixer.link(tee);</div>
<div><br></div><div> Element audioSink = ElementFactory.make("autoaudiosink","AudioOutput");</div><div> pipe.add(audioSink);</div><div> Element audioQueue = ElementFactory.make("queue","AudioQueue");</div>
<div> pipe.add(audioQueue);</div><div> tee.link(audioQueue);</div><div> audioQueue.link(audioSink);</div><div><br></div><div> Pad mixerLine1=mixer.getRequestPad("sink%d");</div><div> Pad mixerLine2=mixer.getRequestPad("sink%d");</div>
<div><br></div><div> Element buzzer1 = ElementFactory.make("audiotestsrc", "Buzzer1");</div><div> pipe.add(buzzer1);</div><div> buzzer1.set("freq", 1000);</div><div> Pad buzzer1src=buzzer1.getSrcPads().get(0);</div>
<div> buzzer1src.link(mixerLine1);</div><div> </div><div> Element buzzer2 = ElementFactory.make("audiotestsrc", "Buzzer2");</div><div> pipe.add(buzzer2);</div><div> buzzer2.set("freq", 500);</div>
<div> Pad buzzer2src=buzzer2.getSrcPads().get(0);</div><div> buzzer2src.link(mixerLine2);</div><div><br></div><div> pipe.play();</div><div><br></div><div> try {</div><div> System.in.read();</div>
<div> } catch (IOException ex) {</div><div> Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);</div><div> }</div><div><br></div><div> Element fakeOutput = ElementFactory.make("fakesink", "FakeOutput");</div>
<div> pipe.add(fakeOutput);</div><div> Element fakeQueue = ElementFactory.make("queue","FakeQueue");</div><div> pipe.add(fakeQueue);</div><div> fakeQueue.link(fakeOutput);</div>
<div> tee.link(fakeQueue);</div><div><br></div><div> pipe.play();</div><div><br></div><div> System.out.println("Added fakesink");</div><div><br></div><div> try {</div><div> System.in.read();</div>
<div> } catch (IOException ex) {</div><div> Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);</div><div> }</div><div><br></div><div> buzzer1src.setBlocked(true);</div><div> buzzer1.setState(State.NULL);</div>
<div> buzzer1src.unlink(mixerLine1);</div><div> mixer.releaseRequestPad(mixerLine1);</div><div><br></div><div> System.out.println("Released buzzer1");</div><div><br></div><div> try {</div>
<div> System.in.read();</div><div> } catch (IOException ex) {</div><div> Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);</div><div> }</div><div><br></div><div> System.out.println("Stopping.");</div>
<div><br></div><div> pipe.stop();</div><div> }</div><div><br></div><div>}</div></div>