+ eDebug("audio: %p, queue_audio %p, video %p, queue_video %p, mpegdemux %p", audio, queue_audio, video, queue_video, mpegdemux);
+ if (audio && queue_audio && video && queue_video && mpegdemux)
+ {
+ g_object_set (G_OBJECT (queue_audio), "max-size-buffers", 0, NULL);
+ g_object_set (G_OBJECT (queue_audio), "max-size-time", (guint64)0, NULL);
+ g_object_set (G_OBJECT (queue_video), "max-size-buffers", 0, NULL);
+ g_object_set (G_OBJECT (queue_video), "max-size-time", (guint64)0, NULL);
+ all_ok = 1;
+ }
+ }
+
+ if (m_gst_pipeline && all_ok)
+ {
+ gst_bus_set_sync_handler(gst_pipeline_get_bus (GST_PIPELINE (m_gst_pipeline)), gstBusSyncHandler, this);
+
+ if (is_audio)
+ {
+ if (!is_mp3)
+ {
+ /* decodebin has dynamic pads. When they get created, we connect them to the audio bin */
+ g_signal_connect (decoder, "new-decoded-pad", G_CALLBACK(gstCBnewPad), this);
+ g_signal_connect (decoder, "unknown-type", G_CALLBACK(gstCBunknownType), this);
+ }
+
+ /* gst_bin will take the 'floating references' */
+ gst_bin_add_many (GST_BIN (m_gst_pipeline),
+ source, decoder, NULL);
+
+ if (filter)
+ {
+ /* id3demux also has dynamic pads, which need to be connected to the decoder (this is done in the 'gstCBfilterPadAdded' CB) */
+ gst_bin_add(GST_BIN(m_gst_pipeline), filter);
+ gst_element_link(source, filter);
+ m_decoder = decoder;
+ g_signal_connect (filter, "pad-added", G_CALLBACK(gstCBfilterPadAdded), this);
+ } else
+ /* in decodebin's case we can just connect the source with the decodebin, and decodebin will take care about id3demux (or whatever is required) */
+ gst_element_link(source, decoder);
+
+ /* create audio bin with the audioconverter, the capsfilter and the audiosink */
+ m_gst_audio = gst_bin_new ("audiobin");
+
+ GstPad *audiopad = gst_element_get_pad (conv, "sink");
+ gst_bin_add_many(GST_BIN(m_gst_audio), conv, flt, sink, (char*)0);
+ gst_element_link_many(conv, flt, sink, (char*)0);
+ gst_element_add_pad(m_gst_audio, gst_ghost_pad_new ("sink", audiopad));
+ gst_object_unref(audiopad);
+ gst_bin_add (GST_BIN(m_gst_pipeline), m_gst_audio);
+
+ /* in mad's case, we can directly connect the decoder to the audiobin. otherwise, we do this in gstCBnewPad */
+ if (is_mp3)
+ gst_element_link(decoder, m_gst_audio);
+ } else
+ {
+ gst_bin_add_many(GST_BIN(m_gst_pipeline), source, mpegdemux, audio, queue_audio, video, queue_video, NULL);
+ gst_element_link(source, mpegdemux);
+ gst_element_link(queue_audio, audio);
+ gst_element_link(queue_video, video);
+
+ m_gst_audioqueue = queue_audio;
+ m_gst_videoqueue = queue_video;
+
+ g_signal_connect(mpegdemux, "pad-added", G_CALLBACK (gstCBpadAdded), this);
+ }