GStreamer 1.0 Core Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties | Signals |
#include <gst/gst.h> struct GstPad; enum GstPadDirection; enum GstPadFlags; enum GstPadLinkReturn; #define GST_PAD_LINK_FAILED (ret) #define GST_PAD_LINK_SUCCESSFUL (ret) enum GstPadLinkCheck; enum GstFlowReturn; const gchar * gst_flow_get_name (GstFlowReturn ret
); GQuark gst_flow_to_quark (GstFlowReturn ret
); enum GstPadMode; const gchar * gst_pad_mode_get_name (GstPadMode mode
); #define gst_pad_get_name (pad) GstPadDirection gst_pad_get_direction (GstPad *pad
); #define gst_pad_get_parent (pad) GstElement * gst_pad_get_parent_element (GstPad *pad
); GstPadTemplate * gst_pad_get_pad_template (GstPad *pad
); GstPadLinkReturn gst_pad_link (GstPad *srcpad
,GstPad *sinkpad
); GstPadLinkReturn gst_pad_link_full (GstPad *srcpad
,GstPad *sinkpad
,GstPadLinkCheck flags
); gboolean gst_pad_unlink (GstPad *srcpad
,GstPad *sinkpad
); gboolean gst_pad_is_linked (GstPad *pad
); gboolean gst_pad_can_link (GstPad *srcpad
,GstPad *sinkpad
); GstCaps * gst_pad_get_allowed_caps (GstPad *pad
); GstCaps * gst_pad_get_current_caps (GstPad *pad
); GstCaps * gst_pad_get_pad_template_caps (GstPad *pad
); GstPad * gst_pad_get_peer (GstPad *pad
); void gst_pad_use_fixed_caps (GstPad *pad
); gboolean gst_pad_has_current_caps (GstPad *pad
); GstEvent * gst_pad_get_sticky_event (GstPad *pad
,GstEventType event_type
,guint idx
); gboolean (*GstPadStickyEventsForeachFunction) (GstPad *pad
,GstEvent **event
,gpointer user_data
); void gst_pad_sticky_events_foreach (GstPad *pad
,GstPadStickyEventsForeachFunction foreach_func
,gpointer user_data
); gboolean gst_pad_is_active (GstPad *pad
); enum GstPadProbeReturn; enum GstPadProbeType; struct GstPadProbeInfo; #define GST_PAD_PROBE_INFO_TYPE (d) #define GST_PAD_PROBE_INFO_ID (d) #define GST_PAD_PROBE_INFO_DATA (d) #define GST_PAD_PROBE_INFO_BUFFER (d) #define GST_PAD_PROBE_INFO_BUFFER_LIST (d) #define GST_PAD_PROBE_INFO_EVENT (d) #define GST_PAD_PROBE_INFO_QUERY (d) GstBuffer * gst_pad_probe_info_get_buffer (GstPadProbeInfo *info
); GstBufferList * gst_pad_probe_info_get_buffer_list (GstPadProbeInfo *info
); GstEvent * gst_pad_probe_info_get_event (GstPadProbeInfo *info
); GstQuery * gst_pad_probe_info_get_query (GstPadProbeInfo *info
); #define GST_PAD_PROBE_INFO_OFFSET (d) #define GST_PAD_PROBE_INFO_SIZE (d) GstPadProbeReturn (*GstPadProbeCallback) (GstPad *pad
,GstPadProbeInfo *info
,gpointer user_data
); gulong gst_pad_add_probe (GstPad *pad
,GstPadProbeType mask
,GstPadProbeCallback callback
,gpointer user_data
,GDestroyNotify destroy_data
); void gst_pad_remove_probe (GstPad *pad
,gulong id
); gboolean gst_pad_is_blocked (GstPad *pad
); gboolean gst_pad_is_blocking (GstPad *pad
); gint64 gst_pad_get_offset (GstPad *pad
); void gst_pad_set_offset (GstPad *pad
,gint64 offset
); GstPad * gst_pad_new (const gchar *name
,GstPadDirection direction
); GstPad * gst_pad_new_from_template (GstPadTemplate *templ
,const gchar *name
); GstPad * gst_pad_new_from_static_template (GstStaticPadTemplate *templ
,const gchar *name
); #define gst_pad_set_chain_function (p, f) void gst_pad_set_chain_function_full (GstPad *pad
,GstPadChainFunction chain
,gpointer user_data
,GDestroyNotify notify
); GstFlowReturn (*GstPadChainFunction) (GstPad *pad
,GstObject *parent
,GstBuffer *buffer
); #define gst_pad_set_chain_list_function (p, f) void gst_pad_set_chain_list_function_full (GstPad *pad
,GstPadChainListFunction chainlist
,gpointer user_data
,GDestroyNotify notify
); GstFlowReturn (*GstPadChainListFunction) (GstPad *pad
,GstObject *parent
,GstBufferList *list
); GstFlowReturn gst_pad_get_range (GstPad *pad
,guint64 offset
,guint size
,GstBuffer **buffer
); #define gst_pad_set_getrange_function (p, f) void gst_pad_set_getrange_function_full (GstPad *pad
,GstPadGetRangeFunction get
,gpointer user_data
,GDestroyNotify notify
); GstFlowReturn (*GstPadGetRangeFunction) (GstPad *pad
,GstObject *parent
,guint64 offset
,guint length
,GstBuffer **buffer
); #define gst_pad_set_event_function (p, f) void gst_pad_set_event_function_full (GstPad *pad
,GstPadEventFunction event
,gpointer user_data
,GDestroyNotify notify
); gboolean (*GstPadEventFunction) (GstPad *pad
,GstObject *parent
,GstEvent *event
); #define gst_pad_set_link_function (p, f) void gst_pad_set_link_function_full (GstPad *pad
,GstPadLinkFunction link
,gpointer user_data
,GDestroyNotify notify
); GstPadLinkReturn (*GstPadLinkFunction) (GstPad *pad
,GstObject *parent
,GstPad *peer
); #define gst_pad_set_unlink_function (p, f) void gst_pad_set_unlink_function_full (GstPad *pad
,GstPadUnlinkFunction unlink
,gpointer user_data
,GDestroyNotify notify
); void (*GstPadUnlinkFunction) (GstPad *pad
,GstObject *parent
); gboolean gst_pad_proxy_query_caps (GstPad *pad
,GstQuery *query
); gboolean gst_pad_proxy_query_accept_caps (GstPad *pad
,GstQuery *query
); #define gst_pad_set_activate_function (p, f) void gst_pad_set_activate_function_full (GstPad *pad
,GstPadActivateFunction activate
,gpointer user_data
,GDestroyNotify notify
); gboolean (*GstPadActivateFunction) (GstPad *pad
,GstObject *parent
); #define gst_pad_set_activatemode_function (p, f) void gst_pad_set_activatemode_function_full (GstPad *pad
,GstPadActivateModeFunction activatemode
,gpointer user_data
,GDestroyNotify notify
); gboolean (*GstPadActivateModeFunction) (GstPad *pad
,GstObject *parent
,GstPadMode mode
,gboolean active
); gboolean gst_pad_needs_reconfigure (GstPad *pad
); gboolean gst_pad_check_reconfigure (GstPad *pad
); void gst_pad_mark_reconfigure (GstPad *pad
); GstFlowReturn gst_pad_push (GstPad *pad
,GstBuffer *buffer
); gboolean gst_pad_push_event (GstPad *pad
,GstEvent *event
); GstFlowReturn gst_pad_push_list (GstPad *pad
,GstBufferList *list
); GstFlowReturn gst_pad_pull_range (GstPad *pad
,guint64 offset
,guint size
,GstBuffer **buffer
); gboolean gst_pad_activate_mode (GstPad *pad
,GstPadMode mode
,gboolean active
); gboolean gst_pad_send_event (GstPad *pad
,GstEvent *event
); gboolean gst_pad_event_default (GstPad *pad
,GstObject *parent
,GstEvent *event
); gboolean gst_pad_query (GstPad *pad
,GstQuery *query
); gboolean gst_pad_peer_query (GstPad *pad
,GstQuery *query
); gboolean gst_pad_query_default (GstPad *pad
,GstObject *parent
,GstQuery *query
); gboolean gst_pad_query_position (GstPad *pad
,GstFormat format
,gint64 *cur
); gboolean gst_pad_query_duration (GstPad *pad
,GstFormat format
,gint64 *duration
); gboolean gst_pad_query_convert (GstPad *pad
,GstFormat src_format
,gint64 src_val
,GstFormat dest_format
,gint64 *dest_val
); gboolean gst_pad_query_accept_caps (GstPad *pad
,GstCaps *caps
); GstCaps * gst_pad_query_caps (GstPad *pad
,GstCaps *filter
); gboolean gst_pad_peer_query_position (GstPad *pad
,GstFormat format
,gint64 *cur
); gboolean gst_pad_peer_query_duration (GstPad *pad
,GstFormat format
,gint64 *duration
); gboolean gst_pad_peer_query_convert (GstPad *pad
,GstFormat src_format
,gint64 src_val
,GstFormat dest_format
,gint64 *dest_val
); gboolean gst_pad_peer_query_accept_caps (GstPad *pad
,GstCaps *caps
); GstCaps * gst_pad_peer_query_caps (GstPad *pad
,GstCaps *filter
); #define gst_pad_set_query_function (p, f) void gst_pad_set_query_function_full (GstPad *pad
,GstPadQueryFunction query
,gpointer user_data
,GDestroyNotify notify
); gboolean (*GstPadQueryFunction) (GstPad *pad
,GstObject *parent
,GstQuery *query
); #define gst_pad_set_iterate_internal_links_function(p, f) void gst_pad_set_iterate_internal_links_function_full (GstPad *pad
,GstPadIterIntLinkFunction iterintlink
,gpointer user_data
,GDestroyNotify notify
); GstIterator * (*GstPadIterIntLinkFunction) (GstPad *pad
,GstObject *parent
); GstIterator * gst_pad_iterate_internal_links (GstPad *pad
); GstIterator * gst_pad_iterate_internal_links_default (GstPad *pad
,GstObject *parent
); void gst_pad_set_element_private (GstPad *pad
,gpointer priv
); gpointer gst_pad_get_element_private (GstPad *pad
); gchar * gst_pad_create_stream_id (GstPad *pad
,GstElement *parent
,const gchar *stream_id
); gchar * gst_pad_create_stream_id_printf (GstPad *pad
,GstElement *parent
,const gchar *stream_id
,...
); gchar * gst_pad_create_stream_id_printf_valist (GstPad *pad
,GstElement *parent
,const gchar *stream_id
,va_list var_args
); gboolean (*GstPadForwardFunction) (GstPad *pad
,gpointer user_data
); gboolean gst_pad_forward (GstPad *pad
,GstPadForwardFunction forward
,gpointer user_data
); GstFlowReturn gst_pad_chain (GstPad *pad
,GstBuffer *buffer
); GstFlowReturn gst_pad_chain_list (GstPad *pad
,GstBufferList *list
); gboolean gst_pad_start_task (GstPad *pad
,GstTaskFunction func
,gpointer user_data
,GDestroyNotify notify
); gboolean gst_pad_pause_task (GstPad *pad
); gboolean gst_pad_stop_task (GstPad *pad
); gboolean gst_pad_set_active (GstPad *pad
,gboolean active
); #define GST_PAD_GET_STREAM_LOCK (pad) #define GST_PAD_STREAM_LOCK (pad) #define GST_PAD_STREAM_TRYLOCK (pad) #define GST_PAD_STREAM_UNLOCK (pad)
"caps" GstCaps* : Read "direction" GstPadDirection : Read / Write / Construct Only "template" GstPadTemplate* : Read / Write
A 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()
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.
A GstElement 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 GstElement that owns the pad.
After two pads are retrieved from an element with gst_element_get_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, 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.
Last reviewed on 2012-03-29 (0.11.3)
struct GstPad { gpointer element_private; GstPadTemplate *padtemplate; GstPadDirection direction; };
The GstPad structure. Use the functions to update the variables.
gpointer |
private data owned by the parent element |
GstPadTemplate * |
padtemplate for this pad |
GstPadDirection |
the direction of the pad, cannot change after creating the pad. |
typedef enum { GST_PAD_UNKNOWN, GST_PAD_SRC, GST_PAD_SINK } GstPadDirection;
The direction of a pad.
typedef enum { GST_PAD_FLAG_BLOCKED = (GST_OBJECT_FLAG_LAST << 0), GST_PAD_FLAG_FLUSHING = (GST_OBJECT_FLAG_LAST << 1), GST_PAD_FLAG_EOS = (GST_OBJECT_FLAG_LAST << 2), GST_PAD_FLAG_BLOCKING = (GST_OBJECT_FLAG_LAST << 3), GST_PAD_FLAG_NEED_PARENT = (GST_OBJECT_FLAG_LAST << 4), GST_PAD_FLAG_NEED_RECONFIGURE = (GST_OBJECT_FLAG_LAST << 5), GST_PAD_FLAG_PENDING_EVENTS = (GST_OBJECT_FLAG_LAST << 6), GST_PAD_FLAG_FIXED_CAPS = (GST_OBJECT_FLAG_LAST << 7), GST_PAD_FLAG_PROXY_CAPS = (GST_OBJECT_FLAG_LAST << 8), GST_PAD_FLAG_PROXY_ALLOCATION = (GST_OBJECT_FLAG_LAST << 9), GST_PAD_FLAG_PROXY_SCHEDULING = (GST_OBJECT_FLAG_LAST << 10), /* padding */ GST_PAD_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 16) } GstPadFlags;
Pad state flags
is dataflow on a pad blocked | |
is pad flushing | |
is pad in EOS state | |
is pad currently blocking on a buffer or event | |
ensure that there is a parent object before calling into the pad callbacks. | |
the pad should be reconfigured/renegotiated. The flag has to be unset manually after reconfiguration happened. | |
the pad has pending events | |
the pad is using fixed caps this means that once the caps are set on the pad, the caps query function only returns those caps. | |
the default event and query handler will forward all events and queries to the internally linked pads instead of discarding them. | |
the default query handler will forward allocation queries to the internally linked pads instead of discarding them. | |
the default query handler will forward scheduling queries to the internally linked pads instead of discarding them. | |
offset to define more flags |
typedef enum { GST_PAD_LINK_OK = 0, GST_PAD_LINK_WRONG_HIERARCHY = -1, GST_PAD_LINK_WAS_LINKED = -2, GST_PAD_LINK_WRONG_DIRECTION = -3, GST_PAD_LINK_NOFORMAT = -4, GST_PAD_LINK_NOSCHED = -5, GST_PAD_LINK_REFUSED = -6 } GstPadLinkReturn;
Result values from gst_pad_link and friends.
link succeeded | |
pads have no common grandparent | |
pad was already linked | |
pads have wrong direction | |
pads do not have common format | |
pads cannot cooperate in scheduling | |
refused for some reason |
#define GST_PAD_LINK_FAILED(ret) ((ret) < GST_PAD_LINK_OK)
Macro to test if the given GstPadLinkReturn value indicates a failed link step.
|
the GstPadLinkReturn value |
#define GST_PAD_LINK_SUCCESSFUL(ret) ((ret) >= GST_PAD_LINK_OK)
Macro to test if the given GstPadLinkReturn value indicates a successful link step.
|
the GstPadLinkReturn value |
typedef enum { GST_PAD_LINK_CHECK_NOTHING = 0, GST_PAD_LINK_CHECK_HIERARCHY = 1 << 0, GST_PAD_LINK_CHECK_TEMPLATE_CAPS = 1 << 1, GST_PAD_LINK_CHECK_CAPS = 1 << 2, GST_PAD_LINK_CHECK_DEFAULT = GST_PAD_LINK_CHECK_HIERARCHY | GST_PAD_LINK_CHECK_CAPS } GstPadLinkCheck;
The amount of checking to be done when linking pads. GST_PAD_LINK_CHECK_CAPS
and GST_PAD_LINK_CHECK_TEMPLATE_CAPS
are mutually exclusive. If both are
specified, expensive but safe GST_PAD_LINK_CHECK_CAPS
are performed.
Only disable some of the checks if you are 100% certain you know the link
will not fail because of hierarchy/caps compatibility failures. If uncertain,
use the default checks (GST_PAD_LINK_CHECK_DEFAULT
) or the regular methods
for linking the pads.
Don't check hierarchy or caps compatibility. | |
Check the pads have same parents/grandparents. Could be omitted if it is already known that the two elements that own the pads are in the same bin. | |
Check if the pads are compatible by using
their template caps. This is much faster than GST_PAD_LINK_CHECK_CAPS , but
would be unsafe e.g. if one pad has GST_CAPS_ANY .
|
|
Check if the pads are compatible by comparing the
caps returned by gst_pad_query_caps() .
|
|
The default checks done when linking
pads (i.e. the ones used by gst_pad_link() ).
|
typedef enum { /* custom success starts here */ GST_FLOW_CUSTOM_SUCCESS_2 = 102, GST_FLOW_CUSTOM_SUCCESS_1 = 101, GST_FLOW_CUSTOM_SUCCESS = 100, /* core predefined */ GST_FLOW_OK = 0, /* expected failures */ GST_FLOW_NOT_LINKED = -1, GST_FLOW_FLUSHING = -2, /* error cases */ GST_FLOW_EOS = -3, GST_FLOW_NOT_NEGOTIATED = -4, GST_FLOW_ERROR = -5, GST_FLOW_NOT_SUPPORTED = -6, /* custom error starts here */ GST_FLOW_CUSTOM_ERROR = -100, GST_FLOW_CUSTOM_ERROR_1 = -101, GST_FLOW_CUSTOM_ERROR_2 = -102 } GstFlowReturn;
The result of passing data to a pad.
Note that the custom return values should not be exposed outside of the element scope.
Pre-defined custom success code. | |
Pre-defined custom success code (define your custom success code to this to avoid compiler warnings). | |
Elements can use values starting from this (and higher) to define custom success codes. | |
Data passing was ok. | |
Pad is not linked. | |
Pad is flushing. | |
Pad is EOS. | |
Pad is not negotiated. | |
Some (fatal) error occured. Element generating this error should post an error message with more details. | |
This operation is not supported. | |
Elements can use values starting from this (and lower) to define custom error codes. | |
Pre-defined custom error code (define your custom error code to this to avoid compiler warnings). | |
Pre-defined custom error code. |
const gchar * gst_flow_get_name (GstFlowReturn ret
);
Gets a string representing the given flow return.
|
a GstFlowReturn to get the name of. |
Returns : |
a static string with the name of the flow return. |
GQuark gst_flow_to_quark (GstFlowReturn ret
);
Get the unique quark for the given GstFlowReturn.
|
a GstFlowReturn to get the quark of. |
Returns : |
the quark associated with the flow return or 0 if an invalid return was specified. |
typedef enum { GST_PAD_MODE_NONE, GST_PAD_MODE_PUSH, GST_PAD_MODE_PULL } GstPadMode;
The status of a GstPad. After activating a pad, which usually happens when the parent element goes from READY to PAUSED, the GstPadMode defines if the pad operates in push or pull mode.
const gchar * gst_pad_mode_get_name (GstPadMode mode
);
Return the name of a pad mode, for use in debug messages mostly.
|
the pad mode |
Returns : |
short mnemonic for pad mode mode
|
#define gst_pad_get_name(pad) gst_object_get_name (GST_OBJECT_CAST (pad))
Get a copy of the name of the pad. g_free()
after usage.
MT safe.
|
the pad to get the name from |
GstPadDirection gst_pad_get_direction (GstPad *pad
);
Gets the direction of the pad. The direction of the pad is decided at construction time so this function does not take the LOCK.
|
a GstPad to get the direction of. |
Returns : |
the GstPadDirection of the pad. MT safe. |
#define gst_pad_get_parent(pad) gst_object_get_parent (GST_OBJECT_CAST (pad))
Get the parent of pad
. This function increases the refcount
of the parent object so you should gst_object_unref()
it after usage.
Can return NULL if the pad did not have a parent.
MT safe.
|
the pad to get the parent of |
GstElement * gst_pad_get_parent_element (GstPad *pad
);
Gets the parent of pad
, cast to a GstElement. If a pad
has no parent or
its parent is not an element, return NULL.
|
a pad |
Returns : |
the parent of the pad. The caller has a reference on the parent, so unref when you're finished with it. MT safe. [transfer full] |
GstPadTemplate * gst_pad_get_pad_template (GstPad *pad
);
Gets the template for pad
.
|
a GstPad. |
Returns : |
the GstPadTemplate from which this pad was
instantiated, or NULL if this pad has no template. Unref after
usage. [transfer full]
|
GstPadLinkReturn gst_pad_link (GstPad *srcpad
,GstPad *sinkpad
);
Links the source pad and the sink pad.
GstPadLinkReturn gst_pad_link_full (GstPad *srcpad
,GstPad *sinkpad
,GstPadLinkCheck flags
);
Links the source pad and the sink pad.
This variant of gst_pad_link provides a more granular control on the checks being done when linking. While providing some considerable speedups the caller of this method must be aware that wrong usage of those flags can cause severe issues. Refer to the documentation of GstPadLinkCheck for more information.
MT Safe.
gboolean gst_pad_unlink (GstPad *srcpad
,GstPad *sinkpad
);
Unlinks the source pad from the sink pad. Will emit the "unlinked" signal on both pads.
gboolean gst_pad_is_linked (GstPad *pad
);
Checks if a pad
is linked to another pad or not.
|
pad to check |
Returns : |
TRUE if the pad is linked, FALSE otherwise. MT safe. |
gboolean gst_pad_can_link (GstPad *srcpad
,GstPad *sinkpad
);
Checks if the source pad and the sink pad are compatible so they can be linked.
GstCaps * gst_pad_get_allowed_caps (GstPad *pad
);
Gets the capabilities of the allowed media types that can flow through
pad
and its peer.
The allowed capabilities is calculated as the intersection of the results of
calling gst_pad_query_caps()
on pad
and its peer. The caller owns a reference
on the resulting caps.
GstCaps * gst_pad_get_current_caps (GstPad *pad
);
Gets the capabilities currently configured on pad
with the last
GST_EVENT_CAPS event.
|
a GstPad to get the current capabilities of. |
Returns : |
the current caps of the pad with incremented ref-count. |
GstCaps * gst_pad_get_pad_template_caps (GstPad *pad
);
Gets the capabilities for pad
's template.
GstPad * gst_pad_get_peer (GstPad *pad
);
Gets the peer of pad
. This function refs the peer pad so
you need to unref it after use.
void gst_pad_use_fixed_caps (GstPad *pad
);
A helper function you can use that sets the FIXED_CAPS flag This way the default CAPS query will always return the negotiated caps or in case the pad is not negotiated, the padtemplate caps.
The negotiated caps are the caps of the last CAPS event that passed on the pad. Use this function on a pad that, once it negotiated to a CAPS, cannot be renegotiated to something else.
|
the pad to use |
gboolean gst_pad_has_current_caps (GstPad *pad
);
Check if pad
has caps set on it with a GST_EVENT_CAPS event.
|
a GstPad to check |
Returns : |
TRUE when pad has caps associated with it. |
GstEvent * gst_pad_get_sticky_event (GstPad *pad
,GstEventType event_type
,guint idx
);
Returns a new reference of the sticky event of type event_type
from the event.
|
the GstPad to get the event from. |
|
the GstEventType that should be retrieved. |
|
the index of the event |
Returns : |
a GstEvent of type event_type or NULL when no
event of event_type was on pad . Unref after usage. [transfer full]
|
gboolean (*GstPadStickyEventsForeachFunction) (GstPad *pad
,GstEvent **event
,gpointer user_data
);
Callback used by gst_pad_sticky_events_foreach()
.
When this function returns TRUE
, the next event will be
returned. When FALSE
is returned, gst_pad_sticky_events_foreach()
will return.
When event
is set to NULL, the item will be removed from the list of sticky events.
When event
has been made writable, the new buffer reference can be assigned
to event
. This function is responsible for unreffing the old event when
removing or modifying.
void gst_pad_sticky_events_foreach (GstPad *pad
,GstPadStickyEventsForeachFunction foreach_func
,gpointer user_data
);
Iterates all sticky events on pad
and calls foreach_func
for every
event. If foreach_func
returns FALSE
the iteration is immediately stopped.
|
the GstPad that should be used for iteration. |
|
the GstPadStickyEventsForeachFunction that should be called for every event. [scope call] |
|
the optional user data. [closure] |
gboolean gst_pad_is_active (GstPad *pad
);
Query if a pad is active
|
the GstPad to query |
Returns : |
TRUE if the pad is active. MT safe. |
typedef enum { GST_PAD_PROBE_DROP, GST_PAD_PROBE_OK, GST_PAD_PROBE_REMOVE, GST_PAD_PROBE_PASS, } GstPadProbeReturn;
Different return values for the GstPadProbeCallback.
drop data in data probes. For push mode this means that
the data item is not sent downstream. For pull mode, it means that the
data item is not passed upstream. In both cases, this result code
returns GST_FLOW_OK or TRUE to the caller.
|
|
normal probe return value | |
remove probe | |
pass the data item in the block probe and block on the next item |
typedef enum { GST_PAD_PROBE_TYPE_INVALID = 0, /* flags to control blocking */ GST_PAD_PROBE_TYPE_IDLE = (1 << 0), GST_PAD_PROBE_TYPE_BLOCK = (1 << 1), /* flags to select datatypes */ GST_PAD_PROBE_TYPE_BUFFER = (1 << 4), GST_PAD_PROBE_TYPE_BUFFER_LIST = (1 << 5), GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM = (1 << 6), GST_PAD_PROBE_TYPE_EVENT_UPSTREAM = (1 << 7), GST_PAD_PROBE_TYPE_EVENT_FLUSH = (1 << 8), GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM = (1 << 9), GST_PAD_PROBE_TYPE_QUERY_UPSTREAM = (1 << 10), /* flags to select scheduling mode */ GST_PAD_PROBE_TYPE_PUSH = (1 << 12), GST_PAD_PROBE_TYPE_PULL = (1 << 13), /* flag combinations */ GST_PAD_PROBE_TYPE_BLOCKING = GST_PAD_PROBE_TYPE_IDLE | GST_PAD_PROBE_TYPE_BLOCK, GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM = GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_BUFFER_LIST | GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, GST_PAD_PROBE_TYPE_DATA_UPSTREAM = GST_PAD_PROBE_TYPE_EVENT_UPSTREAM, GST_PAD_PROBE_TYPE_DATA_BOTH = GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM | GST_PAD_PROBE_TYPE_DATA_UPSTREAM, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM = GST_PAD_PROBE_TYPE_BLOCK | GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM, GST_PAD_PROBE_TYPE_BLOCK_UPSTREAM = GST_PAD_PROBE_TYPE_BLOCK | GST_PAD_PROBE_TYPE_DATA_UPSTREAM, GST_PAD_PROBE_TYPE_EVENT_BOTH = GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM | GST_PAD_PROBE_TYPE_EVENT_UPSTREAM, GST_PAD_PROBE_TYPE_QUERY_BOTH = GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM | GST_PAD_PROBE_TYPE_QUERY_UPSTREAM, GST_PAD_PROBE_TYPE_ALL_BOTH = GST_PAD_PROBE_TYPE_DATA_BOTH | GST_PAD_PROBE_TYPE_QUERY_BOTH, GST_PAD_PROBE_TYPE_SCHEDULING = GST_PAD_PROBE_TYPE_PUSH | GST_PAD_PROBE_TYPE_PULL } GstPadProbeType;
The different probing types that can occur. When either one of
GST_PAD_PROBE_TYPE_IDLE
or GST_PAD_PROBE_TYPE_BLOCK
is used, the probe will be a
blocking probe.
invalid probe type | |
probe idle pads and block | |
probe and block pads | |
probe buffers | |
probe buffer lists | |
probe downstream events | |
probe upstream events | |
probe flush events. This probe has to be
explicitly enabled and is not included in the
@GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM or
@GST_PAD_PROBE_TYPE_EVENT_UPSTREAM probe types.
|
|
probe downstream queries | |
probe upstream queries | |
probe push | |
probe pull | |
probe and block at the next opportunity, at data flow or when idle | |
probe downstream data (buffers, buffer lists, and events) | |
probe upstream data (events) | |
probe upstream and downstream data (buffers, buffer lists, and events) | |
probe and block downstream data (buffers, buffer lists, and events) | |
probe and block upstream data (events) | |
probe upstream and downstream events | |
probe upstream and downstream queries | |
probe upstream events and queries and downstream buffers, buffer lists, events and queries | |
probe push and pull |
struct GstPadProbeInfo { GstPadProbeType type; gulong id; gpointer data; guint64 offset; guint size; };
Info passed in the GstPadProbeCallback.
GstPadProbeType |
the current probe type |
gulong |
the id of the probe |
gpointer |
type specific data, check the type field to know the datatype.
This field can be NULL. |
offset of pull probe, this field is valid when type contains
GST_PAD_PROBE_TYPE_PULL
|
|
guint |
size of pull probe, this field is valid when type contains
GST_PAD_PROBE_TYPE_PULL
|
#define GST_PAD_PROBE_INFO_BUFFER(d) GST_BUFFER_CAST(GST_PAD_PROBE_INFO_DATA(d))
#define GST_PAD_PROBE_INFO_BUFFER_LIST(d) GST_BUFFER_LIST_CAST(GST_PAD_PROBE_INFO_DATA(d))
#define GST_PAD_PROBE_INFO_EVENT(d) GST_EVENT_CAST(GST_PAD_PROBE_INFO_DATA(d))
#define GST_PAD_PROBE_INFO_QUERY(d) GST_QUERY_CAST(GST_PAD_PROBE_INFO_DATA(d))
GstBuffer * gst_pad_probe_info_get_buffer (GstPadProbeInfo *info
);
|
a GstPadProbeInfo |
Returns : |
The GstBuffer from the probe. [transfer none] |
GstBufferList * gst_pad_probe_info_get_buffer_list (GstPadProbeInfo *info
);
GstEvent * gst_pad_probe_info_get_event (GstPadProbeInfo *info
);
|
a GstPadProbeInfo |
Returns : |
The GstEvent from the probe. [transfer none] |
GstQuery * gst_pad_probe_info_get_query (GstPadProbeInfo *info
);
|
a GstPadProbeInfo |
Returns : |
The GstQuery from the probe. [transfer none] |
GstPadProbeReturn (*GstPadProbeCallback) (GstPad *pad
,GstPadProbeInfo *info
,gpointer user_data
);
Callback used by gst_pad_add_probe()
. Gets called to notify about the current
blocking type.
The callback is allowed to modify the data pointer in info
.
|
the GstPad that is blocked |
|
GstPadProbeInfo |
|
the gpointer to optional user data. |
Returns : |
a GstPadProbeReturn |
gulong gst_pad_add_probe (GstPad *pad
,GstPadProbeType mask
,GstPadProbeCallback callback
,gpointer user_data
,GDestroyNotify destroy_data
);
Be notified of different states of pads. The provided callback is called for
every state that matches mask
.
|
the GstPad to add the probe to |
|
the probe mask |
|
GstPadProbeCallback that will be called with notifications of the pad state |
|
user data passed to the callback. [closure] |
|
GDestroyNotify for user_data |
Returns : |
an id or 0 on error. The id can be used to remove the probe with
gst_pad_remove_probe() .
MT safe. |
void gst_pad_remove_probe (GstPad *pad
,gulong id
);
Remove the probe with id
from pad
.
MT safe.
|
the GstPad with the probe |
|
the probe id to remove |
gboolean gst_pad_is_blocked (GstPad *pad
);
Checks if the pad is blocked or not. This function returns the
last requested state of the pad. It is not certain that the pad
is actually blocking at this point (see gst_pad_is_blocking()
).
|
the GstPad to query |
Returns : |
TRUE if the pad is blocked. MT safe. |
gboolean gst_pad_is_blocking (GstPad *pad
);
Checks if the pad is blocking or not. This is a guaranteed state of whether the pad is actually blocking on a GstBuffer or a GstEvent.
|
the GstPad to query |
Returns : |
TRUE if the pad is blocking. MT safe. |
gint64 gst_pad_get_offset (GstPad *pad
);
Get the offset applied to the running time of pad
. pad
has to be a source
pad.
|
a GstPad |
Returns : |
the offset. |
void gst_pad_set_offset (GstPad *pad
,gint64 offset
);
Set the offset that will be applied to the running time of pad
.
|
a GstPad |
|
the offset |
GstPad * gst_pad_new (const gchar *name
,GstPadDirection direction
);
Creates a new pad with the given name in the given direction. If name is NULL, a guaranteed unique name (across all pads) will be assigned. This function makes a copy of the name so you can safely free the name.
|
the name of the new pad. |
|
the GstPadDirection of the pad. |
Returns : |
a new GstPad, or NULL in case of an error. MT safe. [transfer floating] |
GstPad * gst_pad_new_from_template (GstPadTemplate *templ
,const gchar *name
);
Creates a new pad with the given name from the given template. If name is NULL, a guaranteed unique name (across all pads) will be assigned. This function makes a copy of the name so you can safely free the name.
|
the pad template to use |
|
the name of the element |
Returns : |
a new GstPad, or NULL in case of an error. [transfer full] |
GstPad * gst_pad_new_from_static_template (GstStaticPadTemplate *templ
,const gchar *name
);
Creates a new pad with the given name from the given static template. If name is NULL, a guaranteed unique name (across all pads) will be assigned. This function makes a copy of the name so you can safely free the name.
|
the GstStaticPadTemplate to use |
|
the name of the element |
Returns : |
a new GstPad, or NULL in case of an error. [transfer full] |
#define gst_pad_set_chain_function(p,f) gst_pad_set_chain_function_full((p),(f),NULL,NULL)
Calls gst_pad_set_chain_function_full()
with NULL for the user_data and
notify.
|
a sink GstPad. |
|
the GstPadChainFunction to set. |
void gst_pad_set_chain_function_full (GstPad *pad
,GstPadChainFunction chain
,gpointer user_data
,GDestroyNotify notify
);
Sets the given chain function for the pad. The chain function is called to process a GstBuffer input buffer. see GstPadChainFunction for more details.
|
a sink GstPad. |
|
the GstPadChainFunction to set. |
|
user_data passed to notify
|
|
notify called when chain will not be used anymore. |
GstFlowReturn (*GstPadChainFunction) (GstPad *pad
,GstObject *parent
,GstBuffer *buffer
);
A function that will be called on sinkpads when chaining buffers. The function typically processes the data contained in the buffer and either consumes the data or passes it on to the internally linked pad(s).
The implementer of this function receives a refcount to buffer
and should
gst_buffer_unref()
when the buffer is no longer needed.
When a chain function detects an error in the data stream, it must post an error on the bus and return an appropriate GstFlowReturn value.
|
the sink GstPad that performed the chain. |
|
the parent of pad . If the GST_PAD_FLAG_NEED_PARENT flag is set,
parent is guaranteed to be not-NULL and remain valid during the
execution of this function. |
|
the GstBuffer that is chained, not NULL . |
Returns : |
GST_FLOW_OK for success |
#define gst_pad_set_chain_list_function(p,f) gst_pad_set_chain_list_function_full((p),(f),NULL,NULL)
Calls gst_pad_set_chain_list_function_full()
with NULL for the user_data and
notify.
|
a sink GstPad. |
|
the GstPadChainListFunction to set. |
void gst_pad_set_chain_list_function_full (GstPad *pad
,GstPadChainListFunction chainlist
,gpointer user_data
,GDestroyNotify notify
);
Sets the given chain list function for the pad. The chainlist function is called to process a GstBufferList input buffer list. See GstPadChainListFunction for more details.
|
a sink GstPad. |
|
the GstPadChainListFunction to set. |
|
user_data passed to notify
|
|
notify called when chainlist will not be used anymore. |
GstFlowReturn (*GstPadChainListFunction) (GstPad *pad
,GstObject *parent
,GstBufferList *list
);
A function that will be called on sinkpads when chaining buffer lists. The function typically processes the data contained in the buffer list and either consumes the data or passes it on to the internally linked pad(s).
The implementer of this function receives a refcount to list
and
should gst_buffer_list_unref()
when the list is no longer needed.
When a chainlist function detects an error in the data stream, it must post an error on the bus and return an appropriate GstFlowReturn value.
|
the sink GstPad that performed the chain. |
|
the parent of pad . If the GST_PAD_FLAG_NEED_PARENT flag is set,
parent is guaranteed to be not-NULL and remain valid during the
execution of this function. |
|
the GstBufferList that is chained, not NULL . |
Returns : |
GST_FLOW_OK for success |
GstFlowReturn gst_pad_get_range (GstPad *pad
,guint64 offset
,guint size
,GstBuffer **buffer
);
When pad
is flushing this function returns GST_FLOW_FLUSHING
immediately and buffer
is NULL
.
Calls the getrange function of pad
, see GstPadGetRangeFunction for a
description of a getrange function. If pad
has no getrange function
installed (see gst_pad_set_getrange_function()
) this function returns
GST_FLOW_NOT_SUPPORTED.
If buffer
points to a variable holding NULL, a valid new GstBuffer will be
placed in buffer
when this function returns GST_FLOW_OK. The new buffer
must be freed with gst_buffer_unref()
after usage.
When buffer
points to a variable that points to a valid GstBuffer, the
buffer will be filled with the result data when this function returns
GST_FLOW_OK. If the provided buffer is larger than size
, only
size
bytes will be filled in the result buffer and its size will be updated
accordingly.
Note that less than size
bytes can be returned in buffer
when, for example,
an EOS condition is near or when buffer
is not large enough to hold size
bytes. The caller should check the result buffer size to get the result size.
When this function returns any other result value than GST_FLOW_OK, buffer
will be unchanged.
This is a lowlevel function. Usualy gst_pad_pull_range()
is used.
|
a src GstPad, returns GST_FLOW_ERROR if not. |
|
The start offset of the buffer |
|
The length of the buffer |
|
a pointer to hold the GstBuffer,
returns GST_FLOW_ERROR if NULL . [out callee-allocates]
|
Returns : |
a GstFlowReturn from the pad. MT safe. |
#define gst_pad_set_getrange_function(p,f) gst_pad_set_getrange_function_full((p),(f),NULL,NULL)
Calls gst_pad_set_getrange_function_full()
with NULL for the user_data and
notify.
|
a source GstPad. |
|
the GstPadGetRangeFunction to set. |
void gst_pad_set_getrange_function_full (GstPad *pad
,GstPadGetRangeFunction get
,gpointer user_data
,GDestroyNotify notify
);
Sets the given getrange function for the pad. The getrange function is called to produce a new GstBuffer to start the processing pipeline. see GstPadGetRangeFunction for a description of the getrange function.
|
a source GstPad. |
|
the GstPadGetRangeFunction to set. |
|
user_data passed to notify
|
|
notify called when get will not be used anymore. |
GstFlowReturn (*GstPadGetRangeFunction) (GstPad *pad
,GstObject *parent
,guint64 offset
,guint length
,GstBuffer **buffer
);
This function will be called on source pads when a peer element
request a buffer at the specified offset
and length
. If this function
returns GST_FLOW_OK, the result buffer will be stored in buffer
. The
contents of buffer
is invalid for any other return value.
This function is installed on a source pad with
gst_pad_set_getrange_function()
and can only be called on source pads after
they are successfully activated with gst_pad_activate_mode()
with the
GST_PAD_MODE_PULL.
offset
and length
are always given in byte units. offset
must normally be a value
between 0 and the length in bytes of the data available on pad
. The
length (duration in bytes) can be retrieved with a GST_QUERY_DURATION or with a
GST_QUERY_SEEKING.
Any offset
larger or equal than the length will make the function return
GST_FLOW_EOS, which corresponds to EOS. In this case buffer
does not
contain a valid buffer.
The buffer size of buffer
will only be smaller than length
when offset
is
near the end of the stream. In all other cases, the size of buffer
must be
exactly the requested size.
It is allowed to call this function with a 0 length
and valid offset
, in
which case buffer
will contain a 0-sized buffer and the function returns
GST_FLOW_OK.
When this function is called with a -1 offset
, the sequentially next buffer
of length length
in the stream is returned.
When this function is called with a -1 length
, a buffer with a default
optimal length is returned in buffer
. The length might depend on the value
of offset
.
|
the src GstPad to perform the getrange on. |
|
the parent of pad . If the GST_PAD_FLAG_NEED_PARENT flag is set,
parent is guaranteed to be not-NULL and remain valid during the
execution of this function. |
|
the offset of the range |
|
the length of the range |
|
a memory location to hold the result buffer, cannot be NULL. |
Returns : |
GST_FLOW_OK for success and a valid buffer in buffer . Any other
return value leaves buffer undefined. |
#define gst_pad_set_event_function(p,f) gst_pad_set_event_function_full((p),(f),NULL,NULL)
Calls gst_pad_set_event_function_full()
with NULL for the user_data and
notify.
|
a GstPad of either direction. |
|
the GstPadEventFunction to set. |
void gst_pad_set_event_function_full (GstPad *pad
,GstPadEventFunction event
,gpointer user_data
,GDestroyNotify notify
);
Sets the given event handler for the pad.
|
a GstPad of either direction. |
|
the GstPadEventFunction to set. |
|
user_data passed to notify
|
|
notify called when event will not be used anymore. |
gboolean (*GstPadEventFunction) (GstPad *pad
,GstObject *parent
,GstEvent *event
);
Function signature to handle an event for the pad.
|
the GstPad to handle the event. |
|
the parent of pad . If the GST_PAD_FLAG_NEED_PARENT flag is set,
parent is guaranteed to be not-NULL and remain valid during the
execution of this function. |
|
the GstEvent to handle. |
Returns : |
TRUE if the pad could handle the event. |
#define gst_pad_set_link_function(p,f) gst_pad_set_link_function_full((p),(f),NULL,NULL)
Calls gst_pad_set_link_function_full()
with NULL
for the user_data and notify.
|
a GstPad. |
|
the GstPadLinkFunction to set. |
void gst_pad_set_link_function_full (GstPad *pad
,GstPadLinkFunction link
,gpointer user_data
,GDestroyNotify notify
);
Sets the given link function for the pad. It will be called when the pad is linked with another pad.
The return value GST_PAD_LINK_OK should be used when the connection can be made.
The return value GST_PAD_LINK_REFUSED should be used when the connection cannot be made for some reason.
If link
is installed on a source pad, it should call the GstPadLinkFunction
of the peer sink pad, if present.
|
a GstPad. |
|
the GstPadLinkFunction to set. |
|
user_data passed to notify
|
|
notify called when link will not be used anymore. |
GstPadLinkReturn (*GstPadLinkFunction) (GstPad *pad
,GstObject *parent
,GstPad *peer
);
Function signature to handle a new link on the pad.
|
the GstPad that is linked. |
|
the parent of pad . If the GST_PAD_FLAG_NEED_PARENT flag is set,
parent is guaranteed to be not-NULL and remain valid during the
execution of this function. |
|
the peer GstPad of the link |
Returns : |
the result of the link with the specified peer. |
#define gst_pad_set_unlink_function(p,f) gst_pad_set_unlink_function_full((p),(f),NULL,NULL)
Calls gst_pad_set_unlink_function_full()
with NULL
for the user_data and notify.
|
a GstPad. |
|
the GstPadUnlinkFunction to set. |
void gst_pad_set_unlink_function_full (GstPad *pad
,GstPadUnlinkFunction unlink
,gpointer user_data
,GDestroyNotify notify
);
Sets the given unlink function for the pad. It will be called when the pad is unlinked.
|
a GstPad. |
|
the GstPadUnlinkFunction to set. |
|
user_data passed to notify
|
|
notify called when unlink will not be used anymore. |
void (*GstPadUnlinkFunction) (GstPad *pad
,GstObject *parent
);
Function signature to handle a unlinking the pad prom its peer.
|
the GstPad that is linked. |
|
the parent of pad . If the GST_PAD_FLAG_NEED_PARENT flag is set,
parent is guaranteed to be not-NULL and remain valid during the
execution of this function. |
gboolean gst_pad_proxy_query_caps (GstPad *pad
,GstQuery *query
);
Calls gst_pad_query_caps()
for all internally linked pads fof pad
and returns
the intersection of the results.
This function is useful as a default caps query function for an element that can handle any stream format, but requires all its pads to have the same caps. Two such elements are tee and adder.
gboolean gst_pad_proxy_query_accept_caps (GstPad *pad
,GstQuery *query
);
Calls gst_pad_accept_caps()
for all internally linked pads of pad
and
returns the intersection of the results.
This function is useful as a default accept caps query function for an element that can handle any stream format, but requires caps that are acceptable for all oposite pads.
#define gst_pad_set_activate_function(p,f) gst_pad_set_activate_function_full((p),(f),NULL,NULL)
Calls gst_pad_set_activate_function_full()
with NULL for the user_data and
notify.
|
a GstPad. |
|
the GstPadActivateFunction to set. |
void gst_pad_set_activate_function_full (GstPad *pad
,GstPadActivateFunction activate
,gpointer user_data
,GDestroyNotify notify
);
Sets the given activate function for pad
. The activate function will
dispatch to gst_pad_activate_mode()
to perform the actual activation.
Only makes sense to set on sink pads.
Call this function if your sink pad can start a pull-based task.
|
a GstPad. |
|
the GstPadActivateFunction to set. |
|
user_data passed to notify
|
|
notify called when activate will not be used anymore. |
gboolean (*GstPadActivateFunction) (GstPad *pad
,GstObject *parent
);
This function is called when the pad is activated during the element READY to PAUSED state change. By default this function will call the activate function that puts the pad in push mode but elements can override this function to activate the pad in pull mode if they wish.
|
a GstPad |
|
the parent of pad
|
Returns : |
TRUE if the pad could be activated. |
#define gst_pad_set_activatemode_function(p,f) gst_pad_set_activatemode_function_full((p),(f),NULL,NULL)
Calls gst_pad_set_activatemode_function_full()
with NULL for the user_data and
notify.
|
a GstPad. |
|
the GstPadActivateModeFunction to set. |
void gst_pad_set_activatemode_function_full (GstPad *pad
,GstPadActivateModeFunction activatemode
,gpointer user_data
,GDestroyNotify notify
);
Sets the given activate_mode function for the pad. An activate_mode function prepares the element for data passing.
|
a GstPad. |
|
the GstPadActivateModeFunction to set. |
|
user_data passed to notify
|
|
notify called when activatemode will not be used anymore. |
gboolean (*GstPadActivateModeFunction) (GstPad *pad
,GstObject *parent
,GstPadMode mode
,gboolean active
);
The prototype of the push and pull activate functions.
|
a GstPad |
|
the parent of pad
|
|
the requested activation mode of pad
|
|
activate or deactivate the pad. |
Returns : |
TRUE if the pad could be activated or deactivated. |
gboolean gst_pad_needs_reconfigure (GstPad *pad
);
Check the GST_PAD_FLAG_NEED_RECONFIGURE flag on pad
and return TRUE
if the flag was set.
gboolean gst_pad_check_reconfigure (GstPad *pad
);
Check and clear the GST_PAD_FLAG_NEED_RECONFIGURE flag on pad
and return TRUE
if the flag was set.
void gst_pad_mark_reconfigure (GstPad *pad
);
Mark a pad for needing reconfiguration. The next call to
gst_pad_check_reconfigure()
will return TRUE
after this call.
|
the GstPad to mark |
GstFlowReturn gst_pad_push (GstPad *pad
,GstBuffer *buffer
);
Pushes a buffer to the peer of pad
.
This function will call installed block probes before triggering any installed data probes.
The function proceeds calling gst_pad_chain()
on the peer pad and returns
the value from that function. If pad
has no peer, GST_FLOW_NOT_LINKED will
be returned.
In all cases, success or failure, the caller loses its reference to buffer
after calling this function.
|
a source GstPad, returns GST_FLOW_ERROR if not. |
|
the GstBuffer to push returns GST_FLOW_ERROR if not. [transfer full] |
Returns : |
a GstFlowReturn from the peer pad. MT safe. |
gboolean gst_pad_push_event (GstPad *pad
,GstEvent *event
);
Sends the event to the peer of the given pad. This function is mainly used by elements to send events to their peer elements.
This function takes owership of the provided event so you should
gst_event_ref()
it if you want to reuse the event after this call.
GstFlowReturn gst_pad_push_list (GstPad *pad
,GstBufferList *list
);
Pushes a buffer list to the peer of pad
.
This function will call installed block probes before triggering any installed data probes.
The function proceeds calling the chain function on the peer pad and returns
the value from that function. If pad
has no peer, GST_FLOW_NOT_LINKED will
be returned. If the peer pad does not have any installed chainlist function
every group buffer of the list will be merged into a normal GstBuffer and
chained via gst_pad_chain()
.
In all cases, success or failure, the caller loses its reference to list
after calling this function.
|
a source GstPad, returns GST_FLOW_ERROR if not. |
|
the GstBufferList to push returns GST_FLOW_ERROR if not. [transfer full] |
Returns : |
a GstFlowReturn from the peer pad. MT safe. |
GstFlowReturn gst_pad_pull_range (GstPad *pad
,guint64 offset
,guint size
,GstBuffer **buffer
);
Pulls a buffer
from the peer pad or fills up a provided buffer.
This function will first trigger the pad block signal if it was installed.
When pad
is not linked GST_FLOW_NOT_LINKED is returned else this
function returns the result of gst_pad_get_range()
on the peer pad.
See gst_pad_get_range()
for a list of return values and for the
semantics of the arguments of this function.
If buffer
points to a variable holding NULL, a valid new GstBuffer will be
placed in buffer
when this function returns GST_FLOW_OK. The new buffer
must be freed with gst_buffer_unref()
after usage. When this function
returns any other result value, buffer
will still point to NULL.
When buffer
points to a variable that points to a valid GstBuffer, the
buffer will be filled with the result data when this function returns
GST_FLOW_OK. When this function returns any other result value,
buffer
will be unchanged. If the provided buffer is larger than size
, only
size
bytes will be filled in the result buffer and its size will be updated
accordingly.
Note that less than size
bytes can be returned in buffer
when, for example,
an EOS condition is near or when buffer
is not large enough to hold size
bytes. The caller should check the result buffer size to get the result size.
|
a sink GstPad, returns GST_FLOW_ERROR if not. |
|
The start offset of the buffer |
|
The length of the buffer |
|
a pointer to hold the GstBuffer, returns
GST_FLOW_ERROR if NULL . [out callee-allocates]
|
Returns : |
a GstFlowReturn from the peer pad. MT safe. |
gboolean gst_pad_activate_mode (GstPad *pad
,GstPadMode mode
,gboolean active
);
Activates or deactivates the given pad in mode
via dispatching to the
pad's activatemodefunc. For use from within pad activation functions only.
If you don't know what this is, you probably don't want to call it.
|
the GstPad to activate or deactivate. |
|
the requested activation mode |
|
whether or not the pad should be active. |
Returns : |
TRUE if the operation was successful. MT safe. |
gboolean gst_pad_send_event (GstPad *pad
,GstEvent *event
);
Sends the event to the pad. This function can be used by applications to send events in the pipeline.
If pad
is a source pad, event
should be an upstream event. If pad
is a
sink pad, event
should be a downstream event. For example, you would not
send a GST_EVENT_EOS on a src pad; EOS events only propagate downstream.
Furthermore, some downstream events have to be serialized with data flow,
like EOS, while some can travel out-of-band, like GST_EVENT_FLUSH_START. If
the event needs to be serialized with data flow, this function will take the
pad's stream lock while calling its event function.
To find out whether an event type is upstream, downstream, or downstream and
serialized, see GstEventTypeFlags, gst_event_type_get_flags()
,
GST_EVENT_IS_UPSTREAM, GST_EVENT_IS_DOWNSTREAM, and
GST_EVENT_IS_SERIALIZED. Note that in practice that an application or
plugin doesn't need to bother itself with this information; the core handles
all necessary locks and checks.
This function takes owership of the provided event so you should
gst_event_ref()
it if you want to reuse the event after this call.
gboolean gst_pad_event_default (GstPad *pad
,GstObject *parent
,GstEvent *event
);
Invokes the default event handler for the given pad.
The EOS event will pause the task associated with pad
before it is forwarded
to all internally linked pads,
The the event is sent to all pads internally linked to pad
. This function
takes ownership of event
.
gboolean gst_pad_query (GstPad *pad
,GstQuery *query
);
Dispatches a query to a pad. The query should have been allocated by the caller via one of the type-specific allocation functions. The element that the pad belongs to is responsible for filling the query with an appropriate response, which should then be parsed with a type-specific query parsing function.
Again, the caller is responsible for both the allocation and deallocation of the query structure.
Please also note that some queries might need a running pipeline to work.
gboolean gst_pad_peer_query (GstPad *pad
,GstQuery *query
);
Performs gst_pad_query()
on the peer of pad
.
The caller is responsible for both the allocation and deallocation of the query structure.
gboolean gst_pad_query_default (GstPad *pad
,GstObject *parent
,GstQuery *query
);
Invokes the default query handler for the given pad.
The query is sent to all pads internally linked to pad
. Note that
if there are many possible sink pads that are internally linked to
pad
, only one will be sent the query.
Multi-sinkpad elements should implement custom query handlers.
gboolean gst_pad_query_position (GstPad *pad
,GstFormat format
,gint64 *cur
);
Queries a pad for the stream position.
gboolean gst_pad_query_duration (GstPad *pad
,GstFormat format
,gint64 *duration
);
Queries a pad for the total stream duration.
gboolean gst_pad_query_convert (GstPad *pad
,GstFormat src_format
,gint64 src_val
,GstFormat dest_format
,gint64 *dest_val
);
Queries a pad to convert src_val
in src_format
to dest_format
.
gboolean gst_pad_query_accept_caps (GstPad *pad
,GstCaps *caps
);
Check if the given pad accepts the caps.
GstCaps * gst_pad_query_caps (GstPad *pad
,GstCaps *filter
);
Gets the capabilities this pad can produce or consume.
Note that this method doesn't necessarily return the caps set by
gst_pad_set_caps()
- use gst_pad_get_current_caps()
for that instead.
gst_pad_query_caps returns all possible caps a pad can operate with, using
the pad's CAPS query function, If the query fails, this function will return
filter
, if not NULL, otherwise ANY.
When called on sinkpads filter
contains the caps that
upstream could produce in the order preferred by upstream. When
called on srcpads filter
contains the caps accepted by
downstream in the preffered order. filter
might be NULL
but
if it is not NULL
the returned caps will be a subset of filter
.
Note that this function does not return writable GstCaps, use
gst_caps_make_writable()
before modifying the caps.
gboolean gst_pad_peer_query_position (GstPad *pad
,GstFormat format
,gint64 *cur
);
Queries the peer of a given sink pad for the stream position.
gboolean gst_pad_peer_query_duration (GstPad *pad
,GstFormat format
,gint64 *duration
);
Queries the peer pad of a given sink pad for the total stream duration.
gboolean gst_pad_peer_query_convert (GstPad *pad
,GstFormat src_format
,gint64 src_val
,GstFormat dest_format
,gint64 *dest_val
);
Queries the peer pad of a given sink pad to convert src_val
in src_format
to dest_format
.
gboolean gst_pad_peer_query_accept_caps (GstPad *pad
,GstCaps *caps
);
Check if the peer of pad
accepts caps
. If pad
has no peer, this function
returns TRUE.
GstCaps * gst_pad_peer_query_caps (GstPad *pad
,GstCaps *filter
);
Gets the capabilities of the peer connected to this pad. Similar to
gst_pad_query_caps()
.
When called on srcpads filter
contains the caps that
upstream could produce in the order preferred by upstream. When
called on sinkpads filter
contains the caps accepted by
downstream in the preffered order. filter
might be NULL
but
if it is not NULL
the returned caps will be a subset of filter
.
#define gst_pad_set_query_function(p,f) gst_pad_set_query_function_full((p),(f),NULL,NULL)
Calls gst_pad_set_query_function_full()
with NULL for the user_data and
notify.
|
a GstPad of either direction. |
|
the GstPadQueryFunction to set. |
void gst_pad_set_query_function_full (GstPad *pad
,GstPadQueryFunction query
,gpointer user_data
,GDestroyNotify notify
);
Set the given query function for the pad.
|
a GstPad of either direction. |
|
the GstPadQueryFunction to set. |
|
user_data passed to notify
|
|
notify called when query will not be used anymore. |
gboolean (*GstPadQueryFunction) (GstPad *pad
,GstObject *parent
,GstQuery *query
);
The signature of the query function.
|
the GstPad to query. |
|
the parent of pad . If the GST_PAD_FLAG_NEED_PARENT flag is set,
parent is guaranteed to be not-NULL and remain valid during the
execution of this function. |
|
the GstQuery object to execute |
Returns : |
TRUE if the query could be performed. |
#define gst_pad_set_iterate_internal_links_function(p,f) gst_pad_set_iterate_internal_links_function_full((p),(f),NULL,NULL)
Calls gst_pad_set_iterate_internal_links_function_full()
with NULL
for the user_data and notify.
|
a GstPad of either direction. |
|
the GstPadIterIntLinkFunction to set. |
void gst_pad_set_iterate_internal_links_function_full (GstPad *pad
,GstPadIterIntLinkFunction iterintlink
,gpointer user_data
,GDestroyNotify notify
);
Sets the given internal link iterator function for the pad.
|
a GstPad of either direction. |
|
the GstPadIterIntLinkFunction to set. |
|
user_data passed to notify
|
|
notify called when iterintlink will not be used anymore. |
GstIterator * (*GstPadIterIntLinkFunction) (GstPad *pad
,GstObject *parent
);
The signature of the internal pad link iterator function.
|
The GstPad to query. |
|
the parent of pad . If the GST_PAD_FLAG_NEED_PARENT flag is set,
parent is guaranteed to be not-NULL and remain valid during the
execution of this function. |
Returns : |
a new GstIterator that will iterate over all pads that are
linked to the given pad on the inside of the parent element.
the caller must call gst_iterator_free() after usage. |
GstIterator * gst_pad_iterate_internal_links (GstPad *pad
);
Gets an iterator for the pads to which the given pad is linked to inside of the parent element.
Each GstPad element yielded by the iterator will have its refcount increased, so unref after use.
Free-function: gst_iterator_free
|
the GstPad to get the internal links of. |
Returns : |
a new GstIterator of GstPad or NULL when the
pad does not have an iterator function configured. Use
gst_iterator_free() after usage. [transfer full]
|
GstIterator * gst_pad_iterate_internal_links_default (GstPad *pad
,GstObject *parent
);
Iterate the list of pads to which the given pad is linked to inside of the parent element. This is the default handler, and thus returns an iterator of all of the pads inside the parent element with opposite direction.
The caller must free this iterator after use with gst_iterator_free()
.
|
the GstPad to get the internal links of. |
|
the parent of pad or NULL |
Returns : |
a GstIterator of GstPad, or NULL if pad has no parent. Unref each
returned pad with gst_object_unref() . |
void gst_pad_set_element_private (GstPad *pad
,gpointer priv
);
Set the given private data gpointer on the pad. This function can only be used by the element that owns the pad. No locking is performed in this function.
|
the GstPad to set the private data of. |
|
The private data to attach to the pad. |
gpointer gst_pad_get_element_private (GstPad *pad
);
Gets the private data of a pad. No locking is performed in this function.
gchar * gst_pad_create_stream_id (GstPad *pad
,GstElement *parent
,const gchar *stream_id
);
Creates a stream-id for the source GstPad pad
by combining the
upstream information with the optional stream_id
of the stream
of pad
. pad
must have a parent GstElement and which must have zero
or one sinkpad. stream_id
can only be NULL
if the parent element
of pad
has only a single source pad.
This function generates an unique stream-id by getting the upstream
stream-start event stream ID and appending stream_id
to it. If the
element has no sinkpad it will generate an upstream stream-id by
doing an URI query on the element and in the worst case just uses
a random number. Source elements that don't implement the URI
handler interface should ideally generate a unique, deterministic
stream-id manually instead.
|
A source GstPad |
|
Parent GstElement of pad
|
|
The stream-id. [allow-none] |
Returns : |
A stream-id for pad . g_free() after usage. |
gchar * gst_pad_create_stream_id_printf (GstPad *pad
,GstElement *parent
,const gchar *stream_id
,...
);
Creates a stream-id for the source GstPad pad
by combining the
upstream information with the optional stream_id
of the stream
of pad
. pad
must have a parent GstElement and which must have zero
or one sinkpad. stream_id
can only be NULL
if the parent element
of pad
has only a single source pad.
This function generates an unique stream-id by getting the upstream
stream-start event stream ID and appending stream_id
to it. If the
element has no sinkpad it will generate an upstream stream-id by
doing an URI query on the element and in the worst case just uses
a random number. Source elements that don't implement the URI
handler interface should ideally generate a unique, deterministic
stream-id manually instead.
|
A source GstPad |
|
Parent GstElement of pad
|
|
The stream-id. [allow-none] |
|
parameters for the stream_id format string |
Returns : |
A stream-id for pad . g_free() after usage. |
gchar * gst_pad_create_stream_id_printf_valist (GstPad *pad
,GstElement *parent
,const gchar *stream_id
,va_list var_args
);
Creates a stream-id for the source GstPad pad
by combining the
upstream information with the optional stream_id
of the stream
of pad
. pad
must have a parent GstElement and which must have zero
or one sinkpad. stream_id
can only be NULL
if the parent element
of pad
has only a single source pad.
This function generates an unique stream-id by getting the upstream
stream-start event stream ID and appending stream_id
to it. If the
element has no sinkpad it will generate an upstream stream-id by
doing an URI query on the element and in the worst case just uses
a random number. Source elements that don't implement the URI
handler interface should ideally generate a unique, deterministic
stream-id manually instead.
|
A source GstPad |
|
Parent GstElement of pad
|
|
The stream-id. [allow-none] |
|
parameters for the stream_id format string |
Returns : |
A stream-id for pad . g_free() after usage. |
gboolean (*GstPadForwardFunction) (GstPad *pad
,gpointer user_data
);
A forward function is called for all internally linked pads, see
gst_pad_forward()
.
|
the GstPad that is forwarded. |
|
the gpointer to optional user data. |
Returns : |
TRUE if the dispatching procedure has to be stopped. |
gboolean gst_pad_forward (GstPad *pad
,GstPadForwardFunction forward
,gpointer user_data
);
Calls forward
for all internally linked pads of pad
. This function deals with
dynamically changing internal pads and will make sure that the forward
function is only called once for each pad.
When forward
returns TRUE, no further pads will be processed.
|
a GstPad |
|
a GstPadForwardFunction. [scope call] |
|
user data passed to forward
|
Returns : |
TRUE if one of the dispatcher functions returned TRUE. |
GstFlowReturn gst_pad_chain (GstPad *pad
,GstBuffer *buffer
);
Chain a buffer to pad
.
The function returns GST_FLOW_FLUSHING if the pad was flushing.
If the buffer type is not acceptable for pad
(as negotiated with a
preceeding GST_EVENT_CAPS event), this function returns
GST_FLOW_NOT_NEGOTIATED.
The function proceeds calling the chain function installed on pad
(see
gst_pad_set_chain_function()
) and the return value of that function is
returned to the caller. GST_FLOW_NOT_SUPPORTED is returned if pad
has no
chain function.
In all cases, success or failure, the caller loses its reference to buffer
after calling this function.
|
a sink GstPad, returns GST_FLOW_ERROR if not. |
|
the GstBuffer to send, return GST_FLOW_ERROR if not. [transfer full] |
Returns : |
a GstFlowReturn from the pad. MT safe. |
GstFlowReturn gst_pad_chain_list (GstPad *pad
,GstBufferList *list
);
Chain a bufferlist to pad
.
The function returns GST_FLOW_FLUSHING if the pad was flushing.
If pad
was not negotiated properly with a CAPS event, this function
returns GST_FLOW_NOT_NEGOTIATED.
The function proceeds calling the chainlist function installed on pad
(see
gst_pad_set_chain_list_function()
) and the return value of that function is
returned to the caller. GST_FLOW_NOT_SUPPORTED is returned if pad
has no
chainlist function.
In all cases, success or failure, the caller loses its reference to list
after calling this function.
MT safe.
|
a sink GstPad, returns GST_FLOW_ERROR if not. |
|
the GstBufferList to send, return GST_FLOW_ERROR if not. [transfer full] |
Returns : |
a GstFlowReturn from the pad. |
gboolean gst_pad_start_task (GstPad *pad
,GstTaskFunction func
,gpointer user_data
,GDestroyNotify notify
);
Starts a task that repeatedly calls func
with user_data
. This function
is mostly used in pad activation functions to start the dataflow.
The GST_PAD_STREAM_LOCK of pad
will automatically be acquired
before func
is called.
gboolean gst_pad_pause_task (GstPad *pad
);
Pause the task of pad
. This function will also wait until the
function executed by the task is finished if this function is not
called from the task function.
|
the GstPad to pause the task of |
Returns : |
a TRUE if the task could be paused or FALSE when the pad has no task. |
gboolean gst_pad_stop_task (GstPad *pad
);
Stop the task of pad
. This function will also make sure that the
function executed by the task will effectively stop if not called
from the GstTaskFunction.
This function will deadlock if called from the GstTaskFunction of
the task. Use gst_task_pause()
instead.
Regardless of whether the pad has a task, the stream lock is acquired and released so as to ensure that streaming through this pad has finished.
|
the GstPad to stop the task of |
Returns : |
a TRUE if the task could be stopped or FALSE on error. |
gboolean gst_pad_set_active (GstPad *pad
,gboolean active
);
Activates or deactivates the given pad. Normally called from within core state change functions.
If active
, makes sure the pad is active. If it is already active, either in
push or pull mode, just return. Otherwise dispatches to the pad's activate
function to perform the actual activation.
If not active
, calls gst_pad_activate_mode()
with the pad's current mode
and a FALSE argument.
#define GST_PAD_GET_STREAM_LOCK(pad) (&(GST_PAD_CAST(pad)->stream_rec_lock))
Get the stream lock of pad
. The stream lock is protecting the
resources used in the data processing functions of pad
.
|
a GstPad |
#define GST_PAD_STREAM_LOCK(pad) g_rec_mutex_lock(GST_PAD_GET_STREAM_LOCK(pad))
Lock the stream lock of pad
.
|
a GstPad |
#define GST_PAD_STREAM_TRYLOCK(pad) g_rec_mutex_trylock(GST_PAD_GET_STREAM_LOCK(pad))
Try to Lock the stream lock of the pad, return TRUE if the lock could be taken.
|
a GstPad |
#define GST_PAD_STREAM_UNLOCK(pad) g_rec_mutex_unlock(GST_PAD_GET_STREAM_LOCK(pad))
Unlock the stream lock of pad
.
|
a GstPad |
"direction"
property"direction" GstPadDirection : Read / Write / Construct Only
The direction of the pad.
Default value: GST_PAD_UNKNOWN
"linked"
signalvoid user_function (GstPad *pad,
GstPad *peer,
gpointer user_data) : Run Last
Signals that a pad has been linked to the peer pad.
|
the pad that emitted the signal |
|
the peer pad that has been connected |
|
user data set when the signal handler was connected. |
"unlinked"
signalvoid user_function (GstPad *pad,
GstPad *peer,
gpointer user_data) : Run Last
Signals that a pad has been unlinked from the peer pad.
|
the pad that emitted the signal |
|
the peer pad that has been disconnected |
|
user data set when the signal handler was connected. |