# GstAudioEncoder

This base class is for audio encoders turning raw audio samples into encoded audio data.

GstAudioEncoder and subclass should cooperate as follows.

## Configuration

- Initially, GstAudioEncoder calls start when the encoder element is activated, which allows subclass to perform any global setup.

- GstAudioEncoder calls set_format to inform subclass of the format of input audio data that it is about to receive. Subclass should setup for encoding and configure various base class parameters appropriately, notably those directing desired input data handling. While unlikely, it might be called more than once, if changing input parameters require reconfiguration.

- GstAudioEncoder calls stop at end of all processing.

As of configuration stage, and throughout processing, GstAudioEncoder maintains various parameters that provide required context, e.g. describing the format of input audio data. Conversely, subclass can and should configure these context parameters to inform base class of its expectation w.r.t. buffer handling.

## Data processing

     * Base class gathers input sample data (as directed by the context's
       frame_samples and frame_max) and provides this to subclass' @handle_frame.
     * If codec processing results in encoded data, subclass should call
       gst_audio_encoder_finish_frame() to have encoded data pushed
       downstream. Alternatively, it might also call
       gst_audio_encoder_finish_frame() (with a NULL buffer and some number of
       dropped samples) to indicate dropped (non-encoded) samples.
     * Just prior to actually pushing a buffer downstream,
       it is passed to @pre_push.
     * During the parsing process GstAudioEncoderClass will handle both
       srcpad and sinkpad events. Sink events will be passed to subclass
       if @event callback has been provided.

## Shutdown phase

- GstAudioEncoder class calls stop to inform the subclass that data parsing will be stopped.

Subclass is responsible for providing pad template caps for source and sink pads. The pads need to be named "sink" and "src". It also needs to set the fixed caps on srcpad, when the format is ensured. This is typically when base class calls subclass' set_format function, though it might be delayed until calling gst_audio_encoder_finish_frame.

In summary, above process should have subclass concentrating on codec data processing while leaving other matters to base class, such as most notably timestamp handling. While it may exert more control in this area (see e.g. pre_push), it is very much not recommended.

In particular, base class will either favor tracking upstream timestamps (at the possible expense of jitter) or aim to arrange for a perfect stream of output timestamps, depending on perfect-timestamp. However, in the latter case, the input may not be so perfect or ideal, which is handled as follows. An input timestamp is compared with the expected timestamp as dictated by input sample stream and if the deviation is less than tolerance, the deviation is discarded. Otherwise, it is considered a discontuinity and subsequent output timestamp is resynced to the new position after performing configured discontinuity processing. In the non-perfect-timestamp case, an upstream variation exceeding tolerance only leads to marking DISCONT on subsequent outgoing (while timestamps are adjusted to upstream regardless of variation). While DISCONT is also marked in the perfect-timestamp case, this one optionally (see hard-resync) performs some additional steps, such as clipping of (early) input samples or draining all currently remaining input data, depending on the direction of the discontuinity.

If perfect timestamps are arranged, it is also possible to request baseclass (usually set by subclass) to provide additional buffer metadata (in OFFSET and OFFSET_END) fields according to granule defined semantics currently needed by oggmux. Specifically, OFFSET is set to granulepos (= sample count including buffer) and OFFSET_END to corresponding timestamp (as determined by same sample count and sample rate).

Things that subclass need to take care of:

- Provide pad templates
- Set source pad caps when appropriate
- Inform base class of buffer processing needs using context's frame_samples and frame_bytes.
- Set user-configurable properties to sane defaults for format and implementing codec at hand, e.g. those controlling timestamp behaviour and discontinuity processing.
- Accept data in handle_frame and provide encoded results to gst_audio_encoder_finish_frame.

## GstAudioEncoder

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstElement
                    ╰──GstAudioEncoder

The opaque GstAudioEncoder data structure.

### Members

`element` (GstElement) –
No description available
`sinkpad` (GstPad *) –
No description available
`srcpad` (GstPad *) –
No description available
`stream_lock` (GRecMutex) –
No description available
`input_segment` (GstSegment) –
No description available
`output_segment` (GstSegment) –
No description available

### Class structure

#### GstAudioEncoderClass

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

##### Fields

`element_class` (GstElementClass) –

The parent class structure

### GstAudio.AudioEncoderClass

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

##### Attributes

`element_class` (Gst.ElementClass) –

The parent class structure

### GstAudio.AudioEncoderClass

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

##### Attributes

`element_class` (Gst.ElementClass) –

The parent class structure

## GstAudio.AudioEncoder

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.Element
                    ╰──GstAudio.AudioEncoder

The opaque GstAudio.AudioEncoder data structure.

### Members

`element` (Gst.Element) –
No description available
`sinkpad` (Gst.Pad) –
No description available
`srcpad` (Gst.Pad) –
No description available
`stream_lock` (GLib.RecMutex) –
No description available
`input_segment` (Gst.Segment) –
No description available
`output_segment` (Gst.Segment) –
No description available

## GstAudio.AudioEncoder

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.Element
                    ╰──GstAudio.AudioEncoder

The opaque GstAudio.AudioEncoder data structure.

### Members

`element` (Gst.Element) –
No description available
`sinkpad` (Gst.Pad) –
No description available
`srcpad` (Gst.Pad) –
No description available
`stream_lock` (GLib.RecMutex) –
No description available
`input_segment` (Gst.Segment) –
No description available
`output_segment` (Gst.Segment) –
No description available

### Methods

#### gst_audio_encoder_allocate_output_buffer

    GstBuffer *
    gst_audio_encoder_allocate_output_buffer (GstAudioEncoder * enc,
                                              gsize size)

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

Parameters:

`enc` –

a GstAudioEncoder

`size` –

size of the buffer

Returns ( [transfer: full]) –

allocated buffer

#### GstAudio.AudioEncoder.prototype.allocate_output_buffer

    function GstAudio.AudioEncoder.prototype.allocate_output_buffer(size: Number): {
        // javascript wrapper for 'gst_audio_encoder_allocate_output_buffer'
    }

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

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`size` (Number) –

size of the buffer

Returns (Gst.Buffer) –

allocated buffer

#### GstAudio.AudioEncoder.allocate_output_buffer

    def GstAudio.AudioEncoder.allocate_output_buffer (self, size):
        #python wrapper for 'gst_audio_encoder_allocate_output_buffer'

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

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`size` (int) –

size of the buffer

Returns (Gst.Buffer) –

allocated buffer

#### gst_audio_encoder_finish_frame

    GstFlowReturn
    gst_audio_encoder_finish_frame (GstAudioEncoder * enc,
                                    GstBuffer * buffer,
                                    gint samples)

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 handle_frame() may be invalidated by a call to this function.

Parameters:

`enc` –

a GstAudioEncoder

`buffer` ( [transfer: full][allow-none]) –

encoded data

`samples` –

number of samples (per channel) represented by encoded data

Returns –

a GstFlowReturn that should be escalated to caller (of caller)

#### GstAudio.AudioEncoder.prototype.finish_frame

    function GstAudio.AudioEncoder.prototype.finish_frame(buffer: Gst.Buffer, samples: Number): {
        // javascript wrapper for 'gst_audio_encoder_finish_frame'
    }

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 handle_frame() may be invalidated by a call to this function.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`buffer` (Gst.Buffer) –

encoded data

`samples` (Number) –

number of samples (per channel) represented by encoded data

Returns (Gst.FlowReturn) –

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

#### GstAudio.AudioEncoder.finish_frame

    def GstAudio.AudioEncoder.finish_frame (self, buffer, samples):
        #python wrapper for 'gst_audio_encoder_finish_frame'

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 handle_frame() may be invalidated by a call to this function.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`buffer` (Gst.Buffer) –

encoded data

`samples` (int) –

number of samples (per channel) represented by encoded data

Returns (Gst.FlowReturn) –

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

#### gst_audio_encoder_get_allocator

    gst_audio_encoder_get_allocator (GstAudioEncoder * enc,
                                     GstAllocator ** allocator,
                                     GstAllocationParams * params)

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

Unref the allocator after use it.

Parameters:

`enc` –

a GstAudioEncoder

`allocator` ( [out][allow-none][transfer: full]) –

the GstAllocator used

`params` ( [out][allow-none][transfer: full]) –

the GstAllocationParams of allocator

#### GstAudio.AudioEncoder.prototype.get_allocator

    function GstAudio.AudioEncoder.prototype.get_allocator(): {
        // javascript wrapper for 'gst_audio_encoder_get_allocator'
    }

Lets GstAudio.AudioEncoder sub-classes to know the memory allocator used by the base class and its params.

Unref the allocator after use it.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

#### GstAudio.AudioEncoder.get_allocator

    def GstAudio.AudioEncoder.get_allocator (self):
        #python wrapper for 'gst_audio_encoder_get_allocator'

Lets GstAudio.AudioEncoder sub-classes to know the memory allocator used by the base class and its params.

Unref the allocator after use it.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

#### gst_audio_encoder_get_audio_info

    GstAudioInfo *
    gst_audio_encoder_get_audio_info (GstAudioEncoder * enc)

Parameters:

`enc` –

a GstAudioEncoder

Returns ( [transfer: none]) –

a GstAudioInfo describing the input audio format

#### GstAudio.AudioEncoder.prototype.get_audio_info

    function GstAudio.AudioEncoder.prototype.get_audio_info(): {
        // javascript wrapper for 'gst_audio_encoder_get_audio_info'
    }

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

Returns (GstAudio.AudioInfo) –

a GstAudio.AudioInfo describing the input audio format

#### GstAudio.AudioEncoder.get_audio_info

    def GstAudio.AudioEncoder.get_audio_info (self):
        #python wrapper for 'gst_audio_encoder_get_audio_info'

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

Returns (GstAudio.AudioInfo) –

a GstAudio.AudioInfo describing the input audio format

#### gst_audio_encoder_get_drainable

    gboolean
    gst_audio_encoder_get_drainable (GstAudioEncoder * enc)

Queries encoder drain handling.

Parameters:

`enc` –

a GstAudioEncoder

Returns –

TRUE if drainable handling is enabled.

MT safe.

#### GstAudio.AudioEncoder.prototype.get_drainable

    function GstAudio.AudioEncoder.prototype.get_drainable(): {
        // javascript wrapper for 'gst_audio_encoder_get_drainable'
    }

Queries encoder drain handling.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

Returns (Number) –

TRUE if drainable handling is enabled.

MT safe.

#### GstAudio.AudioEncoder.get_drainable

    def GstAudio.AudioEncoder.get_drainable (self):
        #python wrapper for 'gst_audio_encoder_get_drainable'

Queries encoder drain handling.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

Returns (bool) –

TRUE if drainable handling is enabled.

MT safe.

#### gst_audio_encoder_get_frame_max

    gint
    gst_audio_encoder_get_frame_max (GstAudioEncoder * enc)

Parameters:

`enc` –

a GstAudioEncoder

Returns –

currently configured maximum handled frames

#### GstAudio.AudioEncoder.prototype.get_frame_max

    function GstAudio.AudioEncoder.prototype.get_frame_max(): {
        // javascript wrapper for 'gst_audio_encoder_get_frame_max'
    }

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

Returns (Number) –

currently configured maximum handled frames

#### GstAudio.AudioEncoder.get_frame_max

    def GstAudio.AudioEncoder.get_frame_max (self):
        #python wrapper for 'gst_audio_encoder_get_frame_max'

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

Returns (int) –

currently configured maximum handled frames

#### gst_audio_encoder_get_frame_samples_max

    gint
    gst_audio_encoder_get_frame_samples_max (GstAudioEncoder * enc)

Parameters:

`enc` –

a GstAudioEncoder

Returns –

currently maximum requested samples per frame

#### GstAudio.AudioEncoder.prototype.get_frame_samples_max

    function GstAudio.AudioEncoder.prototype.get_frame_samples_max(): {
        // javascript wrapper for 'gst_audio_encoder_get_frame_samples_max'
    }

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

Returns (Number) –

currently maximum requested samples per frame

#### GstAudio.AudioEncoder.get_frame_samples_max

    def GstAudio.AudioEncoder.get_frame_samples_max (self):
        #python wrapper for 'gst_audio_encoder_get_frame_samples_max'

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

Returns (int) –

currently maximum requested samples per frame

#### gst_audio_encoder_get_frame_samples_min

    gint
    gst_audio_encoder_get_frame_samples_min (GstAudioEncoder * enc)

Parameters:

`enc` –

a GstAudioEncoder

Returns –

currently minimum requested samples per frame

#### GstAudio.AudioEncoder.prototype.get_frame_samples_min

    function GstAudio.AudioEncoder.prototype.get_frame_samples_min(): {
        // javascript wrapper for 'gst_audio_encoder_get_frame_samples_min'
    }

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

Returns (Number) –

currently minimum requested samples per frame

#### GstAudio.AudioEncoder.get_frame_samples_min

    def GstAudio.AudioEncoder.get_frame_samples_min (self):
        #python wrapper for 'gst_audio_encoder_get_frame_samples_min'

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

Returns (int) –

currently minimum requested samples per frame

#### gst_audio_encoder_get_hard_min

    gboolean
    gst_audio_encoder_get_hard_min (GstAudioEncoder * enc)

Queries encoder hard minimum handling.

Parameters:

`enc` –

a GstAudioEncoder

Returns –

TRUE if hard minimum handling is enabled.

MT safe.

#### GstAudio.AudioEncoder.prototype.get_hard_min

    function GstAudio.AudioEncoder.prototype.get_hard_min(): {
        // javascript wrapper for 'gst_audio_encoder_get_hard_min'
    }

Queries encoder hard minimum handling.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

Returns (Number) –

TRUE if hard minimum handling is enabled.

MT safe.

#### GstAudio.AudioEncoder.get_hard_min

    def GstAudio.AudioEncoder.get_hard_min (self):
        #python wrapper for 'gst_audio_encoder_get_hard_min'

Queries encoder hard minimum handling.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

Returns (bool) –

TRUE if hard minimum handling is enabled.

MT safe.

#### gst_audio_encoder_get_hard_resync

    gboolean
    gst_audio_encoder_get_hard_resync (GstAudioEncoder * enc)

Parameters:

`enc` –
No description available
Returns –
No description available

#### GstAudio.AudioEncoder.prototype.get_hard_resync

    function GstAudio.AudioEncoder.prototype.get_hard_resync(): {
        // javascript wrapper for 'gst_audio_encoder_get_hard_resync'
    }

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
Returns (Number) –
No description available

#### GstAudio.AudioEncoder.get_hard_resync

    def GstAudio.AudioEncoder.get_hard_resync (self):
        #python wrapper for 'gst_audio_encoder_get_hard_resync'

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
Returns (bool) –
No description available

#### gst_audio_encoder_get_latency

    gst_audio_encoder_get_latency (GstAudioEncoder * enc,
                                   GstClockTime * min,
                                   GstClockTime * max)

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

Parameters:

`enc` –

a GstAudioEncoder

`min` ( [out][allow-none]) –

a pointer to storage to hold minimum latency

`max` ( [out][allow-none]) –

a pointer to storage to hold maximum latency

#### GstAudio.AudioEncoder.prototype.get_latency

    function GstAudio.AudioEncoder.prototype.get_latency(): {
        // javascript wrapper for 'gst_audio_encoder_get_latency'
    }

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

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

#### GstAudio.AudioEncoder.get_latency

    def GstAudio.AudioEncoder.get_latency (self):
        #python wrapper for 'gst_audio_encoder_get_latency'

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

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

#### gst_audio_encoder_get_lookahead

    gint
    gst_audio_encoder_get_lookahead (GstAudioEncoder * enc)

Parameters:

`enc` –

a GstAudioEncoder

Returns –

currently configured encoder lookahead

#### GstAudio.AudioEncoder.prototype.get_lookahead

    function GstAudio.AudioEncoder.prototype.get_lookahead(): {
        // javascript wrapper for 'gst_audio_encoder_get_lookahead'
    }

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

Returns (Number) –

currently configured encoder lookahead

#### GstAudio.AudioEncoder.get_lookahead

    def GstAudio.AudioEncoder.get_lookahead (self):
        #python wrapper for 'gst_audio_encoder_get_lookahead'

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

Returns (int) –

currently configured encoder lookahead

#### gst_audio_encoder_get_mark_granule

    gboolean
    gst_audio_encoder_get_mark_granule (GstAudioEncoder * enc)

Queries if the encoder will handle granule marking.

Parameters:

`enc` –

a GstAudioEncoder

Returns –

TRUE if granule marking is enabled.

MT safe.

#### GstAudio.AudioEncoder.prototype.get_mark_granule

    function GstAudio.AudioEncoder.prototype.get_mark_granule(): {
        // javascript wrapper for 'gst_audio_encoder_get_mark_granule'
    }

Queries if the encoder will handle granule marking.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

Returns (Number) –

TRUE if granule marking is enabled.

MT safe.

#### GstAudio.AudioEncoder.get_mark_granule

    def GstAudio.AudioEncoder.get_mark_granule (self):
        #python wrapper for 'gst_audio_encoder_get_mark_granule'

Queries if the encoder will handle granule marking.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

Returns (bool) –

TRUE if granule marking is enabled.

MT safe.

#### gst_audio_encoder_get_perfect_timestamp

    gboolean
    gst_audio_encoder_get_perfect_timestamp (GstAudioEncoder * enc)

Queries encoder perfect timestamp behaviour.

Parameters:

`enc` –

a GstAudioEncoder

Returns –

TRUE if perfect timestamp setting enabled.

MT safe.

#### GstAudio.AudioEncoder.prototype.get_perfect_timestamp

    function GstAudio.AudioEncoder.prototype.get_perfect_timestamp(): {
        // javascript wrapper for 'gst_audio_encoder_get_perfect_timestamp'
    }

Queries encoder perfect timestamp behaviour.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

Returns (Number) –

TRUE if perfect timestamp setting enabled.

MT safe.

#### GstAudio.AudioEncoder.get_perfect_timestamp

    def GstAudio.AudioEncoder.get_perfect_timestamp (self):
        #python wrapper for 'gst_audio_encoder_get_perfect_timestamp'

Queries encoder perfect timestamp behaviour.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

Returns (bool) –

TRUE if perfect timestamp setting enabled.

MT safe.

#### gst_audio_encoder_get_tolerance

    GstClockTime
    gst_audio_encoder_get_tolerance (GstAudioEncoder * enc)

Queries current audio jitter tolerance threshold.

Parameters:

`enc` –

a GstAudioEncoder

Returns –

encoder audio jitter tolerance threshold.

MT safe.

#### GstAudio.AudioEncoder.prototype.get_tolerance

    function GstAudio.AudioEncoder.prototype.get_tolerance(): {
        // javascript wrapper for 'gst_audio_encoder_get_tolerance'
    }

Queries current audio jitter tolerance threshold.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

Returns (Number) –

encoder audio jitter tolerance threshold.

MT safe.

#### GstAudio.AudioEncoder.get_tolerance

    def GstAudio.AudioEncoder.get_tolerance (self):
        #python wrapper for 'gst_audio_encoder_get_tolerance'

Queries current audio jitter tolerance threshold.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

Returns (int) –

encoder audio jitter tolerance threshold.

MT safe.

#### gst_audio_encoder_merge_tags

    gst_audio_encoder_merge_tags (GstAudioEncoder * enc,
                                  const GstTagList * tags,
                                  GstTagMergeMode mode)

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:

`enc` –

a GstAudioEncoder

`tags` ( [allow-none]) –

a GstTagList to merge, or NULL to unset previously-set tags

`mode` –

the GstTagMergeMode to use, usually GST_TAG_MERGE_REPLACE

#### GstAudio.AudioEncoder.prototype.merge_tags

    function GstAudio.AudioEncoder.prototype.merge_tags(tags: Gst.TagList, mode: Gst.TagMergeMode): {
        // javascript wrapper for 'gst_audio_encoder_merge_tags'
    }

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

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`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.TagMergeMode.REPLACE

#### GstAudio.AudioEncoder.merge_tags

    def GstAudio.AudioEncoder.merge_tags (self, tags, mode):
        #python wrapper for 'gst_audio_encoder_merge_tags'

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

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`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.TagMergeMode.REPLACE

#### gst_audio_encoder_negotiate

    gboolean
    gst_audio_encoder_negotiate (GstAudioEncoder * enc)

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

Parameters:

`enc` –

a GstAudioEncoder

Returns –

TRUE if the negotiation succeeded, else FALSE.

#### GstAudio.AudioEncoder.prototype.negotiate

    function GstAudio.AudioEncoder.prototype.negotiate(): {
        // javascript wrapper for 'gst_audio_encoder_negotiate'
    }

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.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

Returns (Number) –

true if the negotiation succeeded, else false.

#### GstAudio.AudioEncoder.negotiate

    def GstAudio.AudioEncoder.negotiate (self):
        #python wrapper for 'gst_audio_encoder_negotiate'

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.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

Returns (bool) –

True if the negotiation succeeded, else False.

#### gst_audio_encoder_proxy_getcaps

    GstCaps *
    gst_audio_encoder_proxy_getcaps (GstAudioEncoder * enc,
                                     GstCaps * caps,
                                     GstCaps * filter)

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:

`enc` –

a GstAudioEncoder

`caps` ( [allow-none]) –

initial caps

`filter` ( [allow-none]) –

filter caps

Returns ( [transfer: full]) –

a GstCaps owned by caller

#### GstAudio.AudioEncoder.prototype.proxy_getcaps

    function GstAudio.AudioEncoder.prototype.proxy_getcaps(caps: Gst.Caps, filter: Gst.Caps): {
        // javascript wrapper for 'gst_audio_encoder_proxy_getcaps'
    }

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:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`caps` (Gst.Caps) –

initial caps

`filter` (Gst.Caps) –

filter caps

Returns (Gst.Caps) –

a Gst.Caps owned by caller

#### GstAudio.AudioEncoder.proxy_getcaps

    def GstAudio.AudioEncoder.proxy_getcaps (self, caps, filter):
        #python wrapper for 'gst_audio_encoder_proxy_getcaps'

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:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`caps` (Gst.Caps) –

initial caps

`filter` (Gst.Caps) –

filter caps

Returns (Gst.Caps) –

a Gst.Caps owned by caller

#### gst_audio_encoder_set_allocation_caps

    gst_audio_encoder_set_allocation_caps (GstAudioEncoder * enc,
                                           GstCaps * allocation_caps)

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 NULL the allocation query will use the caps from the pad.

Parameters:

`enc` –

a GstAudioEncoder

`allocation_caps` ( [allow-none]) –

a GstCaps or NULL

Since : 1.10

#### GstAudio.AudioEncoder.prototype.set_allocation_caps

    function GstAudio.AudioEncoder.prototype.set_allocation_caps(allocation_caps: Gst.Caps): {
        // javascript wrapper for 'gst_audio_encoder_set_allocation_caps'
    }

Sets a caps in allocation query which are different from the set pad's caps. Use this function before calling GstAudio.AudioEncoder.prototype.negotiate. Setting to null the allocation query will use the caps from the pad.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`allocation_caps` (Gst.Caps) –

a Gst.Caps or null

Since : 1.10

#### GstAudio.AudioEncoder.set_allocation_caps

    def GstAudio.AudioEncoder.set_allocation_caps (self, allocation_caps):
        #python wrapper for 'gst_audio_encoder_set_allocation_caps'

Sets a caps in allocation query which are different from the set pad's caps. Use this function before calling GstAudio.AudioEncoder.negotiate. Setting to None the allocation query will use the caps from the pad.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`allocation_caps` (Gst.Caps) –

a Gst.Caps or None

Since : 1.10

#### gst_audio_encoder_set_drainable

    gst_audio_encoder_set_drainable (GstAudioEncoder * enc,
                                     gboolean enabled)

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:

`enc` –

a GstAudioEncoder

`enabled` –

new state

#### GstAudio.AudioEncoder.prototype.set_drainable

    function GstAudio.AudioEncoder.prototype.set_drainable(enabled: Number): {
        // javascript wrapper for 'gst_audio_encoder_set_drainable'
    }

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:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`enabled` (Number) –

new state

#### GstAudio.AudioEncoder.set_drainable

    def GstAudio.AudioEncoder.set_drainable (self, enabled):
        #python wrapper for 'gst_audio_encoder_set_drainable'

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:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`enabled` (bool) –

new state

#### gst_audio_encoder_set_frame_max

    gst_audio_encoder_set_frame_max (GstAudioEncoder * enc,
                                     gint num)

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 set_format() is called.

Parameters:

`enc` –

a GstAudioEncoder

`num` –

number of frames

#### GstAudio.AudioEncoder.prototype.set_frame_max

    function GstAudio.AudioEncoder.prototype.set_frame_max(num: Number): {
        // javascript wrapper for 'gst_audio_encoder_set_frame_max'
    }

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 set_format() is called.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`num` (Number) –

number of frames

#### GstAudio.AudioEncoder.set_frame_max

    def GstAudio.AudioEncoder.set_frame_max (self, num):
        #python wrapper for 'gst_audio_encoder_set_frame_max'

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 set_format() is called.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`num` (int) –

number of frames

#### gst_audio_encoder_set_frame_samples_max

    gst_audio_encoder_set_frame_samples_max (GstAudioEncoder * enc,
                                             gint num)

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 set_format() is called.

Parameters:

`enc` –

a GstAudioEncoder

`num` –

number of samples per frame

#### GstAudio.AudioEncoder.prototype.set_frame_samples_max

    function GstAudio.AudioEncoder.prototype.set_frame_samples_max(num: Number): {
        // javascript wrapper for 'gst_audio_encoder_set_frame_samples_max'
    }

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, GstAudio.AudioEncoder.prototype.set_frame_samples_min must be called with the same number.

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

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`num` (Number) –

number of samples per frame

#### GstAudio.AudioEncoder.set_frame_samples_max

    def GstAudio.AudioEncoder.set_frame_samples_max (self, num):
        #python wrapper for 'gst_audio_encoder_set_frame_samples_max'

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, GstAudio.AudioEncoder.set_frame_samples_min must be called with the same number.

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

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`num` (int) –

number of samples per frame

#### gst_audio_encoder_set_frame_samples_min

    gst_audio_encoder_set_frame_samples_min (GstAudioEncoder * enc,
                                             gint num)

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 set_format() is called.

Parameters:

`enc` –

a GstAudioEncoder

`num` –

number of samples per frame

#### GstAudio.AudioEncoder.prototype.set_frame_samples_min

    function GstAudio.AudioEncoder.prototype.set_frame_samples_min(num: Number): {
        // javascript wrapper for 'gst_audio_encoder_set_frame_samples_min'
    }

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, GstAudio.AudioEncoder.prototype.set_frame_samples_max must be called with the same number.

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

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`num` (Number) –

number of samples per frame

#### GstAudio.AudioEncoder.set_frame_samples_min

    def GstAudio.AudioEncoder.set_frame_samples_min (self, num):
        #python wrapper for 'gst_audio_encoder_set_frame_samples_min'

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, GstAudio.AudioEncoder.set_frame_samples_max must be called with the same number.

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

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`num` (int) –

number of samples per frame

#### gst_audio_encoder_set_hard_min

    gst_audio_encoder_set_hard_min (GstAudioEncoder * enc,
                                    gboolean enabled)

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:

`enc` –

a GstAudioEncoder

`enabled` –

new state

#### GstAudio.AudioEncoder.prototype.set_hard_min

    function GstAudio.AudioEncoder.prototype.set_hard_min(enabled: Number): {
        // javascript wrapper for 'gst_audio_encoder_set_hard_min'
    }

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:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`enabled` (Number) –

new state

#### GstAudio.AudioEncoder.set_hard_min

    def GstAudio.AudioEncoder.set_hard_min (self, enabled):
        #python wrapper for 'gst_audio_encoder_set_hard_min'

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:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`enabled` (bool) –

new state

#### gst_audio_encoder_set_hard_resync

    gst_audio_encoder_set_hard_resync (GstAudioEncoder * enc,
                                       gboolean enabled)

Parameters:

`enc` –
No description available
`enabled` –
No description available

#### GstAudio.AudioEncoder.prototype.set_hard_resync

    function GstAudio.AudioEncoder.prototype.set_hard_resync(enabled: Number): {
        // javascript wrapper for 'gst_audio_encoder_set_hard_resync'
    }

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
`enabled` (Number) –
No description available

#### GstAudio.AudioEncoder.set_hard_resync

    def GstAudio.AudioEncoder.set_hard_resync (self, enabled):
        #python wrapper for 'gst_audio_encoder_set_hard_resync'

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
`enabled` (bool) –
No description available

#### gst_audio_encoder_set_headers

    gst_audio_encoder_set_headers (GstAudioEncoder * enc,
                                   GList * headers)

Set the codec headers to be sent downstream whenever requested.

Parameters:

`enc` –

a GstAudioEncoder

`headers` ( [transfer: full][element-typeGst.Buffer]) –

a list of GstBuffer containing the codec header

#### GstAudio.AudioEncoder.prototype.set_headers

    function GstAudio.AudioEncoder.prototype.set_headers(headers: [ Gst.Buffer ]): {
        // javascript wrapper for 'gst_audio_encoder_set_headers'
    }

Set the codec headers to be sent downstream whenever requested.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`headers` ([ Gst.Buffer ]) –

a list of Gst.Buffer containing the codec header

#### GstAudio.AudioEncoder.set_headers

    def GstAudio.AudioEncoder.set_headers (self, headers):
        #python wrapper for 'gst_audio_encoder_set_headers'

Set the codec headers to be sent downstream whenever requested.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`headers` ([ Gst.Buffer ]) –

a list of Gst.Buffer containing the codec header

#### gst_audio_encoder_set_latency

    gst_audio_encoder_set_latency (GstAudioEncoder * enc,
                                   GstClockTime min,
                                   GstClockTime max)

Sets encoder latency.

Parameters:

`enc` –

a GstAudioEncoder

`min` –

minimum latency

`max` –

maximum latency

#### GstAudio.AudioEncoder.prototype.set_latency

    function GstAudio.AudioEncoder.prototype.set_latency(min: Number, max: Number): {
        // javascript wrapper for 'gst_audio_encoder_set_latency'
    }

Sets encoder latency.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`min` (Number) –

minimum latency

`max` (Number) –

maximum latency

#### GstAudio.AudioEncoder.set_latency

    def GstAudio.AudioEncoder.set_latency (self, min, max):
        #python wrapper for 'gst_audio_encoder_set_latency'

Sets encoder latency.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`min` (int) –

minimum latency

`max` (int) –

maximum latency

#### gst_audio_encoder_set_lookahead

    gst_audio_encoder_set_lookahead (GstAudioEncoder * enc,
                                     gint num)

Sets encoder lookahead (in units of input rate samples)

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

Parameters:

`enc` –

a GstAudioEncoder

`num` –

lookahead

#### GstAudio.AudioEncoder.prototype.set_lookahead

    function GstAudio.AudioEncoder.prototype.set_lookahead(num: Number): {
        // javascript wrapper for 'gst_audio_encoder_set_lookahead'
    }

Sets encoder lookahead (in units of input rate samples)

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

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`num` (Number) –

lookahead

#### GstAudio.AudioEncoder.set_lookahead

    def GstAudio.AudioEncoder.set_lookahead (self, num):
        #python wrapper for 'gst_audio_encoder_set_lookahead'

Sets encoder lookahead (in units of input rate samples)

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

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`num` (int) –

lookahead

#### gst_audio_encoder_set_mark_granule

    gst_audio_encoder_set_mark_granule (GstAudioEncoder * enc,
                                        gboolean enabled)

Enable or disable encoder granule handling.

MT safe.

Parameters:

`enc` –

a GstAudioEncoder

`enabled` –

new state

#### GstAudio.AudioEncoder.prototype.set_mark_granule

    function GstAudio.AudioEncoder.prototype.set_mark_granule(enabled: Number): {
        // javascript wrapper for 'gst_audio_encoder_set_mark_granule'
    }

Enable or disable encoder granule handling.

MT safe.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`enabled` (Number) –

new state

#### GstAudio.AudioEncoder.set_mark_granule

    def GstAudio.AudioEncoder.set_mark_granule (self, enabled):
        #python wrapper for 'gst_audio_encoder_set_mark_granule'

Enable or disable encoder granule handling.

MT safe.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`enabled` (bool) –

new state

#### gst_audio_encoder_set_output_format

    gboolean
    gst_audio_encoder_set_output_format (GstAudioEncoder * enc,
                                         GstCaps * caps)

Configure output caps on the srcpad of enc.

Parameters:

`enc` –

a GstAudioEncoder

`caps` ( [transfer: none]) –

GstCaps

Returns –

TRUE on success.

#### GstAudio.AudioEncoder.prototype.set_output_format

    function GstAudio.AudioEncoder.prototype.set_output_format(caps: Gst.Caps): {
        // javascript wrapper for 'gst_audio_encoder_set_output_format'
    }

Configure output caps on the srcpad of enc.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`caps` (Gst.Caps) –

Gst.Caps

Returns (Number) –

true on success.

#### GstAudio.AudioEncoder.set_output_format

    def GstAudio.AudioEncoder.set_output_format (self, caps):
        #python wrapper for 'gst_audio_encoder_set_output_format'

Configure output caps on the srcpad of enc.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`caps` (Gst.Caps) –

Gst.Caps

Returns (bool) –

True on success.

#### gst_audio_encoder_set_perfect_timestamp

    gst_audio_encoder_set_perfect_timestamp (GstAudioEncoder * enc,
                                             gboolean enabled)

Enable or disable encoder perfect output timestamp preference.

MT safe.

Parameters:

`enc` –

a GstAudioEncoder

`enabled` –

new state

#### GstAudio.AudioEncoder.prototype.set_perfect_timestamp

    function GstAudio.AudioEncoder.prototype.set_perfect_timestamp(enabled: Number): {
        // javascript wrapper for 'gst_audio_encoder_set_perfect_timestamp'
    }

Enable or disable encoder perfect output timestamp preference.

MT safe.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`enabled` (Number) –

new state

#### GstAudio.AudioEncoder.set_perfect_timestamp

    def GstAudio.AudioEncoder.set_perfect_timestamp (self, enabled):
        #python wrapper for 'gst_audio_encoder_set_perfect_timestamp'

Enable or disable encoder perfect output timestamp preference.

MT safe.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`enabled` (bool) –

new state

#### gst_audio_encoder_set_tolerance

    gst_audio_encoder_set_tolerance (GstAudioEncoder * enc,
                                     GstClockTime tolerance)

Configures encoder audio jitter tolerance threshold.

MT safe.

Parameters:

`enc` –

a GstAudioEncoder

`tolerance` –

new tolerance

#### GstAudio.AudioEncoder.prototype.set_tolerance

    function GstAudio.AudioEncoder.prototype.set_tolerance(tolerance: Number): {
        // javascript wrapper for 'gst_audio_encoder_set_tolerance'
    }

Configures encoder audio jitter tolerance threshold.

MT safe.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`tolerance` (Number) –

new tolerance

#### GstAudio.AudioEncoder.set_tolerance

    def GstAudio.AudioEncoder.set_tolerance (self, tolerance):
        #python wrapper for 'gst_audio_encoder_set_tolerance'

Configures encoder audio jitter tolerance threshold.

MT safe.

Parameters:

`enc` (GstAudio.AudioEncoder) –

a GstAudio.AudioEncoder

`tolerance` (int) –

new tolerance

### Properties

#### hard-resync

    “hard-resync” gboolean

Flags : Read / Write

#### hard-resync

    “hard-resync” Number

Flags : Read / Write

#### hard_resync

    “self.props.hard_resync” bool

Flags : Read / Write

#### mark-granule

    “mark-granule” gboolean

Flags : Read

#### mark-granule

    “mark-granule” Number

Flags : Read

#### mark_granule

    “self.props.mark_granule” bool

Flags : Read

#### perfect-timestamp

    “perfect-timestamp” gboolean

Flags : Read / Write

#### perfect-timestamp

    “perfect-timestamp” Number

Flags : Read / Write

#### perfect_timestamp

    “self.props.perfect_timestamp” bool

Flags : Read / Write

#### tolerance

    “tolerance” gint64

Flags : Read / Write

#### tolerance

    “tolerance” Number

Flags : Read / Write

#### tolerance

    “self.props.tolerance” int

Flags : Read / Write

### Virtual Methods

#### close

    gboolean
    close (GstAudioEncoder * enc)

Optional. Called when the element changes to GST_STATE_NULL. Allows closing external resources.

Parameters:

`enc` –
No description available
Returns –
No description available

#### vfunc_close

    function vfunc_close(enc: GstAudio.AudioEncoder): {
        // javascript implementation of the 'close' virtual method
    }

Optional. Called when the element changes to GST_STATE_NULL. Allows closing external resources.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
Returns (Number) –
No description available

#### do_close

    def do_close (enc):
        #python implementation of the 'close' virtual method

Optional. Called when the element changes to GST_STATE_NULL. Allows closing external resources.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
Returns (bool) –
No description available

#### decide_allocation

    gboolean
    decide_allocation (GstAudioEncoder * enc,
                       GstQuery * query)

Optional. Setup the allocation parameters for allocating output buffers. The passed in query contains the result of the downstream allocation query. Subclasses should chain up to the parent implementation to invoke the default handler.

Parameters:

`enc` –
No description available
`query` –
No description available
Returns –
No description available

#### vfunc_decide_allocation

    function vfunc_decide_allocation(enc: GstAudio.AudioEncoder, query: Gst.Query): {
        // javascript implementation of the 'decide_allocation' virtual method
    }

Optional. Setup the allocation parameters for allocating output buffers. The passed in query contains the result of the downstream allocation query. Subclasses should chain up to the parent implementation to invoke the default handler.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
`query` (Gst.Query) –
No description available
Returns (Number) –
No description available

#### do_decide_allocation

    def do_decide_allocation (enc, query):
        #python implementation of the 'decide_allocation' virtual method

Optional. Setup the allocation parameters for allocating output buffers. The passed in query contains the result of the downstream allocation query. Subclasses should chain up to the parent implementation to invoke the default handler.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
`query` (Gst.Query) –
No description available
Returns (bool) –
No description available

#### flush

    flush (GstAudioEncoder * enc)

Optional. Instructs subclass to clear any codec caches and discard any pending samples and not yet returned encoded data.

Parameters:

`enc` –
No description available

#### vfunc_flush

    function vfunc_flush(enc: GstAudio.AudioEncoder): {
        // javascript implementation of the 'flush' virtual method
    }

Optional. Instructs subclass to clear any codec caches and discard any pending samples and not yet returned encoded data.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available

#### do_flush

    def do_flush (enc):
        #python implementation of the 'flush' virtual method

Optional. Instructs subclass to clear any codec caches and discard any pending samples and not yet returned encoded data.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available

#### getcaps

    GstCaps *
    getcaps (GstAudioEncoder * enc,
             GstCaps * filter)

Optional. Allows for a custom sink getcaps implementation (e.g. for multichannel input specification). If not implemented, default returns gst_audio_encoder_proxy_getcaps applied to sink template caps.

Parameters:

`enc` –
No description available
`filter` –
No description available
Returns –
No description available

#### vfunc_getcaps

    function vfunc_getcaps(enc: GstAudio.AudioEncoder, filter: Gst.Caps): {
        // javascript implementation of the 'getcaps' virtual method
    }

Optional. Allows for a custom sink getcaps implementation (e.g. for multichannel input specification). If not implemented, default returns gst_audio_encoder_proxy_getcaps applied to sink template caps.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
`filter` (Gst.Caps) –
No description available
Returns (Gst.Caps) –
No description available

#### do_getcaps

    def do_getcaps (enc, filter):
        #python implementation of the 'getcaps' virtual method

Optional. Allows for a custom sink getcaps implementation (e.g. for multichannel input specification). If not implemented, default returns gst_audio_encoder_proxy_getcaps applied to sink template caps.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
`filter` (Gst.Caps) –
No description available
Returns (Gst.Caps) –
No description available

#### handle_frame

    GstFlowReturn
    handle_frame (GstAudioEncoder * enc,
                  GstBuffer * buffer)

Provides input samples (or NULL to clear any remaining data) according to directions as configured by the subclass using the API. Input data ref management is performed by base class, subclass should not care or intervene, and input data is only valid until next call to base class, most notably a call to gst_audio_encoder_finish_frame.

Parameters:

`enc` –
No description available
`buffer` –
No description available
Returns –
No description available

#### vfunc_handle_frame

    function vfunc_handle_frame(enc: GstAudio.AudioEncoder, buffer: Gst.Buffer): {
        // javascript implementation of the 'handle_frame' virtual method
    }

Provides input samples (or NULL to clear any remaining data) according to directions as configured by the subclass using the API. Input data ref management is performed by base class, subclass should not care or intervene, and input data is only valid until next call to base class, most notably a call to GstAudio.AudioEncoder.prototype.finish_frame.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
`buffer` (Gst.Buffer) –
No description available
Returns (Gst.FlowReturn) –
No description available

#### do_handle_frame

    def do_handle_frame (enc, buffer):
        #python implementation of the 'handle_frame' virtual method

Provides input samples (or NULL to clear any remaining data) according to directions as configured by the subclass using the API. Input data ref management is performed by base class, subclass should not care or intervene, and input data is only valid until next call to base class, most notably a call to GstAudio.AudioEncoder.finish_frame.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
`buffer` (Gst.Buffer) –
No description available
Returns (Gst.FlowReturn) –
No description available

#### negotiate

    gboolean
    negotiate (GstAudioEncoder * enc)

Optional. Negotiate with downstream and configure buffer pools, etc. Subclasses should chain up to the parent implementation to invoke the default handler.

Parameters:

`enc` –
No description available
Returns –
No description available

#### vfunc_negotiate

    function vfunc_negotiate(enc: GstAudio.AudioEncoder): {
        // javascript implementation of the 'negotiate' virtual method
    }

Optional. Negotiate with downstream and configure buffer pools, etc. Subclasses should chain up to the parent implementation to invoke the default handler.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
Returns (Number) –
No description available

#### do_negotiate

    def do_negotiate (enc):
        #python implementation of the 'negotiate' virtual method

Optional. Negotiate with downstream and configure buffer pools, etc. Subclasses should chain up to the parent implementation to invoke the default handler.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
Returns (bool) –
No description available

#### open

    gboolean
    open (GstAudioEncoder * enc)

Optional. Called when the element changes to GST_STATE_READY. Allows opening external resources.

Parameters:

`enc` –
No description available
Returns –
No description available

#### vfunc_open

    function vfunc_open(enc: GstAudio.AudioEncoder): {
        // javascript implementation of the 'open' virtual method
    }

Optional. Called when the element changes to GST_STATE_READY. Allows opening external resources.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
Returns (Number) –
No description available

#### do_open

    def do_open (enc):
        #python implementation of the 'open' virtual method

Optional. Called when the element changes to GST_STATE_READY. Allows opening external resources.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
Returns (bool) –
No description available

#### pre_push

    GstFlowReturn
    pre_push (GstAudioEncoder * enc,
              GstBuffer ** buffer)

Optional. Called just prior to pushing (encoded data) buffer downstream. Subclass has full discretionary access to buffer, and a not OK flow return will abort downstream pushing.

Parameters:

`enc` –
No description available
`buffer` –
No description available
Returns –
No description available

#### vfunc_pre_push

    function vfunc_pre_push(enc: GstAudio.AudioEncoder, buffer: Gst.Buffer): {
        // javascript implementation of the 'pre_push' virtual method
    }

Optional. Called just prior to pushing (encoded data) buffer downstream. Subclass has full discretionary access to buffer, and a not OK flow return will abort downstream pushing.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
`buffer` (Gst.Buffer) –
No description available
Returns (Gst.FlowReturn) –
No description available

#### do_pre_push

    def do_pre_push (enc, buffer):
        #python implementation of the 'pre_push' virtual method

Optional. Called just prior to pushing (encoded data) buffer downstream. Subclass has full discretionary access to buffer, and a not OK flow return will abort downstream pushing.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
`buffer` (Gst.Buffer) –
No description available
Returns (Gst.FlowReturn) –
No description available

#### propose_allocation

    gboolean
    propose_allocation (GstAudioEncoder * enc,
                        GstQuery * query)

Optional. Propose buffer allocation parameters for upstream elements. Subclasses should chain up to the parent implementation to invoke the default handler.

Parameters:

`enc` –
No description available
`query` –
No description available
Returns –
No description available

#### vfunc_propose_allocation

    function vfunc_propose_allocation(enc: GstAudio.AudioEncoder, query: Gst.Query): {
        // javascript implementation of the 'propose_allocation' virtual method
    }

Optional. Propose buffer allocation parameters for upstream elements. Subclasses should chain up to the parent implementation to invoke the default handler.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
`query` (Gst.Query) –
No description available
Returns (Number) –
No description available

#### do_propose_allocation

    def do_propose_allocation (enc, query):
        #python implementation of the 'propose_allocation' virtual method

Optional. Propose buffer allocation parameters for upstream elements. Subclasses should chain up to the parent implementation to invoke the default handler.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
`query` (Gst.Query) –
No description available
Returns (bool) –
No description available

#### set_format

    gboolean
    set_format (GstAudioEncoder * enc,
                GstAudioInfo * info)

Notifies subclass of incoming data format. GstAudioInfo contains the format according to provided caps.

Parameters:

`enc` –
No description available
`info` –
No description available
Returns –
No description available

#### vfunc_set_format

    function vfunc_set_format(enc: GstAudio.AudioEncoder, info: GstAudio.AudioInfo): {
        // javascript implementation of the 'set_format' virtual method
    }

Notifies subclass of incoming data format. GstAudioInfo contains the format according to provided caps.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
`info` (GstAudio.AudioInfo) –
No description available
Returns (Number) –
No description available

#### do_set_format

    def do_set_format (enc, info):
        #python implementation of the 'set_format' virtual method

Notifies subclass of incoming data format. GstAudioInfo contains the format according to provided caps.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
`info` (GstAudio.AudioInfo) –
No description available
Returns (bool) –
No description available

#### sink_event

    gboolean
    sink_event (GstAudioEncoder * enc,
                GstEvent * event)

Optional. Event handler on the sink pad. Subclasses should chain up to the parent implementation to invoke the default handler.

Parameters:

`enc` –
No description available
`event` –
No description available
Returns –
No description available

#### vfunc_sink_event

    function vfunc_sink_event(enc: GstAudio.AudioEncoder, event: Gst.Event): {
        // javascript implementation of the 'sink_event' virtual method
    }

Optional. Event handler on the sink pad. Subclasses should chain up to the parent implementation to invoke the default handler.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
`event` (Gst.Event) –
No description available
Returns (Number) –
No description available

#### do_sink_event

    def do_sink_event (enc, event):
        #python implementation of the 'sink_event' virtual method

Optional. Event handler on the sink pad. Subclasses should chain up to the parent implementation to invoke the default handler.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
`event` (Gst.Event) –
No description available
Returns (bool) –
No description available

#### sink_query

    gboolean
    sink_query (GstAudioEncoder * encoder,
                GstQuery * query)

Optional. Query handler on the sink pad. This function should return TRUE if the query could be performed. Subclasses should chain up to the parent implementation to invoke the default handler. Since: 1.6

Parameters:

`encoder` –
No description available
`query` –
No description available
Returns –
No description available

#### vfunc_sink_query

    function vfunc_sink_query(encoder: GstAudio.AudioEncoder, query: Gst.Query): {
        // javascript implementation of the 'sink_query' virtual method
    }

Optional. Query handler on the sink pad. This function should return TRUE if the query could be performed. Subclasses should chain up to the parent implementation to invoke the default handler. Since: 1.6

Parameters:

`encoder` (GstAudio.AudioEncoder) –
No description available
`query` (Gst.Query) –
No description available
Returns (Number) –
No description available

#### do_sink_query

    def do_sink_query (encoder, query):
        #python implementation of the 'sink_query' virtual method

Optional. Query handler on the sink pad. This function should return TRUE if the query could be performed. Subclasses should chain up to the parent implementation to invoke the default handler. Since: 1.6

Parameters:

`encoder` (GstAudio.AudioEncoder) –
No description available
`query` (Gst.Query) –
No description available
Returns (bool) –
No description available

#### src_event

    gboolean
    src_event (GstAudioEncoder * enc,
               GstEvent * event)

Optional. Event handler on the src pad. Subclasses should chain up to the parent implementation to invoke the default handler.

Parameters:

`enc` –
No description available
`event` –
No description available
Returns –
No description available

#### vfunc_src_event

    function vfunc_src_event(enc: GstAudio.AudioEncoder, event: Gst.Event): {
        // javascript implementation of the 'src_event' virtual method
    }

Optional. Event handler on the src pad. Subclasses should chain up to the parent implementation to invoke the default handler.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
`event` (Gst.Event) –
No description available
Returns (Number) –
No description available

#### do_src_event

    def do_src_event (enc, event):
        #python implementation of the 'src_event' virtual method

Optional. Event handler on the src pad. Subclasses should chain up to the parent implementation to invoke the default handler.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
`event` (Gst.Event) –
No description available
Returns (bool) –
No description available

#### src_query

    gboolean
    src_query (GstAudioEncoder * encoder,
               GstQuery * query)

Optional. Query handler on the source pad. This function should return TRUE if the query could be performed. Subclasses should chain up to the parent implementation to invoke the default handler. Since: 1.6

Parameters:

`encoder` –
No description available
`query` –
No description available
Returns –
No description available

#### vfunc_src_query

    function vfunc_src_query(encoder: GstAudio.AudioEncoder, query: Gst.Query): {
        // javascript implementation of the 'src_query' virtual method
    }

Optional. Query handler on the source pad. This function should return TRUE if the query could be performed. Subclasses should chain up to the parent implementation to invoke the default handler. Since: 1.6

Parameters:

`encoder` (GstAudio.AudioEncoder) –
No description available
`query` (Gst.Query) –
No description available
Returns (Number) –
No description available

#### do_src_query

    def do_src_query (encoder, query):
        #python implementation of the 'src_query' virtual method

Optional. Query handler on the source pad. This function should return TRUE if the query could be performed. Subclasses should chain up to the parent implementation to invoke the default handler. Since: 1.6

Parameters:

`encoder` (GstAudio.AudioEncoder) –
No description available
`query` (Gst.Query) –
No description available
Returns (bool) –
No description available

#### start

    gboolean
    start (GstAudioEncoder * enc)

Optional. Called when the element starts processing. Allows opening external resources.

Parameters:

`enc` –
No description available
Returns –
No description available

#### vfunc_start

    function vfunc_start(enc: GstAudio.AudioEncoder): {
        // javascript implementation of the 'start' virtual method
    }

Optional. Called when the element starts processing. Allows opening external resources.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
Returns (Number) –
No description available

#### do_start

    def do_start (enc):
        #python implementation of the 'start' virtual method

Optional. Called when the element starts processing. Allows opening external resources.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
Returns (bool) –
No description available

#### stop

    gboolean
    stop (GstAudioEncoder * enc)

Optional. Called when the element stops processing. Allows closing external resources.

Parameters:

`enc` –
No description available
Returns –
No description available

#### vfunc_stop

    function vfunc_stop(enc: GstAudio.AudioEncoder): {
        // javascript implementation of the 'stop' virtual method
    }

Optional. Called when the element stops processing. Allows closing external resources.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
Returns (Number) –
No description available

#### do_stop

    def do_stop (enc):
        #python implementation of the 'stop' virtual method

Optional. Called when the element stops processing. Allows closing external resources.

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
Returns (bool) –
No description available

#### transform_meta

    gboolean
    transform_meta (GstAudioEncoder * enc,
                    GstBuffer * outbuf,
                    GstMeta * meta,
                    GstBuffer * inbuf)

Optional. Transform the metadata on the input buffer to the output buffer. By default this method copies all meta without tags and meta with only the "audio" tag. subclasses can implement this method and return TRUE if the metadata is to be copied. Since: 1.6

Parameters:

`enc` –
No description available
`outbuf` –
No description available
`meta` –
No description available
`inbuf` –
No description available
Returns –
No description available

#### vfunc_transform_meta

    function vfunc_transform_meta(enc: GstAudio.AudioEncoder, outbuf: Gst.Buffer, meta: Gst.Meta, inbuf: Gst.Buffer): {
        // javascript implementation of the 'transform_meta' virtual method
    }

Optional. Transform the metadata on the input buffer to the output buffer. By default this method copies all meta without tags and meta with only the "audio" tag. subclasses can implement this method and return true if the metadata is to be copied. Since: 1.6

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
`outbuf` (Gst.Buffer) –
No description available
`meta` (Gst.Meta) –
No description available
`inbuf` (Gst.Buffer) –
No description available
Returns (Number) –
No description available

#### do_transform_meta

    def do_transform_meta (enc, outbuf, meta, inbuf):
        #python implementation of the 'transform_meta' virtual method

Optional. Transform the metadata on the input buffer to the output buffer. By default this method copies all meta without tags and meta with only the "audio" tag. subclasses can implement this method and return True if the metadata is to be copied. Since: 1.6

Parameters:

`enc` (GstAudio.AudioEncoder) –
No description available
`outbuf` (Gst.Buffer) –
No description available
`meta` (Gst.Meta) –
No description available
`inbuf` (Gst.Buffer) –
No description available
Returns (bool) –
No description available

## Function Macros

### GST_AUDIO_ENCODER_CAST

    #define GST_AUDIO_ENCODER_CAST(obj)	((GstAudioEncoder *)(obj))

### GST_AUDIO_ENCODER_INPUT_SEGMENT

    #define GST_AUDIO_ENCODER_INPUT_SEGMENT(obj)     (GST_AUDIO_ENCODER_CAST (obj)->input_segment)

Gives the input segment of the element.

Parameters:

`obj` –

base parse instance

### GST_AUDIO_ENCODER_OUTPUT_SEGMENT

    #define GST_AUDIO_ENCODER_OUTPUT_SEGMENT(obj)     (GST_AUDIO_ENCODER_CAST (obj)->output_segment)

Gives the output segment of the element.

Parameters:

`obj` –

base parse instance

### GST_AUDIO_ENCODER_SINK_PAD

    #define GST_AUDIO_ENCODER_SINK_PAD(obj)	(GST_AUDIO_ENCODER_CAST (obj)->sinkpad)

Gives the pointer to the sink GstPad object of the element.

Parameters:

`obj` –

audio encoder instance

### GST_AUDIO_ENCODER_SRC_PAD

    #define GST_AUDIO_ENCODER_SRC_PAD(obj)	(GST_AUDIO_ENCODER_CAST (obj)->srcpad)

Gives the pointer to the source GstPad object of the element.

Parameters:

`obj` –

audio encoder instance

### GST_AUDIO_ENCODER_STREAM_LOCK

    #define GST_AUDIO_ENCODER_STREAM_LOCK(enc)   g_rec_mutex_lock (&GST_AUDIO_ENCODER (enc)->stream_lock)

### GST_AUDIO_ENCODER_STREAM_UNLOCK

    #define GST_AUDIO_ENCODER_STREAM_UNLOCK(enc) g_rec_mutex_unlock (&GST_AUDIO_ENCODER (enc)->stream_lock)

## Constants

### GST_AUDIO_ENCODER_SINK_NAME

    #define GST_AUDIO_ENCODER_SINK_NAME	"sink"

the name of the templates for the sink pad

### GstAudio.AUDIO_ENCODER_SINK_NAME

the name of the templates for the sink pad

### GstAudio.AUDIO_ENCODER_SINK_NAME

the name of the templates for the sink pad

### GST_AUDIO_ENCODER_SRC_NAME

    #define GST_AUDIO_ENCODER_SRC_NAME	        "src"

the name of the templates for the source pad

### GstAudio.AUDIO_ENCODER_SRC_NAME

the name of the templates for the source pad

### GstAudio.AUDIO_ENCODER_SRC_NAME

the name of the templates for the source pad

The results of the search are