[gst-embedded] Any API to extract the parent element information?
Edward Hervey
edward.hervey at collabora.co.uk
Thu Nov 6 08:14:51 PST 2008
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
>
>
>
More information about the Gstreamer-embedded
mailing list