Class: GstBase::CollectPads

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

Instance Method Summary collapse

Methods inherited from Gst::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

#initializeGstBase::CollectPads

Create a new instance of Gst::CollectPads.

MT safe.

Instance Method Details

#add_pad(pad, size, destroy_notify, lock) ⇒ GstBase::CollectData

Add a pad to the collection of collect pads. The pad has to be
a sinkpad. The refcount of the pad is incremented. Use
gst_collect_pads_remove_pad() to remove the pad from the collection
again.

You specify a size for the returned Gst::CollectData structure
so that you can use it to store additional information.

You can also specify a Gst::CollectDataDestroyNotify that will be called
just before the Gst::CollectData structure is freed. It is passed the
pointer to the structure and should free any custom memory and resources
allocated for it.

Keeping a pad locked in waiting state is only relevant when using
the default collection algorithm (providing the oldest buffer).
It ensures a buffer must be available on this pad for a collection
to take place. This is of typical use to a muxer element where
non-subtitle streams should always be in waiting state,
e.g. to assure that caps information is available on all these streams
when initial headers have to be written.

The pad will be automatically activated in push mode when pads is
started.

MT safe.

Parameters:

  • pad (Gst::Pad)

    the pad to add

  • size (Integer)

    the size of the returned Gst::CollectData structure

  • destroy_notify (GstBase::CollectDataDestroyNotify)

    function to be called before the returned
    Gst::CollectData structure is freed

  • lock (Boolean)

    whether to lock this pad in usual waiting state

Returns:

  • (GstBase::CollectData)

    a new Gst::CollectData to identify the
    new pad. Or nil if wrong parameters are supplied.

#availableInteger

Query how much bytes can be read from each queued buffer. This means
that the result of this call is the maximum number of bytes that can
be read from each of the pads.

This function should be called with pads STREAM_LOCK held, such as
in the callback.

MT safe.
returns 0 if a pad has no queued buffer.

Returns:

  • (Integer)

    The maximum number of bytes queued on all pads. This function

#clip_running_time(cdata, buf, outbuf, user_data) ⇒ Gst::FlowReturn

Convenience clipping function that converts incoming buffer's timestamp
to running time, or clips the buffer if outside configured segment.

Since 1.6, this clipping function also sets the DTS parameter of the
GstCollectData structure. This version of the running time DTS can be
negative. G_MININT64 is used to indicate invalid value.

Parameters:

  • cdata (GstBase::CollectData)

    collect data of corresponding pad

  • buf (Gst::Buffer)

    buffer being clipped

  • outbuf (Gst::Buffer)

    output buffer with running time, or NULL if clipped

  • user_data (GObject)

    user data (unused)

Returns:

#event_default(data, event, discard) ⇒ Boolean

Default Gst::CollectPads event handling that elements should always
chain up to to ensure proper operation. Element might however indicate
event should not be forwarded downstream.

Parameters:

  • data (GstBase::CollectData)

    collect data of corresponding pad

  • event (Gst::Event)

    event being processed

  • discard (Boolean)

    process but do not send event downstream

Returns:

  • (Boolean)

#flush(data, size) ⇒ Integer

Flush size bytes from the pad data.

This function should be called with pads STREAM_LOCK held, such as
in the callback.

MT safe.
is 0 if the pad was end-of-stream.

Parameters:

  • data (GstBase::CollectData)

    the data to use

  • size (Integer)

    the number of bytes to flush

Returns:

  • (Integer)

    The number of bytes flushed This can be less than size and

#flushing=(flushing) ⇒ nil

Change the flushing state of all the pads in the collection. No pad
is able to accept anymore data when flushing is true. Calling this
function with flushing false makes pads accept data again.
Caller must ensure that downstream streaming (thread) is not blocked,
e.g. by sending a FLUSH_START downstream.

MT safe.

Parameters:

  • flushing (Boolean)

    desired state of the pads

Returns:

  • (nil)

#peek(data) ⇒ Gst::Buffer

Peek at the buffer currently queued in data. This function
should be called with the pads STREAM_LOCK held, such as in the callback
handler.

MT safe.
buffer is queued. should unref the buffer after usage.

Parameters:

  • data (GstBase::CollectData)

    the data to use

Returns:

#pop(data) ⇒ Gst::Buffer

Pop the buffer currently queued in data. This function
should be called with the pads STREAM_LOCK held, such as in the callback
handler.

MT safe.
buffer was queued. You should unref the buffer after usage.

Parameters:

  • data (GstBase::CollectData)

    the data to use

Returns:

#query_default(data, query, discard) ⇒ Boolean

Default Gst::CollectPads query handling that elements should always
chain up to to ensure proper operation. Element might however indicate
query should not be forwarded downstream.

Parameters:

  • data (GstBase::CollectData)

    collect data of corresponding pad

  • query (Gst::Query)

    query being processed

  • discard (Boolean)

    process but do not send event downstream

Returns:

  • (Boolean)

#read_buffer(data, size) ⇒ Gst::Buffer

Get a subbuffer of size bytes from the given pad data.

This function should be called with pads STREAM_LOCK held, such as in the
callback.

MT safe.
be less that requested. A return of nil signals that the pad is
end-of-stream. Unref the buffer after use.

Parameters:

  • data (GstBase::CollectData)

    the data to use

  • size (Integer)

    the number of bytes to read

Returns:

  • (Gst::Buffer)

    A sub buffer. The size of the buffer can

#remove_pad(pad) ⇒ Boolean

Remove a pad from the collection of collect pads. This function will also
free the Gst::CollectData and all the resources that were allocated with
gst_collect_pads_add_pad().

The pad will be deactivated automatically when pads is stopped.

MT safe.

Parameters:

Returns:

  • (Boolean)

    true if the pad could be removed.

#set_buffer_function(func, user_data) ⇒ nil

Set the callback function and user data that will be called with
the oldest buffer when all pads have been collected, or nil on EOS.
If a buffer is passed, the callback owns a reference and must unref
it.

MT safe.

Parameters:

  • func (GstBase::CollectPadsBufferFunction)

    the function to set

  • user_data (GObject)

    user data passed to the function

Returns:

  • (nil)

#set_clip_function(clipfunc, user_data) ⇒ nil

Install a clipping function that is called right after a buffer is received
on a pad managed by pads. See Gst::CollectPadsClipFunction for more info.

Parameters:

  • clipfunc (GstBase::CollectPadsClipFunction)

    clip function to install

  • user_data (GObject)

    user data to pass to clip_func

Returns:

  • (nil)

#set_compare_function(func, user_data) ⇒ nil

Set the timestamp comparison function.

MT safe.

Parameters:

  • func (GstBase::CollectPadsCompareFunction)

    the function to set

  • user_data (GObject)

    user data passed to the function

Returns:

  • (nil)

#set_event_function(func, user_data) ⇒ nil

Set the event callback function and user data that will be called when
collectpads has received an event originating from one of the collected
pads. If the event being processed is a serialized one, this callback is
called with pads STREAM_LOCK held, otherwise not. As this lock should be
held when calling a number of CollectPads functions, it should be acquired
if so (unusually) needed.

MT safe.

Parameters:

  • func (GstBase::CollectPadsEventFunction)

    the function to set

  • user_data (GObject)

    user data passed to the function

Returns:

  • (nil)

#set_flush_function(func, user_data) ⇒ nil

Install a flush function that is called when the internal
state of all pads should be flushed as part of flushing seek
handling. See Gst::CollectPadsFlushFunction for more info.

Parameters:

  • func (GstBase::CollectPadsFlushFunction)

    flush function to install

  • user_data (GObject)

    user data to pass to func

Returns:

  • (nil)

#set_function(func, user_data) ⇒ nil

CollectPads provides a default collection algorithm that will determine
the oldest buffer available on all of its pads, and then delegate
to a configured callback.
However, if circumstances are more complicated and/or more control
is desired, this sets a callback that will be invoked instead when
all the pads added to the collection have buffers queued.
Evidently, this callback is not compatible with
gst_collect_pads_set_buffer_function() callback.
If this callback is set, the former will be unset.

MT safe.

Parameters:

  • func (GstBase::CollectPadsFunction)

    the function to set

  • user_data (GObject)

    user data passed to the function

Returns:

  • (nil)

#set_query_function(func, user_data) ⇒ nil

Set the query callback function and user data that will be called after
collectpads has received a query originating from one of the collected
pads. If the query being processed is a serialized one, this callback is
called with pads STREAM_LOCK held, otherwise not. As this lock should be
held when calling a number of CollectPads functions, it should be acquired
if so (unusually) needed.

MT safe.

Parameters:

  • func (GstBase::CollectPadsQueryFunction)

    the function to set

  • user_data (GObject)

    user data passed to the function

Returns:

  • (nil)

#set_waiting(data, waiting) ⇒ nil

Sets a pad to waiting or non-waiting mode, if at least this pad
has not been created with locked waiting state,
in which case nothing happens.

This function should be called with pads STREAM_LOCK held, such as
in the callback.

MT safe.

Parameters:

  • data (GstBase::CollectData)

    the data to use

  • waiting (Boolean)

    boolean indicating whether this pad should operate
    in waiting or non-waiting mode

Returns:

  • (nil)

#src_event_default(pad, event) ⇒ Boolean

Default Gst::CollectPads event handling for the src pad of elements.
Elements can chain up to this to let flushing seek event handling
be done by Gst::CollectPads.

Parameters:

  • pad (Gst::Pad)

    src Gst::Pad that received the event

  • event (Gst::Event)

    event being processed

Returns:

  • (Boolean)

#startnil

Starts the processing of data in the collect_pads.

MT safe.

Returns:

  • (nil)

#stopnil

Stops the processing of data in the collect_pads. this function
will also unblock any blocking operations.

MT safe.

Returns:

  • (nil)

#take_buffer(data, size) ⇒ Gst::Buffer

Get a subbuffer of size bytes from the given pad data. Flushes the amount
of read bytes.

This function should be called with pads STREAM_LOCK held, such as in the
callback.

MT safe.
be less that requested. A return of nil signals that the pad is
end-of-stream. Unref the buffer after use.

Parameters:

  • data (GstBase::CollectData)

    the data to use

  • size (Integer)

    the number of bytes to read

Returns:

  • (Gst::Buffer)

    A sub buffer. The size of the buffer can