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