Class GhostPad

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class GhostPad extends ProxyPad

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.

  • Constructor Details

    • GhostPad

      public GhostPad(MemorySegment address)
      Create a GhostPad instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • GhostPad

      public GhostPad(@Nullable String name, Pad 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.

      Parameters:
      name - the name of the new pad, or null to assign a default name
      target - the pad to ghost.
    • GhostPad

      public GhostPad()
      Create a new GhostPad.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the GhostPad class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected GhostPad asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class ProxyPad
      Returns:
      the instance as if it were its parent type
    • fromTemplate

      public static @Nullable Pad fromTemplate(@Nullable String name, Pad target, PadTemplate 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.

      Parameters:
      name - the name of the new pad, or null to assign a default name.
      target - the pad to ghost.
      templ - the GstPadTemplate to use on the ghostpad.
      Returns:
      a new GstPad, or null in case of an error.
    • noTarget

      public static @Nullable Pad noTarget(@Nullable String name, PadDirection 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.

      Parameters:
      name - the name of the new pad, or null to assign a default name.
      dir - the direction of the ghostpad
      Returns:
      a new GstPad, or null in case of an error.
    • noTargetFromTemplate

      public static @Nullable Pad noTargetFromTemplate(@Nullable String name, PadTemplate templ)
      Create a new ghostpad based on templ, without setting a target. The direction will be taken from the templ.
      Parameters:
      name - the name of the new pad, or null to assign a default name
      templ - the GstPadTemplate to create the ghostpad from.
      Returns:
      a new GstPad, or null in case of an error.
    • activateModeDefault

      public static boolean activateModeDefault(Pad pad, @Nullable GstObject parent, PadMode mode, boolean active)
      Invoke the default activate mode function of a ghost pad.
      Parameters:
      pad - the GstPad to activate or deactivate.
      parent - the parent of pad or null
      mode - the requested activation mode
      active - whether the pad should be active or not.
      Returns:
      true if the operation was successful.
    • internalActivateModeDefault

      public static boolean internalActivateModeDefault(Pad pad, @Nullable GstObject parent, PadMode mode, boolean active)
      Invoke the default activate mode function of a proxy pad that is owned by a ghost pad.
      Parameters:
      pad - the GstPad to activate or deactivate.
      parent - the parent of pad or null
      mode - the requested activation mode
      active - whether the pad should be active or not.
      Returns:
      true if the operation was successful.
    • construct

      @Deprecated public boolean construct()
      Deprecated.
      This function is deprecated since 1.18 and does nothing anymore.

      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).

      Returns:
      true if the construction succeeds, false otherwise.
    • getTarget

      public @Nullable Pad getTarget()
      Get the target pad of gpad. Unref target pad after usage.
      Returns:
      the target GstPad, can be null if the ghostpad has no target set. Unref target pad after usage.
    • setTarget

      public boolean setTarget(@Nullable Pad 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.
      Parameters:
      newtarget - the new pad target
      Returns:
      true if the new target could be set. This function can return false when the internal pads could not be linked.
    • builder

      public static GhostPad.Builder<? extends GhostPad.Builder> builder()
      A GhostPad.Builder object constructs a GhostPad with the specified properties. Use the various set...() methods to set properties, and finish construction with GhostPad.Builder.build().
      Returns:
      the builder object