![]() |
![]() |
![]() |
GStreamer 0.11 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; #define GST_PAD_LINK_CHECK_DEFAULT enum GstFlowReturn; enum GstActivateMode; enum GstProbeReturn; enum GstProbeType; #define GST_PROBE_TYPE_BLOCKING #define GST_PROBE_TYPE_DATA #define GST_PROBE_TYPE_SCHEDULING #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_caps (GstPad *pad
,GstCaps *filter
); #define gst_pad_get_caps_reffed (p) GstCaps * gst_pad_get_allowed_caps (GstPad *pad
); GstCaps * gst_pad_get_negotiated_caps (GstPad *pad
); GstCaps * gst_pad_get_current_caps (GstPad *pad
); GstCaps * gst_pad_get_pad_template_caps (GstPad *pad
); gboolean gst_pad_set_caps (GstPad *pad
,GstCaps *caps
); GstPad * gst_pad_get_peer (GstPad *pad
); GstCaps * gst_pad_peer_get_caps (GstPad *pad
,GstCaps *filter
); #define gst_pad_peer_get_caps_reffed (p) 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
); GstFlowReturn (*GstPadStickyEventsForeachFunction) (GstPad *pad
,GstEvent *event
,gpointer user_data
); GstFlowReturn gst_pad_sticky_events_foreach (GstPad *pad
,GstPadStickyEventsForeachFunction foreach_func
,gpointer user_data
); gboolean gst_pad_is_active (GstPad *pad
); gboolean gst_pad_is_blocked (GstPad *pad
); gboolean gst_pad_is_blocking (GstPad *pad
); GstProbeReturn (*GstPadProbeCallback) (GstPad *pad
,GstProbeType type
,gpointer type_data
,gpointer user_data
); gulong gst_pad_add_probe (GstPad *pad
,GstProbeType mask
,GstPadProbeCallback callback
,gpointer user_data
,GDestroyNotify destroy_data
); void gst_pad_remove_probe (GstPad *pad
,gulong id
); 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
); void gst_pad_set_chain_function (GstPad *pad
,GstPadChainFunction chain
); GstFlowReturn (*GstPadChainFunction) (GstPad *pad
,GstBuffer *buffer
); void gst_pad_set_chain_list_function (GstPad *pad
,GstPadChainListFunction chainlist
); GstFlowReturn (*GstPadChainListFunction) (GstPad *pad
,GstBufferList *list
); GstFlowReturn gst_pad_get_range (GstPad *pad
,guint64 offset
,guint size
,GstBuffer **buffer
); void gst_pad_set_getrange_function (GstPad *pad
,GstPadGetRangeFunction get
); GstFlowReturn (*GstPadGetRangeFunction) (GstPad *pad
,guint64 offset
,guint length
,GstBuffer **buffer
); void gst_pad_set_event_function (GstPad *pad
,GstPadEventFunction event
); gboolean (*GstPadEventFunction) (GstPad *pad
,GstEvent *event
); void gst_pad_set_link_function (GstPad *pad
,GstPadLinkFunction link
); GstPadLinkReturn (*GstPadLinkFunction) (GstPad *pad
,GstPad *peer
); void gst_pad_set_unlink_function (GstPad *pad
,GstPadUnlinkFunction unlink
); void (*GstPadUnlinkFunction) (GstPad *pad
); gboolean gst_pad_accept_caps (GstPad *pad
,GstCaps *caps
); void gst_pad_set_acceptcaps_function (GstPad *pad
,GstPadAcceptCapsFunction acceptcaps
); gboolean (*GstPadAcceptCapsFunction) (GstPad *pad
,GstCaps *caps
); void gst_pad_set_getcaps_function (GstPad *pad
,GstPadGetCapsFunction getcaps
); GstCaps * (*GstPadGetCapsFunction) (GstPad *pad
,GstCaps *filter
); GstCaps * gst_pad_proxy_getcaps (GstPad *pad
,GstCaps *filter
); void gst_pad_fixate_caps (GstPad *pad
,GstCaps *caps
); void gst_pad_set_fixatecaps_function (GstPad *pad
,GstPadFixateCapsFunction fixatecaps
); void (*GstPadFixateCapsFunction) (GstPad *pad
,GstCaps *caps
); gboolean gst_pad_peer_accept_caps (GstPad *pad
,GstCaps *caps
); void gst_pad_set_activate_function (GstPad *pad
,GstPadActivateFunction activate
); gboolean (*GstPadActivateFunction) (GstPad *pad
); void gst_pad_set_activatepush_function (GstPad *pad
,GstPadActivateModeFunction activatepush
); void gst_pad_set_activatepull_function (GstPad *pad
,GstPadActivateModeFunction activatepull
); gboolean (*GstPadActivateModeFunction) (GstPad *pad
,gboolean active
); 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_pull (GstPad *pad
,gboolean active
); gboolean gst_pad_activate_push (GstPad *pad
,gboolean active
); gboolean gst_pad_send_event (GstPad *pad
,GstEvent *event
); gboolean gst_pad_event_default (GstPad *pad
,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
,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_peer_position (GstPad *pad
,GstFormat format
,gint64 *cur
); gboolean gst_pad_query_peer_duration (GstPad *pad
,GstFormat format
,gint64 *duration
); gboolean gst_pad_query_peer_convert (GstPad *pad
,GstFormat src_format
,gint64 src_val
,GstFormat dest_format
,gint64 *dest_val
); void gst_pad_set_query_function (GstPad *pad
,GstPadQueryFunction query
); gboolean (*GstPadQueryFunction) (GstPad *pad
,GstQuery *query
); void gst_pad_set_query_type_function (GstPad *pad
,GstPadQueryTypeFunction type_func
); const GstQueryType * (*GstPadQueryTypeFunction) (GstPad *pad
); const GstQueryType * gst_pad_get_query_types (GstPad *pad
); const GstQueryType * gst_pad_get_query_types_default (GstPad *pad
); void gst_pad_set_iterate_internal_links_function (GstPad *pad
,GstPadIterIntLinkFunction iterintlink
); GstIterator * (*GstPadIterIntLinkFunction) (GstPad *pad
); GstIterator * gst_pad_iterate_internal_links (GstPad *pad
); GstIterator * gst_pad_iterate_internal_links_default (GstPad *pad
); void gst_pad_set_element_private (GstPad *pad
,gpointer priv
); gpointer gst_pad_get_element_private (GstPad *pad
); 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 data
); 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_LOCK_FULL (pad, t) #define GST_PAD_STREAM_TRYLOCK (pad) #define GST_PAD_STREAM_UNLOCK (pad) #define GST_PAD_STREAM_UNLOCK_FULL (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.
After two pads are retrieved from an element with gst_element_get_pad()
,
the pads can be link 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 are typically created from a GstPadTemplate with
gst_pad_new_from_template()
.
Pads have GstCaps attached to it to describe the media type they are
capable of dealing with. gst_pad_get_caps()
and gst_pad_set_caps()
are
used to manipulate the caps of the pads.
Pads created from a pad template cannot set capabilities that are
incompatible with the pad template capabilities.
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.
gst_pad_get_parent()
will retrieve the GstElement that owns the pad.
A GstElement creating a pad will typically use the various gst_pad_set_*_function() calls to register callbacks for various events on the pads.
GstElements will use gst_pad_push()
and gst_pad_pull_range()
to push out
or pull in a buffer.
To send a GstEvent on a pad, use gst_pad_send_event()
and
gst_pad_push_event()
.
Last reviewed on 2006-07-06 (0.10.9)
struct GstPad { gpointer element_private; GstPadTemplate *padtemplate; GstPadDirection direction; /* streaming rec_lock */ GStaticRecMutex stream_rec_lock; GstTask *task; /* block cond, mutex is from the object */ GCond *block_cond; GHookList probes; /* the pad capabilities */ GstPadGetCapsFunction getcapsfunc; GstPadAcceptCapsFunction acceptcapsfunc; GstPadFixateCapsFunction fixatecapsfunc; GstActivateMode mode; GstPadActivateFunction activatefunc; GstPadActivateModeFunction activatepushfunc; GstPadActivateModeFunction activatepullfunc; /* pad link */ GstPad *peer; GstPadLinkFunction linkfunc; GstPadUnlinkFunction unlinkfunc; /* data transport functions */ GstPadChainFunction chainfunc; GstPadChainListFunction chainlistfunc; GstPadGetRangeFunction getrangefunc; GstPadEventFunction eventfunc; /* pad offset */ gint64 offset; /* generic query method */ GstPadQueryTypeFunction querytypefunc; GstPadQueryFunction queryfunc; /* internal links */ GstPadIterIntLinkFunction iterintlinkfunc; /* counts number of probes attached. */ gint num_probes; gint num_blocked; };
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. |
GStaticRecMutex |
recursive stream lock of the pad, used to protect the data used in streaming. |
GstTask * |
task for this pad if the pad is actively driving dataflow. |
GCond * |
conditional to signal pad block |
GHookList |
|
GstPadGetCapsFunction |
function to get caps of the pad |
GstPadAcceptCapsFunction |
function to check if pad can accept caps |
GstPadFixateCapsFunction |
function to fixate caps |
GstActivateMode |
current activation mode of the pad |
GstPadActivateFunction |
pad activation function |
GstPadActivateModeFunction |
function to activate/deactivate pad in push mode |
GstPadActivateModeFunction |
function to activate/deactivate pad in pull mode |
GstPad * |
the pad this pad is linked to |
GstPadLinkFunction |
function called when pad is linked |
GstPadUnlinkFunction |
function called when pad is unlinked |
GstPadChainFunction |
function to chain buffer to pad |
GstPadChainListFunction |
|
GstPadGetRangeFunction |
function to get a range of data from a pad |
GstPadEventFunction |
function to send an event to a pad |
gint64 |
|
GstPadQueryTypeFunction |
get list of supported queries |
GstPadQueryFunction |
perform a query on the pad |
GstPadIterIntLinkFunction |
get the internal links iterator of this pad |
gint |
|
gint |
typedef enum { GST_PAD_UNKNOWN, GST_PAD_SRC, GST_PAD_SINK } GstPadDirection;
The direction of a pad.
typedef enum { GST_PAD_BLOCKED = (GST_OBJECT_FLAG_LAST << 0), GST_PAD_FLUSHING = (GST_OBJECT_FLAG_LAST << 1), GST_PAD_IN_GETCAPS = (GST_OBJECT_FLAG_LAST << 2), GST_PAD_BLOCKING = (GST_OBJECT_FLAG_LAST << 4), GST_PAD_NEED_RECONFIGURE = (GST_OBJECT_FLAG_LAST << 5), GST_PAD_NEED_EVENTS = (GST_OBJECT_FLAG_LAST << 6), GST_PAD_FIXED_CAPS = (GST_OBJECT_FLAG_LAST << 7), /* padding */ GST_PAD_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 16) } GstPadFlags;
Pad state flags
is dataflow on a pad blocked | |
is pad refusing buffers | |
GstPadGetCapsFunction() is running now | |
is pad currently blocking on a buffer or event | |
the pad should be reconfigured/renegotiated. The flag has to be unset manually after reconfiguration happened. Since: 0.10.34. | |
the pad has pending events | |
the pad is using fixed caps this means that once the caps are set on the pad, the getcaps function only returns those caps. | |
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 } 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_get_caps() .
|
Since 0.10.30
#define GST_PAD_LINK_CHECK_DEFAULT (GST_PAD_LINK_CHECK_HIERARCHY | GST_PAD_LINK_CHECK_CAPS)
The default checks done when linking pads (i.e. the ones used by
gst_pad_link()
).
Since 0.10.30
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_RESEND = 1, GST_FLOW_OK = 0, /* expected failures */ GST_FLOW_NOT_LINKED = -1, GST_FLOW_WRONG_STATE = -2, /* error cases */ GST_FLOW_UNEXPECTED = -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 and are available since 0.10.7.
Pre-defined custom success code. Since 0.10.29. | |
Pre-defined custom success code (define your custom success code to this to avoid compiler warnings). Since 0.10.29. | |
Elements can use values starting from this (and higher) to define custom success codes. Since 0.10.7. | |
Resend buffer, possibly with new caps (not sent yet) (unused/unimplemented). | |
Data passing was ok. | |
Pad is not linked. | |
Pad is in wrong state. | |
Did not expect anything, like after 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. Since 0.10.7. | |
Pre-defined custom error code (define your custom error code to this to avoid compiler warnings). Since 0.10.29. | |
Pre-defined custom error code. Since 0.10.29. |
typedef enum { GST_ACTIVATE_NONE, GST_ACTIVATE_PUSH, GST_ACTIVATE_PULL } GstActivateMode;
The status of a GstPad. After activating a pad, which usually happens when the parent element goes from READY to PAUSED, the GstActivateMode defines if the pad operates in push or pull mode.
typedef enum { GST_PROBE_DROP, GST_PROBE_OK, GST_PROBE_REMOVE, GST_PROBE_PASS, } GstProbeReturn;
Different return values for the GstPadProbeCallback.
typedef enum { GST_PROBE_TYPE_INVALID = 0, /* flags to control blocking */ GST_PROBE_TYPE_IDLE = (1 << 0), GST_PROBE_TYPE_BLOCK = (1 << 1), /* flags to select datatypes */ GST_PROBE_TYPE_BUFFER = (1 << 2), GST_PROBE_TYPE_BUFFER_LIST = (1 << 3), GST_PROBE_TYPE_EVENT = (1 << 4), /* flags to select scheduling mode */ GST_PROBE_TYPE_PUSH = (1 << 5), GST_PROBE_TYPE_PULL = (1 << 6), } GstProbeType;
The different probing types that can occur. When either one of
GST_PROBE_TYPE_IDLE
or GST_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 events | |
probe push | |
probe pull |
#define GST_PROBE_TYPE_BLOCKING (GST_PROBE_TYPE_IDLE | GST_PROBE_TYPE_BLOCK)
#define GST_PROBE_TYPE_SCHEDULING (GST_PROBE_TYPE_PUSH | GST_PROBE_TYPE_PULL)
#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.
|
the source GstPad to link. |
|
the sink GstPad to link. |
|
the checks to validate when linking |
Returns : |
A result code indicating if the connection worked or what went wrong. |
Since 0.10.30
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_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_get_caps returns all possible caps a pad can operate with, using
the pad's get_caps function;
this returns the pad template caps if not explicitly set.
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.
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_get_caps()
on pad
and its peer. The caller owns a reference
on the resulting caps.
GstCaps * gst_pad_get_negotiated_caps (GstPad *pad
);
Gets the capabilities of the media type that currently flows through pad
and its peer.
This function can be used on both src and sinkpads. Note that srcpads are always negotiated before sinkpads so it is possible that the negotiated caps on the srcpad do not match the negotiated caps of the peer.
GstCaps * gst_pad_get_current_caps (GstPad *pad
);
Gets the capabilities currently configured on pad
with the last call to
gst_pad_set_caps()
.
|
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.
gboolean gst_pad_set_caps (GstPad *pad
,GstCaps *caps
);
Sets the capabilities of this pad. The caps must be fixed. Any previous caps on the pad will be unreffed. This function refs the caps so you should unref if as soon as you don't need it anymore. It is possible to set NULL caps, which will make the pad unnegotiated again.
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.
GstCaps * gst_pad_peer_get_caps (GstPad *pad
,GstCaps *filter
);
Gets the capabilities of the peer connected to this pad. Similar to
gst_pad_get_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
.
void gst_pad_use_fixed_caps (GstPad *pad
);
A helper function you can use that sets the FIXED_CAPS flag This way the default getcaps function will always return the negotiated caps or in case the pad is not negotiated, the padtemplate caps.
Use this function on a pad that, once gst_pad_set_caps()
has been called
on it, 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 gst_pad_set_caps()
.
|
a GstPad to check |
Returns : |
TRUE when pad has caps associated with it. |
GstEvent * gst_pad_get_sticky_event (GstPad *pad
,GstEventType event_type
);
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. |
Returns : |
a GstEvent of type event_type . Unref after usage. [transfer full]
|
GstFlowReturn (*GstPadStickyEventsForeachFunction) (GstPad *pad
,GstEvent *event
,gpointer user_data
);
Callback used by gst_pad_sticky_events_foreach()
.
GstFlowReturn gst_pad_sticky_events_foreach (GstPad *pad
,GstPadStickyEventsForeachFunction foreach_func
,gpointer user_data
);
Iterates all active sticky events on pad
and calls foreach_func
for every
event. If foreach_func
returns something else than GST_FLOW_OK 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] |
Returns : |
GST_FLOW_OK if iteration was successful |
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. |
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. |
Since 0.10.11
GstProbeReturn (*GstPadProbeCallback) (GstPad *pad
,GstProbeType type
,gpointer type_data
,gpointer user_data
);
Callback used by gst_pad_add_probe()
. Gets called to notify about the current
blocking type.
|
the GstPad that is blocked |
|
the current probe type |
|
type specific data |
|
the gpointer to optional user data. |
gulong gst_pad_add_probe (GstPad *pad
,GstProbeType 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 |
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 full] |
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] |
void gst_pad_set_chain_function (GstPad *pad
,GstPadChainFunction chain
);
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. |
GstFlowReturn (*GstPadChainFunction) (GstPad *pad
,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 GstBuffer that is chained, not NULL . |
Returns : |
GST_FLOW_OK for success |
void gst_pad_set_chain_list_function (GstPad *pad
,GstPadChainListFunction chainlist
);
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. |
Since 0.10.24
GstFlowReturn (*GstPadChainListFunction) (GstPad *pad
,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 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_WRONG_STATE
immediatly 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.
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. |
void gst_pad_set_getrange_function (GstPad *pad
,GstPadGetRangeFunction get
);
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. |
GstFlowReturn (*GstPadGetRangeFunction) (GstPad *pad
,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_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_UNEXPECTED, 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 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. |
void gst_pad_set_event_function (GstPad *pad
,GstPadEventFunction event
);
Sets the given event handler for the pad.
|
a GstPad of either direction. |
|
the GstPadEventFunction to set. |
gboolean (*GstPadEventFunction) (GstPad *pad
,GstEvent *event
);
Function signature to handle an event for the pad.
void gst_pad_set_link_function (GstPad *pad
,GstPadLinkFunction link
);
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. |
GstPadLinkReturn (*GstPadLinkFunction) (GstPad *pad
,GstPad *peer
);
Function signature to handle a new link on the pad.
void gst_pad_set_unlink_function (GstPad *pad
,GstPadUnlinkFunction unlink
);
Sets the given unlink function for the pad. It will be called when the pad is unlinked.
|
a GstPad. |
|
the GstPadUnlinkFunction to set. |
void (*GstPadUnlinkFunction) (GstPad *pad
);
Function signature to handle a unlinking the pad prom its peer.
|
the GstPad that is linked. |
gboolean gst_pad_accept_caps (GstPad *pad
,GstCaps *caps
);
Check if the given pad accepts the caps.
void gst_pad_set_acceptcaps_function (GstPad *pad
,GstPadAcceptCapsFunction acceptcaps
);
Sets the given acceptcaps function for the pad. The acceptcaps function
will be called to check if the pad can accept the given caps. Setting the
acceptcaps function to NULL restores the default behaviour of allowing
any caps that matches the caps from gst_pad_get_caps()
.
|
a GstPad. |
|
the GstPadAcceptCapsFunction to set. |
gboolean (*GstPadAcceptCapsFunction) (GstPad *pad
,GstCaps *caps
);
Check if pad
can accept caps
. By default this function will see if caps
intersect with the result from gst_pad_get_caps()
by can be overridden to
perform extra checks.
void gst_pad_set_getcaps_function (GstPad *pad
,GstPadGetCapsFunction getcaps
);
Sets the given getcaps function for the pad. getcaps
should return the
allowable caps for a pad in the context of the element's state, its link to
other elements, and the devices or files it has opened. These caps must be a
subset of the pad template caps. In the NULL state with no links, getcaps
should ideally return the same caps as the pad template. In rare
circumstances, an object property can affect the caps returned by getcaps
,
but this is discouraged.
You do not need to call this function if pad
's allowed caps are always the
same as the pad template caps. This can only be true if the padtemplate
has fixed simple caps.
For most filters, the caps returned by getcaps
is directly affected by the
allowed caps on other pads. For demuxers and decoders, the caps returned by
the srcpad's getcaps function is directly related to the stream data. Again,
getcaps
should return the most specific caps it reasonably can, since this
helps with autoplugging.
Note that the return value from getcaps
is owned by the caller, so the
caller should unref the caps after usage.
|
a GstPad. |
|
the GstPadGetCapsFunction to set. |
GstCaps * (*GstPadGetCapsFunction) (GstPad *pad
,GstCaps *filter
);
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
only a subset of filter
must be returned.
Returns a copy of the capabilities of the specified pad. By default this function will return the pad template capabilities, but can optionally be overridden by elements.
GstCaps * gst_pad_proxy_getcaps (GstPad *pad
,GstCaps *filter
);
Calls gst_pad_get_allowed_caps()
for every other pad belonging to the
same element as pad
, and returns the intersection of the results.
This function is useful as a default getcaps 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.
Free-function: gst_caps_unref
void gst_pad_fixate_caps (GstPad *pad
,GstCaps *caps
);
Fixate a caps on the given pad. Modifies the caps in place, so you should
make sure that the caps are actually writable (see gst_caps_make_writable()
).
void gst_pad_set_fixatecaps_function (GstPad *pad
,GstPadFixateCapsFunction fixatecaps
);
Sets the given fixatecaps function for the pad. The fixatecaps function will be called whenever the default values for a GstCaps needs to be filled in.
|
a GstPad. |
|
the GstPadFixateCapsFunction to set. |
void (*GstPadFixateCapsFunction) (GstPad *pad
,GstCaps *caps
);
Given possibly unfixed caps caps
, let pad
use its default prefered
format to make a fixed caps. caps
should be writable. By default this
function will pick the first value of any ranges or lists in the caps but
elements can override this function to perform other behaviour.
gboolean gst_pad_peer_accept_caps (GstPad *pad
,GstCaps *caps
);
Check if the peer of pad
accepts caps
. If pad
has no peer, this function
returns TRUE.
void gst_pad_set_activate_function (GstPad *pad
,GstPadActivateFunction activate
);
Sets the given activate function for pad
. The activate function will
dispatch to gst_pad_activate_push()
or gst_pad_activate_pull()
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. |
gboolean (*GstPadActivateFunction) (GstPad *pad
);
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 |
Returns : |
TRUE if the pad could be activated. |
void gst_pad_set_activatepush_function (GstPad *pad
,GstPadActivateModeFunction activatepush
);
Sets the given activate_push function for the pad. An activate_push function prepares the element for pushing. See XXX part-activation.txt for details.
|
a GstPad. |
|
the GstPadActivateModeFunction to set. |
void gst_pad_set_activatepull_function (GstPad *pad
,GstPadActivateModeFunction activatepull
);
Sets the given activate_pull function for the pad. An activate_pull function prepares the element and any upstream connections for pulling. See XXX part-activation.txt for details.
|
a GstPad. |
|
the GstPadActivateModeFunction to set. |
gboolean (*GstPadActivateModeFunction) (GstPad *pad
,gboolean active
);
The prototype of the push and pull activate functions.
|
a GstPad |
|
activate or deactivate the pad. |
Returns : |
TRUE if the pad could be activated or deactivated. |
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. |
Since 0.10.24
GstFlowReturn gst_pad_pull_range (GstPad *pad
,guint64 offset
,guint size
,GstBuffer **buffer
);
Pulls a buffer
from the peer pad.
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.
buffer
's caps must either be unset or the same as what is already
configured on pad
. Renegotiation within a running pull-mode pipeline is not
supported.
|
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.
When this function returns GST_FLOW_OK, buffer will contain a valid
GstBuffer that should be freed with gst_buffer_unref() after usage.
buffer may not be used or freed when any other return value than
GST_FLOW_OK is returned.
MT safe. |
gboolean gst_pad_activate_pull (GstPad *pad
,gboolean active
);
Activates or deactivates the given pad in pull mode via dispatching to the pad's activatepullfunc. For use from within pad activation functions only. When called on sink pads, will first proxy the call to the peer pad, which is expected to activate its internally linked pads from within its activate_pull function.
If you don't know what this is, you probably don't want to call it.
|
the GstPad to activate or deactivate. |
|
whether or not the pad should be active. |
Returns : |
TRUE if the operation was successful. MT safe. |
gboolean gst_pad_activate_push (GstPad *pad
,gboolean active
);
Activates or deactivates the given pad in push mode via dispatching to the pad's activatepushfunc. For use from within pad activation functions only.
If you don't know what this is, you probably don't want to call it.
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
,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 CAPS event will never be forwarded.
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.
|
a GstPad to invoke the peer query on. |
|
the GstQuery to perform. [transfer none] |
Returns : |
TRUE if the query could be performed. This function returns FALSE
if pad has no peer. |
Since 0.10.15
gboolean gst_pad_query_default (GstPad *pad
,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_peer_position (GstPad *pad
,GstFormat format
,gint64 *cur
);
Queries the peer of a given sink pad for the stream position.
gboolean gst_pad_query_peer_duration (GstPad *pad
,GstFormat format
,gint64 *duration
);
Queries the peer pad of a given sink pad for the total stream duration.
gboolean gst_pad_query_peer_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
.
void gst_pad_set_query_function (GstPad *pad
,GstPadQueryFunction query
);
Set the given query function for the pad.
|
a GstPad of either direction. |
|
the GstPadQueryFunction to set. |
gboolean (*GstPadQueryFunction) (GstPad *pad
,GstQuery *query
);
The signature of the query function.
void gst_pad_set_query_type_function (GstPad *pad
,GstPadQueryTypeFunction type_func
);
Set the given query type function for the pad.
|
a GstPad of either direction. |
|
the GstPadQueryTypeFunction to set. |
const GstQueryType * (*GstPadQueryTypeFunction) (GstPad *pad
);
The signature of the query types function.
|
a GstPad to query |
Returns : |
a constant array of query types |
const GstQueryType * gst_pad_get_query_types (GstPad *pad
);
Get an array of supported queries that can be performed on this pad.
|
a GstPad. |
Returns : |
a zero-terminated array of GstQueryType. [transfer none][array zero-terminated=1] |
const GstQueryType * gst_pad_get_query_types_default (GstPad *pad
);
Invoke the default query types function on the pad. This function will get
the supported query type from the peer of an internally linked pad of pad
.
|
a GstPad. |
Returns : |
a zero-terminated array of GstQueryType, or NULL if none of the internally-linked pads has a query types function. [transfer none][array zero-terminated=1] |
void gst_pad_set_iterate_internal_links_function (GstPad *pad
,GstPadIterIntLinkFunction iterintlink
);
Sets the given internal link iterator function for the pad.
|
a GstPad of either direction. |
|
the GstPadIterIntLinkFunction to set. |
Since 0.10.21
GstIterator * (*GstPadIterIntLinkFunction) (GstPad *pad
);
The signature of the internal pad link iterator function.
|
The GstPad to query. |
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.
Since 0.10.21 |
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]
|
Since 0.10.21
GstIterator * gst_pad_iterate_internal_links_default
(GstPad *pad
);
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. |
Returns : |
a GstIterator of GstPad, or NULL if pad has no parent. Unref each
returned pad with gst_object_unref() . |
Since 0.10.21
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.
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 |
|
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_WRONG_STATE 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_WRONG_STATE 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. |
Since 0.10.24
gboolean gst_pad_start_task (GstPad *pad
,GstTaskFunction func
,gpointer data
);
Starts a task that repeatedly calls func
with 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
, checks the pad's current mode and calls
gst_pad_activate_push()
or gst_pad_activate_pull()
, as appropriate, with 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_static_rec_mutex_lock(GST_PAD_GET_STREAM_LOCK(pad)))
Lock the stream lock of pad
.
|
a GstPad |
#define GST_PAD_STREAM_LOCK_FULL(pad,t) (g_static_rec_mutex_lock_full(GST_PAD_GET_STREAM_LOCK(pad), t))
Lock the stream lock of pad
t
times.
|
a GstPad |
|
the number of times to recursively lock |
#define GST_PAD_STREAM_TRYLOCK(pad) (g_static_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_static_rec_mutex_unlock(GST_PAD_GET_STREAM_LOCK(pad)))
Unlock the stream lock of pad
.
|
a GstPad |
#define GST_PAD_STREAM_UNLOCK_FULL(pad) (g_static_rec_mutex_unlock_full(GST_PAD_GET_STREAM_LOCK(pad)))
Fully unlock the recursive stream lock of pad
, return the number of times
pad
was locked.
|
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. |