GStreamer 0.10 Core Reference Manual | ||||
---|---|---|---|---|
#include <gst/gst.h> GstPad; enum GstPadDirection; enum GstPadFlags; enum GstPadLinkReturn; #define GST_PAD_LINK_FAILED (ret) #define GST_PAD_LINK_SUCCESSFUL (ret) enum GstFlowReturn; enum GstActivateMode; #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); 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* gst_pad_get_allowed_caps (GstPad *pad); GstCaps* gst_pad_get_negotiated_caps (GstPad *pad); const 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); void gst_pad_use_fixed_caps (GstPad *pad); gboolean gst_pad_is_active (GstPad *pad); gboolean gst_pad_set_blocked (GstPad *pad, gboolean blocked); gboolean gst_pad_set_blocked_async (GstPad *pad, gboolean blocked, GstPadBlockCallback callback, gpointer user_data); gboolean gst_pad_set_blocked_async_full (GstPad *pad, gboolean blocked, GstPadBlockCallback callback, gpointer user_data, GDestroyNotify destroy_data); void (*GstPadBlockCallback) (GstPad *pad, gboolean blocked, gpointer user_data); gboolean gst_pad_is_blocked (GstPad *pad); gboolean gst_pad_is_blocking (GstPad *pad); gulong gst_pad_add_data_probe (GstPad *pad, GCallback handler, gpointer data); gulong gst_pad_add_data_probe_full (GstPad *pad, GCallback handler, gpointer data, GDestroyNotify notify); gulong gst_pad_add_buffer_probe (GstPad *pad, GCallback handler, gpointer data); gulong gst_pad_add_buffer_probe_full (GstPad *pad, GCallback handler, gpointer data, GDestroyNotify notify); gulong gst_pad_add_event_probe (GstPad *pad, GCallback handler, gpointer data); gulong gst_pad_add_event_probe_full (GstPad *pad, GCallback handler, gpointer data, GDestroyNotify notify); void gst_pad_remove_data_probe (GstPad *pad, guint handler_id); void gst_pad_remove_buffer_probe (GstPad *pad, guint handler_id); void gst_pad_remove_event_probe (GstPad *pad, guint handler_id); 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); GstFlowReturn gst_pad_alloc_buffer (GstPad *pad, guint64 offset, gint size, GstCaps *caps, GstBuffer **buf); GstFlowReturn gst_pad_alloc_buffer_and_set_caps (GstPad *pad, guint64 offset, gint size, GstCaps *caps, GstBuffer **buf); void gst_pad_set_bufferalloc_function (GstPad *pad, GstPadBufferAllocFunction bufalloc); GstFlowReturn (*GstPadBufferAllocFunction) (GstPad *pad, guint64 offset, guint size, GstCaps *caps, GstBuffer **buf); 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); void gst_pad_set_checkgetrange_function (GstPad *pad, GstPadCheckGetRangeFunction check); gboolean (*GstPadCheckGetRangeFunction) (GstPad *pad); 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* gst_pad_proxy_getcaps (GstPad *pad); void gst_pad_set_setcaps_function (GstPad *pad, GstPadSetCapsFunction setcaps); gboolean (*GstPadSetCapsFunction) (GstPad *pad, GstCaps *caps); gboolean gst_pad_proxy_setcaps (GstPad *pad, GstCaps *caps); 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); GstCaps* gst_pad_get_fixed_caps_func (GstPad *pad); 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); gboolean gst_pad_check_pull_range (GstPad *pad); 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_internal_link_function (GstPad *pad, GstPadIntLinkFunction intlink); GList* (*GstPadIntLinkFunction) (GstPad *pad); GList* gst_pad_get_internal_links (GstPad *pad); GList* gst_pad_get_internal_links_default (GstPad *pad); void gst_pad_load_and_link (xmlNodePtr self, GstObject *parent); gboolean gst_pad_dispatcher (GstPad *pad, GstPadDispatcherFunction dispatch, gpointer data); gboolean (*GstPadDispatcherFunction) (GstPad *pad, gpointer data); void gst_pad_set_element_private (GstPad *pad, gpointer priv); gpointer gst_pad_get_element_private (GstPad *pad); 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_CAPS (pad) #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) #define GST_FLOW_IS_FATAL (ret) #define GST_FLOW_IS_SUCCESS (ret)
"caps" GstCaps* : Read "direction" GstPadDirection : Read / Write / Construct Only "template" GstPadTemplate* : Read / Write
"have-data" : Run Last / Has Details "linked" : Run Last "request-link" : Run Last "unlinked" : Run Last
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)
typedef struct { gpointer element_private; GstPadTemplate *padtemplate; GstPadDirection direction; /* streaming rec_lock */ GStaticRecMutex *stream_rec_lock; GstTask *task; GMutex *preroll_lock; GCond *preroll_cond; /* block cond, mutex is from the object */ GCond *block_cond; GstPadBlockCallback block_callback; gpointer block_data; /* the pad capabilities */ GstCaps *caps; GstPadGetCapsFunction getcapsfunc; GstPadSetCapsFunction setcapsfunc; GstPadAcceptCapsFunction acceptcapsfunc; GstPadFixateCapsFunction fixatecapsfunc; GstPadActivateFunction activatefunc; GstPadActivateModeFunction activatepushfunc; GstPadActivateModeFunction activatepullfunc; /* pad link */ GstPadLinkFunction linkfunc; GstPadUnlinkFunction unlinkfunc; GstPad *peer; gpointer sched_private; /* data transport functions */ GstPadChainFunction chainfunc; GstPadCheckGetRangeFunction checkgetrangefunc; GstPadGetRangeFunction getrangefunc; GstPadEventFunction eventfunc; GstActivateMode mode; /* generic query method */ GstPadQueryTypeFunction querytypefunc; GstPadQueryFunction queryfunc; /* internal links */ GstPadIntLinkFunction intlinkfunc; GstPadBufferAllocFunction bufferallocfunc; /* whether to emit signals for have-data. counts number * of handlers attached. */ gint do_buffer_signals; gint do_event_signals; /* ABI added */ /* iterate internal links */ GstPadIterIntLinkFunction iterintlinkfunc; /* free block_data */ GDestroyNotify block_destroy_data; } GstPad;
The GstPad structure. Use the functions to update the variables.
gpointer element_private ; |
private data owned by the parent element |
GstPadTemplate *padtemplate ; |
padtemplate for this pad |
GstPadDirection direction ; |
the direction of the pad, cannot change after creating the pad. |
GStaticRecMutex *stream_rec_lock ; |
recursive stream lock of the pad, used to protect the data used in streaming. |
GstTask *task ; |
task for this pad if the pad is actively driving dataflow. |
GMutex *preroll_lock ; |
lock used when prerolling |
GCond *preroll_cond ; |
conf to signal preroll |
GCond *block_cond ; |
conditional to signal pad block |
GstPadBlockCallback block_callback ; |
callback for the pad block if any |
gpointer block_data ; |
user data for block_callback
|
GstCaps *caps ; |
the current caps of the pad |
GstPadGetCapsFunction getcapsfunc ; |
function to get caps of the pad |
GstPadSetCapsFunction setcapsfunc ; |
function to set caps on the pad |
GstPadAcceptCapsFunction acceptcapsfunc ; |
function to check if pad can accept caps |
GstPadFixateCapsFunction fixatecapsfunc ; |
function to fixate caps |
GstPadActivateFunction activatefunc ; |
pad activation function |
GstPadActivateModeFunction activatepushfunc ; |
function to activate/deactivate pad in push mode |
GstPadActivateModeFunction activatepullfunc ; |
function to activate/deactivate pad in pull mode |
GstPadLinkFunction linkfunc ; |
function called when pad is linked |
GstPadUnlinkFunction unlinkfunc ; |
function called when pad is unlinked |
GstPad *peer ; |
the pad this pad is linked to |
gpointer sched_private ; |
private storage for the scheduler |
GstPadChainFunction chainfunc ; |
function to chain buffer to pad |
GstPadCheckGetRangeFunction checkgetrangefunc ; |
function to check if pad can operate in pull mode |
GstPadGetRangeFunction getrangefunc ; |
function to get a range of data from a pad |
GstPadEventFunction eventfunc ; |
function to send an event to a pad |
GstActivateMode mode ; |
current activation mode of the pad |
GstPadQueryTypeFunction querytypefunc ; |
get list of supported queries |
GstPadQueryFunction queryfunc ; |
perform a query on the pad |
GstPadIntLinkFunction intlinkfunc ; |
get the internal links of this pad |
GstPadBufferAllocFunction bufferallocfunc ; |
function to allocate a buffer for this pad |
gint do_buffer_signals ; |
counter counting installed buffer signals |
gint do_event_signals ; |
counter counting installed event signals |
GstPadIterIntLinkFunction iterintlinkfunc ; |
get the internal links iterator of this pad |
GDestroyNotify block_destroy_data ; |
notify function for gst_pad_set_blocked_async_full()
|
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_IN_SETCAPS = (GST_OBJECT_FLAG_LAST << 3), GST_PAD_BLOCKING = (GST_OBJECT_FLAG_LAST << 4), /* padding */ GST_PAD_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 8) } GstPadFlags;
Pad state flags
GST_PAD_BLOCKED
|
is dataflow on a pad blocked |
GST_PAD_FLUSHING
|
is pad refusing buffers |
GST_PAD_IN_GETCAPS
|
GstPadGetCapsFunction() is running now
|
GST_PAD_IN_SETCAPS
|
GstPadSetCapsFunction() is running now
|
GST_PAD_BLOCKING
|
is pad currently blocking on a buffer or event |
GST_PAD_FLAG_LAST
|
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.
#define GST_PAD_LINK_FAILED(ret) ((ret) < GST_PAD_LINK_OK)
Macro to test if the given GstPadLinkReturn value indicates a failed link step.
ret : |
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.
ret : |
the GstPadLinkReturn value |
typedef enum { /* custom success starts here */ 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 } 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.
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.
#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.
pad : |
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.
pad : |
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.
pad : |
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.
pad : |
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. |
GstPadTemplate* gst_pad_get_pad_template (GstPad *pad);
Gets the template for pad
.
pad : |
a GstPad. |
Returns : | the GstPadTemplate from which this pad was instantiated, or NULL
if this pad has no template.
FIXME: currently returns an unrefcounted padtemplate.
|
GstPadLinkReturn gst_pad_link (GstPad *srcpad, GstPad *sinkpad);
Links the source pad and the sink pad.
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 : |
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);
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_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.
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.
const GstCaps* gst_pad_get_pad_template_caps (GstPad *pad);
Gets the capabilities for pad
's template.
pad : |
a GstPad to get the template capabilities from. |
Returns : | the GstCaps of this pad template. If you intend to keep a
reference on the caps, make a copy (see gst_caps_copy() ).
|
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);
Gets the capabilities of the peer connected to this pad.
void gst_pad_use_fixed_caps (GstPad *pad);
A helper function you can use that sets the
gst_pad_get_fixed_caps_func
as the getcaps function for the
pad. This way the 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 _set_caps()
has been called
on it, cannot be renegotiated to something else.
pad : |
the pad to use |
gboolean gst_pad_is_active (GstPad *pad);
Query if a pad is active
pad : |
the GstPad to query |
Returns : | TRUE if the pad is active. MT safe. |
gboolean gst_pad_set_blocked (GstPad *pad, gboolean blocked);
Blocks or unblocks the dataflow on a pad. This function is
a shortcut for gst_pad_set_blocked_async()
with a NULL
callback.
pad : |
the GstPad to block or unblock |
blocked : |
boolean indicating we should block or unblock |
Returns : | TRUE if the pad could be blocked. This function can fail if the wrong parameters were passed or the pad was already in the requested state. MT safe. |
gboolean gst_pad_set_blocked_async (GstPad *pad, gboolean blocked, GstPadBlockCallback callback, gpointer user_data);
Blocks or unblocks the dataflow on a pad. The provided callback is called when the operation succeeds; this happens right before the next attempt at pushing a buffer on the pad.
This can take a while as the pad can only become blocked when real dataflow is happening. When the pipeline is stalled, for example in PAUSED, this can take an indeterminate amount of time. You can pass NULL as the callback to make this call block. Be careful with this blocking call as it might not return for reasons stated above.
pad : |
the GstPad to block or unblock |
blocked : |
boolean indicating whether the pad should be blocked or unblocked |
callback : |
GstPadBlockCallback that will be called when the operation succeeds |
user_data : |
user data passed to the callback |
Returns : | TRUE if the pad could be blocked. This function can fail if the wrong parameters were passed or the pad was already in the requested state. MT safe. |
gboolean gst_pad_set_blocked_async_full (GstPad *pad, gboolean blocked, GstPadBlockCallback callback, gpointer user_data, GDestroyNotify destroy_data);
Blocks or unblocks the dataflow on a pad. The provided callback is called when the operation succeeds; this happens right before the next attempt at pushing a buffer on the pad.
This can take a while as the pad can only become blocked when real dataflow is happening. When the pipeline is stalled, for example in PAUSED, this can take an indeterminate amount of time. You can pass NULL as the callback to make this call block. Be careful with this blocking call as it might not return for reasons stated above.
pad : |
the GstPad to block or unblock |
blocked : |
boolean indicating whether the pad should be blocked or unblocked |
callback : |
GstPadBlockCallback that will be called when the operation succeeds |
user_data : |
user data passed to the callback |
destroy_data : |
GDestroyNotify for user_data |
Returns : | TRUE if the pad could be blocked. This function can fail if the wrong parameters were passed or the pad was already in the requested state. MT safe. |
Since 0.10.23
void (*GstPadBlockCallback) (GstPad *pad, gboolean blocked, gpointer user_data);
Callback used by gst_pad_set_blocked_async()
. Gets called when the blocking
operation succeeds.
pad : |
the GstPad that is blockend or unblocked. |
blocked : |
blocking state for the pad |
user_data : |
the gpointer to optional user data. |
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()
).
pad : |
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.
pad : |
the GstPad to query |
Returns : | TRUE if the pad is blocking. MT safe. |
Since 0.10.11
gulong gst_pad_add_data_probe (GstPad *pad, GCallback handler, gpointer data);
Adds a "data probe" to a pad. This function will be called whenever data
passes through a pad. In this case data means both events and buffers. The
probe will be called with the data as an argument, meaning handler
should
have the same callback signature as the "have-data" signal.
Note that the data will have a reference count greater than 1, so it will
be immutable -- you must not change it.
For source pads, the probe will be called after the blocking function, if any
(see gst_pad_set_blocked_async()
), but before looking up the peer to chain
to. For sink pads, the probe function will be called before configuring the
sink with new caps, if any, and before calling the pad's chain function.
Your data probe should return TRUE to let the data continue to flow, or FALSE to drop it. Dropping data is rarely useful, but occasionally comes in handy with events.
Although probes are implemented internally by connecting handler
to the
have-data signal on the pad, if you want to remove a probe it is insufficient
to only call g_signal_handler_disconnect on the returned handler id. To
remove a probe, use the appropriate function, such as
gst_pad_remove_data_probe()
.
pad : |
pad to add the data probe handler to |
handler : |
function to call when data is passed over pad |
data : |
data to pass along with the handler |
Returns : | The handler id. |
gulong gst_pad_add_data_probe_full (GstPad *pad, GCallback handler, gpointer data, GDestroyNotify notify);
Adds a "data probe" to a pad. This function will be called whenever data
passes through a pad. In this case data means both events and buffers. The
probe will be called with the data as an argument, meaning handler
should
have the same callback signature as the "have-data" signal.
Note that the data will have a reference count greater than 1, so it will
be immutable -- you must not change it.
For source pads, the probe will be called after the blocking function, if any
(see gst_pad_set_blocked_async()
), but before looking up the peer to chain
to. For sink pads, the probe function will be called before configuring the
sink with new caps, if any, and before calling the pad's chain function.
Your data probe should return TRUE to let the data continue to flow, or FALSE to drop it. Dropping data is rarely useful, but occasionally comes in handy with events.
Although probes are implemented internally by connecting handler
to the
have-data signal on the pad, if you want to remove a probe it is insufficient
to only call g_signal_handler_disconnect on the returned handler id. To
remove a probe, use the appropriate function, such as
gst_pad_remove_data_probe()
.
The notify
function is called when the probe is disconnected and usually
used to free data
.
pad : |
pad to add the data probe handler to |
handler : |
function to call when data is passed over pad |
data : |
data to pass along with the handler |
notify : |
function to call when the probe is disconnected, or NULL |
Returns : | The handler id. |
Since 0.10.20
gulong gst_pad_add_buffer_probe (GstPad *pad, GCallback handler, gpointer data);
Adds a probe that will be called for all buffers passing through a pad. See
gst_pad_add_data_probe()
for more information.
pad : |
pad to add the buffer probe handler to |
handler : |
function to call when buffers are passed over pad |
data : |
data to pass along with the handler |
Returns : | The handler id |
gulong gst_pad_add_buffer_probe_full (GstPad *pad, GCallback handler, gpointer data, GDestroyNotify notify);
Adds a probe that will be called for all buffers passing through a pad. See
gst_pad_add_data_probe()
for more information.
The notify
function is called when the probe is disconnected and usually
used to free data
.
pad : |
pad to add the buffer probe handler to |
handler : |
function to call when buffer are passed over pad |
data : |
data to pass along with the handler |
notify : |
function to call when the probe is disconnected, or NULL |
Returns : | The handler id |
Since 0.10.20
gulong gst_pad_add_event_probe (GstPad *pad, GCallback handler, gpointer data);
Adds a probe that will be called for all events passing through a pad. See
gst_pad_add_data_probe()
for more information.
pad : |
pad to add the event probe handler to |
handler : |
function to call when events are passed over pad |
data : |
data to pass along with the handler |
Returns : | The handler id |
gulong gst_pad_add_event_probe_full (GstPad *pad, GCallback handler, gpointer data, GDestroyNotify notify);
Adds a probe that will be called for all events passing through a pad. See
gst_pad_add_data_probe()
for more information.
The notify
function is called when the probe is disconnected and usually
used to free data
.
pad : |
pad to add the event probe handler to |
handler : |
function to call when events are passed over pad |
data : |
data to pass along with the handler, or NULL |
notify : |
function to call when probe is disconnected, or NULL |
Returns : | The handler id |
Since 0.10.20
void gst_pad_remove_data_probe (GstPad *pad, guint handler_id);
Removes a data probe from pad
.
pad : |
pad to remove the data probe handler from |
handler_id : |
handler id returned from gst_pad_add_data_probe |
void gst_pad_remove_buffer_probe (GstPad *pad, guint handler_id);
Removes a buffer probe from pad
.
pad : |
pad to remove the buffer probe handler from |
handler_id : |
handler id returned from gst_pad_add_buffer_probe |
void gst_pad_remove_event_probe (GstPad *pad, guint handler_id);
Removes an event probe from pad
.
pad : |
pad to remove the event probe handler from |
handler_id : |
handler id returned from gst_pad_add_event_probe |
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.
name : |
the name of the new pad. |
direction : |
the GstPadDirection of the pad. |
Returns : | a new GstPad, or NULL in case of an error. MT safe. |
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.
templ : |
the pad template to use |
name : |
the name of the element |
Returns : | a new GstPad, or NULL in case of an error. |
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.
templ : |
the GstStaticPadTemplate to use |
name : |
the name of the element |
Returns : | a new GstPad, or NULL in case of an error. |
GstFlowReturn gst_pad_alloc_buffer (GstPad *pad, guint64 offset, gint size, GstCaps *caps, GstBuffer **buf);
Allocates a new, empty buffer optimized to push to pad pad
. This
function only works if pad
is a source pad and has a peer.
A new, empty GstBuffer will be put in the buf
argument.
You need to check the caps of the buffer after performing this
function and renegotiate to the format if needed. If the caps changed, it is
possible that the buffer returned in buf
is not of the right size for the
new format, buf
needs to be unreffed and reallocated if this is the case.
pad : |
a source GstPad |
offset : |
the offset of the new buffer in the stream |
size : |
the size of the new buffer |
caps : |
the caps of the new buffer |
buf : |
a newly allocated buffer |
Returns : | a result code indicating success of the operation. Any
result code other than GST_FLOW_OK is an error and buf should
not be used.
An error can occur if the pad is not connected or when the downstream
peer elements cannot provide an acceptable buffer.
MT safe.
|
GstFlowReturn gst_pad_alloc_buffer_and_set_caps (GstPad *pad, guint64 offset, gint size, GstCaps *caps, GstBuffer **buf);
In addition to the function gst_pad_alloc_buffer()
, this function
automatically calls gst_pad_set_caps()
when the caps of the
newly allocated buffer are different from the pad
caps.
After a renegotiation, the size of the new buffer returned in buf
could
be of the wrong size for the new format and must be unreffed an reallocated
in that case.
pad : |
a source GstPad |
offset : |
the offset of the new buffer in the stream |
size : |
the size of the new buffer |
caps : |
the caps of the new buffer |
buf : |
a newly allocated buffer |
Returns : | a result code indicating success of the operation. Any
result code other than GST_FLOW_OK is an error and buf should
not be used.
An error can occur if the pad is not connected or when the downstream
peer elements cannot provide an acceptable buffer.
MT safe.
|
void gst_pad_set_bufferalloc_function (GstPad *pad, GstPadBufferAllocFunction bufalloc);
Sets the given bufferalloc function for the pad. Note that the bufferalloc function can only be set on sinkpads.
pad : |
a sink GstPad. |
bufalloc : |
the GstPadBufferAllocFunction to set. |
GstFlowReturn (*GstPadBufferAllocFunction) (GstPad *pad, guint64 offset, guint size, GstCaps *caps, GstBuffer **buf);
Ask the sinkpad pad
to allocate a buffer with offset
, size
and caps
.
The result will be stored in buf
.
The purpose of this function is to allocate a buffer that is optimal to
be processed by pad
. The function is mostly overridden by elements that can
provide a hardware buffer in order to avoid additional memcpy operations.
The function can return a buffer that has caps different from the requested
caps
, in which case the upstream element requests a format change to this
new caps.
If a format change was requested, the returned buffer will be one to hold
the data of said new caps, so its size might be different from the requested
size
.
When this function returns anything else than GST_FLOW_OK, the buffer allocation
failed and buf
does not contain valid data. If the function returns GST_FLOW_OK and
the buf
is NULL, a GstBuffer will be created with caps
, offset
and size
.
By default this function returns a new buffer of size
and with caps
containing
purely malloced data. The buffer should be freed with gst_buffer_unref()
after usage.
pad : |
a sink GstPad |
offset : |
the desired offset of the buffer |
size : |
the desired size of the buffer |
caps : |
the desired caps of the buffer |
buf : |
pointer to hold the allocated buffer. |
Returns : | GST_FLOW_OK if buf contains a valid buffer, any other return
value means buf does not hold a valid buffer.
|
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.
pad : |
a sink GstPad. |
chain : |
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.
pad : |
the sink GstPad that performed the chain. |
buffer : |
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.
pad : |
a sink GstPad. |
chainlist : |
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.
pad : |
the sink GstPad that performed the chain. |
list : |
the GstBufferList that is chained, not NULL .
|
Returns : | GST_FLOW_OK for success |
void gst_pad_set_checkgetrange_function (GstPad *pad, GstPadCheckGetRangeFunction check);
Sets the given checkgetrange function for the pad. Implement this function on a pad if you dynamically support getrange based scheduling on the pad.
pad : |
a source GstPad. |
check : |
the GstPadCheckGetRangeFunction to set. |
gboolean (*GstPadCheckGetRangeFunction) (GstPad *pad);
Check if pad
can be activated in pull mode.
This function will be deprecated after 0.10; use the seeking query to check if a pad can support random access.
pad : |
a GstPad |
Returns : | TRUE if the pad can operate in pull mode. |
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.
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.
pad : |
a src GstPad, returns GST_FLOW_ERROR if not. |
offset : |
The start offset of the buffer |
size : |
The length of the buffer |
buffer : |
a pointer to hold the GstBuffer, returns GST_FLOW_ERROR if NULL .
|
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.
pad : |
a source GstPad. |
get : |
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
might be smaller than length
when offset
is near
the end of the stream.
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
.
pad : |
the src GstPad to perform the getrange on. |
offset : |
the offset of the range |
length : |
the length of the range |
buffer : |
a memory location to hold the result buffer, cannot be NULL. |
Returns : | GST_FLOW_OK for success |
void gst_pad_set_event_function (GstPad *pad, GstPadEventFunction event);
Sets the given event handler for the pad.
pad : |
a GstPad of either direction. |
event : |
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.
pad : |
a GstPad. |
link : |
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.
pad : |
a GstPad. |
unlink : |
the GstPadUnlinkFunction to set. |
void (*GstPadUnlinkFunction) (GstPad *pad);
Function signature to handle a unlinking the pad prom its peer.
pad : |
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.
pad : |
a GstPad. |
acceptcaps : |
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.
pad : |
a GstPad. |
getcaps : |
the GstPadGetCapsFunction to set. |
GstCaps* (*GstPadGetCapsFunction) (GstPad *pad);
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);
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 aggregator.
pad : |
a GstPad to proxy. |
Returns : | the intersection of the other pads' allowed caps. |
void gst_pad_set_setcaps_function (GstPad *pad, GstPadSetCapsFunction setcaps);
Sets the given setcaps function for the pad. The setcaps function will be called whenever a buffer with a new media type is pushed or pulled from the pad. The pad/element needs to update its internal structures to process the new media type. If this new type is not acceptable, the setcaps function should return FALSE.
pad : |
a GstPad. |
setcaps : |
the GstPadSetCapsFunction to set. |
gboolean (*GstPadSetCapsFunction) (GstPad *pad, GstCaps *caps);
Set caps
on pad
. By default this function updates the caps of the
pad but the function can be overriden by elements to perform extra
actions or verifications.
gboolean gst_pad_proxy_setcaps (GstPad *pad, GstCaps *caps);
Calls gst_pad_set_caps()
for every other pad belonging to the
same element as pad
. If gst_pad_set_caps()
fails on any pad,
the proxy setcaps fails. May be used only during negotiation.
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.
pad : |
a GstPad. |
fixatecaps : |
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.
GstCaps* gst_pad_get_fixed_caps_func (GstPad *pad);
A helper function you can use as a GetCaps function that will return the currently negotiated caps or the padtemplate when NULL.
pad : |
the pad to use |
Returns : | The currently negotiated caps or the padtemplate. |
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.
pad : |
a GstPad. |
activate : |
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.
pad : |
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.
pad : |
a GstPad. |
activatepush : |
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.
pad : |
a GstPad. |
activatepull : |
the GstPadActivateModeFunction to set. |
gboolean (*GstPadActivateModeFunction) (GstPad *pad, gboolean active);
The prototype of the push and pull activate functions.
pad : |
a GstPad |
active : |
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 an installed pad block before triggering any installed pad probes.
If the caps on buffer
are different from the currently configured caps on
pad
, this function will call any installed setcaps function on pad
(see
gst_pad_set_setcaps_function()
). In case of failure to renegotiate the new
format, this function returns GST_FLOW_NOT_NEGOTIATED.
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.
pad : |
a source GstPad, returns GST_FLOW_ERROR if not. |
buffer : |
the GstBuffer to push returns GST_FLOW_ERROR if not. |
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 an installed pad block before triggering any installed pad probes.
If the caps on the first buffer in the first group of list
are different
from the currently configured caps on pad
, this function will call any
installed setcaps function on pad
(see gst_pad_set_setcaps_function()
). In
case of failure to renegotiate the new format, this function returns
GST_FLOW_NOT_NEGOTIATED.
If there are any probes installed on pad
every group of the buffer list
will be merged into a normal GstBuffer and pushed via gst_pad_push and the
buffer list will be unreffed.
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.
pad : |
a source GstPad, returns GST_FLOW_ERROR if not. |
list : |
the GstBufferList to push returns GST_FLOW_ERROR if not. |
Returns : | a GstFlowReturn from the peer pad. MT safe. |
Since 0.10.24
gboolean gst_pad_check_pull_range (GstPad *pad);
Checks if a gst_pad_pull_range()
can be performed on the peer
source pad. This function is used by plugins that want to check
if they can use random access on the peer source pad.
The peer sourcepad can implement a custom GstPadCheckGetRangeFunction if it needs to perform some logic to determine if pull_range is possible.
pad : |
a sink GstPad. |
Returns : | a gboolean with the result. MT safe. |
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.
pad : |
a sink GstPad, returns GST_FLOW_ERROR if not. |
offset : |
The start offset of the buffer |
size : |
The length of the buffer |
buffer : |
a pointer to hold the GstBuffer, returns GST_FLOW_ERROR if NULL .
|
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.
pad : |
the GstPad to activate or deactivate. |
active : |
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.
pad : |
the GstPad to activate or deactivate. |
active : |
whether the pad should be active or not. |
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, GstEvent *event);
Invokes the default event handler for the given pad. End-of-stream and
discontinuity events are handled specially, and then the event 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 an event.
Multi-sinkpad elements should implement custom event handlers.
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 in gstquery.h. The element 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.
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.
pad : |
a GstPad to invoke the peer query on. |
query : |
the GstQuery to perform. |
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.
pad : |
a GstPad of either direction. |
query : |
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.
pad : |
a GstPad of either direction. |
type_func : |
the GstPadQueryTypeFunction to set. |
const GstQueryType* (*GstPadQueryTypeFunction) (GstPad *pad);
The signature of the query types function.
pad : |
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.
pad : |
a GstPad. |
Returns : | a zero-terminated array of GstQueryType. |
const GstQueryType* gst_pad_get_query_types_default (GstPad *pad);
Invoke the default dispatcher for the query types on the pad.
pad : |
a GstPad. |
Returns : | an zero-terminated array of GstQueryType, or NULL if none of the internally-linked pads has a query types function. |
void gst_pad_set_iterate_internal_links_function (GstPad *pad, GstPadIterIntLinkFunction iterintlink);
Sets the given internal link iterator function for the pad.
pad : |
a GstPad of either direction. |
iterintlink : |
the GstPadIterIntLinkFunction to set. |
Since 0.10.21
GstIterator* (*GstPadIterIntLinkFunction) (GstPad *pad);
The signature of the internal pad link iterator function.
pad : |
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.
pad : |
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.
|
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()
.
pad : |
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_internal_link_function (GstPad *pad, GstPadIntLinkFunction intlink);
gst_pad_set_internal_link_function
is deprecated and should not be used in newly-written code. Use the thread-safe gst_pad_set_iterate_internal_links_function()
Sets the given internal link function for the pad.
pad : |
a GstPad of either direction. |
intlink : |
the GstPadIntLinkFunction to set. |
GList* (*GstPadIntLinkFunction) (GstPad *pad);
GstPadIntLinkFunction
is deprecated and should not be used in newly-written code. use the threadsafe GstPadIterIntLinkFunction instead.
The signature of the internal pad link function.
pad : |
The GstPad to query. |
Returns : | a newly allocated GList of pads that are linked to the given pad on
the inside of the parent element.
The caller must call g_list_free() on it after use.
|
GList* gst_pad_get_internal_links (GstPad *pad);
gst_pad_get_internal_links
is deprecated and should not be used in newly-written code. This function does not ref the pads in the list so that they
could become invalid by the time the application accesses them. It's also
possible that the list changes while handling the pads, which the caller of
this function is unable to know. Use the thread-safe
gst_pad_iterate_internal_links()
instead.
Gets a list of pads to which the given pad is linked to inside of the parent element. The caller must free this list after use.
Not MT safe.
pad : |
the GstPad to get the internal links of. |
Returns : | a newly allocated GList of pads, free with g_list_free() .
|
GList* gst_pad_get_internal_links_default (GstPad *pad);
gst_pad_get_internal_links_default
is deprecated and should not be used in newly-written code. This function does not ref the pads in the list so that they
could become invalid by the time the application accesses them. It's also
possible that the list changes while handling the pads, which the caller of
this function is unable to know. Use the thread-safe
gst_pad_iterate_internal_links_default()
instead.
Gets a list of pads to which the given pad is linked to inside of the parent element. This is the default handler, and thus returns a list of all of the pads inside the parent element with opposite direction.
The caller must free this list after use with g_list_free()
.
pad : |
the GstPad to get the internal links of. |
Returns : | a newly allocated GList of pads, or NULL if the pad has no parent. Not MT safe. |
void gst_pad_load_and_link (xmlNodePtr self, GstObject *parent);
Reads the pad definition from the XML node and links the given pad in the element to a pad of an element up in the hierarchy.
self : |
an xmlNodePtr to read the description from. |
parent : |
the GstObject element that owns the pad. |
gboolean gst_pad_dispatcher (GstPad *pad, GstPadDispatcherFunction dispatch, gpointer data);
Invokes the given dispatcher function on each respective peer of all pads that are internally linked to the given pad. The GstPadDispatcherFunction should return TRUE when no further pads need to be processed.
pad : |
a GstPad to dispatch. |
dispatch : |
the GstDispatcherFunction to call. |
data : |
gpointer user data passed to the dispatcher function. |
Returns : | TRUE if one of the dispatcher functions returned TRUE. |
gboolean (*GstPadDispatcherFunction) (GstPad *pad, gpointer data);
A dispatcher function is called for all internally linked pads, see
gst_pad_dispatcher()
.
pad : |
the GstPad that is dispatched. |
data : |
the gpointer to optional user data. |
Returns : | TRUE if the dispatching procedure has to be stopped. |
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.
pad : |
the GstPad to set the private data of. |
priv : |
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.
pad : |
the GstPad to get the private data of. |
Returns : | a gpointer to the private data. |
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 caps on buffer
are different from the current caps on pad
, this
function will call any setcaps function (see gst_pad_set_setcaps_function()
)
installed on pad
. If the new caps are not acceptable for pad
, 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.
pad : |
a sink GstPad, returns GST_FLOW_ERROR if not. |
buffer : |
the GstBuffer to send, return GST_FLOW_ERROR if not. |
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 the caps on the first buffer of list
are different from the current
caps on pad
, this function will call any setcaps function
(see gst_pad_set_setcaps_function()
) installed on pad
. If the new caps
are not acceptable for pad
, 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.
pad : |
a sink GstPad, returns GST_FLOW_ERROR if not. |
list : |
the GstBufferList to send, return GST_FLOW_ERROR if not. |
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.
pad : |
the GstPad to start the task of |
func : |
the task function to call |
data : |
data passed to the task function |
Returns : | a TRUE if the task could be started.
|
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.
pad : |
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.
pad : |
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.
pad : |
the GstPad to activate or deactivate. |
active : |
whether or not the pad should be active. |
Returns : | TRUE if the operation was successful. MT safe. |
#define GST_PAD_CAPS(pad) (GST_PAD_CAST(pad)->caps)
The caps for this pad.
pad : |
a GstPad. |
#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
.
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
.
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.
pad : |
a GstPad |
t : |
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.
pad : |
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
.
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.
pad : |
a GstPad |
#define GST_FLOW_IS_FATAL(ret) ((ret) <= GST_FLOW_UNEXPECTED)
Macro to test if the given GstFlowReturn value indicates a fatal error. This macro is mainly used in elements driving the pipeline to decide whether an error message should be posted on the bus. Note that such elements may also need to post an error message in the GST_FLOW_NOT_LINKED case which is not caught by this macro.
ret : |
a GstFlowReturn value |
#define GST_FLOW_IS_SUCCESS(ret) ((ret) >= GST_FLOW_OK)
Macro to test if the given GstFlowReturn value indicates a successfull result This macro is mainly used in elements to decide if the processing of a buffer was successfull.
ret : |
a GstFlowReturn value |
Since 0.10.7
"direction"
property"direction" GstPadDirection : Read / Write / Construct Only
The direction of the pad.
Default value: GST_PAD_UNKNOWN
"have-data"
signalgboolean user_function (GstPad *pad, GstMiniObject *mini_obj, gpointer user_data) : Run Last / Has Details
Signals that new data is available on the pad. This signal is used internally for implementing pad probes. See gst_pad_add_*_probe functions.
pad : |
the pad that emitted the signal |
mini_obj : |
new data |
user_data : |
user data set when the signal handler was connected. |
Returns : | TRUE to keep the data, FALSE to drop it
|
"linked"
signalvoid user_function (GstPad *pad, GstPad *peer, gpointer user_data) : Run Last
Signals that a pad has been linked to the peer pad.
pad : |
the pad that emitted the signal |
peer : |
the peer pad that has been connected |
user_data : |
user data set when the signal handler was connected. |
"request-link"
signalvoid user_function (GstPad *pad, gpointer user_data) : Run Last
Signals that a pad connection has been requested.
pad : |
the pad that emitted the signal |
peer : |
the peer pad for which a connection is requested |
user_data : |
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.
pad : |
the pad that emitted the signal |
peer : |
the peer pad that has been disconnected |
user_data : |
user data set when the signal handler was connected. |