Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > d620e9f76c810e9fbdaebc304909c8fc > files > 219

lib64gstreamer0.10-devel-0.10.36-7.mga4.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Ghost pads</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79;charset=UTF-8"><LINK
REL="HOME"
TITLE="GStreamer Application Development Manual (0.10.36)"
HREF="index.html"><LINK
REL="UP"
TITLE="Pads and capabilities"
HREF="chapter-pads.html"><LINK
REL="PREVIOUS"
TITLE="What capabilities are used for"
HREF="section-caps-api.html"><LINK
REL="NEXT"
TITLE="Buffers and Events"
HREF="chapter-data.html"></HEAD
><BODY
CLASS="sect1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
><SPAN
CLASS="application"
>GStreamer</SPAN
> Application Development Manual (0.10.36)</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="section-caps-api.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 8. Pads and capabilities</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="chapter-data.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="section-pads-ghost"
>8.4. Ghost pads</A
></H1
><P
>&#13;      You can see from <A
HREF="section-pads-ghost.html#section-bin-noghost-img"
>Figure 8-1</A
> how a bin
      has no pads of its own. This is where "ghost pads" come into play.
    </P
><DIV
CLASS="figure"
><A
NAME="section-bin-noghost-img"
></A
><P
><B
>Figure 8-1. Visualisation of a <A
HREF="../../gstreamer/html/GstBin.html"
TARGET="_top"
><CODE
CLASS="classname"
>GstBin</CODE
></A
>
      element without ghost pads</B
></P
><DIV
CLASS="mediaobject"
><P
><IMG
SRC="images/bin-element-noghost.png"></P
></DIV
></DIV
><P
>&#13;      A ghost pad is a pad from some element in the bin that can be
      accessed directly from the bin as well. Compare it to a symbolic
      link in UNIX filesystems. Using ghost pads on bins, the bin also
      has a pad and can transparently be used as an element in other
      parts of your code.
    </P
><DIV
CLASS="figure"
><A
NAME="section-bin-ghost-img"
></A
><P
><B
>Figure 8-2. Visualisation of a <A
HREF="../../gstreamer/html/GstBin.html"
TARGET="_top"
><CODE
CLASS="classname"
>GstBin</CODE
></A
>
      element with a ghost pad</B
></P
><DIV
CLASS="mediaobject"
><P
><IMG
SRC="images/bin-element-ghost.png"></P
></DIV
></DIV
><P
>&#13;      <A
HREF="section-pads-ghost.html#section-bin-ghost-img"
>Figure 8-2</A
> is a representation of a
      ghost pad. The sink pad of element one is now also a pad of the bin.
      Because ghost pads look and work like any other pads, they can be added 
      to any type of elements, not just to a <CODE
CLASS="classname"
>GstBin</CODE
>,
      just like ordinary pads.
    </P
><P
>&#13;      A ghostpad is created using the function
      <CODE
CLASS="function"
>gst_ghost_pad_new ()</CODE
>:
    </P
><PRE
CLASS="programlisting"
>&#13;#include &#60;gst/gst.h&#62;

int
main (int   argc,
      char *argv[])
{
  GstElement *bin, *sink;
  GstPad *pad;

  /* init */
  gst_init (&#38;argc, &#38;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));

[..]

}
    </PRE
><P
>&#13;      In the above example, the bin now also has a pad: the pad called
      <SPAN
CLASS="QUOTE"
>"sink"</SPAN
> of the given element. The bin can, from here
      on, be used as a substitute for the sink element. You could, for
      example, link another element to the bin.
    </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="section-caps-api.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="chapter-data.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>What capabilities are used for</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="chapter-pads.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Buffers and Events</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>