[gst-devel] Confusion over ghost pads

William R Sowerbutts will at sowerbutts.com
Wed Jan 14 18:08:00 CET 2004


I'm using GStreamer 0.7.3 to develop a simple application for blending two 
video streams together.

I've read the relevant documentation about ghost pads, and my understanding is
that attaching a ghost pad to a GstBin simply exposes that pad to the outside
of the bin, and allows you to use the ghost pad and the real pad
interchangeably.

However, this doesn't work for me.

My app creates a GstThread with a filesrc, dvdec and queue object suitably 
interconnected. It then creates a ghost pad for the queue's "src" pad as a 
"src" pad on the GstThread.

When I try to attach to this pad, I get the following error
("../content/window_shot_1_3.mov.dv" is the name of my thread):

INFO  GST_ELEMENT_PADS(20791) gstelement.c(1081):gst_element_get_static_pad: found pad ../content/window_shot_1_3.mov.dv:src
DEBUG GST_ELEMENT_PADS(20791) gstelement.c(1546):gst_element_link_pads_filtered: pad ../content/window_shot_1_3.mov.dv:src is no src pad

A simple test case demonstrates that there is something funky going on:

#include <gst/gst.h>

int main (int argc, char *argv[]) 
{
  GstElement *thread, *filesource;

  gst_init(&argc, &argv);

  thread = gst_thread_new("test_thread");
  g_assert(thread != NULL);

  // create object to read data from disk
  filesource = gst_element_factory_make("filesrc", "filesrc");
  g_assert(filesource != NULL);

  gst_bin_add(GST_BIN(thread), filesource);

  g_assert(GST_RPAD_DIRECTION(gst_element_get_pad(filesource, "src")) == GST_PAD_SRC);

  // connect the filesrc's output to the bin's "src" ghost pad
  g_assert(gst_element_add_ghost_pad(thread, gst_element_get_pad(filesource, "src"), "src") != 0);

  // All OK up to this point, but this assertion fails!!
  g_assert(GST_RPAD_DIRECTION(gst_element_get_pad(thread, "src")) == GST_PAD_SRC);

  gst_object_unref (GST_OBJECT (thread));

  return 0;
}

GST_PAD_DIRECTION of the pad is GST_PAD_SRC, but GST_RPAD_DIRECTION is not? 

I'm confused. 

Can anyone explain to me where I'm going wrong? 

Thanks!

_________________________________________________________________________
William R Sowerbutts                                  will at sowerbutts.com
Coder / Guru / Nrrrd                                http://sowerbutts.com
         main(){char*s=">#=0> ^#X@#@^7=",c=0,m;for(;c<15;c++)for
         (m=-1;m<7;putchar(m++/6&c%3/2?10:s[c]-31&1<<m?42:32));}  





More information about the gstreamer-devel mailing list