Class: GstAudio::AudioDecoder

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 (and likely set_format) 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

#allocate_output_buffer(size) ⇒ Gst::Buffer

Helper function that allocates a buffer to hold an audio frame
for dec's current output format.

Parameters:

  • size (Integer)

    size of the buffer

Returns:

#allocation_caps=(allocation_caps) ⇒ nil

Sets a caps in allocation query which are different from the set
pad's caps. Use this function before calling
gst_audio_decoder_negotiate(). Setting to nil the allocation
query will use the caps from the pad.

Parameters:

  • allocation_caps (Gst::Caps)

    a Gst::Caps or nil

Returns:

  • (nil)

#audio_infoGstAudio::AudioInfo

Returns a Gst::AudioInfo describing the input audio format.

Returns:

  • (GstAudio::AudioInfo)

    a Gst::AudioInfo describing the input audio format

#delayInteger

Returns currently configured decoder delay.

Returns:

  • (Integer)

    currently configured decoder delay

#drainableBoolean

Queries decoder drain handling.
MT safe.

Returns:

  • (Boolean)

    TRUE if drainable handling is enabled.

#drainable=(enabled) ⇒ nil

Configures decoder drain handling. If drainable, subclass might
be handed a NULL buffer to have it return any leftover decoded data.
Otherwise, it is not considered so capable and will only ever be passed
real data.

MT safe.

Parameters:

  • enabled (Boolean)

    new state

Returns:

  • (nil)

#estimate_rateInteger

Returns currently configured byte to time conversion setting.

Returns:

  • (Integer)

    currently configured byte to time conversion setting

#estimate_rate=(enabled) ⇒ nil

Allows baseclass to perform byte to time estimated conversion.

Parameters:

  • enabled (Boolean)

    whether to enable byte to time conversion

Returns:

  • (nil)

#finish_frame(buf, frames) ⇒ Gst::FlowReturn

Collects decoded data and pushes it downstream.

buf may be NULL in which case the indicated number of frames
are discarded and considered to have produced no output
(e.g. lead-in or setup frames).
Otherwise, source pad caps must be set when it is called with valid
data in buf.

Note that a frame received in Gst::AudioDecoderClass.handle_frame() may be
invalidated by a call to this function.

Parameters:

  • buf (Gst::Buffer)

    decoded data

  • frames (Integer)

    number of decoded frames represented by decoded data

Returns:

  • (Gst::FlowReturn)

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

#finish_subframe(buf) ⇒ Gst::FlowReturn

Collects decoded data and pushes it downstream. This function may be called
multiple times for a given input frame.

buf may be NULL in which case it is assumed that the current input frame is
finished. This is equivalent to calling gst_audio_decoder_finish_subframe()
with a NULL buffer and frames=1 after having pushed out all decoded audio
subframes using this function.

When called with valid data in buf the source pad caps must have been set
already.

Note that a frame received in Gst::AudioDecoderClass.handle_frame() may be
invalidated by a call to this function.

Parameters:

Returns:

  • (Gst::FlowReturn)

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

#get_allocator(allocator, params) ⇒ nil

Lets Gst::AudioDecoder sub-classes to know the memory allocator
used by the base class and its params.

Unref the allocator after use it.
used
Gst::AllocationParams of allocator

Parameters:

  • allocator (Gst::Allocator)

    the Gst::Allocator

  • params (Gst::AllocationParams)

    the

Returns:

  • (nil)

#get_latency(min, max) ⇒ nil

Sets the variables pointed to by min and max to the currently configured
latency.

Parameters:

  • min (Gst::ClockTime)

    a pointer to storage to hold minimum latency

  • max (Gst::ClockTime)

    a pointer to storage to hold maximum latency

Returns:

  • (nil)

#get_parse_state(sync, eos) ⇒ nil

Return current parsing (sync and eos) state.

Parameters:

  • sync (Boolean)

    a pointer to a variable to hold the current sync state

  • eos (Boolean)

    a pointer to a variable to hold the current eos state

Returns:

  • (nil)

#max_errorsInteger

Maximum number of tolerated consecutive decode errors. See
gst_audio_decoder_set_max_errors() for more details.

Returns:

  • (Integer)

    max-errors

#max_errors=(max_errors) ⇒ Integer

Maximum number of tolerated consecutive decode errors. See
gst_audio_decoder_set_max_errors() for more details.

Parameters:

  • max_errors (Integer)

Returns:

  • (Integer)

    max-errors

  • (Integer)

    max-errors

#merge_tags(tags, mode) ⇒ nil

Sets the audio decoder tags and how they should be merged with any
upstream stream tags. This will override any tags previously-set
with gst_audio_decoder_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

  • mode (Gst::TagMergeMode)

    the Gst::TagMergeMode to use, usually #GST_TAG_MERGE_REPLACE

Returns:

  • (nil)

#min_latencyInteger

Returns min-latency.

Returns:

  • (Integer)

    min-latency

#min_latency=(min_latency) ⇒ Integer

Parameters:

  • min_latency (Integer)

Returns:

  • (Integer)

    min-latency

  • (Integer)

    min-latency

#needs_formatBoolean

Queries decoder required format handling.
MT safe.

Returns:

  • (Boolean)

    TRUE if required format handling is enabled.

#needs_format=(enabled) ⇒ nil

Configures decoder format needs. If enabled, subclass needs to be
negotiated with format caps before it can process any data. It will then
never be handed any data before it has been configured.
Otherwise, it might be handed data without having been configured and
is then expected being able to do so either by default
or based on the input data.

MT safe.

Parameters:

  • enabled (Boolean)

    new state

Returns:

  • (nil)

#negotiateBoolean

Negotiate with downstream elements to currently configured Gst::AudioInfo.
Unmark GST_PAD_FLAG_NEED_RECONFIGURE in any case. But mark it again if
negotiate fails.

Returns:

  • (Boolean)

    true if the negotiation succeeded, else false.

#output_caps=(caps) ⇒ Boolean

Configure output caps on the srcpad of dec. Similar to
gst_audio_decoder_set_output_format(), but allows subclasses to specify
output caps that can't be expressed via Gst::AudioInfo e.g. caps that have
caps features.

Parameters:

Returns:

  • (Boolean)

    true on success.

#output_format=(info) ⇒ Boolean

Configure output info on the srcpad of dec.

Parameters:

  • info (GstAudio::AudioInfo)

    Gst::AudioInfo

Returns:

  • (Boolean)

    true on success.

#plcBoolean

Queries decoder packet loss concealment handling.
MT safe.

Returns:

  • (Boolean)

    TRUE if packet loss concealment is enabled.

#plc=(plc) ⇒ Boolean

Parameters:

  • plc (Boolean)

Returns:

  • (Boolean)

    plc

  • (Boolean)

    plc

#plc?Boolean

Returns plc.

Returns:

  • (Boolean)

    plc

#plc_awareInteger

Returns currently configured plc handling.

Returns:

  • (Integer)

    currently configured plc handling

#plc_aware=(plc) ⇒ nil

Indicates whether or not subclass handles packet loss concealment (plc).

Parameters:

  • plc (Boolean)

    new plc state

Returns:

  • (nil)

#proxy_getcaps(caps, filter) ⇒ Gst::Caps

Returns caps that express caps (or sink template caps if caps == NULL)
restricted to rate/channels/... combinations supported by downstream
elements.

Parameters:

Returns:

  • (Gst::Caps)

    a Gst::Caps owned by caller

#set_latency(min, max) ⇒ nil

Sets decoder latency. 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 (Gst::ClockTime)

    minimum latency

  • max (Gst::ClockTime)

    maximum latency

Returns:

  • (nil)

#toleranceInteger

Returns tolerance.

Returns:

  • (Integer)

    tolerance

#tolerance=(tolerance) ⇒ Integer

Parameters:

  • tolerance (Integer)

Returns:

  • (Integer)

    tolerance

  • (Integer)

    tolerance

#use_default_pad_acceptcaps=(use) ⇒ nil

Lets Gst::AudioDecoder sub-classes decide if they want the sink pad
to use the default pad query handler to reply to accept-caps queries.

By setting this to true it is possible to further customize the default
handler with %GST_PAD_SET_ACCEPT_INTERSECT and
%GST_PAD_SET_ACCEPT_TEMPLATE

Parameters:

  • use (Boolean)

    if the default pad accept-caps query handling should be used

Returns:

  • (nil)