Gst.Element

const Gst = imports.gi.Gst;

let element = new Gst.Element();
  

GstElement is the abstract base class needed to construct an element that can be used in a GStreamer pipeline. Please refer to the plugin writers guide for more information on creating Gst.Element subclasses.

The name of a Gst.Element can be get with gst_element_get_name() and set with gst_element_set_name(). For speed, GST_ELEMENT_NAME() can be used in the core when using the appropriate locking. Do not use this in plug-ins or applications in order to retain ABI compatibility.

Elements can have pads (of the type Gst.Pad). These pads link to pads on other elements. Gst.Buffer flow between these linked pads. A Gst.Element has a GLib.List of Gst.Pad structures for all their input (or sink) and output (or source) pads. Core and plug-in writers can add and remove pads with Gst.add_pad and Gst.remove_pad.

An existing pad of an element can be retrieved by name with Gst.get_static_pad. A new dynamic pad can be created using Gst.request_pad with a Gst.PadTemplate or Gst.get_request_pad with the template name such as "src_\%u". An iterator of all pads can be retrieved with Gst.iterate_pads.

Elements can be linked through their pads. If the link is straightforward, use the Gst.link convenience function to link two elements, or Gst.link_many for more elements in a row. Use Gst.link_filtered to link two elements constrained by a specified set of Gst.Caps. For finer control, use Gst.link_pads and Gst.link_pads_filtered to specify the pads to link on each element by name.

Each element has a state (see Gst.State). You can get and set the state of an element with Gst.get_state and Gst.set_state. Setting a state triggers a Gst.StateChange. To get a string representation of a Gst.State, use Gst.state_get_name.

You can get and set a Gst.Clock on an element using Gst.get_clock and Gst.set_clock. Some elements can provide a clock for the pipeline if the #GST_ELEMENT_FLAG_PROVIDE_CLOCK flag is set. With the Gst.provide_clock method one can retrieve the clock provided by such an element. Not all elements require a clock to operate correctly. If the #GST_ELEMENT_FLAG_REQUIRE_CLOCK() flag is set, a clock should be set on the element with Gst.set_clock.

Note that clock slection and distribution is normally handled by the toplevel Gst.Pipeline so the clock functions are only to be used in very specific situations.

Last reviewed on 2012-03-28 (0.11.3)

Hierarchy

  • GObject.Object
    • GObject.InitiallyUnowned
      • Gst.Object
        • Gst.Element