Class: GstAudio::AudioEncoder

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

Overview

Subclasses can override any of the available virtual methods or not, as needed. At minimum set_format and 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

#allocate_output_buffer(size) ⇒ Gst::Buffer

Helper function that allocates a buffer to hold an encoded audio frame for enc'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_encoder_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

#drainableBoolean

Queries encoder drain handling. MT safe.

Returns:

  • (Boolean)

    TRUE if drainable handling is enabled.

#drainable=(enabled) ⇒ nil

Configures encoder drain handling. If drainable, subclass might be handed a NULL buffer to have it return any leftover encoded 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)

#finish_frame(buffer, samples) ⇒ Gst::FlowReturn

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

If samples < 0, then best estimate is all samples provided to encoder (subclass) so far. buf may be NULL, in which case next number of samples are considered discarded, e.g. as a result of discontinuous transmission, and a discontinuity is marked.

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

Parameters:

  • buffer (Gst::Buffer)

    encoded data

  • samples (Integer)

    number of samples (per channel) represented by encoded data

Returns:

  • (Gst::FlowReturn)

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

#frame_maxInteger

Returns currently configured maximum handled frames.

Returns:

  • (Integer)

    currently configured maximum handled frames

#frame_max=(num) ⇒ nil

Sets max number of frames accepted at once (assumed minimally 1). Requires frame_samples_min and frame_samples_max to be the equal.

Note: This value will be reset to 0 every time before Gst::AudioEncoderClass.set_format() is called.

Parameters:

  • num (Integer)

    number of frames

Returns:

  • (nil)

#frame_samples_maxInteger

Returns currently maximum requested samples per frame.

Returns:

  • (Integer)

    currently maximum requested samples per frame

#frame_samples_max=(num) ⇒ nil

Sets number of samples (per channel) subclass needs to be handed, at most or will be handed all available if 0.

If an exact number of samples is required, gst_audio_encoder_set_frame_samples_min() must be called with the same number.

Note: This value will be reset to 0 every time before Gst::AudioEncoderClass.set_format() is called.

Parameters:

  • num (Integer)

    number of samples per frame

Returns:

  • (nil)

#frame_samples_minInteger

Returns currently minimum requested samples per frame.

Returns:

  • (Integer)

    currently minimum requested samples per frame

#frame_samples_min=(num) ⇒ nil

Sets number of samples (per channel) subclass needs to be handed, at least or will be handed all available if 0.

If an exact number of samples is required, gst_audio_encoder_set_frame_samples_max() must be called with the same number.

Note: This value will be reset to 0 every time before Gst::AudioEncoderClass.set_format() is called.

Parameters:

  • num (Integer)

    number of samples per frame

Returns:

  • (nil)

#get_allocator(allocator, params) ⇒ nil

Lets Gst::AudioEncoder 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)

#hard_minBoolean

Queries encoder hard minimum handling. MT safe.

Returns:

  • (Boolean)

    TRUE if hard minimum handling is enabled.

#hard_min=(enabled) ⇒ nil

Configures encoder hard minimum handling. If enabled, subclass will never be handed less samples than it configured, which otherwise might occur near end-of-data handling. Instead, the leftover samples will simply be discarded.

MT safe.

Parameters:

  • enabled (Boolean)

    new state

Returns:

  • (nil)

#hard_resyncBoolean

Returns:

  • (Boolean)

#hard_resync=(hard_resync) ⇒ Boolean

Parameters:

  • hard_resync (Boolean)

Returns:

  • (Boolean)

    hard-resync

  • (Boolean)

    hard-resync

#hard_resync?Boolean

Returns hard-resync.

Returns:

  • (Boolean)

    hard-resync

#headers=(headers) ⇒ nil

Set the codec headers to be sent downstream whenever requested.

Parameters:

  • headers (GLib::List<Gst::Buffer>)

    a list of Gst::Buffer containing the codec header

Returns:

  • (nil)

#lookaheadInteger

Returns currently configured encoder lookahead.

Returns:

  • (Integer)

    currently configured encoder lookahead

#lookahead=(num) ⇒ nil

Sets encoder lookahead (in units of input rate samples)

Note: This value will be reset to 0 every time before Gst::AudioEncoderClass.set_format() is called.

Parameters:

  • num (Integer)

    lookahead

Returns:

  • (nil)

#mark_granuleBoolean

Queries if the encoder will handle granule marking. MT safe.

Returns:

  • (Boolean)

    TRUE if granule marking is enabled.

#mark_granule=(mark_granule) ⇒ Boolean

Parameters:

  • mark_granule (Boolean)

Returns:

  • (Boolean)

    mark-granule

  • (Boolean)

    mark-granule

#mark_granule?Boolean

Returns mark-granule.

Returns:

  • (Boolean)

    mark-granule

#merge_tags(tags, mode) ⇒ nil

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

MT safe.

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)

#negotiateBoolean

Negotiate with downstream elements to currently configured Gst::Caps. 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_format=(caps) ⇒ Boolean

Configure output caps on the srcpad of enc.

Parameters:

Returns:

  • (Boolean)

    true on success.

#perfect_timestampBoolean

Queries encoder perfect timestamp behaviour. MT safe.

Returns:

  • (Boolean)

    TRUE if perfect timestamp setting enabled.

#perfect_timestamp=(perfect_timestamp) ⇒ Boolean

Parameters:

  • perfect_timestamp (Boolean)

Returns:

  • (Boolean)

    perfect-timestamp

  • (Boolean)

    perfect-timestamp

#perfect_timestamp?Boolean

Returns perfect-timestamp.

Returns:

  • (Boolean)

    perfect-timestamp

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

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

Parameters:

Returns:

  • (Gst::Caps)

    a Gst::Caps owned by caller

#set_latency(min, max) ⇒ nil

Sets encoder 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