Module: GstBase

Defined in:
lib/gst/base-loader.rb

Overview

Copyright (C) 2013-2021 Ruby-GNOME Project Team

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Defined Under Namespace

Modules: AggregatorStartTimeSelection, BaseParseFrameFlags, BaseSrcFlags, CollectPadsStateFlags Classes: Adapter, Aggregator, AggregatorPad, BaseParse, BaseSink, BaseSrc, BaseTransform, CollectPads, DataQueue, Loader, PushSrc

Constant Summary collapse

BASE_PARSE_FLAG_DRAINING =
2
BASE_PARSE_FLAG_LOST_SYNC =
1
BASE_TRANSFORM_SINK_NAME =

The name of the templates for the sink pad.

sink
BASE_TRANSFORM_SRC_NAME =

The name of the templates for the source pad.

src

Instance Method Summary collapse

Instance Method Details

#bit_reader_new(data, size) ⇒ GstBase::BitReader

Create a new Gst::BitReader instance, which will read from data.

Free-function: gst_bit_reader_free

Parameters:

  • data (Array<Integer>)

    Data from which the Gst::BitReader should read

  • size (Integer)

    Size of data in bytes

Returns:

  • (GstBase::BitReader)

    a new Gst::BitReader instance

#bit_writer_newGstBase::BitWriter

Creates a new, empty Gst::BitWriter instance.

Free-function: gst_bit_writer_free

Returns:

  • (GstBase::BitWriter)

    a new, empty Gst::ByteWriter instance

#bit_writer_new_with_data(data, size, initialized) ⇒ GstBase::BitWriter

Creates a new Gst::BitWriter instance with the given memory area. If initialized is true it is possible to read size bits from the Gst::BitWriter from the beginning.

Free-function: gst_bit_writer_free

Parameters:

  • data (Array<Integer>)

    Memory area for writing

  • size (Integer)

    Size of data in bytes

  • initialized (Boolean)

    if true the complete data can be read from the beginning

Returns:

  • (GstBase::BitWriter)

    a new Gst::BitWriter instance

#bit_writer_new_with_size(size, fixed) ⇒ GstBase::BitWriter

Creates a Gst::BitWriter instance with the given initial data size.

Free-function: gst_bit_writer_free

Parameters:

  • size (Integer)

    Initial size of data in bytes

  • fixed (Boolean)

    If true the data can't be reallocated

Returns:

  • (GstBase::BitWriter)

    a new Gst::BitWriter instance

#byte_reader_new(data, size) ⇒ GstBase::ByteReader

Create a new Gst::ByteReader instance, which will read from data.

Free-function: gst_byte_reader_free

Parameters:

  • data (Array<Integer>)

    data from which the Gst::ByteReader should read

  • size (Integer)

    Size of data in bytes

Returns:

  • (GstBase::ByteReader)

    a new Gst::ByteReader instance

#byte_writer_newGstBase::ByteWriter

Creates a new, empty Gst::ByteWriter instance

Free-function: gst_byte_writer_free

Returns:

  • (GstBase::ByteWriter)

    a new, empty Gst::ByteWriter instance

#byte_writer_new_with_data(data, size, initialized) ⇒ GstBase::ByteWriter

Creates a new Gst::ByteWriter instance with the given memory area. If initialized is true it is possible to read size bytes from the Gst::ByteWriter from the beginning.

Free-function: gst_byte_writer_free

Parameters:

  • data (Integer)

    Memory area for writing

  • size (Integer)

    Size of data in bytes

  • initialized (Boolean)

    If true the complete data can be read from the beginning

Returns:

  • (GstBase::ByteWriter)

    a new Gst::ByteWriter instance

#byte_writer_new_with_size(size, fixed) ⇒ GstBase::ByteWriter

Creates a new Gst::ByteWriter instance with the given initial data size.

Free-function: gst_byte_writer_free

Parameters:

  • size (Integer)

    Initial size of data

  • fixed (Boolean)

    If true the data can't be reallocated

Returns:

  • (GstBase::ByteWriter)

    a new Gst::ByteWriter instance

#queue_array_new(initial_size) ⇒ GstBase::QueueArray

Allocates a new Gst::QueueArray object with an initial queue size of initial_size.

Parameters:

  • initial_size (Integer)

    Initial size of the new queue

Returns:

  • (GstBase::QueueArray)

    a new Gst::QueueArray object

#queue_array_new_for_struct(struct_size, initial_size) ⇒ GstBase::QueueArray

Allocates a new Gst::QueueArray object for elements (e.g. structures) of size struct_size, with an initial queue size of initial_size.

Parameters:

  • struct_size (Integer)

    Size of each element (e.g. structure) in the array

  • initial_size (Integer)

    Initial size of the new queue

Returns:

  • (GstBase::QueueArray)

    a new Gst::QueueArray object

#type_find_data_new(obj, data, size) ⇒ GstBase::TypeFindData

Free-function: gst_type_find_data_free

Parameters:

  • obj (Gst::Object)

    object doing the typefinding, or nil (used for logging)

  • data (Array<Integer>)

    a pointer with data to typefind

  • size (Integer)

    the size of data

Returns:

  • (GstBase::TypeFindData)

    the Gst::TypeFindData. The caller should free the returned Gst::TypeFindData with gst_type_find_data_free().

#type_find_helper(src, size) ⇒ Gst::Caps

Tries to find what type of data is flowing from the given source Gst::Pad.

Free-function: gst_caps_unref

Parameters:

  • src (Gst::Pad)

    A source Gst::Pad

  • size (Integer)

    The length in bytes

Returns:

  • (Gst::Caps)

    the Gst::Caps corresponding to the data stream. Returns nil if no Gst::Caps matches the data stream.

#type_find_helper_for_buffer(obj, buf, prob) ⇒ Gst::Caps

Tries to find what type of data is contained in the given Gst::Buffer, the assumption being that the buffer represents the beginning of the stream or file.

All available typefinders will be called on the data in order of rank. If a typefinding function returns a probability of %GST_TYPE_FIND_MAXIMUM, typefinding is stopped immediately and the found caps will be returned right away. Otherwise, all available typefind functions will the tried, and the caps with the highest probability will be returned, or nil if the content of the buffer could not be identified.

Free-function: gst_caps_unref

Parameters:

  • obj (Gst::Object)

    object doing the typefinding, or nil (used for logging)

  • buf (Gst::Buffer)

    a Gst::Buffer with data to typefind

  • prob (Gst::TypeFindProbability)

    location to store the probability of the found caps, or nil

Returns:

  • (Gst::Caps)

    the Gst::Caps corresponding to the data, or nil if no type could be found. The caller should free the caps returned with gst_caps_unref().

#type_find_helper_for_buffer_with_caps(obj, buf, caps, prob) ⇒ Gst::Caps

Tries to find if type of media contained in the given Gst::Buffer, matches caps specified, assumption being that the buffer represents the beginning of the stream or file.

Tries to find what type of data is contained in the given data, the assumption being that the data represents the beginning of the stream or file.

Only the typefinder matching the given caps will be called, if found. The caps with the highest probability will be returned, or nil if the content of the data could not be identified.

Free-function: gst_caps_unref

Parameters:

Returns:

  • (Gst::Caps)

    the Gst::Caps corresponding to the data, or nil if no type could be found. The caller should free the caps returned with gst_caps_unref().

#type_find_helper_for_buffer_with_extension(obj, buf, extension, prob) ⇒ Gst::Caps

Tries to find what type of data is contained in the given Gst::Buffer, the assumption being that the buffer represents the beginning of the stream or file.

All available typefinders will be called on the data in order of rank. If a typefinding function returns a probability of %GST_TYPE_FIND_MAXIMUM, typefinding is stopped immediately and the found caps will be returned right away. Otherwise, all available typefind functions will the tried, and the caps with the highest probability will be returned, or nil if the content of the buffer could not be identified.

When extension is not nil, this function will first try the typefind functions for the given extension, which might speed up the typefinding in many cases.

Free-function: gst_caps_unref

Parameters:

  • obj (Gst::Object)

    object doing the typefinding, or nil (used for logging)

  • buf (Gst::Buffer)

    a Gst::Buffer with data to typefind

  • extension (String)

    extension of the media, or nil

  • prob (Gst::TypeFindProbability)

    location to store the probability of the found caps, or nil

Returns:

  • (Gst::Caps)

    the Gst::Caps corresponding to the data, or nil if no type could be found. The caller should free the caps returned with gst_caps_unref().

#type_find_helper_for_data(obj, data, size, prob) ⇒ Gst::Caps

Tries to find what type of data is contained in the given data, the assumption being that the data represents the beginning of the stream or file.

All available typefinders will be called on the data in order of rank. If a typefinding function returns a probability of %GST_TYPE_FIND_MAXIMUM, typefinding is stopped immediately and the found caps will be returned right away. Otherwise, all available typefind functions will the tried, and the caps with the highest probability will be returned, or nil if the content of data could not be identified.

Free-function: gst_caps_unref

Parameters:

  • obj (Gst::Object)

    object doing the typefinding, or nil (used for logging)

  • data (Array<Integer>)
    • a pointer with data to typefind
  • size (Integer)

    the size of data

  • prob (Gst::TypeFindProbability)

    location to store the probability of the found caps, or nil

Returns:

  • (Gst::Caps)

    the Gst::Caps corresponding to the data, or nil if no type could be found. The caller should free the caps returned with gst_caps_unref().

#type_find_helper_for_data_with_caps(obj, data, size, caps, prob) ⇒ Gst::Caps

Tries to find if type of media contained in the given data, matches the caps specified, assumption being that the data represents the beginning of the stream or file.

Only the typefinder matching the given caps will be called, if found. The caps with the highest probability will be returned, or nil if the content of the data could not be identified.

Free-function: gst_caps_unref

Parameters:

  • obj (Gst::Object)

    object doing the typefinding, or nil (used for logging)

  • data (Array<Integer>)

    a pointer with data to typefind

  • size (Integer)

    the size of data

  • caps (Gst::Caps)

    caps of the media

  • prob (Gst::TypeFindProbability)

    location to store the probability of the found caps, or nil

Returns:

  • (Gst::Caps)

    the Gst::Caps corresponding to the data, or nil if no type could be found. The caller should free the caps returned with gst_caps_unref().

#type_find_helper_for_data_with_extension(obj, data, size, extension, prob) ⇒ Gst::Caps

Tries to find what type of data is contained in the given data, the assumption being that the data represents the beginning of the stream or file.

All available typefinders will be called on the data in order of rank. If a typefinding function returns a probability of %GST_TYPE_FIND_MAXIMUM, typefinding is stopped immediately and the found caps will be returned right away. Otherwise, all available typefind functions will the tried, and the caps with the highest probability will be returned, or nil if the content of data could not be identified.

When extension is not nil, this function will first try the typefind functions for the given extension, which might speed up the typefinding in many cases.

Free-function: gst_caps_unref

Parameters:

  • obj (Gst::Object)

    object doing the typefinding, or nil (used for logging)

  • data (Array<Integer>)
    • a pointer with data to typefind
  • size (Integer)

    the size of data

  • extension (String)

    extension of the media, or nil

  • prob (Gst::TypeFindProbability)

    location to store the probability of the found caps, or nil

Returns:

  • (Gst::Caps)

    the Gst::Caps corresponding to the data, or nil if no type could be found. The caller should free the caps returned with gst_caps_unref().

#type_find_helper_for_extension(obj, extension) ⇒ Gst::Caps

Tries to find the best Gst::Caps associated with extension.

All available typefinders will be checked against the extension in order of rank. The caps of the first typefinder that can handle extension will be returned.

Free-function: gst_caps_unref

Parameters:

  • obj (Gst::Object)

    object doing the typefinding, or nil (used for logging)

  • extension (String)

    an extension

Returns:

  • (Gst::Caps)

    the Gst::Caps corresponding to extension, or nil if no type could be found. The caller should free the caps returned with gst_caps_unref().

#type_find_helper_get_range(obj, parent, func, size, extension, prob) ⇒ Gst::Caps

Utility function to do pull-based typefinding. Unlike gst_type_find_helper() however, this function will use the specified function func to obtain the data needed by the typefind functions, rather than operating on a given source pad. This is useful mostly for elements like tag demuxers which strip off data at the beginning and/or end of a file and want to typefind the stripped data stream before adding their own source pad (the specified callback can then call the upstream peer pad with offsets adjusted for the tag size, for example).

When extension is not nil, this function will first try the typefind functions for the given extension, which might speed up the typefinding in many cases.

Free-function: gst_caps_unref

Parameters:

  • obj (Gst::Object)

    A Gst::Object that will be passed as first argument to func

  • parent (Gst::Object)

    the parent of obj or nil

  • func (GstBase::TypeFindHelperGetRangeFunction)

    A generic Gst::TypeFindHelperGetRangeFunction that will be used to access data at random offsets when doing the typefinding

  • size (Integer)

    The length in bytes

  • extension (String)

    extension of the media, or nil

  • prob (Gst::TypeFindProbability)

    location to store the probability of the found caps, or nil

Returns:

  • (Gst::Caps)

    the Gst::Caps corresponding to the data stream. Returns nil if no Gst::Caps matches the data stream.

#type_find_helper_get_range_full(obj, parent, func, size, extension, caps, prob) ⇒ Gst::FlowReturn

Utility function to do pull-based typefinding. Unlike gst_type_find_helper() however, this function will use the specified function func to obtain the data needed by the typefind functions, rather than operating on a given source pad. This is useful mostly for elements like tag demuxers which strip off data at the beginning and/or end of a file and want to typefind the stripped data stream before adding their own source pad (the specified callback can then call the upstream peer pad with offsets adjusted for the tag size, for example).

When extension is not nil, this function will first try the typefind functions for the given extension, which might speed up the typefinding in many cases.

Parameters:

  • obj (Gst::Object)

    A Gst::Object that will be passed as first argument to func

  • parent (Gst::Object)

    the parent of obj or nil

  • func (GstBase::TypeFindHelperGetRangeFunction)

    A generic Gst::TypeFindHelperGetRangeFunction that will be used to access data at random offsets when doing the typefinding

  • size (Integer)

    The length in bytes

  • extension (String)

    extension of the media, or nil

  • caps (Gst::Caps)

    returned caps

  • prob (Gst::TypeFindProbability)

    location to store the probability of the found caps, or nil

Returns:

  • (Gst::FlowReturn)

    the last %GstFlowReturn from pulling a buffer or %GST_FLOW_OK if typefinding was successful.

#type_find_list_factories_for_caps(obj, caps) ⇒ GLib::List<Gst::TypeFindFactory>

Tries to find the best Gst::TypeFindFactory associated with caps.

The typefinder that can handle caps will be returned.

Free-function: g_list_free

Parameters:

  • obj (Gst::Object)

    object doing the typefinding, or nil (used for logging)

  • caps (Gst::Caps)

    caps of the media

Returns:

  • (GLib::List<Gst::TypeFindFactory>)

    the list of Gst::TypeFindFactory corresponding to caps, or nil if no typefinder could be found. Caller should free the returned list with g_list_free() and list elements with gst_object_unref().