Multiple input sources

symeon.mattes symeon.mattes at gmail.com
Wed Oct 14 23:47:53 PDT 2015


Hi,

I'm trying to create a pipeline at which I'll be able to choose on the fly a
different source. If we consider the following 

<http://gstreamer-devel.966125.n4.nabble.com/file/n4674095/PipelineWithoutInputSelector.png> 

*and the code*:
GstElement *pipeline,*input,*audioconvert,*output;

pipeline=gst_pipeline_new("mypipeline");
input=gst_element_factory_make("osxaudiosrc",NULL);
audioconvert=gst_element_factory_make("audioconvert",NULL);
audioconvert=gst_element_factory_make("autoaudiosink",NULL);

gst_bin_add_many(GST_BIN(pipeline),input,audioconvert,output,NULL);
gst_element_link_many(input,audioconvert,output,NULL);
gst_element_set_state(pipeline,GST_STATE_PLAYING);

*or in case of of a file src I have*:
GstElement *pipeline,*input,*audioconvert,*output;

pipeline=gst_pipeline_new("mypipeline");
input=gst_element_factory_make("uridecodebin",NULL);g_object_set(G_OBJECT(input,"uri","file1"));
audioconvert=gst_element_factory_make("audioconvert",NULL);
audioconvert=gst_element_factory_make("autoaudiosink",NULL);

gst_bin_add_many(GST_BIN(pipeline),input,audioconvert,output,NULL);
g_signal_connect(input,"pad-added",G_CALLBACK(handle_dynamic_link),gst_element_get_static_pad(audioconvert,"sink"));
gst_element_link_many(audioconvert,output,NULL);
gst_element_set_state(pipeline,GST_STATE_PLAYING);


*where*

static void handle_dynamic_link(GstPadTemplate *templ, GstPad *newpad,
gpointer data)
{
   GstPad *target = (GstPad *) data;
   gst_pad_link(newpad,target);
}

This works just fine!

However, when I try to connect everything through input selector, then I
don't have the expected result, i.e.

<http://gstreamer-devel.966125.n4.nabble.com/file/n4674095/PipelineWithInputSelector.png> 

*with code:*

GstElement
*pipeline,*input1,input2,input3,*input_select,*audioconvert,*output;

pipeline=gst_pipeline_new("mypipeline");
input1=gst_element_factory_make("osxaudiosrc",NULL);
input2=gst_element_factory_make("uridecodebin",NULL);g_object_set(G_OBJECT(input,"uri","file1"));
input3=gst_element_factory_make("uridecodebin",NULL);g_object_set(G_OBJECT(input,"uri","file2"));
input_select=gst_element_factory_make("input-selector",NULL);
audioconvert=gst_element_factory_make("audioconvert",NULL);
audioconvert=gst_element_factory_make("autoaudiosink",NULL);

gst_bin_add_many(GST_BIN(pipeline),input1,input2,input3,input_select,audioconvert,output,NULL);
gst_element_link_many(input1,input_select,,audioconvert,output,NULL);
g_signal_connect(input2,"pad-added",G_CALLBACK(handle_dynamic_link),gst_element_get_static_pad(audioconvert,"sink_1"));
gst_element_link_many(audioconvert,output,NULL);
g_signal_connect(input2,"pad-added",G_CALLBACK(handle_dynamic_link),gst_element_get_static_pad(audioconvert,"sink_2"));
gst_element_link_many(audioconvert,output,NULL);

gst_element_set_state(pipeline,GST_STATE_PLAYING);




Then when I change to the sink_1, i.e.


g_object_set(G_OBJECT(input_select),'active-pad',gst_element_get_static_pad(input_select,"sink_1"))



Nothing happens. I keep having the stream of the 1st input. I believe it has
something to do with the dynamic pads, but I'm not so sure what/where I
should look to.





--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Multiple-input-sources-tp4674095.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list