Class: GstBase::BaseParse

Inherits:
Gst::Element show all
Defined in:
(unknown)

Overview

Subclasses can override any of the available virtual methods or not, as
needed. At minimum handle_frame needs to be overridden.

Instance Method Summary collapse

Methods inherited from Gst::Element

#>>, [], #abort_state, #add_metadata, #add_pad, #add_pad_template, #add_property_deep_notify_watch, #add_property_notify_watch, #add_static_metadata, #add_static_pad_template, #add_static_pad_template_with_gtype, #base_time, #base_time=, #bus, #bus=, #call_async, #change_state, #clock, #clock=, #context=, #contexts, #continue_state, #create_all_pads, #current_clock_time, #current_running_time, #decorate_stream_id, #decorate_stream_id_printf, #decorate_stream_id_printf_valist, #factory, #flags, #flags_raw, #foreach_pad, #foreach_sink_pad, #foreach_src_pad, #get_compatible_pad, #get_compatible_pad_template, #get_context, #get_context_unlocked, #get_metadata, #get_pad_template, #get_request_pad, #get_state, #get_static_pad, #is_locked_state, #iterate_pads, #iterate_sink_pads, #iterate_src_pads, #link_elements, #link_filtered, #link_many, #link_pads, #link_pads_filtered, #link_pads_full, #locked_state=, #lost_state, make_from_uri, #message_full, #message_full_with_details, #no_more_pads, #pad_template_list, #pause, #play, #post_message, #provide_clock, #query, #query_convert, #query_duration, #query_position, #ready, register, #release_request_pad, #remove_pad, #remove_property_notify_watch, #request_pad, #request_pad_simple, #seek, #seek_simple, #send_event, #set_metadata, #set_static_metadata, #start_time, #start_time=, #state=, state_change_return_get_name, state_get_name, #stop, #sync_state_with_parent, type_set_skip_documentation, #unlink, #unlink_many, #unlink_pads

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

Instance Method Details

#add_index_entry(offset, ts, key, force) ⇒ Boolean

Adds an entry to the index associating offset to ts. It is recommended
to only add keyframe entries. force allows to bypass checks, such as
whether the stream is (upstream) seekable, another entry is already "close"
to the new entry, etc.

Parameters:

  • offset (Integer)

    offset of entry

  • ts (Gst::ClockTime)

    timestamp associated with offset

  • key (Boolean)

    whether entry refers to keyframe

  • force (Boolean)

    add entry disregarding sanity checks

Returns:

  • (Boolean)

    #gboolean indicating whether entry was added

#average_bitrate=(bitrate) ⇒ nil

Optionally sets the average bitrate detected in media (if non-zero),
e.g. based on metadata, as it will be posted to the application.

By default, announced average bitrate is estimated. The average bitrate
is used to estimate the total duration of the stream and to estimate
a seek position, if there's no index and the format is syncable
(see gst_base_parse_set_syncable()).

Parameters:

  • bitrate (Integer)

    average bitrate in bits/second

Returns:

  • (nil)

#convert_default(src_format, src_value, dest_format, dest_value) ⇒ Boolean

Default implementation of Gst::BaseParseClass::convert.

Parameters:

  • src_format (Gst::Format)

    Gst::Format describing the source format.

  • src_value (Integer)

    Source value to be converted.

  • dest_format (Gst::Format)

    Gst::Format defining the converted format.

  • dest_value (Integer)

    Pointer where the conversion result will be put.

Returns:

  • (Boolean)

    true if conversion was successful.

#disable_passthrough=(disable_passthrough) ⇒ Boolean

If set to true, baseparse will unconditionally force parsing of the
incoming data. This can be required in the rare cases where the incoming
side-data (caps, pts, dts, ...) is not trusted by the user and wants to
force validation and parsing of the incoming data.
If set to false, decision of whether to parse the data or not is up to
the implementation (standard behaviour).

Parameters:

  • disable_passthrough (Boolean)

Returns:

  • (Boolean)

    disable-passthrough

  • (Boolean)

    disable-passthrough

#disable_passthrough?Boolean

If set to true, baseparse will unconditionally force parsing of the
incoming data. This can be required in the rare cases where the incoming
side-data (caps, pts, dts, ...) is not trusted by the user and wants to
force validation and parsing of the incoming data.
If set to false, decision of whether to parse the data or not is up to
the implementation (standard behaviour).

Returns:

  • (Boolean)

    disable-passthrough

#drainnil

Drains the adapter until it is empty. It decreases the min_frame_size to
match the current adapter size and calls chain method until the adapter
is emptied or chain returns with error.

Returns:

  • (nil)

#finish_frame(frame, size) ⇒ Gst::FlowReturn

Collects parsed data and pushes it downstream.
Source pad caps must be set when this is called.

If frame's out_buffer is set, that will be used as subsequent frame data,
and size amount will be flushed from the input data. The output_buffer size
can differ from the consumed size indicated by size.

Otherwise, size samples will be taken from the input and used for output,
and the output's metadata (timestamps etc) will be taken as (optionally)
set by the subclass on frame's (input) buffer (which is otherwise
ignored for any but the above purpose/information).

Note that the latter buffer is invalidated by this call, whereas the
caller retains ownership of frame.

Parameters:

  • frame (GstBase::BaseParseFrame)

    a Gst::BaseParseFrame

  • size (Integer)

    consumed input data represented by frame

Returns:

  • (Gst::FlowReturn)

    a Gst::FlowReturn that should be escalated to caller (of caller)

#has_timing_info=(has_timing) ⇒ nil

Set if frames carry timing information which the subclass can (generally)
parse and provide. In particular, intrinsic (rather than estimated) time
can be obtained following a seek.

Parameters:

  • has_timing (Boolean)

    whether frames carry timing information

Returns:

  • (nil)

#infer_ts=(infer_ts) ⇒ nil

By default, the base class might try to infer PTS from DTS and vice
versa. While this is generally correct for audio data, it may not
be otherwise. Sub-classes implementing such formats should disable
timestamp inferring.

Parameters:

  • infer_ts (Boolean)

    true if parser should infer DTS/PTS from each other

Returns:

  • (nil)

#merge_tags(tags, mode) ⇒ nil

Sets the parser subclass's tags and how they should be merged with any
upstream stream tags. This will override any tags previously-set
with gst_base_parse_merge_tags().

Note that this is provided for convenience, and the subclass is
not required to use this and can still do tag handling on its own.

Parameters:

  • tags (Gst::TagList)

    a Gst::TagList to merge, or NULL to unset
    previously-set tags

  • mode (Gst::TagMergeMode)

    the Gst::TagMergeMode to use, usually #GST_TAG_MERGE_REPLACE

Returns:

  • (nil)

#min_frame_size=(min_size) ⇒ nil

Subclass can use this function to tell the base class that it needs to
be given buffers of at least min_size bytes.

Parameters:

  • min_size (Integer)

    Minimum size in bytes of the data that this base class should
    give to subclass.

Returns:

  • (nil)

#passthrough=(passthrough) ⇒ nil

Set if the nature of the format or configuration does not allow (much)
parsing, and the parser should operate in passthrough mode (which only
applies when operating in push mode). That is, incoming buffers are
pushed through unmodified, i.e. no Gst::BaseParseClass::handle_frame
will be invoked, but Gst::BaseParseClass::pre_push_frame will still be
invoked, so subclass can perform as much or as little is appropriate for
passthrough semantics in Gst::BaseParseClass::pre_push_frame.

Parameters:

  • passthrough (Boolean)

    true if parser should run in passthrough mode

Returns:

  • (nil)

#pts_interpolation=(pts_interpolate) ⇒ nil

By default, the base class will guess PTS timestamps using a simple
interpolation (previous timestamp + duration), which is incorrect for
data streams with reordering, where PTS can go backward. Sub-classes
implementing such formats should disable PTS interpolation.

Parameters:

  • pts_interpolate (Boolean)

    true if parser should interpolate PTS timestamps

Returns:

  • (nil)

#push_frame(frame) ⇒ Gst::FlowReturn

Pushes the frame's buffer downstream, sends any pending events and
does some timestamp and segment handling. Takes ownership of
frame's buffer, though caller retains ownership of frame.

This must be called with sinkpad STREAM_LOCK held.

Parameters:

  • frame (GstBase::BaseParseFrame)

    a Gst::BaseParseFrame

Returns:

#set_duration(fmt, duration, interval) ⇒ nil

Sets the duration of the currently playing media. Subclass can use this
when it is able to determine duration and/or notices a change in the media
duration. Alternatively, if interval is non-zero (default), then stream
duration is determined based on estimated bitrate, and updated every interval
frames.

Parameters:

  • fmt (Gst::Format)

    Gst::Format.

  • duration (Integer)

    duration value.

  • interval (Integer)

    how often to update the duration estimate based on bitrate, or 0.

Returns:

  • (nil)

#set_frame_rate(fps_num, fps_den, lead_in, lead_out) ⇒ nil

If frames per second is configured, parser can take care of buffer duration
and timestamping. When performing segment clipping, or seeking to a specific
location, a corresponding decoder might need an initial lead_in and a
following lead_out number of frames to ensure the desired segment is
entirely filled upon decoding.

Parameters:

  • fps_num (Integer)

    frames per second (numerator).

  • fps_den (Integer)

    frames per second (denominator).

  • lead_in (Integer)

    frames needed before a segment for subsequent decode

  • lead_out (Integer)

    frames needed after a segment

Returns:

  • (nil)

#set_latency(min_latency, max_latency) ⇒ nil

Sets the minimum and maximum (which may likely be equal) latency introduced
by the parsing process. If there is such a latency, which depends on the
particular parsing of the format, it typically corresponds to 1 frame duration.

If the provided values changed from previously provided ones, this will
also post a LATENCY message on the bus so the pipeline can reconfigure its
global latency.

Parameters:

  • min_latency (Gst::ClockTime)

    minimum parse latency

  • max_latency (Gst::ClockTime)

    maximum parse latency

Returns:

  • (nil)

#syncable=(syncable) ⇒ nil

Set if frame starts can be identified. This is set by default and
determines whether seeking based on bitrate averages
is possible for a format/stream.

Parameters:

  • syncable (Boolean)

    set if frame starts can be identified

Returns:

  • (nil)

#ts_at_offset=(offset) ⇒ nil

This function should only be called from a handle_frame implementation.

Gst::BaseParse creates initial timestamps for frames by using the last
timestamp seen in the stream before the frame starts. In certain
cases, the correct timestamps will occur in the stream after the
start of the frame, but before the start of the actual picture data.
This function can be used to set the timestamps based on the offset
into the frame data that the picture starts.

Parameters:

  • offset (Integer)

    offset into current buffer

Returns:

  • (nil)