Class: Gst::Pad

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Direct Known Subclasses

ProxyPad, GstBase::AggregatorPad

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Object

#add_control_binding, check_uniqueness, #control_bindings_disabled=, #control_rate, #control_rate=, default_deep_notify, #default_error, #get_control_binding, #get_g_value_array, #get_value, #get_value_array, #has_active_control_bindings, #has_ancestor, #has_as_ancestor, #has_as_parent, #name, #name=, #parent, #parent=, #path_string, #ref, ref_sink, #remove_control_binding, replace, #set_control_binding_disabled, #suggest_next_sync, #sync_values, #unparent, #unref

Constructor Details

#initialize(templ, name) ⇒ Gst::Pad

Creates a new pad with the given name from the given template. If name is nil, 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.

Parameters:

  • templ (Gst::PadTemplate)

    the pad template to use

  • name (String)

    the name of the pad

Class Method Details

Gets a string representing the given pad-link return.

Parameters:

Returns:

  • (String)

    a static string with the name of the pad-link return.

Instance Method Details

#activate_mode(mode, active) ⇒ Boolean

Activates or deactivates the given pad in mode via dispatching to the pad's activatemodefunc. For use from within pad activation functions only.

If you don't know what this is, you probably don't want to call it. MT safe.

Parameters:

  • mode (Gst::PadMode)

    the requested activation mode

  • active (Boolean)

    whether or not the pad should be active.

Returns:

  • (Boolean)

    true if the operation was successful.

#active=(active) ⇒ Boolean

Activates or deactivates the given pad. Normally called from within core state change functions.

If active, makes sure the pad is active. If it is already active, either in push or pull mode, just return. Otherwise dispatches to the pad's activate function to perform the actual activation.

If not active, calls gst_pad_activate_mode() with the pad's current mode and a false argument. MT safe.

Parameters:

  • active (Boolean)

    whether or not the pad should be active.

Returns:

  • (Boolean)

    true if the operation was successful.

#add_probe(mask, callback, user_data, destroy_data) ⇒ Gst::gulong

Be notified of different states of pads. The provided callback is called for every state that matches mask.

Probes are called in groups: First GST_PAD_PROBE_TYPE_BLOCK probes are called, then others, then finally GST_PAD_PROBE_TYPE_IDLE. The only exception here are GST_PAD_PROBE_TYPE_IDLE probes that are called immediately if the pad is already idle while calling gst_pad_add_probe(). In each of the groups, probes are called in the order in which they were added. probe with gst_pad_remove_probe(). When using GST_PAD_PROBE_TYPE_IDLE it can happen that the probe can be run immediately and if the probe returns GST_PAD_PROBE_REMOVE this functions returns 0.

MT safe.

Parameters:

  • mask (Gst::PadProbeType)

    the probe mask

  • callback (Gst::PadProbeCallback)

    Gst::PadProbeCallback that will be called with notifications of the pad state

  • user_data (GObject)

    user data passed to the callback

  • destroy_data (GLib::DestroyNotify)

    GDestroy::Notify for user_data

Returns:

  • (Gst::gulong)

    an id or 0 if no probe is pending. The id can be used to remove the

#allowed_capsGst::Caps

Gets the capabilities of the allowed media types that can flow through pad and its peer.

The allowed capabilities is calculated as the intersection of the results of calling gst_pad_query_caps() on pad and its peer. The caller owns a reference on the resulting caps. MT safe.

Returns:

  • (Gst::Caps)

    the allowed Gst::Caps of the pad link. Unref the caps when you no longer need it. This function returns nil when pad has no peer.

Checks if the source pad and the sink pad are compatible so they can be linked.

Parameters:

  • sinkpad (Gst::Pad)

    the sink Gst::Pad.

Returns:

  • (Boolean)

    true if the pads can be linked.

#capsGst::Caps

Returns caps.

Returns:

#caps=(caps) ⇒ Gst::Caps

Parameters:

Returns:

#chain(buffer) ⇒ Gst::FlowReturn

Chain a buffer to pad.

The function returns #GST_FLOW_FLUSHING if the pad was flushing.

If the buffer type is not acceptable for pad (as negotiated with a preceding 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. MT safe.

Parameters:

  • buffer (Gst::Buffer)

    the Gst::Buffer to send, return GST_FLOW_ERROR if not.

Returns:

#chain_list(list) ⇒ Gst::FlowReturn

Chain a bufferlist to pad.

The function returns #GST_FLOW_FLUSHING if the pad was flushing.

If pad was not negotiated properly with a CAPS event, this function returns #GST_FLOW_NOT_NEGOTIATED.

The function proceeds calling the chainlist function installed on pad (see gst_pad_set_chain_list_function()) and the return value of that function is returned to the caller. #GST_FLOW_NOT_SUPPORTED is returned if pad has no chainlist function.

In all cases, success or failure, the caller loses its reference to list after calling this function.

MT safe.

Parameters:

  • list (Gst::BufferList)

    the Gst::BufferList to send, return GST_FLOW_ERROR if not.

Returns:

#check_reconfigureBoolean

Check and clear the #GST_PAD_FLAG_NEED_RECONFIGURE flag on pad and return true if the flag was set.

Returns:

  • (Boolean)

    true is the GST_PAD_FLAG_NEED_RECONFIGURE flag was set on pad.

#create_stream_id(parent, stream_id) ⇒ String

Creates a stream-id for the source Gst::Pad pad by combining the upstream information with the optional stream_id of the stream of pad. pad must have a parent Gst::Element and which must have zero or one sinkpad. stream_id can only be nil if the parent element of pad has only a single source pad.

This function generates an unique stream-id by getting the upstream stream-start event stream ID and appending stream_id to it. If the element has no sinkpad it will generate an upstream stream-id by doing an URI query on the element and in the worst case just uses a random number. Source elements that don't implement the URI handler interface should ideally generate a unique, deterministic stream-id manually instead.

Since stream IDs are sorted alphabetically, any numbers in the stream ID should be printed with a fixed number of characters, preceded by 0's, such as by using the format %03u instead of %u.

Parameters:

  • parent (Gst::Element)

    Parent Gst::Element of pad

  • stream_id (String)

    The stream-id

Returns:

  • (String)

    A stream-id for pad. g_free() after usage.

#create_stream_id_printf(parent, stream_id, array) ⇒ String

Creates a stream-id for the source Gst::Pad pad by combining the upstream information with the optional stream_id of the stream of pad. pad must have a parent Gst::Element and which must have zero or one sinkpad. stream_id can only be nil if the parent element of pad has only a single source pad.

This function generates an unique stream-id by getting the upstream stream-start event stream ID and appending stream_id to it. If the element has no sinkpad it will generate an upstream stream-id by doing an URI query on the element and in the worst case just uses a random number. Source elements that don't implement the URI handler interface should ideally generate a unique, deterministic stream-id manually instead.

Parameters:

  • parent (Gst::Element)

    Parent Gst::Element of pad

  • stream_id (String)

    The stream-id

  • array (Array)

    parameters for the stream_id format string

Returns:

  • (String)

    A stream-id for pad. g_free() after usage.

#create_stream_id_printf_valist(parent, stream_id, var_args) ⇒ String

Creates a stream-id for the source Gst::Pad pad by combining the upstream information with the optional stream_id of the stream of pad. pad must have a parent Gst::Element and which must have zero or one sinkpad. stream_id can only be nil if the parent element of pad has only a single source pad.

This function generates an unique stream-id by getting the upstream stream-start event stream ID and appending stream_id to it. If the element has no sinkpad it will generate an upstream stream-id by doing an URI query on the element and in the worst case just uses a random number. Source elements that don't implement the URI handler interface should ideally generate a unique, deterministic stream-id manually instead.

Parameters:

  • parent (Gst::Element)

    Parent Gst::Element of pad

  • stream_id (String)

    The stream-id

  • var_args (Gst::va_list)

    parameters for the stream_id format string

Returns:

  • (String)

    A stream-id for pad. g_free() after usage.

#current_capsGst::Caps

Gets the capabilities currently configured on pad with the last #GST_EVENT_CAPS event. incremented ref-count or nil when pad has no caps. Unref after usage.

Returns:

  • (Gst::Caps)

    the current caps of the pad with

#directionGst::PadDirection

Returns direction.

Returns:

#direction=(direction) ⇒ Gst::PadDirection

Parameters:

Returns:

#element_privateGObject

Gets the private data of a pad. No locking is performed in this function.

Returns:

  • (GObject)

    a #gpointer to the private data.

#element_private=(priv) ⇒ nil

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.

Parameters:

  • priv (GObject)

    The private data to attach to the pad.

Returns:

  • (nil)

#event_default(parent, event) ⇒ Boolean

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 event is sent to all pads internally linked to pad. This function takes ownership of event.

Parameters:

  • parent (Gst::Object)

    the parent of pad or nil

  • event (Gst::Event)

    the Gst::Event to handle.

Returns:

  • (Boolean)

    true if the event was sent successfully.

#forward(forward, user_data) ⇒ Boolean

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.

Parameters:

  • forward (Gst::PadForwardFunction)

    a Gst::PadForwardFunction

  • user_data (GObject)

    user data passed to forward

Returns:

  • (Boolean)

    true if one of the dispatcher functions returned true.

#get_range(offset, size, buffer) ⇒ Gst::FlowReturn

When pad is flushing this function returns #GST_FLOW_FLUSHING immediately and buffer is nil.

Calls the getrange function of pad, see Gst::PadGetRangeFunction for a description of a getrange function. If pad has no getrange function installed (see gst_pad_set_getrange_function()) this function returns #GST_FLOW_NOT_SUPPORTED.

If buffer points to a variable holding nil, a valid new Gst::Buffer will be placed in buffer when this function returns #GST_FLOW_OK. The new buffer must be freed with gst_buffer_unref() after usage.

When buffer points to a variable that points to a valid Gst::Buffer, the buffer will be filled with the result data when this function returns #GST_FLOW_OK. If the provided buffer is larger than size, only size bytes will be filled in the result buffer and its size will be updated accordingly.

Note that less than size bytes can be returned in buffer when, for example, an EOS condition is near or when buffer is not large enough to hold size bytes. The caller should check the result buffer size to get the result size.

When this function returns any other result value than #GST_FLOW_OK, buffer will be unchanged.

This is a lowlevel function. Usually gst_pad_pull_range() is used. MT safe.

Parameters:

  • offset (Integer)

    The start offset of the buffer

  • size (Integer)

    The length of the buffer

  • buffer (Gst::Buffer)

    a pointer to hold the Gst::Buffer, returns #GST_FLOW_ERROR if nil.

Returns:

#get_sticky_event(event_type, idx) ⇒ Gst::Event

Returns a new reference of the sticky event of type event_type from the event. event_type or nil when no event of event_type was on pad. Unref after usage.

Parameters:

  • event_type (Gst::EventType)

    the Gst::EventType that should be retrieved.

  • idx (Integer)

    the index of the event

Returns:

  • (Gst::Event)

    a Gst::Event of type

#has_current_capsBoolean

Check if pad has caps set on it with a #GST_EVENT_CAPS event.

Returns:

  • (Boolean)

    true when pad has caps associated with it.

#is_activeBoolean

Query if a pad is active MT safe.

Returns:

  • (Boolean)

    true if the pad is active.

#is_blockedBoolean

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()). MT safe.

Returns:

  • (Boolean)

    true if the pad is blocked.

#is_blockingBoolean

Checks if the pad is blocking or not. This is a guaranteed state of whether the pad is actually blocking on a Gst::Buffer or a #GstEvent. MT safe.

Returns:

  • (Boolean)

    true if the pad is blocking.

#is_linkedBoolean

Checks if a pad is linked to another pad or not. MT safe.

Returns:

  • (Boolean)

    true if the pad is linked, false otherwise.

Gets an iterator for the pads to which the given pad is linked to inside of the parent element.

Each Gst::Pad element yielded by the iterator will have its refcount increased, so unref after use.

Free-function: gst_iterator_free

Returns:

  • (Gst::Iterator)

    a new Gst::Iterator of #GstPad or nil when the pad does not have an iterator function configured. Use gst_iterator_free() after usage.

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(). has no parent. Unref each returned pad with gst_object_unref().

Parameters:

Returns:

  • (Gst::Iterator)

    a Gst::Iterator of #GstPad, or nil if pad

#last_flow_returnGst::FlowReturn

Gets the Gst::FlowReturn return from the last data passed by this pad.

Returns:

Links the source pad and the sink pad. MT Safe.

Parameters:

  • sinkpad (Gst::Pad)

    the sink Gst::Pad to link.

Returns:

  • (Gst::PadLinkReturn)

    A result code indicating if the connection worked or what went wrong.

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 Gst::PadLinkCheck for more information.

MT Safe.

Parameters:

Returns:

  • (Gst::PadLinkReturn)

    A result code indicating if the connection worked or what went wrong.

Links src to sink, creating any Gst::GhostPad's in between as necessary.

This is a convenience function to save having to create and add intermediate Gst::GhostPad's as required for linking across #GstBin boundaries.

If src or sink pads don't have parent elements or do not share a common ancestor, the link will fail.

Parameters:

Returns:

  • (Boolean)

    whether the link succeeded.

Links src to sink, creating any Gst::GhostPad's in between as necessary.

This is a convenience function to save having to create and add intermediate Gst::GhostPad's as required for linking across #GstBin boundaries.

If src or sink pads don't have parent elements or do not share a common ancestor, the link will fail.

Calling gst_pad_link_maybe_ghosting_full() with flags == %GST_PAD_LINK_CHECK_DEFAULT is the recommended way of linking pads with safety checks applied.

Parameters:

Returns:

  • (Boolean)

    whether the link succeeded.

#mark_reconfigurenil

Mark a pad for needing reconfiguration. The next call to gst_pad_check_reconfigure() will return true after this call.

Returns:

  • (nil)

#needs_reconfigureBoolean

Check the #GST_PAD_FLAG_NEED_RECONFIGURE flag on pad and return true if the flag was set.

Returns:

  • (Boolean)

    true is the GST_PAD_FLAG_NEED_RECONFIGURE flag is set on pad.

#offsetInteger

The offset that will be applied to the running time of the pad.

Returns:

  • (Integer)

    offset

#offset=(offset) ⇒ Integer

The offset that will be applied to the running time of the pad.

Parameters:

  • offset (Integer)

Returns:

  • (Integer)

    offset

  • (Integer)

    offset

#pad_templateGst::PadTemplate

Gets the template for pad.

Returns:

  • (Gst::PadTemplate)

    the Gst::PadTemplate from which this pad was instantiated, or nil if this pad has no template. Unref after usage.

#pad_template_capsGst::Caps

Gets the capabilities for pad's template. Unref after usage.

Returns:

  • (Gst::Caps)

    the Gst::Caps of this pad template.

#parent_elementGst::Element

Gets the parent of pad, cast to a Gst::Element. If a pad has no parent or its parent is not an element, return nil. caller has a reference on the parent, so unref when you're finished with it.

MT safe.

Returns:

#pause_taskBoolean

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. has no task.

Returns:

  • (Boolean)

    a true if the task could be paused or false when the pad

#peerGst::Pad

Gets the peer of pad. This function refs the peer pad so you need to unref it after use. MT safe.

Returns:

  • (Gst::Pad)

    the peer Gst::Pad. Unref after usage.

#peer_query(query) ⇒ Boolean

Performs gst_pad_query() on the peer of pad.

The caller is responsible for both the allocation and deallocation of the query structure. if pad has no peer.

Parameters:

  • query (Gst::Query)

    the Gst::Query to perform.

Returns:

  • (Boolean)

    true if the query could be performed. This function returns false

#peer_query_accept_caps(caps) ⇒ Boolean

Check if the peer of pad accepts caps. If pad has no peer, this function returns true.

Parameters:

  • caps (Gst::Caps)

    a Gst::Caps to check on the pad

Returns:

  • (Boolean)

    true if the peer of pad can accept the caps or pad has no peer.

#peer_query_caps(filter) ⇒ Gst::Caps

Gets the capabilities of the peer connected to this pad. Similar to gst_pad_query_caps().

When called on srcpads filter contains the caps that upstream could produce in the order preferred by upstream. When called on sinkpads filter contains the caps accepted by downstream in the preferred order. filter might be nil but if it is not nil the returned caps will be a subset of filter. ref-count. When there is no peer pad, this function returns filter or, when filter is nil, ANY caps.

Parameters:

  • filter (Gst::Caps)

    a Gst::Caps filter, or nil.

Returns:

  • (Gst::Caps)

    the caps of the peer pad with incremented

#peer_query_convert(src_format, src_val, dest_format, dest_val) ⇒ Boolean

Queries the peer pad of a given sink pad to convert src_val in src_format to dest_format.

Parameters:

  • src_format (Gst::Format)

    a Gst::Format to convert from.

  • src_val (Integer)

    a value to convert.

  • dest_format (Gst::Format)

    the Gst::Format to convert to.

  • dest_val (Integer)

    a pointer to the result.

Returns:

  • (Boolean)

    true if the query could be performed.

#peer_query_duration(format, duration) ⇒ Boolean

Queries the peer pad of a given sink pad for the total stream duration.

Parameters:

  • format (Gst::Format)

    the Gst::Format requested

  • duration (Integer)

    a location in which to store the total duration, or nil.

Returns:

  • (Boolean)

    true if the query could be performed.

#peer_query_position(format, cur) ⇒ Boolean

Queries the peer of a given sink pad for the stream position.

Parameters:

  • format (Gst::Format)

    the Gst::Format requested

  • cur (Integer)

    a location in which to store the current position, or nil.

Returns:

  • (Boolean)

    true if the query could be performed.

#proxy_query_accept_caps(query) ⇒ Boolean

Checks if all internally linked pads of pad accepts the caps in query and returns the intersection of the results.

This function is useful as a default accept caps query function for an element that can handle any stream format, but requires caps that are acceptable for all opposite pads.

Parameters:

  • query (Gst::Query)

    an ACCEPT_CAPS Gst::Query.

Returns:

  • (Boolean)

    true if query could be executed

#proxy_query_caps(query) ⇒ Boolean

Calls gst_pad_query_caps() for all internally linked pads of pad and returns the intersection of the results.

This function is useful as a default caps query function for an element that can handle any stream format, but requires all its pads to have the same caps. Two such elements are tee and adder.

Parameters:

  • query (Gst::Query)

    a CAPS Gst::Query.

Returns:

  • (Boolean)

    true if query could be executed

#pull_range(offset, size, buffer) ⇒ Gst::FlowReturn

Pulls a buffer from the peer pad or fills up a provided buffer.

This function will first trigger the pad block signal if it was installed.

When pad is not linked #GST_FLOW_NOT_LINKED is returned else this function returns the result of gst_pad_get_range() on the peer pad. See gst_pad_get_range() for a list of return values and for the semantics of the arguments of this function.

If buffer points to a variable holding nil, a valid new Gst::Buffer will be placed in buffer when this function returns #GST_FLOW_OK. The new buffer must be freed with gst_buffer_unref() after usage. When this function returns any other result value, buffer will still point to nil.

When buffer points to a variable that points to a valid Gst::Buffer, the buffer will be filled with the result data when this function returns #GST_FLOW_OK. When this function returns any other result value, buffer will be unchanged. If the provided buffer is larger than size, only size bytes will be filled in the result buffer and its size will be updated accordingly.

Note that less than size bytes can be returned in buffer when, for example, an EOS condition is near or when buffer is not large enough to hold size bytes. The caller should check the result buffer size to get the result size. MT safe.

Parameters:

  • offset (Integer)

    The start offset of the buffer

  • size (Integer)

    The length of the buffer

  • buffer (Gst::Buffer)

    a pointer to hold the Gst::Buffer, returns GST_FLOW_ERROR if nil.

Returns:

#push(buffer) ⇒ Gst::FlowReturn

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. MT safe.

Parameters:

  • buffer (Gst::Buffer)

    the Gst::Buffer to push returns GST_FLOW_ERROR if not.

Returns:

#push_event(event) ⇒ Boolean

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 ownership of the provided event so you should gst_event_ref() it if you want to reuse the event after this call. MT safe.

Parameters:

  • event (Gst::Event)

    the Gst::Event to send to the pad.

Returns:

  • (Boolean)

    true if the event was handled.

#push_list(list) ⇒ Gst::FlowReturn

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 Gst::Buffer and chained via gst_pad_chain().

In all cases, success or failure, the caller loses its reference to list after calling this function. MT safe.

Parameters:

  • list (Gst::BufferList)

    the Gst::BufferList to push returns GST_FLOW_ERROR if not.

Returns:

#query(query) ⇒ Boolean

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.

Parameters:

  • query (Gst::Query)

    the Gst::Query to perform.

Returns:

  • (Boolean)

    true if the query could be performed.

#query_accept_caps(caps) ⇒ Boolean

Check if the given pad accepts the caps.

Parameters:

  • caps (Gst::Caps)

    a Gst::Caps to check on the pad

Returns:

  • (Boolean)

    true if the pad can accept the caps.

#query_caps(filter) ⇒ Gst::Caps

Gets the capabilities this pad can produce or consume. Note that this method doesn't necessarily return the caps set by sending a gst_event_new_caps() - use gst_pad_get_current_caps() for that instead. gst_pad_query_caps returns all possible caps a pad can operate with, using the pad's CAPS query function, If the query fails, this function will return filter, if not nil, otherwise ANY.

When called on sinkpads filter contains the caps that upstream could produce in the order preferred by upstream. When called on srcpads filter contains the caps accepted by downstream in the preferred order. filter might be nil but if it is not nil the returned caps will be a subset of filter.

Note that this function does not return writable Gst::Caps, use gst_caps_make_writable() before modifying the caps.

Parameters:

  • filter (Gst::Caps)

    suggested Gst::Caps, or nil

Returns:

  • (Gst::Caps)

    the caps of the pad with incremented ref-count.

#query_convert(src_format, src_val, dest_format, dest_val) ⇒ Boolean

Queries a pad to convert src_val in src_format to dest_format.

Parameters:

  • src_format (Gst::Format)

    a Gst::Format to convert from.

  • src_val (Integer)

    a value to convert.

  • dest_format (Gst::Format)

    the Gst::Format to convert to.

  • dest_val (Integer)

    a pointer to the result.

Returns:

  • (Boolean)

    true if the query could be performed.

#query_default(parent, query) ⇒ Boolean

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.

Parameters:

  • parent (Gst::Object)

    the parent of pad or nil

  • query (Gst::Query)

    the Gst::Query to handle.

Returns:

  • (Boolean)

    true if the query was performed successfully.

#query_duration(format, duration) ⇒ Boolean

Queries a pad for the total stream duration.

Parameters:

  • format (Gst::Format)

    the Gst::Format requested

  • duration (Integer)

    a location in which to store the total duration, or nil.

Returns:

  • (Boolean)

    true if the query could be performed.

#query_position(format, cur) ⇒ Boolean

Queries a pad for the stream position.

Parameters:

  • format (Gst::Format)

    the Gst::Format requested

  • cur (Integer)

    A location in which to store the current position, or nil.

Returns:

  • (Boolean)

    true if the query could be performed.

#remove_probe(id) ⇒ nil

Remove the probe with id from pad.

MT safe.

Parameters:

  • id (Gst::gulong)

    the probe id to remove

Returns:

  • (nil)

#send_event(event) ⇒ Boolean

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 Gst::EventTypeFlags, 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 ownership of the provided event so you should gst_event_ref() it if you want to reuse the event after this call.

Parameters:

  • event (Gst::Event)

    the Gst::Event to send to the pad.

Returns:

  • (Boolean)

    true if the event was handled.

#set_activate_function_full(activate, user_data, notify) ⇒ nil

Sets the given activate function for pad. The activate function will dispatch to gst_pad_activate_mode() to perform the actual activation. Only makes sense to set on sink pads.

Call this function if your sink pad can start a pull-based task.

Parameters:

  • activate (Gst::PadActivateFunction)

    the Gst::PadActivateFunction to set.

  • user_data (GObject)

    user_data passed to notify

  • notify (GLib::DestroyNotify)

    notify called when activate will not be used anymore.

Returns:

  • (nil)

#set_activatemode_function_full(activatemode, user_data, notify) ⇒ nil

Sets the given activate_mode function for the pad. An activate_mode function prepares the element for data passing.

Parameters:

  • activatemode (Gst::PadActivateModeFunction)

    the Gst::PadActivateModeFunction to set.

  • user_data (GObject)

    user_data passed to notify

  • notify (GLib::DestroyNotify)

    notify called when activatemode will not be used anymore.

Returns:

  • (nil)

#set_chain_function_full(chain, user_data, notify) ⇒ nil

Sets the given chain function for the pad. The chain function is called to process a Gst::Buffer input buffer. see #GstPadChainFunction for more details.

Parameters:

  • chain (Gst::PadChainFunction)

    the Gst::PadChainFunction to set.

  • user_data (GObject)

    user_data passed to notify

  • notify (GLib::DestroyNotify)

    notify called when chain will not be used anymore.

Returns:

  • (nil)

#set_chain_list_function_full(chainlist, user_data, notify) ⇒ nil

Sets the given chain list function for the pad. The chainlist function is called to process a Gst::BufferList input buffer list. See Gst::PadChainListFunction for more details.

Parameters:

  • chainlist (Gst::PadChainListFunction)

    the Gst::PadChainListFunction to set.

  • user_data (GObject)

    user_data passed to notify

  • notify (GLib::DestroyNotify)

    notify called when chainlist will not be used anymore.

Returns:

  • (nil)

#set_event_full_function_full(event, user_data, notify) ⇒ nil

Sets the given event handler for the pad.

Parameters:

  • event (Gst::PadEventFullFunction)

    the Gst::PadEventFullFunction to set.

  • user_data (GObject)

    user_data passed to notify

  • notify (GLib::DestroyNotify)

    notify called when event will not be used anymore.

Returns:

  • (nil)

#set_event_function_full(event, user_data, notify) ⇒ nil

Sets the given event handler for the pad.

Parameters:

  • event (Gst::PadEventFunction)

    the Gst::PadEventFunction to set.

  • user_data (GObject)

    user_data passed to notify

  • notify (GLib::DestroyNotify)

    notify called when event will not be used anymore.

Returns:

  • (nil)

#set_getrange_function_full(get, user_data, notify) ⇒ nil

Sets the given getrange function for the pad. The getrange function is called to produce a new Gst::Buffer to start the processing pipeline. see Gst::PadGetRangeFunction for a description of the getrange function.

Parameters:

  • get (Gst::PadGetRangeFunction)

    the Gst::PadGetRangeFunction to set.

  • user_data (GObject)

    user_data passed to notify

  • notify (GLib::DestroyNotify)

    notify called when get will not be used anymore.

Returns:

  • (nil)

Sets the given internal link iterator function for the pad.

Parameters:

  • iterintlink (Gst::PadIterIntLinkFunction)

    the Gst::PadIterIntLinkFunction to set.

  • user_data (GObject)

    user_data passed to notify

  • notify (GLib::DestroyNotify)

    notify called when iterintlink will not be used anymore.

Returns:

  • (nil)

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 Gst::PadLinkFunction of the peer sink pad, if present.

Parameters:

  • link (Gst::PadLinkFunction)

    the Gst::PadLinkFunction to set.

  • user_data (GObject)

    user_data passed to notify

  • notify (GLib::DestroyNotify)

    notify called when link will not be used anymore.

Returns:

  • (nil)

#set_query_function_full(query, user_data, notify) ⇒ nil

Set the given query function for the pad.

Parameters:

  • query (Gst::PadQueryFunction)

    the Gst::PadQueryFunction to set.

  • user_data (GObject)

    user_data passed to notify

  • notify (GLib::DestroyNotify)

    notify called when query will not be used anymore.

Returns:

  • (nil)

Sets the given unlink function for the pad. It will be called when the pad is unlinked.

Note that the pad's lock is already held when the unlink function is called, so most pad functions cannot be called from within the callback.

Parameters:

  • unlink (Gst::PadUnlinkFunction)

    the Gst::PadUnlinkFunction to set.

  • user_data (GObject)

    user_data passed to notify

  • notify (GLib::DestroyNotify)

    notify called when unlink will not be used anymore.

Returns:

  • (nil)

If there is a single internal link of the given pad, this function will return it. Otherwise, it will return NULL. or more than one internal links. Unref returned pad with gst_object_unref().

Returns:

  • (Gst::Pad)

    a Gst::Pad, or nil if pad has none

#start_task(func, user_data, notify) ⇒ Boolean

Starts a task that repeatedly calls func with user_data. This function is mostly used in pad activation functions to start the dataflow. The #GST_PAD_STREAM_LOCK of pad will automatically be acquired before func is called.

Parameters:

  • func (Gst::TaskFunction)

    the task function to call

  • user_data (GObject)

    user data passed to the task function

  • notify (GLib::DestroyNotify)

    called when user_data is no longer referenced

Returns:

  • (Boolean)

    a true if the task could be started.

#sticky_events_foreach(foreach_func, user_data) ⇒ nil

Iterates all sticky events on pad and calls foreach_func for every event. If foreach_func returns false the iteration is immediately stopped.

Parameters:

  • foreach_func (Gst::PadStickyEventsForeachFunction)

    the Gst::PadStickyEventsForeachFunction that should be called for every event.

  • user_data (GObject)

    the optional user data.

Returns:

  • (nil)

#stop_taskBoolean

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.

Returns:

  • (Boolean)

    a true if the task could be stopped or false on error.

#store_sticky_event(event) ⇒ Gst::FlowReturn

Store the sticky event on pad was flushing or #GST_FLOW_EOS when the pad was EOS.

Parameters:

  • event (Gst::Event)

    a Gst::Event

Returns:

  • (Gst::FlowReturn)

    #GST_FLOW_OK on success, #GST_FLOW_FLUSHING when the pad

#streamGst::Stream

Returns the current Gst::Stream for the pad, or nil if none has been set yet, i.e. the pad has not received a stream-start event yet.

This is a convenience wrapper around gst_pad_get_sticky_event() and gst_event_parse_stream().

Returns:

  • (Gst::Stream)

    the current Gst::Stream for pad, or nil. unref the returned stream when no longer needed.

#stream_idString

Returns the current stream-id for the pad, or nil if none has been set yet, i.e. the pad has not received a stream-start event yet.

This is a convenience wrapper around gst_pad_get_sticky_event() and gst_event_parse_stream_start().

The returned stream-id string should be treated as an opaque string, its contents should not be interpreted.

Returns:

  • (String)

    a newly-allocated copy of the stream-id for pad, or nil. g_free() the returned string when no longer needed.

#task_stateGst::TaskState

Get pad task state. If no task is currently set, #GST_TASK_STOPPED is returned.

Returns:

#templateGst::PadTemplate

Returns template.

Returns:

#template=(template) ⇒ Gst::PadTemplate

Parameters:

Returns:

Unlinks the source pad from the sink pad. Will emit the Gst::Pad::unlinked signal on both pads. the pads were not linked together.

MT safe.

Parameters:

  • sinkpad (Gst::Pad)

    the sink Gst::Pad to unlink.

Returns:

  • (Boolean)

    true if the pads were unlinked. This function returns false if

#use_fixed_capsnil

A helper function you can use that sets the FIXED_CAPS flag This way the default CAPS query will always return the negotiated caps or in case the pad is not negotiated, the padtemplate caps.

The negotiated caps are the caps of the last CAPS event that passed on the pad. Use this function on a pad that, once it negotiated to a CAPS, cannot be renegotiated to something else.

Returns:

  • (nil)