Hi Edward, <br><br>Thanks for your reply. <br>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. <br>What I'm keen to know are <br>
1. is there any api which will directly give me the parent element details (something like gst_get_factory_name())<br>2. Is it possible to extract the element information by any other means?<br><br>Thanks again,<br>Gireesh<br>
<br><div class="gmail_quote">On Thu, Nov 6, 2008 at 7:54 PM, Edward Hervey <span dir="ltr"><<a href="mailto:edward.hervey@collabora.co.uk">edward.hervey@collabora.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Thu, 2008-11-06 at 18:46 +0530, Gireesh Kumar M wrote:<br>
> Hi All,<br>
><br>
> Is there any way to extract the parent element information from a<br>
> gstreamer element?<br>
> I tried it using the following code snippets but none of them worked.<br>
><br>
><br>
> GstElement *elem =<br>
> GST_ELEMENT_CAST(gst_element_get_parent(GST_ELEMENT(pad)));<br>
<br>
</div> Yay, casting a GstPad to a GstElement (!?!?!?).<br>
Yay, not checking for the return value of gst_element_get_parent().<br>
<div class="Ih2E3d"><br>
> g_print("In element %s\n", gst_element_get_name(elem)); //-------this<br>
> displays current element name properly<br>
><br>
> elem = GST_ELEMENT_CAST(gst_element_get_parent(elem));<br>
<br>
</div> Yay, not checking for the return value of gst_element_get_parent().<br>
<div class="Ih2E3d"><br>
> g_print("Parent element is %s\n",<br>
> gst_element_get_name(elem)); //---this displays pipeline0<br>
><br>
><br>
> elem = GST_ELEMENT_CAST(gst_element_get_parent(elem)); //--this<br>
<br>
</div> Yay, not checking for the return value of gst_element_get_parent().<br>
<div class="Ih2E3d"><br>
> throws the following error<br>
> g_print("Grand Parent element is %s\n", gst_element_get_name(elem));<br>
><br>
> /*(gst-launch-0.10:488): GStreamer-CRITICAL **: gst_object_get_name:<br>
> assertion `GS<br>
> T_IS_OBJECT (object)' failed<br>
> Caught SIGSEGV accessing address (nil)<br>
> Spinning. Please run 'gdb gst-launch 488' to continue debugging,<br>
> Ctrl-C to quit<br>
> , or Ctrl-\ to dump core. */<br>
><br>
><br>
> Then I tried,<br>
><br>
> GstElement *elem =<br>
> GST_ELEMENT_CAST(gst_element_get_parent(GST_ELEMENT(pad)));<br>
<br>
</div> Yay, not checking for the return value of gst_element_get_parent().<br>
YAY, casting a GstPad to a GstElement (!?!?!?!)<br>
<br>
> elem = GST_ELEMENT_CAST(gst_element_get_parent(elem));<br>
><br>
Yay, not checking for the return value of gst_element_get_parent().<br>
<div class="Ih2E3d"><br>
> GstElementClass *kl = GST_ELEMENT_GET_CLASS(elem);<br>
<br>
</div> Yay, not checking for the return value of GST_ELEMENT_GET_CLASS().<br>
<div class="Ih2E3d"><br>
> g_print("In element %s\n",<br>
> gst_object_get_name((GstObject*)(kl.details->longname));<br>
><br>
> This again gave pipeline0, where I'm expecting the actual name of the<br>
> element. It would be great if anyone can guide me.<br>
<br>
</div> So, to summarize: You're asking for the parent of the parent of the<br>
pad.<br>
The parent of the pad : The element to which the pad (maybe) belongs.<br>
The parent of the element to which the pad belongs : a pipeline.<br>
<br>
There's nothing wrong in what it's returning, but please... if you<br>
haven't noticed by now... always check the return values of<br>
functions/methods. It'll avoid you from calling methods/functions with<br>
invalid arguments.<br>
<font color="#888888"><br>
Edward<br>
</font><div class="Ih2E3d"><br>
><br>
> Many thanks in advance,<br>
> Gireesh<br>
</div><div><div></div><div class="Wj3C7c">> -------------------------------------------------------------------------<br>
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge<br>
> Build the coolest Linux based applications with Moblin SDK & win great prizes<br>
> Grand prize is a trip for two to an Open Source event anywhere in the world<br>
> <a href="http://moblin-contest.org/redirect.php?banner_id=100&url=/" target="_blank">http://moblin-contest.org/redirect.php?banner_id=100&url=/</a><br>
> _______________________________________________ Gstreamer-embedded mailing list <a href="mailto:Gstreamer-embedded@lists.sourceforge.net">Gstreamer-embedded@lists.sourceforge.net</a> <a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-embedded" target="_blank">https://lists.sourceforge.net/lists/listinfo/gstreamer-embedded</a><br>
<br>
</div></div></blockquote></div><br>