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("");<br>
<br> // Audio bin<br> audiobin = gst_bin_new("audiobin");<br> qDebug() << "adding audiobin to pipeline";<br> gst_bin_add(GST_BIN(pipeline), audiobin);<br><br> qDebug() << "adding elements";<br>
_sourceQ = gst_element_factory_make("queue2", NULL);<br> quint64 maxBufferTime = 0; // disable<br> guint maxBufferBytes = Settings::getValue<int>(Settings::SECTION_RECEIVE<br> + Settings::RECEIVE_MAX_BUFFER_SIZE);<br>
guint highPercent = Settings::getValue<int>(Settings::SECTION_RECEIVE<br> + Settings::RECEIVE_BUFFER_HIGHPERC);<br> guint lowPercent = Settings::getValue<int>(Settings::SECTION_RECEIVE<br>
+ Settings::RECEIVE_BUFFER_LOWPERC);<br> bool useBuffering = Settings::getValue<int>(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> "max-size-buffers", 0,<br> "max-size-time", maxBufferTime,<br>
"max-size-bytes", maxBufferBytes,<br> "use-buffering", useBuffering,<br> "high-percent", highPercent,<br> "low-percent", lowPercent,<br>
NULL);<br><br> qDebug() << "add source to bin elements";<br> gst_bin_add(GST_BIN(audiobin), _sourceQ);<br><br> qDebug() << "create sourceQ sink pad";<br>
GstPad* pad = gst_element_get_pad(_sourceQ, "sink");<br> gst_element_add_pad(audiobin, gst_ghost_pad_new("sink", pad));<br> gst_object_unref(pad);<br><br><br> qDebug() << "init output stage";<br>
initOutputStage(GST_BIN(pipeline));<br><br> qDebug() << "ref elements";<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<GStreamerDecodebinPrivate*>(self);<br>
GstPad* const audiopad = gst_element_get_pad(obj->audiobin, "sink");<br><br> qDebug() << "uridecodebin pad add started";<br> Q_UNUSED(uriDecodebin);<br> if (GST_PAD_IS_LINKED(audiopad)) {<br>
qDebug() << "audiopad is already linked. Unlinking old pad.";<br> gst_pad_unlink(audiopad, GST_PAD_PEER(audiopad));<br> }<br><br> qDebug() << "uridecodebin pad added";<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<QString>( Settings::SECTION_DEVICES + Settings::AUDIO_OUTPUT );<br> _pcmSink = gst_element_factory_make("alsasink", NULL);<br>
g_object_set(G_OBJECT(_pcmSink), "device", dev.toLatin1().data(), NULL);<br> <br> GstBaseAudioSinkSlaveMethod slaveMethod = GST_BASE_AUDIO_SINK_SLAVE_NONE;<br> g_object_set(G_OBJECT(_pcmSink), "sync", 0,<br>
"async", 0,<br> "slave-method", 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<bool>(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>(<unknown>:2847): GStreamer-CRITICAL **: gst_object_ref: assertion `object != NULL' failed<br><br>When I try to link it all together I get:<br>
<br>link many in streaming <br><br>(<unknown>:2847): GStreamer-CRITICAL **: gst_element_link_many: assertion `GST_IS_ELEMENT (element_1)' failed<br><br>Code:<br><br> virtual void linkStreaming()<br> {<br> qDebug() << "linking in streaming";<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() << "link many in streaming";<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"><<a href="mailto:gstreamer-devel-request@lists.freedesktop.org">gstreamer-devel-request@lists.freedesktop.org</a>></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 'help' 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 "Re: Contents of gstreamer-devel digest..."<br>
<br>
<br>
Today'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 <<a href="mailto:t.i.m@zen.co.uk">t.i.m@zen.co.uk</a>><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: <1317716752.4063.3.camel@zingle><br>
Content-Type: text/plain; charset="UTF-8"<br>
<br>
On Tue, 2011-10-04 at 10:43 +0800, Stuart Gray wrote:<br>
<br>
> In trying to connect uridecodebin to queue2 I get the following output<br>
> from gstreamer:<br>
><br>
> (<unknown>:1363): GStreamer-WARNING **: Name queue20 is not unique in<br>
> bin , not adding<br>
><br>
> My code is as follows:<br>
><br>
> pipeline = gst_pipeline_new("");<br>
><br>
> uriDecodebin = gst_element_factory_make("uridecodebin", NULL);<br>
><br>
> g_object_set(G_OBJECT(uriDecodebin), "buffer-size", 150000,<br>
> NULL);<br>
> g_object_set(G_OBJECT(uriDecodebin), "download", false, NULL);<br>
> g_object_set(G_OBJECT(uriDecodebin), "use-buffering", false,<br>
> NULL);<br>
> g_signal_connect(G_OBJECT(uriDecodebin), "drained",<br>
> G_CALLBACK(sourceDrainedCallback), this);<br>
> /* connect uridecodebin to _sourceQ when it creates its output<br>
> pad */<br>
> g_signal_connect(G_OBJECT(uriDecodebin), "pad-added",<br>
> G_CALLBACK(callbackPadAdded), this);<br>
><br>
> outputBin = gst_bin_new("output-bin");<br>
> ...<br>
> _sourceQ = gst_element_factory_make("queue2", NULL);<br>
> gst_bin_add_many(GST_BIN(outputBin), _sourceQ, _pcmSink,<br>
> NULL);<br>
> ...<br>
<br>
What does your callbackPadAdded look like?<br>
<br>
I'm guessing you are creating "queue" elements in there. It's basically<br>
a bug in the way GStreamer creates default names for elements if you<br>
don't specify one. The first "queue2" instance will get named "queue20"<br>
and the twentieth "queue" instance will get named "queue20" as well,<br>
which may cause problems if you are using both at the same time. It'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>