0

I have created a pipeline to store audio-stream of mixed audio(which will play one after the other). To handle three audio source at once I have taken a input selector which is connected to the three filesrc which are followed three decodebin as well. I have used to "pad-added" to the create three sink pad for each decode connected to the three filesrc.


//decoders

data.src2dec = gst_element_factory_make("decodebin", "aud_decoder1");
data.src3dec = gst_element_factory_make("decodebin", "aud_decoder2");
data.src4dec = gst_element_factory_make("decodebin", "aud_decoder3");

//filesrc

data.filesrc2 = gst_element_factory_make("filesrc", "source2");
data.filesrc3 = gst_element_factory_make("filesrc", "source3");
data.filesrc4 = gst_element_factory_make("filesrc", "source4")

g_signal_connect(data.src2dec, "pad-added", G_CALLBACK (pad_added_handler), &data);
g_signal_connect(data.src3dec, "pad-added", G_CALLBACK (pad_added_handler), &data);
g_signal_connect(data.src4dec, "pad-added", G_CALLBACK (pad_added_handler), &data);

//here is the code snippet which handles the creation of the sink pads and is handled by a callback function 

else if (g_str_has_prefix (new_pad_type, "audio/x-raw")) {
     sink_pad = gst_element_get_request_pad(data->input_selector, "sink_%u");
     g_print("Created a sink pad '%s' from '%s':\n", GST_PAD_NAME(sink_pad),       GST_ELEMENT_NAME(data->input_selector));

     g_print ("It has type '%s'.\n", new_pad_type);
}

With this I was able to create three sinkpads eg. sink_0, sink_1, sink_2. At the moment, I don't have any idea which sink_pad is selected by "input-selector" as the active_pad and how to set active_pad.

All I am trying to do is switch the streams when one ends but my pipeline throws EOS as soon as one started first ends. Hence, other streams will not be stored into the output. How do I handle the switching and stop the pipeline from generating EOS until all three of the sources finishes their streams? Also, where do I learn more about the input-selector to be able to use it efficiently.

0 Answers0