Gst.Pad

const Gst = imports.gi.Gst;

let pad = new Gst.Pad({
    direction: value,
    template: value,
});
  

A Gst.Element is linked to other elements via "pads", which are extremely light-weight generic link points.

Pads have a Gst.PadDirection, source pads produce data, sink pads consume data.

Pads are typically created from a Gst.PadTemplate with Gst.new_from_template and are then added to a Gst.Element. This usually happens when the element is created but it can also happen dynamically based on the data that the element is processing or based on the pads that the application requests.

Pads without pad templates can be created with Gst.new, which takes a direction and a name as an argument. If the name is NULL, then a guaranteed unique name will be assigned to it.

A Gst.Element creating a pad will typically use the various gst_pad_set_*_function() calls to register callbacks for events, queries or dataflow on the pads.

gst_pad_get_parent() will retrieve the Gst.Element that owns the pad.

After two pads are retrieved from an element with gst_element_get_pad(), the pads can be linked with Gst.link. (For quick links, you can also use Gst.Element.prototype.link, which will make the obvious link for you if it's straightforward.). Pads can be unlinked again with Gst.unlink. Gst.get_peer can be used to check what the pad is linked to.

Before dataflow is possible on the pads, they need to be activated with Gst.set_active.

Gst.query and Gst.peer_query can be used to query various properties of the pad and the stream.

To send a Gst.Event on a pad, use Gst.send_event and Gst.push_event. Some events will be sticky on the pad, meaning that after they pass on the pad they can be queried later with Gst.get_sticky_event and Gst.sticky_events_foreach. Gst.get_current_caps and Gst.has_current_caps are convenience functions to query the current sticky CAPS event on a pad.

GstElements will use Gst.push and Gst.pull_range to push out or pull in a buffer.

The dataflow, events and queries that happen on a pad can be monitored with probes that can be installed with Gst.add_probe. Gst.is_blocked can be used to check if a block probe is installed on the pad. Gst.is_blocking checks if the blocking probe is currently blocking the pad. Gst.remove_probe is used to remove a previously installed probe and unblock blocking probes if any.

Pad have an offset that can be retrieved with Gst.get_offset. This offset will be applied to the running_time of all data passing over the pad. Gst.set_offset can be used to change the offset.

Convenience functions exist to start, pause and stop the task on a pad with Gst.start_task, Gst.pause_task and Gst.stop_task respectively.

Last reviewed on 2012-03-29 (0.11.3)

Hierarchy

  • GObject.Object
    • GObject.InitiallyUnowned
      • Gst.Object
        • Gst.Pad