[gst-devel] Get pointer to elements in pipeline

wl2776 wl2776 at gmail.com
Wed Mar 17 16:55:06 CET 2010



ericcardmanNo3 wrote:
> 
> i do:
> 
> 	GstPad *pP = gst_pad_get_peer(dec->sinkpad);
> 	GstElement* pDEC = (GstElement*) gst_pad_get_parent_element
> (dec->sinkpad);
> 	GstElement *pEE =
> gst_bin_get_by_name(GST_ELEMENT_PARENT(pDEC),"filesrc");
> 	GstElement *pEE1 = gst_bin_get_by_name(dec,"filesrc");
> 	g_print("§§§§ GST_ELEMENT_PARENT is 0x%x pEE is 0x%x pEE1 is  
>                                                                     
> 0x%x\n",GST_ELEMENT_PARENT(pDEC),pEE, pEE1);
> 	g_object_get(pDEC,"name",&fb_fd,NULL);
> 	g_print("### pP is 0x%x (pDEC is 0x%x [%s])\n",pP,pDEC,fb_fd);
> 
> OUTPUT IS:
> 
> (<unknown>:1493): GStreamer-CRITICAL **: gst_bin_get_by_name: assertion
> `GST_IS_BIN (bin)' failed
> ???? GST_ELEMENT_PARENT is 0xf4040 pEE is 0x0 pEE1 is 0x0
> ### pP is 0xaad80 (pDEC is 0x165128 [my264decoder0])
> 
> Do you know what i am doing wrong here? 
> 
You didn't specify what dec is.
I suppose, it is your decoder element.
Then dec->sinkpad is the sink pad of it. 
Then, after
   GstElement* pDEC = (GstElement*) gst_pad_get_parent_element
(dec->sinkpad);
pDEC should contain the same as dec - the pointer to your decoder element.

Next instruction.
GstElement *pEE = gst_bin_get_by_name(GST_ELEMENT_PARENT(pDEC),"filesrc");
Here you're getting a bin, containing your decoder and querying it for
element, named "filesrc". 
However, this bin doesn't contain the element with such name.
How do you know that the element's name is "filesrc"? This could be
"source", "filesrc0", etc.

Next instuction.
GstElement *pEE1 = gst_bin_get_by_name(dec,"filesrc");
Here you're querying your decoder element for an element, named "filesrc".
Your decoder is not a bin, so, you're getting error message.

I would recommend you

putenv("GST_DEBUG_DUMP_DOT_DIR=/home/your/favorite/dir/goes/here");

then go to the topmost level with calls to GST_ELEMENT_PARENT in cycle, then 

GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(topmost_bin), GST_DEBUG_GRAPH_SHOW_ALL,
"player");

This will result in the /home/you/favorive/dir/player.dot file, which you
can convert to png with the following command.
dot -Tpng -o/home/you/favorive/dir/player.png
/home/you/favorive/dir/player.dot

Somethig
[!!! untested ] 
GstElement *el, *el1;

el=el1=GST_ELEMENT_PARENT(dec);
while(el){
  el1=el;
  el=GST_ELEMENT_PARENT(el1);
}
[!!! untested ] 

The code above should give you a pointer to a topmost container.
Then do

GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(topmost_bin), GST_DEBUG_GRAPH_SHOW_ALL,
"player");

and explore the resulting player.dot file.
It will show you all names, links and capabilites.

-- 
View this message in context: http://n4.nabble.com/Get-pointer-to-elements-in-pipeline-tp1596079p1596653.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.




More information about the gstreamer-devel mailing list