Gstreamer-GstPad

相關連接:https://blog.csdn.net/knowledgebao/article/details/84621238


GstPad — Object contained by elements that allows links to other elements

Includes

#include <gst/gst.h>

Description

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

Pads have a GstPadDirection, source pads produce data, sink pads consume data消費數據.

Pads are typically created from a GstPadTemplate with gst_pad_new_from_template()/gst_pad_new_from_static_template()  and are then added to a GstElement. 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_pad_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.

GstElement creating a pad will typically use the various gst_pad_set_*_function()(for example: gst_pad_set_event_function/ gst_pad_set_chain_function...) calls to register callbacks for events, queries or dataflow on the pads.

gst_pad_get_parent() will retrieve the GstElement that owns the pad.

After two pads are retrieved from an element by gst_element_get_static_pad(), the pads can be linked with gst_pad_link(). (For quick links, you can also use gst_element_link(), which will make the obvious link for you if it's straightforward簡單的.). Pads can be unlinked again with gst_pad_unlink()gst_pad_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_pad_set_active().

gst_pad_query() and gst_pad_peer_query() can be used to query詢問 various properties of the pad and the stream.

To send a GstEvent on a pad, use gst_pad_send_event() and gst_pad_push_event(). Some events will be sticky on the pad黏着在pad上, meaning that after they pass on the pad they can be queried later with gst_pad_get_sticky_event() and gst_pad_sticky_events_foreach().gst_pad_get_current_caps() and gst_pad_has_current_caps() are convenience便利 functions to query the current sticky CAPS event on a pad.

GstElements will use gst_pad_push() and gst_pad_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_pad_add_probe()gst_pad_is_blocked() can be used to check if a block probe is installed on the pad. gst_pad_is_blocking() checks if the blocking probe is currently blocking the pad. gst_pad_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_pad_get_offset(). This offset will be applied to the running_time of all data passing over the pad. gst_pad_set_offset() can be used to change the offset.

Convenience functions exist to start, pause and stop the task on a pad with gst_pad_start_task()gst_pad_pause_task() and gst_pad_stop_task() respectively分別地.

Functions

https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstPad.html

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章