A Element is linked to other elements via "pads", which are extremely light-weight
generic link points. After two pads are retrieved from an element with get_pad, the
pads can be link with link. (For quick links, you can also use
link, which will make the obvious link for you if it's straightforward.) Pads are
typically created from a PadTemplate with
Pad.from_template. Pads have
Caps attached to it to describe the media type they are capable of dealing with.
get_caps and 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 Pad, 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
Element that owns the pad. A
Element 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 push and
pull_range to push out or pull in a buffer. To send a Event on a pad, use
send_event and push_event. Last
reviewed on 2006-07-06 (0.10.9)
gst_pad_add_data_probe for more information. The notify function is called when the probe is disconnected and
usually used to free data.
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
remove_data_probe. The notify function is called when the
probe is disconnected and usually used to free data.
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. This function only works if
pad is a source pad and has a peer. A new, empty Buffer 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. result code other than
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.
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. result code other than
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.
pad. The function returns
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
set_setcaps_function) installed on pad. If the new caps
are not acceptable for pad, this function returns
NOT_NEGOTIATED. The function proceeds calling the chain function installed on pad (see
set_chain_function) and the return value of that function is returned
to the caller. 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. MT safe.
pad. The function returns
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
set_setcaps_function) installed on pad. If the new caps
are not acceptable for pad, this function returns
NOT_NEGOTIATED. The function proceeds calling the chainlist function installed on pad (see
set_chain_list_function) and the return value of that function is
returned to the caller. 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. 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.
pad
and its peer. The caller owns a reference on the resulting caps. caps when you no longer need it. This function returns NULL
when pad has no peer. MT safe.
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. MT safe.
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. the caps when you no longer need it. This function
returns NULL when the pad has no peer or is not negotiated yet. MT safe.
pad. instantiated, or null if this pad has no
template.
pad's template. to keep a reference on the caps, make a copy
(see copy).
pad, cast to a
Element. If a pad has no parent or its parent is not an element, return NULL. reference on the parent, so unref
when you're finished with it. MT safe.
pad. This function refs the peer pad so you need to unref it after use.
MT safe.
pad is flushing this function returns
WRONG_STATE immediatly and buffer is null.
Calls the getrange function of pad, see PadGetRangeFunction
for a description of a getrange function. If pad has no getrange function installed (see
set_getrange_function) this function returns
NOT_SUPPORTED. This is a lowlevel function. Usualy
pull_range is used. MT safe.
pad is linked to another pad or not. MT safe.
gst_iterator_free after usage.
gst_iterator_free. returned pad with
unref.
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. has no task.
pad accepts caps. If pad has no peer, this
function returns TRUE.
pad. The
caller is responsible for both the allocation and deallocation of the query structure. if pad has no peer.
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.
buffer from the peer pad. This function will first trigger the pad block signal
if it was installed. When pad is not linked NOT_LINKED
is returned else this function returns the result of get_range on the peer pad.
See get_range for a list of return values and for the semantics of the arguments
of this function. configured on pad. Renegotiation within a running pull-mode pipeline is not supported. When this
function returns OK, buffer will contain a valid
Buffer that should be freed with unref
after usage. OK is returned. MT safe.
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
set_setcaps_function). In case of failure to renegotiate the new
format, this function returns NOT_NEGOTIATED. The function
proceeds calling chain on the peer pad and returns the value from that function. If
pad has no peer, NOT_LINKED will be returned. In all
cases, success or failure, the caller loses its reference to buffer after calling this function. MT safe.
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 set_setcaps_function). In case of failure to renegotiate the
new format, this function returns NOT_NEGOTIATED. If there are
any probes installed on pad every group of the buffer list will be merged into a normal
Buffer 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,
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
Buffer and chained via chain. In all cases, success or failure, the caller
loses its reference to list after calling this function. MT safe.
src_val in src_format to dest_format.
pad. Note that if there are many possible sink pads that are internally linked to Multi-sinkpad elements should
implement custom query handlers.
src_val in src_format to
dest_format.
pad.
pad.
pad.
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 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 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
EventTypeFlags, get_flags,
is_upstream,
is_downstream, and 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 ref it if you want to
reuse the event after this call.
pad. The activate function will dispatch to
activate_push or
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.
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 activate_push or
activate_pull, as appropriate, with a FALSE argument. MT safe.
gst_pad_set_blocked_async with a NULL callback.
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, helps with autoplugging. Note that the return value from getcaps is
owned by the caller, so the caller should unref the caps after usage.
link is installed on a source pad, it should call the
PadLinkFunction of the peer sink pad, if present.
func with data. This function is mostly
used in pad activation functions to start the dataflow. The stream_lock of
pad will automatically be acquired before func is called.
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 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.
