gst_ghost_pad_new () only generates _proxypad not ghost sink pad

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

gst_ghost_pad_new () only generates _proxypad not ghost sink pad

vanderhoffer
This post was updated on .
Hi,
I am adding a ghost pad with

myGhostPad_sink = gst_ghost_pad_new (//code here//);
myGhostPad_src = gst_ghost_pad_new (//code here//);

and testing with

 if(GST_PAD_DIRECTION(myGhostPad_sink) == GST_PAD_SINK){//code here//}

however the .dot file does not show reference to a ghost sink pad, only a
_proxypadn_nnnnnnn as shown in the image below

when trying to verify pad exists with
gst_element_get_static_pad(//code here//)
it returns null.

This only happens on sink pads, src pads work as expected.
Am I doing something wrong for adding ghost sink pads?

thanks
Art

Reply | Threaded
Open this post in threaded view
|

Re: gst_ghost_pad_new () only generates _proxypad not ghost sink pad

Gst-Geek
Hi,

To add ghost pad you have to create ghost pad to a existing pad and that pad to be added to the bin. In your code adding ghost pad to bin is missing it seems.

The code fir that will be some thing like this
{
  GstElement *bin, *sink;
  GstPad *pad;

  /* init */
  gst_init (&argc, &argv);

  /* create element, add to bin */
  sink = gst_element_factory_make ("fakesink", "sink");
  bin = gst_bin_new ("mybin");
  gst_bin_add (GST_BIN (bin), sink);

  /* add ghostpad */
  pad = gst_element_get_static_pad (sink, "sink");
  gst_element_add_pad (bin, gst_ghost_pad_new ("sink", pad));
  gst_object_unref (GST_OBJECT (pad));
 }

This link may help you
https://gstreamer.freedesktop.org/documentation/application-development/basics/pads.html#ghost-pads

~ Vinod
Reply | Threaded
Open this post in threaded view
|

Re: gst_ghost_pad_new () only generates _proxypad not ghost sink pad

vanderhoffer
Thanks for taking the time to reply Vinod,

My code was short hand as it is a complex source code.
I have used the full method for both sink/src and the src does generate a
element[src]->proxypad->ghostpad->bin wall,
however the sink does not it only generates a proxypad.
I am assuming the structure is the reverse of the src end, ie
bin wall ->ghostpad->proxypad->element

My understanding is that to get a proxy pad the ghostpad must have been created,
could it be the ghostpad is not being assigned to the bin?

Please note that after ghostpad creation I can verify the direction with
if(GST_PAD_DIRECTION(myGhostPad_sink) == GST_PAD_SINK){//code here//}
so it seems to exist

thx
Art
Reply | Threaded
Open this post in threaded view
|

Re: gst_ghost_pad_new () only generates _proxypad not ghost sink pad

vanderhoffer
This post was updated on .
Turns out I was overwriting the memory space in a pthread and not terminating the string of gpad name with a `\0`, hence returning null. Always something to watch out for in C if you come from a higher level programing language.