[gst-embedded] Any API to extract the parent element information?
Gireesh Kumar M
gireesh.mnair at gmail.com
Thu Nov 6 21:57:15 PST 2008
Hi Edward,
>Those are two things:
> * Getting the parent element (of what ? a pad ? another element ?) =>
>use the appropriate gst_*_get_parent().
Yes. I tried it in the same way.
gst_element_get_parent() gave me "pipeline0" and not the parent element
name. Is it because I'm casting it?
Now, two questions...
1. it there a way to get the GstElement object corresponds to a particular
GstPad object? A macro or something? I was expecting GST_ELEMENT to do the
casting.
I'm referring to
element = GST_ELEMENT (GST_OBJECT_PARENT (rpad));
from line no 678,
http://www.google.com/codesearch?hl=en&q=GST_ELEMENT+show:7kqxMMVD25A:h1NDCsbGCXw:9xQ-bHfcgJ4&sa=N&cd=5&ct=rc&cs_p=http://gstreamer.freedesktop.org/src/gst-editor/gst-editor-0.7.0.tar.bz2&cs_f=gst-editor-0.7.0/libs/gst/editor/gsteditorpad.c
2. Is there any api to query the running pipeline? Some string that contains
the pipeline name, at least?
>* Getting the GstElementFactory details of an instance. =>
>gst_element_get_factory() => gst_element_factory_get_*().
You are talking about gst_element_factory_get_longname(), right? This needs
the return value of gst_element_factory_find("element name") to be passed,
where the element name is unknown at compile time. What I intend to do is
something like this.
gst-launch-0.10 filesrc location=file.avi ! ffdemux_avi ! queue ! <my
decoder plugin> ! alsasink
Is it possible to extract the demuxer name (run time) from my decoder
element?
Thanks a lot,
Gireesh
On Thu, Nov 6, 2008 at 9:44 PM, Edward Hervey <edward.hervey at collabora.co.uk
> wrote:
> On Thu, 2008-11-06 at 21:33 +0530, Gireesh Kumar M wrote:
> > Hi Edward,
> >
> > Thanks for your reply.
> > Yes, it's essential to check the return values, but this is just a
> > sample code by which I wanted to demonstrate what I'm trying to do.
>
> Fair enough, in that case don't mention the segfaults.
>
> > What I'm keen to know are
> > 1. is there any api which will directly give me the parent element
> > details (something like gst_get_factory_name())
>
> Those are two things:
> * Getting the parent element (of what ? a pad ? another element ?) =>
> use the appropriate gst_*_get_parent().
> * Getting the GstElementFactory details of an instance. =>
> gst_element_get_factory() => gst_element_factory_get_*().
>
> > 2. Is it possible to extract the element information by any other
> > means?
> >
> > Thanks again,
> > Gireesh
> >
> > On Thu, Nov 6, 2008 at 7:54 PM, Edward Hervey
> > <edward.hervey at collabora.co.uk> wrote:
> > On Thu, 2008-11-06 at 18:46 +0530, Gireesh Kumar M wrote:
> > > Hi All,
> > >
> > > Is there any way to extract the parent element information
> > from a
> > > gstreamer element?
> > > I tried it using the following code snippets but none of
> > them worked.
> > >
> > >
> > > GstElement *elem =
> > > GST_ELEMENT_CAST(gst_element_get_parent(GST_ELEMENT(pad)));
> >
> >
> > Yay, casting a GstPad to a GstElement (!?!?!?).
> > Yay, not checking for the return value of
> > gst_element_get_parent().
> >
> > > g_print("In element %s\n",
> > gst_element_get_name(elem)); //-------this
> > > displays current element name properly
> > >
> > > elem = GST_ELEMENT_CAST(gst_element_get_parent(elem));
> >
> >
> > Yay, not checking for the return value of
> > gst_element_get_parent().
> >
> > > g_print("Parent element is %s\n",
> > > gst_element_get_name(elem)); //---this displays pipeline0
> > >
> > >
> > > elem = GST_ELEMENT_CAST(gst_element_get_parent(elem));
> > //--this
> >
> >
> > Yay, not checking for the return value of
> > gst_element_get_parent().
> >
> > > throws the following error
> > > g_print("Grand Parent element is %s\n",
> > gst_element_get_name(elem));
> > >
> > > /*(gst-launch-0.10:488): GStreamer-CRITICAL **:
> > gst_object_get_name:
> > > assertion `GS
> > > T_IS_OBJECT (object)' failed
> > > Caught SIGSEGV accessing address (nil)
> > > Spinning. Please run 'gdb gst-launch 488' to continue
> > debugging,
> > > Ctrl-C to quit
> > > , or Ctrl-\ to dump core. */
> > >
> > >
> > > Then I tried,
> > >
> > > GstElement *elem =
> > > GST_ELEMENT_CAST(gst_element_get_parent(GST_ELEMENT(pad)));
> >
> >
> > Yay, not checking for the return value of
> > gst_element_get_parent().
> > YAY, casting a GstPad to a GstElement (!?!?!?!)
> >
> > > elem = GST_ELEMENT_CAST(gst_element_get_parent(elem));
> > >
> > Yay, not checking for the return value of
> > gst_element_get_parent().
> >
> > > GstElementClass *kl = GST_ELEMENT_GET_CLASS(elem);
> >
> >
> > Yay, not checking for the return value of
> > GST_ELEMENT_GET_CLASS().
> >
> > > g_print("In element %s\n",
> > > gst_object_get_name((GstObject*)(kl.details->longname));
> > >
> > > This again gave pipeline0, where I'm expecting the actual
> > name of the
> > > element. It would be great if anyone can guide me.
> >
> >
> > So, to summarize: You're asking for the parent of the parent
> > of the
> > pad.
> > The parent of the pad : The element to which the pad (maybe)
> > belongs.
> > The parent of the element to which the pad belongs : a
> > pipeline.
> >
> > There's nothing wrong in what it's returning, but please...
> > if you
> > haven't noticed by now... always check the return values of
> > functions/methods. It'll avoid you from calling
> > methods/functions with
> > invalid arguments.
> >
> > Edward
> >
> > >
> > > Many thanks in advance,
> > > Gireesh
> >
> >
> > >
> >
> -------------------------------------------------------------------------
> > > This SF.Net email is sponsored by the Moblin Your Move
> > Developer's challenge
> > > Build the coolest Linux based applications with Moblin SDK &
> > win great prizes
> > > Grand prize is a trip for two to an Open Source event
> > anywhere in the world
> > > http://moblin-contest.org/redirect.php?banner_id=100&url=/
> > > _______________________________________________
> > Gstreamer-embedded mailing list
> > Gstreamer-embedded at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gstreamer-embedded
> >
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-embedded/attachments/20081107/1fd825fc/attachment.htm>
More information about the Gstreamer-embedded
mailing list