Hi Edward,<br><br>>Those are two things:<br>
> * Getting the parent element (of what ? a pad ? another element ?) =><br>
>use the appropriate gst_*_get_parent().<br><br>Yes. I tried it in the same way.<br>gst_element_get_parent() gave me "pipeline0" and not the parent element name. Is it because I'm casting it?<br>Now, two questions...<br>
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. <br>I'm referring to <br><pre><span id="l678"><font style="font-family: arial narrow,sans-serif;" size="2">element = <span class="chl" id="m0">GST_ELEMENT</span> (GST_OBJECT_PARENT (rpad));</font><br>
</span></pre>from line no 678,<br><a href="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">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</a> <br>
<br>2. Is there any api to query the running pipeline? Some string that contains the pipeline name, at least?<br><br>
>* Getting the GstElementFactory details of an instance. =><br>
>gst_element_get_factory() => gst_element_factory_get_*().<br>
<br>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.<br>
<font size="2"><span style="font-family: arial narrow,sans-serif;"><br>gst-launch-0.10 filesrc location=file.avi ! ffdemux_avi ! queue ! <my decoder plugin> ! alsasink</span></font><br>
<br>Is it possible to extract the demuxer name (run time) from my decoder element?<br><br>Thanks a lot,<br>Gireesh<br><br><br><div class="gmail_quote">On Thu, Nov 6, 2008 at 9:44 PM, Edward Hervey <span dir="ltr"><<a href="mailto:edward.hervey@collabora.co.uk" target="_blank">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>On Thu, 2008-11-06 at 21:33 +0530, Gireesh Kumar M wrote:<br>
> Hi Edward,<br>
><br>
> Thanks for your reply.<br>
> Yes, it's essential to check the return values, but this is just a<br>
> sample code by which I wanted to demonstrate what I'm trying to do.<br>
<br>
</div> Fair enough, in that case don't mention the segfaults.<br>
<div><br>
> What I'm keen to know are<br>
> 1. is there any api which will directly give me the parent element<br>
> details (something like gst_get_factory_name())<br>
<br>
</div> Those are two things:<br>
* Getting the parent element (of what ? a pad ? another element ?) =><br>
use the appropriate gst_*_get_parent().<br>
* Getting the GstElementFactory details of an instance. =><br>
gst_element_get_factory() => gst_element_factory_get_*().<br>
<div><div></div><div><br>
> 2. Is it possible to extract the element information by any other<br>
> means?<br>
><br>
> Thanks again,<br>
> Gireesh<br>
><br>
> On Thu, Nov 6, 2008 at 7:54 PM, Edward Hervey<br>
> <<a href="mailto:edward.hervey@collabora.co.uk" target="_blank">edward.hervey@collabora.co.uk</a>> wrote:<br>
> 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<br>
> from a<br>
> > gstreamer element?<br>
> > I tried it using the following code snippets but none of<br>
> them worked.<br>
> ><br>
> ><br>
> > GstElement *elem =<br>
> > GST_ELEMENT_CAST(gst_element_get_parent(GST_ELEMENT(pad)));<br>
><br>
><br>
> Yay, casting a GstPad to a GstElement (!?!?!?).<br>
> Yay, not checking for the return value of<br>
> gst_element_get_parent().<br>
><br>
> > g_print("In element %s\n",<br>
> 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>
><br>
> Yay, not checking for the return value of<br>
> gst_element_get_parent().<br>
><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));<br>
> //--this<br>
><br>
><br>
> Yay, not checking for the return value of<br>
> gst_element_get_parent().<br>
><br>
> > throws the following error<br>
> > g_print("Grand Parent element is %s\n",<br>
> gst_element_get_name(elem));<br>
> ><br>
> > /*(gst-launch-0.10:488): GStreamer-CRITICAL **:<br>
> 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<br>
> 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>
><br>
> Yay, not checking for the return value of<br>
> 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<br>
> gst_element_get_parent().<br>
><br>
> > GstElementClass *kl = GST_ELEMENT_GET_CLASS(elem);<br>
><br>
><br>
> Yay, not checking for the return value of<br>
> GST_ELEMENT_GET_CLASS().<br>
><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<br>
> name of the<br>
> > element. It would be great if anyone can guide me.<br>
><br>
><br>
> So, to summarize: You're asking for the parent of the parent<br>
> of the<br>
> pad.<br>
> The parent of the pad : The element to which the pad (maybe)<br>
> belongs.<br>
> The parent of the element to which the pad belongs : a<br>
> pipeline.<br>
><br>
> There's nothing wrong in what it's returning, but please...<br>
> if you<br>
> haven't noticed by now... always check the return values of<br>
> functions/methods. It'll avoid you from calling<br>
> methods/functions with<br>
> invalid arguments.<br>
><br>
> Edward<br>
><br>
> ><br>
> > Many thanks in advance,<br>
> > Gireesh<br>
><br>
><br>
> ><br>
> -------------------------------------------------------------------------<br>
> > This SF.Net email is sponsored by the Moblin Your Move<br>
> Developer's challenge<br>
> > Build the coolest Linux based applications with Moblin SDK &<br>
> win great prizes<br>
> > Grand prize is a trip for two to an Open Source event<br>
> 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>
> > _______________________________________________<br>
> Gstreamer-embedded mailing list<br>
> <a href="mailto:Gstreamer-embedded@lists.sourceforge.net" target="_blank">Gstreamer-embedded@lists.sourceforge.net</a><br>
> <a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-embedded" target="_blank">https://lists.sourceforge.net/lists/listinfo/gstreamer-embedded</a><br>
><br>
><br>
><br>
<br>
</div></div></blockquote></div><br>