Hi Tim,<br><br>I had already begun to think of an alternative way to do this. I was thinking about using BINs.<br><br>As I am running within an embedded system I need to queue2 to put the second part of the pipeline into a different thread and also to buffer data in a way that I can control.<br>
<br>I have re-written the code as following:<br><br><br>    virtual bool init()<br>    {<br>        if (!GStreamerPlayerBase::init()) {<br>            return false;<br>        }<br>        <br>        pipeline = gst_pipeline_new(&quot;&quot;);<br>
<br>        // Audio bin<br>        audiobin = gst_bin_new(&quot;audiobin&quot;);<br>        qDebug() &lt;&lt; &quot;adding audiobin to pipeline&quot;;<br>        gst_bin_add(GST_BIN(pipeline), audiobin);<br><br>        qDebug() &lt;&lt; &quot;adding elements&quot;;<br>
        _sourceQ = gst_element_factory_make(&quot;queue2&quot;, NULL);<br>        quint64 maxBufferTime = 0; // disable<br>        guint maxBufferBytes = Settings::getValue&lt;int&gt;(Settings::SECTION_RECEIVE<br>            + Settings::RECEIVE_MAX_BUFFER_SIZE);<br>
        guint highPercent = Settings::getValue&lt;int&gt;(Settings::SECTION_RECEIVE<br>            + Settings::RECEIVE_BUFFER_HIGHPERC);<br>        guint lowPercent = Settings::getValue&lt;int&gt;(Settings::SECTION_RECEIVE<br>
            + Settings::RECEIVE_BUFFER_LOWPERC);<br>        bool useBuffering = Settings::getValue&lt;int&gt;(Settings::SECTION_RECEIVE<br>            + Settings::RECEIVE_USE_BUFFER);<br><br>        //this queue is used to force buffering of more data, the intention<br>
        //being to help with internet radio drop out<br>        g_object_set(G_OBJECT(_sourceQ),<br>                        &quot;max-size-buffers&quot;, 0,<br>                        &quot;max-size-time&quot;, maxBufferTime,<br>
                        &quot;max-size-bytes&quot;, maxBufferBytes,<br>                        &quot;use-buffering&quot;, useBuffering,<br>                        &quot;high-percent&quot;, highPercent,<br>                        &quot;low-percent&quot;, lowPercent,<br>
                        NULL);<br><br>        qDebug() &lt;&lt; &quot;add source to bin elements&quot;;<br>        gst_bin_add(GST_BIN(audiobin), _sourceQ);<br><br>        qDebug() &lt;&lt; &quot;create sourceQ sink pad&quot;;<br>
        GstPad* pad = gst_element_get_pad(_sourceQ, &quot;sink&quot;);<br>        gst_element_add_pad(audiobin, gst_ghost_pad_new(&quot;sink&quot;, pad));<br>        gst_object_unref(pad);<br><br><br>        qDebug() &lt;&lt; &quot;init output stage&quot;;<br>
        initOutputStage(GST_BIN(pipeline));<br><br>        qDebug() &lt;&lt; &quot;ref elements&quot;;<br>        gst_object_ref(uriDecodebin);<br>        gst_object_ref(_sourceQ);<br>        return true;<br>    }<br><br>
my callbackPadAdded is:<br><br>    static void callbackPadAdded(GstElement *uriDecodebin,<br>                                 GstPad     *pad,<br>                                 gpointer self)<br>    {<br>        GStreamerDecodebinPrivate* obj = reinterpret_cast&lt;GStreamerDecodebinPrivate*&gt;(self);<br>
        GstPad* const audiopad = gst_element_get_pad(obj-&gt;audiobin, &quot;sink&quot;);<br><br>        qDebug() &lt;&lt; &quot;uridecodebin pad add started&quot;;<br>        Q_UNUSED(uriDecodebin);<br>        if (GST_PAD_IS_LINKED(audiopad)) {<br>
            qDebug() &lt;&lt; &quot;audiopad is already linked. Unlinking old pad.&quot;;<br>            gst_pad_unlink(audiopad, GST_PAD_PEER(audiopad));<br>        }<br><br>        qDebug() &lt;&lt; &quot;uridecodebin pad added&quot;;<br>
<br>        gst_pad_link(pad, audiopad);<br><br>        gst_object_unref(audiopad);<br>    }<br><br><br>For the above I would like to add setting of caps to the uridecodebin. <br><br>Setting of the output stage is:<br><br>
    void initOutputStage(GstBin* outputBin)<br>    {<br>        QString dev = Settings::getValue&lt;QString&gt;( Settings::SECTION_DEVICES + Settings::AUDIO_OUTPUT );<br>        _pcmSink = gst_element_factory_make(&quot;alsasink&quot;, NULL);<br>
        g_object_set(G_OBJECT(_pcmSink), &quot;device&quot;, dev.toLatin1().data(), NULL);<br>        <br>        GstBaseAudioSinkSlaveMethod slaveMethod = GST_BASE_AUDIO_SINK_SLAVE_NONE;<br>        g_object_set(G_OBJECT(_pcmSink), &quot;sync&quot;, 0,<br>
                                        &quot;async&quot;, 0,<br>                                        &quot;slave-method&quot;, slaveMethod,<br>                                        NULL);<br><br><br>        gst_bin_add(GST_BIN(outputBin), _pcmSink); <br>
        // link the static parts together<br>        gst_element_link(_pcmSink, NULL);<br><br>        bool usePlayBin = Settings::getValue&lt;bool&gt;(Settings::SECTION_AUDIO + Settings::USE_PLAYBIN);<br><br>    }<br><br>
<br>I get no audio from the code when I try to run this. I do not see how to link the BUN together and get it into the playing state.<br><br>I have the following:<br>
<br>
        gst_element_link_many(uriDecodebin, _sourceQ, _pcmSink, NULL);<br>
<br><br>During initialization I get the following warning:<br><br>ref elements <br><br>(&lt;unknown&gt;:2847): GStreamer-CRITICAL **: gst_object_ref: assertion `object != NULL&#39; failed<br><br>When I try to link it all together I get:<br>
<br>link many in streaming <br><br>(&lt;unknown&gt;:2847): GStreamer-CRITICAL **: gst_element_link_many: assertion `GST_IS_ELEMENT (element_1)&#39; failed<br><br>Code:<br><br>    virtual void linkStreaming()<br>    {<br>        qDebug() &lt;&lt; &quot;linking in streaming&quot;;<br>
        <br>        gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_NULL);<br><br>        if (passThroughLinked) {<br>            gst_element_set_state(GST_ELEMENT(recPipeline), GST_STATE_NULL);<br>//            gst_bin_remove_many(GST_BIN(pipeline), passThroughFakeSource, passThroughCapsFilter, _audioResample, NULL);<br>
        }<br><br>        qDebug() &lt;&lt; &quot;link many in streaming&quot;;<br>        gst_element_link_many(uriDecodebin, _sourceQ, _pcmSink, NULL);<br>    <br>        passThroughLinked = false;    <br>    }    <br><br>
I think if I use the BIN to put _sourceQ into I can get the callBackPadAdded to work correctly. But with BINs I am unsure how to link them together correctly and I suspect this is where my error is.<br><br>My goal is to have the very simple pipeline:<br>
<br>             uridecodebin ! queue2 ! alsasink<br><br>Thanks,<br>Stuart<br>
<br><br><div class="gmail_quote">On 5 October 2011 03:00,  <span dir="ltr">&lt;<a href="mailto:gstreamer-devel-request@lists.freedesktop.org">gstreamer-devel-request@lists.freedesktop.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Send gstreamer-devel mailing list submissions to<br>
        <a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
or, via email, send a message with subject or body &#39;help&#39; to<br>
        <a href="mailto:gstreamer-devel-request@lists.freedesktop.org">gstreamer-devel-request@lists.freedesktop.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:gstreamer-devel-owner@lists.freedesktop.org">gstreamer-devel-owner@lists.freedesktop.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than &quot;Re: Contents of gstreamer-devel digest...&quot;<br>
<br>
<br>
Today&#39;s Topics:<br>
<br>
   1. Re: Name queue20 is not unique in bin , not adding - when<br>
      connecting uridecodebin to queue2 (Tim-Philipp M?ller)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Tue, 04 Oct 2011 09:25:52 +0100<br>
From: Tim-Philipp M?ller &lt;<a href="mailto:t.i.m@zen.co.uk">t.i.m@zen.co.uk</a>&gt;<br>
Subject: Re: Name queue20 is not unique in bin , not adding - when<br>
        connecting uridecodebin to queue2<br>
To: <a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
Message-ID: &lt;1317716752.4063.3.camel@zingle&gt;<br>
Content-Type: text/plain; charset=&quot;UTF-8&quot;<br>
<br>
On Tue, 2011-10-04 at 10:43 +0800, Stuart Gray wrote:<br>
<br>
&gt; In trying to connect uridecodebin to queue2 I get the following output<br>
&gt; from gstreamer:<br>
&gt;<br>
&gt; (&lt;unknown&gt;:1363): GStreamer-WARNING **: Name queue20 is not unique in<br>
&gt; bin , not adding<br>
&gt;<br>
&gt; My code is as follows:<br>
&gt;<br>
&gt;         pipeline = gst_pipeline_new(&quot;&quot;);<br>
&gt;<br>
&gt;         uriDecodebin = gst_element_factory_make(&quot;uridecodebin&quot;, NULL);<br>
&gt;<br>
&gt;         g_object_set(G_OBJECT(uriDecodebin), &quot;buffer-size&quot;, 150000,<br>
&gt; NULL);<br>
&gt;         g_object_set(G_OBJECT(uriDecodebin), &quot;download&quot;, false, NULL);<br>
&gt;         g_object_set(G_OBJECT(uriDecodebin), &quot;use-buffering&quot;, false,<br>
&gt; NULL);<br>
&gt;         g_signal_connect(G_OBJECT(uriDecodebin), &quot;drained&quot;,<br>
&gt; G_CALLBACK(sourceDrainedCallback), this);<br>
&gt;         /* connect uridecodebin to _sourceQ when it creates its output<br>
&gt; pad */<br>
&gt;         g_signal_connect(G_OBJECT(uriDecodebin), &quot;pad-added&quot;,<br>
&gt; G_CALLBACK(callbackPadAdded), this);<br>
&gt;<br>
&gt;         outputBin = gst_bin_new(&quot;output-bin&quot;);<br>
&gt; ...<br>
&gt;         _sourceQ = gst_element_factory_make(&quot;queue2&quot;, NULL);<br>
&gt;         gst_bin_add_many(GST_BIN(outputBin), _sourceQ, _pcmSink,<br>
&gt; NULL);<br>
&gt; ...<br>
<br>
What does your callbackPadAdded look like?<br>
<br>
I&#39;m guessing you are creating &quot;queue&quot; elements in there. It&#39;s basically<br>
a bug in the way GStreamer creates default names for elements if you<br>
don&#39;t specify one. The first &quot;queue2&quot; instance will get named &quot;queue20&quot;<br>
and the twentieth &quot;queue&quot; instance will get named &quot;queue20&quot; as well,<br>
which may cause problems if you are using both at the same time. It&#39;s<br>
hard to change now though, because it would break code that relies on<br>
the the naming scheme.<br>
<br>
In this case, you could just use a normal queue instead of queue2 before<br>
the sink (or just not use a queue at all?).<br>
<br>
Cheers<br>
 -Tim<br>
<br>
<br>
<br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
<br>
<br>
End of gstreamer-devel Digest, Vol 9, Issue 8<br>
*********************************************<br>
</blockquote></div><br>