## GstGhostPad GstGhostPad — Pseudo link pads |

## Synopsis

    #include <gst/gst.h>

    struct              GstProxyPad;
    struct              GstGhostPad;
    GstPad *            gst_ghost_pad_new                   (const gchar *name,
                                                             GstPad *target);
    GstPad *            gst_ghost_pad_new_no_target         (const gchar *name,
                                                             GstPadDirection dir);
    GstPad *            gst_ghost_pad_new_from_template     (const gchar *name,
                                                             GstPad *target,
                                                             GstPadTemplate *templ);
    GstPad *            gst_ghost_pad_new_no_target_from_template
                                                            (const gchar *name,
                                                             GstPadTemplate *templ);
    gboolean            gst_ghost_pad_set_target            (GstGhostPad *gpad,
                                                             GstPad *newtarget);
    GstPad *            gst_ghost_pad_get_target            (GstGhostPad *gpad);
    gboolean            gst_ghost_pad_construct             (GstGhostPad *gpad);
    gboolean            gst_ghost_pad_activate_mode_default (GstPad *pad,
                                                             GstObject *parent,
                                                             GstPadMode mode,
                                                             gboolean active);
    gboolean            gst_ghost_pad_internal_activate_mode_default
                                                            (GstPad *pad,
                                                             GstObject *parent,
                                                             GstPadMode mode,
                                                             gboolean active);
    GstProxyPad *       gst_proxy_pad_get_internal          (GstProxyPad *pad);
    GstIterator *       gst_proxy_pad_iterate_internal_links_default
                                                            (GstPad *pad,
                                                             GstObject *parent);
    GstFlowReturn       gst_proxy_pad_chain_default         (GstPad *pad,
                                                             GstObject *parent,
                                                             GstBuffer *buffer);
    GstFlowReturn       gst_proxy_pad_chain_list_default    (GstPad *pad,
                                                             GstObject *parent,
                                                             GstBufferList *list);
    GstFlowReturn       gst_proxy_pad_getrange_default      (GstPad *pad,
                                                             GstObject *parent,
                                                             guint64 offset,
                                                             guint size,
                                                             GstBuffer **buffer);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GstObject
                   +----GstPad
                         +----GstProxyPad
                               +----GstGhostPad

      GObject
       +----GInitiallyUnowned
             +----GstObject
                   +----GstPad
                         +----GstProxyPad
                               +----GstGhostPad

## Description

GhostPads are useful when organizing pipelines with GstBin like elements. The idea here is to create hierarchical element graphs. The bin element contains a sub-graph. Now one would like to treat the bin-element like any other GstElement. This is where GhostPads come into play. A GhostPad acts as a proxy for another pad. Thus the bin can have sink and source ghost-pads that are associated with sink and source pads of the child elements.

If the target pad is known at creation time, `gst_ghost_pad_new()` is the function to use to get a ghost-pad. Otherwise one can use `gst_ghost_pad_new_no_target()` to create the ghost-pad and use `gst_ghost_pad_set_target()` to establish the association later on.

Note that GhostPads add overhead to the data processing of a pipeline.

Last reviewed on 2005-11-18 (0.9.5)

## Details

### struct GstProxyPad

    struct GstProxyPad;

### struct GstGhostPad

    struct GstGhostPad;

Opaque GstGhostPad structure.

### gst_ghost_pad_new ()

    GstPad *            gst_ghost_pad_new                   (const gchar *name,
                                                             GstPad *target);

Create a new ghostpad with `target` as the target. The direction will be taken from the target pad. `target` must be unlinked.

Will ref the target.

`name` : | the name of the new pad, or NULL to assign a default name. [allow-none]
`target` : | the pad to ghost. [transfer none]
Returns : | a new GstPad, or NULL in case of an error. [transfer floating]

### gst_ghost_pad_new_no_target ()

    GstPad *            gst_ghost_pad_new_no_target         (const gchar *name,
                                                             GstPadDirection dir);

Create a new ghostpad without a target with the given direction. A target can be set on the ghostpad later with the `gst_ghost_pad_set_target()` function.

The created ghostpad will not have a padtemplate.

`name` : | the name of the new pad, or NULL to assign a default name. [allow-none]
`dir` : | the direction of the ghostpad
Returns : | a new GstPad, or NULL in case of an error. [transfer full]

### gst_ghost_pad_new_from_template ()

    GstPad *            gst_ghost_pad_new_from_template     (const gchar *name,
                                                             GstPad *target,
                                                             GstPadTemplate *templ);

Create a new ghostpad with `target` as the target. The direction will be taken from the target pad. The template used on the ghostpad will be `template`.

Will ref the target.

`name` : | the name of the new pad, or NULL to assign a default name. [allow-none]
`target` : | the pad to ghost. [transfer none]
`templ` : | the GstPadTemplate to use on the ghostpad. [transfer none]
Returns : | a new GstPad, or NULL in case of an error. [transfer full]

### gst_ghost_pad_new_no_target_from_template ()

    GstPad *            gst_ghost_pad_new_no_target_from_template
                                                            (const gchar *name,
                                                             GstPadTemplate *templ);

Create a new ghostpad based on `templ`, without setting a target. The direction will be taken from the `templ`.

`name` : | the name of the new pad, or NULL to assign a default name. [allow-none]
`templ` : | the GstPadTemplate to create the ghostpad from. [transfer none]
Returns : | a new GstPad, or NULL in case of an error. [transfer full]

### gst_ghost_pad_set_target ()

    gboolean            gst_ghost_pad_set_target            (GstGhostPad *gpad,
                                                             GstPad *newtarget);

Set the new target of the ghostpad `gpad`. Any existing target is unlinked and links to the new target are established. if `newtarget` is NULL the target will be cleared.

`gpad` : | the GstGhostPad
`newtarget` : | the new pad target. [transfer none][allow-none]
Returns : | TRUE if the new target could be set. This function can return FALSE when the internal pads could not be linked. [transfer full]

### gst_ghost_pad_get_target ()

    GstPad *            gst_ghost_pad_get_target            (GstGhostPad *gpad);

Get the target pad of `gpad`. Unref target pad after usage.

`gpad` : | the GstGhostPad
Returns : | the target GstPad, can be NULL if the ghostpad has no target set. Unref target pad after usage. [transfer full]

### gst_ghost_pad_construct ()

    gboolean            gst_ghost_pad_construct             (GstGhostPad *gpad);

Finish initialization of a newly allocated ghost pad.

This function is most useful in language bindings and when subclassing GstGhostPad; plugin and application developers normally will not call this function. Call this function directly after a call to g_object_new (GST_TYPE_GHOST_PAD, "direction", `dir`, ..., NULL).

`gpad` : | the newly allocated ghost pad
Returns : | `TRUE` if the construction succeeds, `FALSE` otherwise.

### gst_ghost_pad_activate_mode_default ()

    gboolean            gst_ghost_pad_activate_mode_default (GstPad *pad,
                                                             GstObject *parent,
                                                             GstPadMode mode,
                                                             gboolean active);

Invoke the default activate mode function of a ghost pad.

`pad` : | the GstPad to activate or deactivate.
`parent` : | the parent of `pad` or NULL. [allow-none]
`mode` : | the requested activation mode
`active` : | whether the pad should be active or not.
Returns : | `TRUE` if the operation was successful.

### gst_ghost_pad_internal_activate_mode_default ()

    gboolean            gst_ghost_pad_internal_activate_mode_default
                                                            (GstPad *pad,
                                                             GstObject *parent,
                                                             GstPadMode mode,
                                                             gboolean active);

Invoke the default activate mode function of a proxy pad that is owned by a ghost pad.

`pad` : | the GstPad to activate or deactivate.
`parent` : | the parent of `pad` or NULL. [allow-none]
`mode` : | the requested activation mode
`active` : | whether the pad should be active or not.
Returns : | `TRUE` if the operation was successful.

### gst_proxy_pad_get_internal ()

    GstProxyPad *       gst_proxy_pad_get_internal          (GstProxyPad *pad);

Get the internal pad of `pad`. Unref target pad after usage.

The internal pad of a GstGhostPad is the internally used pad of opposite direction, which is used to link to the target.

`pad` : | the GstProxyPad
Returns : | the target GstProxyPad, can be NULL. Unref target pad after usage. [transfer full]

### gst_proxy_pad_iterate_internal_links_default ()

    GstIterator *       gst_proxy_pad_iterate_internal_links_default
                                                            (GstPad *pad,
                                                             GstObject *parent);

Invoke the default iterate internal links function of the proxy pad.

`pad` : | the GstPad to get the internal links of.
`parent` : | the parent of `pad` or NULL. [allow-none]
Returns : | a GstIterator of GstPad, or NULL if `pad` has no parent. Unref each returned pad with `gst_object_unref()`.

### gst_proxy_pad_chain_default ()

    GstFlowReturn       gst_proxy_pad_chain_default         (GstPad *pad,
                                                             GstObject *parent,
                                                             GstBuffer *buffer);

Invoke the default chain function of the proxy pad.

`pad` : | a sink GstPad, returns GST_FLOW_ERROR if not.
`parent` : | the parent of `pad` or NULL. [allow-none]
`buffer` : | the GstBuffer to send, return GST_FLOW_ERROR if not. [transfer full]
Returns : | a GstFlowReturn from the pad.

### gst_proxy_pad_chain_list_default ()

    GstFlowReturn       gst_proxy_pad_chain_list_default    (GstPad *pad,
                                                             GstObject *parent,
                                                             GstBufferList *list);

Invoke the default chain list function of the proxy pad.

`pad` : | a sink GstPad, returns GST_FLOW_ERROR if not.
`parent` : | the parent of `pad` or NULL. [allow-none]
`list` : | the GstBufferList to send, return GST_FLOW_ERROR if not. [transfer full]
Returns : | a GstFlowReturn from the pad.

### gst_proxy_pad_getrange_default ()

    GstFlowReturn       gst_proxy_pad_getrange_default      (GstPad *pad,
                                                             GstObject *parent,
                                                             guint64 offset,
                                                             guint size,
                                                             GstBuffer **buffer);

Invoke the default getrange function of the proxy pad.

`pad` : | a src GstPad, returns GST_FLOW_ERROR if not.
`parent` : | the parent of `pad`
`offset` : | The start offset of the buffer
`size` : | The length of the buffer
`buffer` : | a pointer to hold the GstBuffer, returns GST_FLOW_ERROR if `NULL`. [out callee-allocates]
Returns : | a GstFlowReturn from the pad.

## See Also

GstPad