Name queue20 is not unique in bin , not adding - when connecting uridecodebin to queue2 (Stuart Gray)
Stuart Gray
stuart68 at gmail.com
Wed Oct 5 01:37:49 PDT 2011
Hi
When chaning the code yo improve my debug output I mis-takenly removed my
uridecodebin.
Here is the code now, but it still does not link correctly and I get no
audio out.
virtual bool init()
{
if (!GStreamerPlayerBase::init()) {
return false;
}
pipeline = gst_pipeline_new("");
// Audio bin
audiobin = gst_bin_new("audiobin");
qDebug() << "adding audiobin to pipeline";
gst_bin_add(GST_BIN(pipeline), audiobin);
qDebug() << "adding elements";
_sourceQ = gst_element_factory_make("queue2", NULL);
quint64 maxBufferTime = 0; // disable
guint maxBufferBytes =
Settings::getValue<int>(Settings::SECTION_RECEIVE
+ Settings::RECEIVE_MAX_BUFFER_SIZE);
guint highPercent =
Settings::getValue<int>(Settings::SECTION_RECEIVE
+ Settings::RECEIVE_BUFFER_HIGHPERC);
guint lowPercent = Settings::getValue<int>(Settings::SECTION_RECEIVE
+ Settings::RECEIVE_BUFFER_LOWPERC);
bool useBuffering =
Settings::getValue<int>(Settings::SECTION_RECEIVE
+ Settings::RECEIVE_USE_BUFFER);
//this queue is used to force buffering of more data, the intention
//being to help with internet radio drop out
g_object_set(G_OBJECT(_sourceQ),
"max-size-buffers", 0,
"max-size-time", maxBufferTime,
"max-size-bytes", maxBufferBytes,
"use-buffering", useBuffering,
"high-percent", highPercent,
"low-percent", lowPercent,
NULL);
qDebug() << "add source to bin elements";
gst_bin_add(GST_BIN(audiobin), _sourceQ);
qDebug() << "cret sourceQ sink pad";
GstPad* pad = gst_element_get_pad(_sourceQ, "sink");
gst_element_add_pad(audiobin, gst_ghost_pad_new("sink", pad));
gst_object_unref(pad);
uriDecodebin = gst_element_factory_make("uridecodebin", NULL);
gst_bin_add(GST_BIN(pipeline), uriDecodebin);
g_object_set(G_OBJECT(uriDecodebin), "buffer-size", 150000, NULL);
g_object_set(G_OBJECT(uriDecodebin), "download", false, NULL);
g_object_set(G_OBJECT(uriDecodebin), "use-buffering", false, NULL);
g_signal_connect(G_OBJECT(uriDecodebin), "drained",
G_CALLBACK(sourceDrainedCallback), this);
/* connect uridecodebin to _sourceQ when it creates its output pad
*/
qDebug() << "adding uriDeecode callback";
g_signal_connect(G_OBJECT(uriDecodebin), "pad-added",
G_CALLBACK(callbackPadAdded), this);
qDebug() << "init output stage";
initOutputStage(GST_BIN(pipeline));
qDebug() << "ref elements";
gst_object_ref(uriDecodebin);
gst_object_ref(_sourceQ);
return true;
}
Cheers,
Stuart
> Message: 5
> Date: Wed, 5 Oct 2011 16:15:50 +0800
> From: Stuart Gray <stuart68 at gmail.com>
> Subject: Re: Name queue20 is not unique in bin , not adding - when
> connecting uridecodebin to queue2
> To: gstreamer-devel at lists.freedesktop.org
> Message-ID:
> <CAG2RAVYtZWYgTumW1-Socf92MAjnytt4oFPTDaY_yRBZ_GLKuw at mail.gmail.com
> >
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi Tim,
>
> I had already begun to think of an alternative way to do this. I was
> thinking about using BINs.
>
> 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.
>
> I have re-written the code as following:
>
>
> virtual bool init()
> {
> if (!GStreamerPlayerBase::init()) {
> return false;
> }
>
> pipeline = gst_pipeline_new("");
>
> // Audio bin
> audiobin = gst_bin_new("audiobin");
> qDebug() << "adding audiobin to pipeline";
> gst_bin_add(GST_BIN(pipeline), audiobin);
>
> qDebug() << "adding elements";
> _sourceQ = gst_element_factory_make("queue2", NULL);
> quint64 maxBufferTime = 0; // disable
> guint maxBufferBytes =
> Settings::getValue<int>(Settings::SECTION_RECEIVE
> + Settings::RECEIVE_MAX_BUFFER_SIZE);
> guint highPercent =
> Settings::getValue<int>(Settings::SECTION_RECEIVE
> + Settings::RECEIVE_BUFFER_HIGHPERC);
> guint lowPercent = Settings::getValue<int>(Settings::SECTION_RECEIVE
> + Settings::RECEIVE_BUFFER_LOWPERC);
> bool useBuffering =
> Settings::getValue<int>(Settings::SECTION_RECEIVE
> + Settings::RECEIVE_USE_BUFFER);
>
> //this queue is used to force buffering of more data, the intention
> //being to help with internet radio drop out
> g_object_set(G_OBJECT(_sourceQ),
> "max-size-buffers", 0,
> "max-size-time", maxBufferTime,
> "max-size-bytes", maxBufferBytes,
> "use-buffering", useBuffering,
> "high-percent", highPercent,
> "low-percent", lowPercent,
> NULL);
>
> qDebug() << "add source to bin elements";
> gst_bin_add(GST_BIN(audiobin), _sourceQ);
>
> qDebug() << "create sourceQ sink pad";
> GstPad* pad = gst_element_get_pad(_sourceQ, "sink");
> gst_element_add_pad(audiobin, gst_ghost_pad_new("sink", pad));
> gst_object_unref(pad);
>
>
> qDebug() << "init output stage";
> initOutputStage(GST_BIN(pipeline));
>
> qDebug() << "ref elements";
> gst_object_ref(uriDecodebin);
> gst_object_ref(_sourceQ);
> return true;
> }
>
> my callbackPadAdded is:
>
> static void callbackPadAdded(GstElement *uriDecodebin,
> GstPad *pad,
> gpointer self)
> {
> GStreamerDecodebinPrivate* obj =
> reinterpret_cast<GStreamerDecodebinPrivate*>(self);
> GstPad* const audiopad = gst_element_get_pad(obj->audiobin, "sink");
>
> qDebug() << "uridecodebin pad add started";
> Q_UNUSED(uriDecodebin);
> if (GST_PAD_IS_LINKED(audiopad)) {
> qDebug() << "audiopad is already linked. Unlinking old pad.";
> gst_pad_unlink(audiopad, GST_PAD_PEER(audiopad));
> }
>
> qDebug() << "uridecodebin pad added";
>
> gst_pad_link(pad, audiopad);
>
> gst_object_unref(audiopad);
> }
>
>
> For the above I would like to add setting of caps to the uridecodebin.
>
> Setting of the output stage is:
>
> void initOutputStage(GstBin* outputBin)
> {
> QString dev = Settings::getValue<QString>( Settings::SECTION_DEVICES
> + Settings::AUDIO_OUTPUT );
> _pcmSink = gst_element_factory_make("alsasink", NULL);
> g_object_set(G_OBJECT(_pcmSink), "device", dev.toLatin1().data(),
> NULL);
>
> GstBaseAudioSinkSlaveMethod slaveMethod =
> GST_BASE_AUDIO_SINK_SLAVE_NONE;
> g_object_set(G_OBJECT(_pcmSink), "sync", 0,
> "async", 0,
> "slave-method", slaveMethod,
> NULL);
>
>
> gst_bin_add(GST_BIN(outputBin), _pcmSink);
> // link the static parts together
> gst_element_link(_pcmSink, NULL);
>
> bool usePlayBin = Settings::getValue<bool>(Settings::SECTION_AUDIO +
> Settings::USE_PLAYBIN);
>
> }
>
>
> 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.
>
> I have the following:
>
> gst_element_link_many(uriDecodebin, _sourceQ, _pcmSink, NULL);
>
>
> During initialization I get the following warning:
>
> ref elements
>
> (<unknown>:2847): GStreamer-CRITICAL **: gst_object_ref: assertion `object
> != NULL' failed
>
> When I try to link it all together I get:
>
> link many in streaming
>
> (<unknown>:2847): GStreamer-CRITICAL **: gst_element_link_many: assertion
> `GST_IS_ELEMENT (element_1)' failed
>
> Code:
>
> virtual void linkStreaming()
> {
> qDebug() << "linking in streaming";
>
> gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_NULL);
>
> if (passThroughLinked) {
> gst_element_set_state(GST_ELEMENT(recPipeline), GST_STATE_NULL);
> // gst_bin_remove_many(GST_BIN(pipeline), passThroughFakeSource,
> passThroughCapsFilter, _audioResample, NULL);
> }
>
> qDebug() << "link many in streaming";
> gst_element_link_many(uriDecodebin, _sourceQ, _pcmSink, NULL);
>
> passThroughLinked = false;
> }
>
> 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.
>
> My goal is to have the very simple pipeline:
>
> uridecodebin ! queue2 ! alsasink
>
> Thanks,
> Stuart
>
>
> On 5 October 2011 03:00, <gstreamer-devel-request at lists.freedesktop.org
> >wrote:
>
> > Send gstreamer-devel mailing list submissions to
> > gstreamer-devel at lists.freedesktop.org
> >
> > To subscribe or unsubscribe via the World Wide Web, visit
> > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> > or, via email, send a message with subject or body 'help' to
> > gstreamer-devel-request at lists.freedesktop.org
> >
> > You can reach the person managing the list at
> > gstreamer-devel-owner at lists.freedesktop.org
> >
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of gstreamer-devel digest..."
> >
> >
> > Today's Topics:
> >
> > 1. Re: Name queue20 is not unique in bin , not adding - when
> > connecting uridecodebin to queue2 (Tim-Philipp M?ller)
> >
> >
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Tue, 04 Oct 2011 09:25:52 +0100
> > From: Tim-Philipp M?ller <t.i.m at zen.co.uk>
> > Subject: Re: Name queue20 is not unique in bin , not adding - when
> > connecting uridecodebin to queue2
> > To: gstreamer-devel at lists.freedesktop.org
> > Message-ID: <1317716752.4063.3.camel at zingle>
> > Content-Type: text/plain; charset="UTF-8"
> >
> > On Tue, 2011-10-04 at 10:43 +0800, Stuart Gray wrote:
> >
> > > In trying to connect uridecodebin to queue2 I get the following output
> > > from gstreamer:
> > >
> > > (<unknown>:1363): GStreamer-WARNING **: Name queue20 is not unique in
> > > bin , not adding
> > >
> > > My code is as follows:
> > >
> > > pipeline = gst_pipeline_new("");
> > >
> > > uriDecodebin = gst_element_factory_make("uridecodebin", NULL);
> > >
> > > g_object_set(G_OBJECT(uriDecodebin), "buffer-size", 150000,
> > > NULL);
> > > g_object_set(G_OBJECT(uriDecodebin), "download", false, NULL);
> > > g_object_set(G_OBJECT(uriDecodebin), "use-buffering", false,
> > > NULL);
> > > g_signal_connect(G_OBJECT(uriDecodebin), "drained",
> > > G_CALLBACK(sourceDrainedCallback), this);
> > > /* connect uridecodebin to _sourceQ when it creates its output
> > > pad */
> > > g_signal_connect(G_OBJECT(uriDecodebin), "pad-added",
> > > G_CALLBACK(callbackPadAdded), this);
> > >
> > > outputBin = gst_bin_new("output-bin");
> > > ...
> > > _sourceQ = gst_element_factory_make("queue2", NULL);
> > > gst_bin_add_many(GST_BIN(outputBin), _sourceQ, _pcmSink,
> > > NULL);
> > > ...
> >
> > What does your callbackPadAdded look like?
> >
> > I'm guessing you are creating "queue" elements in there. It's basically
> > a bug in the way GStreamer creates default names for elements if you
> > don't specify one. The first "queue2" instance will get named "queue20"
> > and the twentieth "queue" instance will get named "queue20" as well,
> > which may cause problems if you are using both at the same time. It's
> > hard to change now though, because it would break code that relies on
> > the the naming scheme.
> >
> > In this case, you could just use a normal queue instead of queue2 before
> > the sink (or just not use a queue at all?).
> >
> > Cheers
> > -Tim
> >
> >
> >
> >
> > ------------------------------
> >
> > _______________________________________________
> > gstreamer-devel mailing list
> > gstreamer-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> >
> >
> > End of gstreamer-devel Digest, Vol 9, Issue 8
> > *********************************************
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20111005/469630ca/attachment.htm
> >
>
> ------------------------------
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
> End of gstreamer-devel Digest, Vol 9, Issue 10
> **********************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20111005/9207a571/attachment-0001.htm>
More information about the gstreamer-devel
mailing list