# gstnonstreamaudiodecoder

This base class is for decoders which do not operate on a streaming model. That is: they load the encoded media at once, as part of an initialization, and afterwards can decode samples (sometimes referred to as "rendering the samples").

This sets it apart from GstAudioDecoder, which is a base class for streaming audio decoders.

The base class is conceptually a mix between decoder and parser. This is unavoidable, since virtually no format that isn't streaming based has a clear distinction between parsing and decoding. As a result, this class also handles seeking.

Non-streaming audio formats tend to have some characteristics unknown to more "regular" bitstreams. These include subsongs and looping.

Subsongs are a set of songs-within-a-song. An analogy would be a multitrack recording, where each track is its own song. The first subsong is typically the "main" one. Subsongs were popular for video games to enable context- aware music; for example, subsong `#0` would be the "main" song, `#1` would be an alternate song playing when a fight started, `#2` would be heard during conversations etc. The base class is designed to always have at least one subsong. If the subclass doesn't provide any, the base class creates a "pseudo" subsong, which is actually the whole song. Downstream is informed about the subsong using a table of contents (TOC), but only if there are at least 2 subsongs.

Looping refers to jumps within the song, typically backwards to the loop start (although bi-directional looping is possible). The loop is defined by a chronological start and end; once the playback position reaches the loop end, it jumps back to the loop start. Depending on the subclass, looping may not be possible at all, or it may only be possible to enable/disable it (that is, either no looping, or an infinite amount of loops), or it may allow for defining a finite number of times the loop is repeated. Looping can affect output in two ways. Either, the playback position is reset to the start of the loop, similar to what happens after a seek event. Or, it is not reset, so the pipeline sees playback steadily moving forwards, the playback position monotonically increasing. However, seeking must always happen within the confines of the defined subsong duration; for example, if a subsong is 2 minutes long, steady playback is at 5 minutes (because infinite looping is enabled), then seeking will still place the position within the 2 minute period. Loop count 0 means no looping. Loop count -1 means infinite looping. Nonzero positive values indicate how often a loop shall occur.

If the initial subsong and loop count are set to values the subclass does not support, the subclass has a chance to correct these values. get_property then reports the corrected versions.

The base class operates as follows:

- Unloaded mode

  - Initial values are set. If a current subsong has already been defined (for example over the command line with gst-launch), then the subsong index is copied over to current_subsong . Same goes for the num-loops and output-mode properties. Media is NOT loaded yet.
  - Once the sinkpad is activated, the process continues. The sinkpad is activated in push mode, and the class accumulates the incoming media data in an adapter inside the sinkpad's chain function until either an EOS event is received from upstream, or the number of bytes reported by upstream is reached. Then it loads the media, and starts the decoder output task.
  - If upstream cannot respond to the size query (in bytes) of load_from_buffer fails, an error is reported, and the pipeline stops.
  - If there are no errors, load_from_buffer is called to load the media. The subclass must at least call gst_nonstream_audio_decoder_set_output_format there, and is free to make use of the initial subsong, output mode, and position. If the actual output mode or position differs from the initial value,it must set the initial value to the actual one (for example, if the actual starting position is always 0, set *initial_position to 0). If loading is unsuccessful, an error is reported, and the pipeline stops. Otherwise, the base class calls get_current_subsong to retrieve the actual current subsong, get_subsong_duration to report the current subsong's duration in a duration event and message, and get_subsong_tags to send tags downstream in an event (these functions are optional; if set to NULL, the associated operation is skipped). Afterwards, the base class switches to loaded mode, and starts the decoder output task.

- Loaded mode

  - Inside the decoder output task, the base class repeatedly calls decode, which returns a buffer with decoded, ready-to-play samples. If the subclass reached the end of playback, decode returns FALSE, otherwise TRUE.
  - Upon reaching a loop end, subclass either ignores that, or loops back to the beginning of the loop. In the latter case, if the output mode is set to LOOPING, the subclass must call gst_nonstream_audio_decoder_handle_loop *after* the playback position moved to the start of the loop. In STEADY mode, the subclass must *not* call this function. Since many decoders only provide a callback for when the looping occurs, and that looping occurs inside the decoding operation itself, the following mechanism for subclass is suggested: set a flag inside such a callback. Then, in the next decode call, before doing the decoding, check this flag. If it is set, gst_nonstream_audio_decoder_handle_loop is called, and the flag is cleared. (This function call is necessary in LOOPING mode because it updates the current segment and makes sure the next buffer that is sent downstream has its DISCONT flag set.)
  - When the current subsong is switched, set_current_subsong is called. If it fails, a warning is reported, and nothing else is done. Otherwise, it calls get_subsong_duration to get the new current subsongs's duration, get_subsong_tags to get its tags, reports a new duration (i.e. it sends a duration event downstream and generates a duration message), updates the current segment, and sends the subsong's tags in an event downstream. (If set_current_subsong has been set to NULL by the subclass, attempts to set a current subsong are ignored; likewise, if get_subsong_duration is NULL, no duration is reported, and if get_subsong_tags is NULL, no tags are sent downstream.)
  - When an attempt is made to switch the output mode, it is checked against the bitmask returned by get_supported_output_modes. If the proposed new output mode is supported, the current segment is updated (it is open-ended in STEADY mode, and covers the (sub)song length in LOOPING mode), and the subclass' set_output_mode function is called unless it is set to NULL. Subclasses should reset internal loop counters in this function.

The relationship between (sub)song duration, output mode, and number of loops is defined this way (this is all done by the base class automatically):

- Segments have their duration and stop values set to GST_CLOCK_TIME_NONE in STEADY mode, and to the duration of the (sub)song in LOOPING mode.

- The duration that is returned to a DURATION query is always the duration of the (sub)song, regardless of number of loops or output mode. The same goes for DURATION messages and tags.

- If the number of loops is >0 or -1, durations of TOC entries are set to the duration of the respective subsong in LOOPING mode and to G_MAXINT64 in STEADY mode. If the number of loops is 0, entry durations are set to the subsong duration regardless of the output mode.

## GstNonstreamAudioDecoder

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstElement
                    ╰──GstNonstreamAudioDecoder

The opaque GstNonstreamAudioDecoder data structure.

### Members

`element` (GstElement) –
No description available
`sinkpad` (GstPad *) –
No description available
`srcpad` (GstPad *) –
No description available
`upstream_size` (gint64) –
No description available
`loaded_mode` (gboolean) –
No description available
`input_data_adapter` (GstAdapter *) –
No description available
`current_subsong` (guint) –
No description available
`subsong_mode` (GstNonstreamAudioSubsongMode) –
No description available
`subsong_duration` (GstClockTime) –
No description available
`output_mode` (GstNonstreamAudioOutputMode) –
No description available
`num_loops` (gint) –
No description available
`output_format_changed` (gboolean) –
No description available
`output_audio_info` (GstAudioInfo) –
No description available
`cur_pos_in_samples` (guint64) –
No description available
`num_decoded_samples` (guint64) –
No description available
`cur_segment` (GstSegment) –
No description available
`discont` (gboolean) –
No description available
`toc` (GstToc *) –
No description available
`allocator` (GstAllocator *) –
No description available
`allocation_params` (GstAllocationParams) –
No description available
`mutex` (GMutex) –
No description available

### Class structure

#### GstNonstreamAudioDecoderClass

Subclasses can override any of the available optional virtual methods or not, as needed. At minimum, load_from_buffer (or load_from_custom), get_supported_output_modes, and decode need to be overridden.

All functions are called with a locked decoder mutex.

> If GST_ELEMENT_ERROR, GST_ELEMENT_WARNING, or GST_ELEMENT_INFO are called from inside one of these functions, it is strongly recommended to unlock the decoder mutex before and re-lock it after these macros to prevent potential deadlocks in case the application does something with the element when it receives an ERROR/WARNING/INFO message. Same goes for gst_element_post_message calls and non-serialized events.

By default, this class works by reading media data from the sinkpad, and then commencing playback. Some decoders cannot be given data from a memory block, so the usual way of reading all upstream data and passing it to load_from_buffer doesn't work then. In this case, set the value of loads_from_sinkpad to FALSE. This changes the way this class operates; it does not require a sinkpad to exist anymore, and will call load_from_custom instead. One example of a decoder where this makes sense is UADE (Unix Amiga Delitracker Emulator). For some formats (such as TFMX), it needs to do the file loading by itself. Since most decoders can read input data from a memory block, the default value of loads_from_sinkpad is TRUE.

##### Fields

`element_class` (GstElementClass) –

The parent class structure

`loads_from_sinkpad` (gboolean) –
No description available

### GstBadAudio.NonstreamAudioDecoderClass

Subclasses can override any of the available optional virtual methods or not, as needed. At minimum, load_from_buffer (or load_from_custom), get_supported_output_modes, and decode need to be overridden.

All functions are called with a locked decoder mutex.

> If GST_ELEMENT_ERROR, GST_ELEMENT_WARNING, or GST_ELEMENT_INFO are called from inside one of these functions, it is strongly recommended to unlock the decoder mutex before and re-lock it after these macros to prevent potential deadlocks in case the application does something with the element when it receives an ERROR/WARNING/INFO message. Same goes for Gst.Element.prototype.post_message calls and non-serialized events.

By default, this class works by reading media data from the sinkpad, and then commencing playback. Some decoders cannot be given data from a memory block, so the usual way of reading all upstream data and passing it to load_from_buffer doesn't work then. In this case, set the value of loads_from_sinkpad to FALSE. This changes the way this class operates; it does not require a sinkpad to exist anymore, and will call load_from_custom instead. One example of a decoder where this makes sense is UADE (Unix Amiga Delitracker Emulator). For some formats (such as TFMX), it needs to do the file loading by itself. Since most decoders can read input data from a memory block, the default value of loads_from_sinkpad is TRUE.

##### Attributes

`element_class` (Gst.ElementClass) –

The parent class structure

`loads_from_sinkpad` (Number) –
No description available

### GstBadAudio.NonstreamAudioDecoderClass

Subclasses can override any of the available optional virtual methods or not, as needed. At minimum, load_from_buffer (or load_from_custom), get_supported_output_modes, and decode need to be overridden.

All functions are called with a locked decoder mutex.

> If GST_ELEMENT_ERROR, GST_ELEMENT_WARNING, or GST_ELEMENT_INFO are called from inside one of these functions, it is strongly recommended to unlock the decoder mutex before and re-lock it after these macros to prevent potential deadlocks in case the application does something with the element when it receives an ERROR/WARNING/INFO message. Same goes for Gst.Element.post_message calls and non-serialized events.

By default, this class works by reading media data from the sinkpad, and then commencing playback. Some decoders cannot be given data from a memory block, so the usual way of reading all upstream data and passing it to load_from_buffer doesn't work then. In this case, set the value of loads_from_sinkpad to FALSE. This changes the way this class operates; it does not require a sinkpad to exist anymore, and will call load_from_custom instead. One example of a decoder where this makes sense is UADE (Unix Amiga Delitracker Emulator). For some formats (such as TFMX), it needs to do the file loading by itself. Since most decoders can read input data from a memory block, the default value of loads_from_sinkpad is TRUE.

##### Attributes

`element_class` (Gst.ElementClass) –

The parent class structure

`loads_from_sinkpad` (bool) –
No description available

## GstBadAudio.NonstreamAudioDecoder

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.Element
                    ╰──GstBadAudio.NonstreamAudioDecoder

The opaque GstBadAudio.NonstreamAudioDecoder data structure.

### Members

`element` (Gst.Element) –
No description available
`sinkpad` (Gst.Pad) –
No description available
`srcpad` (Gst.Pad) –
No description available
`upstream_size` (Number) –
No description available
`loaded_mode` (Number) –
No description available
`input_data_adapter` (GstBase.Adapter) –
No description available
`current_subsong` (Number) –
No description available
`subsong_mode` (GstBadAudio.NonstreamAudioSubsongMode) –
No description available
`subsong_duration` (Number) –
No description available
`output_mode` (GstBadAudio.NonstreamAudioOutputMode) –
No description available
`num_loops` (Number) –
No description available
`output_format_changed` (Number) –
No description available
`output_audio_info` (GstAudio.AudioInfo) –
No description available
`cur_pos_in_samples` (Number) –
No description available
`num_decoded_samples` (Number) –
No description available
`cur_segment` (Gst.Segment) –
No description available
`discont` (Number) –
No description available
`toc` (Gst.Toc) –
No description available
`allocator` (Gst.Allocator) –
No description available
`allocation_params` (Gst.AllocationParams) –
No description available
`mutex` (GLib.Mutex) –
No description available

## GstBadAudio.NonstreamAudioDecoder

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.Element
                    ╰──GstBadAudio.NonstreamAudioDecoder

The opaque GstBadAudio.NonstreamAudioDecoder data structure.

### Members

`element` (Gst.Element) –
No description available
`sinkpad` (Gst.Pad) –
No description available
`srcpad` (Gst.Pad) –
No description available
`upstream_size` (int) –
No description available
`loaded_mode` (bool) –
No description available
`input_data_adapter` (GstBase.Adapter) –
No description available
`current_subsong` (int) –
No description available
`subsong_mode` (GstBadAudio.NonstreamAudioSubsongMode) –
No description available
`subsong_duration` (int) –
No description available
`output_mode` (GstBadAudio.NonstreamAudioOutputMode) –
No description available
`num_loops` (int) –
No description available
`output_format_changed` (bool) –
No description available
`output_audio_info` (GstAudio.AudioInfo) –
No description available
`cur_pos_in_samples` (int) –
No description available
`num_decoded_samples` (int) –
No description available
`cur_segment` (Gst.Segment) –
No description available
`discont` (bool) –
No description available
`toc` (Gst.Toc) –
No description available
`allocator` (Gst.Allocator) –
No description available
`allocation_params` (Gst.AllocationParams) –
No description available
`mutex` (GLib.Mutex) –
No description available

### Methods

#### gst_nonstream_audio_decoder_allocate_output_buffer

    GstBuffer *
    gst_nonstream_audio_decoder_allocate_output_buffer (GstNonstreamAudioDecoder * dec,
                                                        gsize size)

Allocates an output buffer with the internally configured buffer pool.

This function may only be called from within load_from_buffer, load_from_custom, and decode.

Parameters:

`dec` –

Decoder instance

`size` –

Size of the output buffer, in bytes

Returns ( [transfer: full][nullable]) –

Newly allocated output buffer, or NULL if allocation failed

#### GstBadAudio.NonstreamAudioDecoder.prototype.allocate_output_buffer

    function GstBadAudio.NonstreamAudioDecoder.prototype.allocate_output_buffer(size: Number): {
        // javascript wrapper for 'gst_nonstream_audio_decoder_allocate_output_buffer'
    }

Allocates an output buffer with the internally configured buffer pool.

This function may only be called from within load_from_buffer, load_from_custom, and decode.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –

Decoder instance

`size` (Number) –

Size of the output buffer, in bytes

Returns (Gst.Buffer) –

Newly allocated output buffer, or NULL if allocation failed

#### GstBadAudio.NonstreamAudioDecoder.allocate_output_buffer

    def GstBadAudio.NonstreamAudioDecoder.allocate_output_buffer (self, size):
        #python wrapper for 'gst_nonstream_audio_decoder_allocate_output_buffer'

Allocates an output buffer with the internally configured buffer pool.

This function may only be called from within load_from_buffer, load_from_custom, and decode.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –

Decoder instance

`size` (int) –

Size of the output buffer, in bytes

Returns (Gst.Buffer) –

Newly allocated output buffer, or NULL if allocation failed

#### gst_nonstream_audio_decoder_get_downstream_info

    gst_nonstream_audio_decoder_get_downstream_info (GstNonstreamAudioDecoder * dec,
                                                     GstAudioFormat * format,
                                                     gint * sample_rate,
                                                     gint * num_channels)

Gets sample format, sample rate, channel count from the allowed srcpad caps.

This is useful for when the subclass wishes to adjust one or more output parameters to whatever downstream is supporting. For example, the output sample rate is often a freely adjustable value in module players.

This function tries to find a value inside the srcpad peer's caps for format, sample_rate, num_chnanels . Any of these can be NULL; they (and the corresponding downstream caps) are then skipped while retrieving information. Non-fixated caps are fixated first; the value closest to their present value is then chosen. For example, if the variables pointed to by the arguments are GST_AUDIO_FORMAT_16, 48000 Hz, and 2 channels, and the downstream caps are:

"audio/x-raw, format={S16LE,S32LE}, rate=[1,32000], channels=[1,MAX]"

Then format and channels stay the same, while sample_rate is set to 32000 Hz. This way, the initial values the the variables pointed to by the arguments are set to can be used as default output values. Note that if no downstream caps can be retrieved, then this function does nothing, therefore it is necessary to ensure that format, sample_rate, and channels have valid initial values.

Decoder lock is not held by this function, so it can be called from within any of the class vfuncs.

Parameters:

`dec` –

a GstNonstreamAudioDecoder

`format` –

GstAudioFormat value to fill with a sample format

`sample_rate` –

Integer to fill with a sample rate

`num_channels` –

Integer to fill with a channel count

#### GstBadAudio.NonstreamAudioDecoder.prototype.get_downstream_info

    function GstBadAudio.NonstreamAudioDecoder.prototype.get_downstream_info(format: GstAudio.AudioFormat, sample_rate: Number, num_channels: Number): {
        // javascript wrapper for 'gst_nonstream_audio_decoder_get_downstream_info'
    }

Gets sample format, sample rate, channel count from the allowed srcpad caps.

This is useful for when the subclass wishes to adjust one or more output parameters to whatever downstream is supporting. For example, the output sample rate is often a freely adjustable value in module players.

This function tries to find a value inside the srcpad peer's caps for format, sample_rate, num_chnanels . Any of these can be NULL; they (and the corresponding downstream caps) are then skipped while retrieving information. Non-fixated caps are fixated first; the value closest to their present value is then chosen. For example, if the variables pointed to by the arguments are GST_AUDIO_FORMAT_16, 48000 Hz, and 2 channels, and the downstream caps are:

"audio/x-raw, format={S16LE,S32LE}, rate=[1,32000], channels=[1,MAX]"

Then format and channels stay the same, while sample_rate is set to 32000 Hz. This way, the initial values the the variables pointed to by the arguments are set to can be used as default output values. Note that if no downstream caps can be retrieved, then this function does nothing, therefore it is necessary to ensure that format, sample_rate, and channels have valid initial values.

Decoder lock is not held by this function, so it can be called from within any of the class vfuncs.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –

a GstBadAudio.NonstreamAudioDecoder

`format` (GstAudio.AudioFormat) –

GstAudio.AudioFormat value to fill with a sample format

`sample_rate` (Number) –

Integer to fill with a sample rate

`num_channels` (Number) –

Integer to fill with a channel count

#### GstBadAudio.NonstreamAudioDecoder.get_downstream_info

    def GstBadAudio.NonstreamAudioDecoder.get_downstream_info (self, format, sample_rate, num_channels):
        #python wrapper for 'gst_nonstream_audio_decoder_get_downstream_info'

Gets sample format, sample rate, channel count from the allowed srcpad caps.

This is useful for when the subclass wishes to adjust one or more output parameters to whatever downstream is supporting. For example, the output sample rate is often a freely adjustable value in module players.

This function tries to find a value inside the srcpad peer's caps for format, sample_rate, num_chnanels . Any of these can be NULL; they (and the corresponding downstream caps) are then skipped while retrieving information. Non-fixated caps are fixated first; the value closest to their present value is then chosen. For example, if the variables pointed to by the arguments are GST_AUDIO_FORMAT_16, 48000 Hz, and 2 channels, and the downstream caps are:

"audio/x-raw, format={S16LE,S32LE}, rate=[1,32000], channels=[1,MAX]"

Then format and channels stay the same, while sample_rate is set to 32000 Hz. This way, the initial values the the variables pointed to by the arguments are set to can be used as default output values. Note that if no downstream caps can be retrieved, then this function does nothing, therefore it is necessary to ensure that format, sample_rate, and channels have valid initial values.

Decoder lock is not held by this function, so it can be called from within any of the class vfuncs.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –

a GstBadAudio.NonstreamAudioDecoder

`format` (GstAudio.AudioFormat) –

GstAudio.AudioFormat value to fill with a sample format

`sample_rate` (int) –

Integer to fill with a sample rate

`num_channels` (int) –

Integer to fill with a channel count

#### gst_nonstream_audio_decoder_handle_loop

    gst_nonstream_audio_decoder_handle_loop (GstNonstreamAudioDecoder * dec,
                                             GstClockTime new_position)

Reports that a loop has been completed and creates a new appropriate segment for the next loop.

new_position exists because a loop may not start at the beginning.

This function is only useful for subclasses which can be in the GST_NONSTREAM_AUDIO_OUTPUT_MODE_LOOPING output mode, since in the GST_NONSTREAM_AUDIO_OUTPUT_MODE_STEADY output mode, this function does nothing. See GstNonstreamAudioOutputMode for more details.

The subclass calls this during playback when it loops. It produces a new segment with updated base time and internal time values, to allow for seamless looping. It does not check the number of elapsed loops; this is up the subclass.

Note that if this function is called, then it must be done after the last samples of the loop have been decoded and pushed downstream.

This function must be called with the decoder mutex lock held, since it is typically called from within decode (which in turn are called with the lock already held).

Parameters:

`dec` –

a GstNonstreamAudioDecoder new_position New position the next loop starts with

`new_position` –
No description available

#### GstBadAudio.NonstreamAudioDecoder.prototype.handle_loop

    function GstBadAudio.NonstreamAudioDecoder.prototype.handle_loop(new_position: Number): {
        // javascript wrapper for 'gst_nonstream_audio_decoder_handle_loop'
    }

Reports that a loop has been completed and creates a new appropriate segment for the next loop.

new_position exists because a loop may not start at the beginning.

This function is only useful for subclasses which can be in the GST_NONSTREAM_AUDIO_OUTPUT_MODE_LOOPING output mode, since in the GST_NONSTREAM_AUDIO_OUTPUT_MODE_STEADY output mode, this function does nothing. See GstBadAudio.NonstreamAudioOutputMode for more details.

The subclass calls this during playback when it loops. It produces a new segment with updated base time and internal time values, to allow for seamless looping. It does not check the number of elapsed loops; this is up the subclass.

Note that if this function is called, then it must be done after the last samples of the loop have been decoded and pushed downstream.

This function must be called with the decoder mutex lock held, since it is typically called from within decode (which in turn are called with the lock already held).

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –

a GstBadAudio.NonstreamAudioDecoder new_position New position the next loop starts with

`new_position` (Number) –
No description available

#### GstBadAudio.NonstreamAudioDecoder.handle_loop

    def GstBadAudio.NonstreamAudioDecoder.handle_loop (self, new_position):
        #python wrapper for 'gst_nonstream_audio_decoder_handle_loop'

Reports that a loop has been completed and creates a new appropriate segment for the next loop.

new_position exists because a loop may not start at the beginning.

This function is only useful for subclasses which can be in the GST_NONSTREAM_AUDIO_OUTPUT_MODE_LOOPING output mode, since in the GST_NONSTREAM_AUDIO_OUTPUT_MODE_STEADY output mode, this function does nothing. See GstBadAudio.NonstreamAudioOutputMode for more details.

The subclass calls this during playback when it loops. It produces a new segment with updated base time and internal time values, to allow for seamless looping. It does not check the number of elapsed loops; this is up the subclass.

Note that if this function is called, then it must be done after the last samples of the loop have been decoded and pushed downstream.

This function must be called with the decoder mutex lock held, since it is typically called from within decode (which in turn are called with the lock already held).

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –

a GstBadAudio.NonstreamAudioDecoder new_position New position the next loop starts with

`new_position` (int) –
No description available

#### gst_nonstream_audio_decoder_set_output_format

    gboolean
    gst_nonstream_audio_decoder_set_output_format (GstNonstreamAudioDecoder * dec,
                                                   const GstAudioInfo * audio_info)

Sets the output caps by means of a GstAudioInfo structure.

This must be called latest in the first decode call, to ensure src caps are set before decoded samples are sent downstream. Typically, this is called from inside load_from_buffer or load_from_custom.

This function must be called with the decoder mutex lock held, since it is typically called from within the aforementioned vfuncs (which in turn are called with the lock already held).

Parameters:

`dec` –

a GstNonstreamAudioDecoder

`audio_info` –

Valid audio info structure containing the output format

Returns –

TRUE if setting the output format succeeded, FALSE otherwise

#### GstBadAudio.NonstreamAudioDecoder.prototype.set_output_format

    function GstBadAudio.NonstreamAudioDecoder.prototype.set_output_format(audio_info: GstAudio.AudioInfo): {
        // javascript wrapper for 'gst_nonstream_audio_decoder_set_output_format'
    }

Sets the output caps by means of a GstAudioInfo structure.

This must be called latest in the first decode call, to ensure src caps are set before decoded samples are sent downstream. Typically, this is called from inside load_from_buffer or load_from_custom.

This function must be called with the decoder mutex lock held, since it is typically called from within the aforementioned vfuncs (which in turn are called with the lock already held).

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –

a GstBadAudio.NonstreamAudioDecoder

`audio_info` (GstAudio.AudioInfo) –

Valid audio info structure containing the output format

Returns (Number) –

TRUE if setting the output format succeeded, FALSE otherwise

#### GstBadAudio.NonstreamAudioDecoder.set_output_format

    def GstBadAudio.NonstreamAudioDecoder.set_output_format (self, audio_info):
        #python wrapper for 'gst_nonstream_audio_decoder_set_output_format'

Sets the output caps by means of a GstAudioInfo structure.

This must be called latest in the first decode call, to ensure src caps are set before decoded samples are sent downstream. Typically, this is called from inside load_from_buffer or load_from_custom.

This function must be called with the decoder mutex lock held, since it is typically called from within the aforementioned vfuncs (which in turn are called with the lock already held).

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –

a GstBadAudio.NonstreamAudioDecoder

`audio_info` (GstAudio.AudioInfo) –

Valid audio info structure containing the output format

Returns (bool) –

TRUE if setting the output format succeeded, FALSE otherwise

#### gst_nonstream_audio_decoder_set_output_format_simple

    gboolean
    gst_nonstream_audio_decoder_set_output_format_simple (GstNonstreamAudioDecoder * dec,
                                                          guint sample_rate,
                                                          GstAudioFormat sample_format,
                                                          guint num_channels)

Convenience function; sets the output caps by means of common parameters.

Internally, this fills a GstAudioInfo structure and calls gst_nonstream_audio_decoder_set_output_format.

Parameters:

`dec` –

a GstNonstreamAudioDecoder

`sample_rate` –

Output sample rate to use, in Hz

`sample_format` –

Output sample format to use

`num_channels` –

Number of output channels to use

Returns –

TRUE if setting the output format succeeded, FALSE otherwise

#### GstBadAudio.NonstreamAudioDecoder.prototype.set_output_format_simple

    function GstBadAudio.NonstreamAudioDecoder.prototype.set_output_format_simple(sample_rate: Number, sample_format: GstAudio.AudioFormat, num_channels: Number): {
        // javascript wrapper for 'gst_nonstream_audio_decoder_set_output_format_simple'
    }

Convenience function; sets the output caps by means of common parameters.

Internally, this fills a GstAudioInfo structure and calls GstBadAudio.NonstreamAudioDecoder.prototype.set_output_format.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –

a GstBadAudio.NonstreamAudioDecoder

`sample_rate` (Number) –

Output sample rate to use, in Hz

`sample_format` (GstAudio.AudioFormat) –

Output sample format to use

`num_channels` (Number) –

Number of output channels to use

Returns (Number) –

TRUE if setting the output format succeeded, FALSE otherwise

#### GstBadAudio.NonstreamAudioDecoder.set_output_format_simple

    def GstBadAudio.NonstreamAudioDecoder.set_output_format_simple (self, sample_rate, sample_format, num_channels):
        #python wrapper for 'gst_nonstream_audio_decoder_set_output_format_simple'

Convenience function; sets the output caps by means of common parameters.

Internally, this fills a GstAudioInfo structure and calls GstBadAudio.NonstreamAudioDecoder.set_output_format.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –

a GstBadAudio.NonstreamAudioDecoder

`sample_rate` (int) –

Output sample rate to use, in Hz

`sample_format` (GstAudio.AudioFormat) –

Output sample format to use

`num_channels` (int) –

Number of output channels to use

Returns (bool) –

TRUE if setting the output format succeeded, FALSE otherwise

### Properties

#### current-subsong

    “current-subsong” guint

Flags : Read / Write

#### current-subsong

    “current-subsong” Number

Flags : Read / Write

#### current_subsong

    “self.props.current_subsong” int

Flags : Read / Write

#### num-loops

    “num-loops” gint

Flags : Read / Write

#### num-loops

    “num-loops” Number

Flags : Read / Write

#### num_loops

    “self.props.num_loops” int

Flags : Read / Write

#### output-mode

    “output-mode” object *

Flags : Read / Write

#### subsong-mode

    “subsong-mode” object *

Flags : Read / Write

### Virtual Methods

#### decide_allocation

    gboolean
    decide_allocation (GstNonstreamAudioDecoder * dec,
                       GstQuery * query)

Optional. Sets up 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:

`dec` –
No description available
`query` –
No description available
Returns –
No description available

#### vfunc_decide_allocation

    function vfunc_decide_allocation(dec: GstBadAudio.NonstreamAudioDecoder, query: Gst.Query): {
        // javascript implementation of the 'decide_allocation' virtual method
    }

Optional. Sets up 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:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
`query` (Gst.Query) –
No description available
Returns (Number) –
No description available

#### do_decide_allocation

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

Optional. Sets up 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:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
`query` (Gst.Query) –
No description available
Returns (bool) –
No description available

#### decode

    gboolean
    decode (GstNonstreamAudioDecoder * dec,
            GstBuffer ** buffer,
            guint * num_samples)

Always required. Allocates an output buffer, fills it with decoded audio samples, and must be passed on to *buffer . The number of decoded samples must be passed on to *num_samples. If decoding finishes or the decoding is no longer possible (for example, due to an unrecoverable error), this function returns FALSE, otherwise TRUE.

Parameters:

`dec` –
No description available
`buffer` –
No description available
`num_samples` –
No description available
Returns –
No description available

#### vfunc_decode

    function vfunc_decode(dec: GstBadAudio.NonstreamAudioDecoder, buffer: Gst.Buffer, num_samples: Number): {
        // javascript implementation of the 'decode' virtual method
    }

Always required. Allocates an output buffer, fills it with decoded audio samples, and must be passed on to *buffer . The number of decoded samples must be passed on to *num_samples. If decoding finishes or the decoding is no longer possible (for example, due to an unrecoverable error), this function returns FALSE, otherwise TRUE.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
`buffer` (Gst.Buffer) –
No description available
`num_samples` (Number) –
No description available
Returns (Number) –
No description available

#### do_decode

    def do_decode (dec, buffer, num_samples):
        #python implementation of the 'decode' virtual method

Always required. Allocates an output buffer, fills it with decoded audio samples, and must be passed on to *buffer . The number of decoded samples must be passed on to *num_samples. If decoding finishes or the decoding is no longer possible (for example, due to an unrecoverable error), this function returns FALSE, otherwise TRUE.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
`buffer` (Gst.Buffer) –
No description available
`num_samples` (int) –
No description available
Returns (bool) –
No description available

#### get_current_subsong

    guint
    get_current_subsong (GstNonstreamAudioDecoder * dec)

Optional. Returns the current subsong. If the current subsong mode is not GST_NONSTREAM_AUDIO_SUBSONG_MODE_SINGLE, this function's return value is undefined. If this function is implemented by the subclass, get_num_subsongs should be implemented as well.

Parameters:

`dec` –
No description available
Returns –
No description available

#### vfunc_get_current_subsong

    function vfunc_get_current_subsong(dec: GstBadAudio.NonstreamAudioDecoder): {
        // javascript implementation of the 'get_current_subsong' virtual method
    }

Optional. Returns the current subsong. If the current subsong mode is not GST_NONSTREAM_AUDIO_SUBSONG_MODE_SINGLE, this function's return value is undefined. If this function is implemented by the subclass, get_num_subsongs should be implemented as well.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
Returns (Number) –
No description available

#### do_get_current_subsong

    def do_get_current_subsong (dec):
        #python implementation of the 'get_current_subsong' virtual method

Optional. Returns the current subsong. If the current subsong mode is not GST_NONSTREAM_AUDIO_SUBSONG_MODE_SINGLE, this function's return value is undefined. If this function is implemented by the subclass, get_num_subsongs should be implemented as well.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
Returns (int) –
No description available

#### get_main_tags

    GstTagList *
    get_main_tags (GstNonstreamAudioDecoder * dec)

Optional. Returns a tag list containing the main song tags, or NULL if there are no such tags. Returned tags will be unref'd. Use this vfunc instead of manually pushing a tag event downstream to avoid edge cases where not yet pushed sticky tag events get overwritten before they are pushed (can for example happen with decodebin if tags are pushed downstream before the decodebin pads are linked).

Parameters:

`dec` –
No description available
Returns –
No description available

#### vfunc_get_main_tags

    function vfunc_get_main_tags(dec: GstBadAudio.NonstreamAudioDecoder): {
        // javascript implementation of the 'get_main_tags' virtual method
    }

Optional. Returns a tag list containing the main song tags, or NULL if there are no such tags. Returned tags will be unref'd. Use this vfunc instead of manually pushing a tag event downstream to avoid edge cases where not yet pushed sticky tag events get overwritten before they are pushed (can for example happen with decodebin if tags are pushed downstream before the decodebin pads are linked).

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
Returns (Gst.TagList) –
No description available

#### do_get_main_tags

    def do_get_main_tags (dec):
        #python implementation of the 'get_main_tags' virtual method

Optional. Returns a tag list containing the main song tags, or NULL if there are no such tags. Returned tags will be unref'd. Use this vfunc instead of manually pushing a tag event downstream to avoid edge cases where not yet pushed sticky tag events get overwritten before they are pushed (can for example happen with decodebin if tags are pushed downstream before the decodebin pads are linked).

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
Returns (Gst.TagList) –
No description available

#### get_num_loops

    gint
    get_num_loops (GstNonstreamAudioDecoder * dec)

Optional. Returns the number of loops for playback.

Parameters:

`dec` –
No description available
Returns –
No description available

#### vfunc_get_num_loops

    function vfunc_get_num_loops(dec: GstBadAudio.NonstreamAudioDecoder): {
        // javascript implementation of the 'get_num_loops' virtual method
    }

Optional. Returns the number of loops for playback.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
Returns (Number) –
No description available

#### do_get_num_loops

    def do_get_num_loops (dec):
        #python implementation of the 'get_num_loops' virtual method

Optional. Returns the number of loops for playback.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
Returns (int) –
No description available

#### get_num_subsongs

    guint
    get_num_subsongs (GstNonstreamAudioDecoder * dec)

Optional. Returns the number of subsongs available. The return values 0 and 1 have a similar, but distinct, meaning. If this function returns 0, then this decoder does not support subsongs at all. get_current_subsong must then also always return 0. In other words, this function either never returns 0, or never returns anything else than 0. A return value of 1 means that the media contains either only one or no subsongs (the entire song is then considered to be one single subsong). 1 also means that only this very media has no or just one subsong, and the decoder itself can support multiple subsongs.

Parameters:

`dec` –
No description available
Returns –
No description available

#### vfunc_get_num_subsongs

    function vfunc_get_num_subsongs(dec: GstBadAudio.NonstreamAudioDecoder): {
        // javascript implementation of the 'get_num_subsongs' virtual method
    }

Optional. Returns the number of subsongs available. The return values 0 and 1 have a similar, but distinct, meaning. If this function returns 0, then this decoder does not support subsongs at all. get_current_subsong must then also always return 0. In other words, this function either never returns 0, or never returns anything else than 0. A return value of 1 means that the media contains either only one or no subsongs (the entire song is then considered to be one single subsong). 1 also means that only this very media has no or just one subsong, and the decoder itself can support multiple subsongs.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
Returns (Number) –
No description available

#### do_get_num_subsongs

    def do_get_num_subsongs (dec):
        #python implementation of the 'get_num_subsongs' virtual method

Optional. Returns the number of subsongs available. The return values 0 and 1 have a similar, but distinct, meaning. If this function returns 0, then this decoder does not support subsongs at all. get_current_subsong must then also always return 0. In other words, this function either never returns 0, or never returns anything else than 0. A return value of 1 means that the media contains either only one or no subsongs (the entire song is then considered to be one single subsong). 1 also means that only this very media has no or just one subsong, and the decoder itself can support multiple subsongs.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
Returns (int) –
No description available

#### get_subsong_duration

    GstClockTime
    get_subsong_duration (GstNonstreamAudioDecoder * dec,
                          guint subsong)

Optional. Returns the duration of a subsong. Returns GST_CLOCK_TIME_NONE if duration is unknown.

Parameters:

`dec` –
No description available
`subsong` –
No description available
Returns –
No description available

#### vfunc_get_subsong_duration

    function vfunc_get_subsong_duration(dec: GstBadAudio.NonstreamAudioDecoder, subsong: Number): {
        // javascript implementation of the 'get_subsong_duration' virtual method
    }

Optional. Returns the duration of a subsong. Returns GST_CLOCK_TIME_NONE if duration is unknown.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
`subsong` (Number) –
No description available
Returns (Number) –
No description available

#### do_get_subsong_duration

    def do_get_subsong_duration (dec, subsong):
        #python implementation of the 'get_subsong_duration' virtual method

Optional. Returns the duration of a subsong. Returns GST_CLOCK_TIME_NONE if duration is unknown.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
`subsong` (int) –
No description available
Returns (int) –
No description available

#### get_subsong_tags

    GstTagList *
    get_subsong_tags (GstNonstreamAudioDecoder * dec,
                      guint subsong)

Optional. Returns tags for a subsong, or NULL if there are no tags. Returned tags will be unref'd.

Parameters:

`dec` –
No description available
`subsong` –
No description available
Returns –
No description available

#### vfunc_get_subsong_tags

    function vfunc_get_subsong_tags(dec: GstBadAudio.NonstreamAudioDecoder, subsong: Number): {
        // javascript implementation of the 'get_subsong_tags' virtual method
    }

Optional. Returns tags for a subsong, or NULL if there are no tags. Returned tags will be unref'd.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
`subsong` (Number) –
No description available
Returns (Gst.TagList) –
No description available

#### do_get_subsong_tags

    def do_get_subsong_tags (dec, subsong):
        #python implementation of the 'get_subsong_tags' virtual method

Optional. Returns tags for a subsong, or NULL if there are no tags. Returned tags will be unref'd.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
`subsong` (int) –
No description available
Returns (Gst.TagList) –
No description available

#### get_supported_output_modes

    guint
    get_supported_output_modes (GstNonstreamAudioDecoder * dec)

Always required. Returns a bitmask containing the output modes the subclass supports. The mask is formed by a bitwise OR combination of integers, which can be calculated this way: 1 << GST_NONSTREAM_AUDIO_OUTPUT_MODE_ , where mode is either STEADY or LOOPING

Parameters:

`dec` –
No description available
Returns –
No description available

#### vfunc_get_supported_output_modes

    function vfunc_get_supported_output_modes(dec: GstBadAudio.NonstreamAudioDecoder): {
        // javascript implementation of the 'get_supported_output_modes' virtual method
    }

Always required. Returns a bitmask containing the output modes the subclass supports. The mask is formed by a bitwise OR combination of integers, which can be calculated this way: 1 << GST_NONSTREAM_AUDIO_OUTPUT_MODE_ , where mode is either STEADY or LOOPING

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
Returns (Number) –
No description available

#### do_get_supported_output_modes

    def do_get_supported_output_modes (dec):
        #python implementation of the 'get_supported_output_modes' virtual method

Always required. Returns a bitmask containing the output modes the subclass supports. The mask is formed by a bitwise OR combination of integers, which can be calculated this way: 1 << GST_NONSTREAM_AUDIO_OUTPUT_MODE_ , where mode is either STEADY or LOOPING

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
Returns (int) –
No description available

#### load_from_buffer

    gboolean
    load_from_buffer (GstNonstreamAudioDecoder * dec,
                      GstBuffer * source_data,
                      guint initial_subsong,
                      GstNonstreamAudioSubsongMode initial_subsong_mode,
                      GstClockTime * initial_position,
                      GstNonstreamAudioOutputMode * initial_output_mode,
                      gint * initial_num_loops)

Required if loads_from_sinkpad is set to TRUE (the default value). Loads the media from the given buffer. The entire media is supplied at once, so after this call, loading should be finished. This function can also make use of a suggested initial subsong & subsong mode and initial playback position (but isn't required to). In case it chooses a different starting position, the function must pass this position to *initial_position. The subclass does not have to unref the input buffer; the base class does that already.

Parameters:

`dec` –
No description available
`source_data` –
No description available
`initial_subsong` –
No description available
`initial_subsong_mode` –
No description available
`initial_position` –
No description available
`initial_output_mode` –
No description available
`initial_num_loops` –
No description available
Returns –
No description available

#### vfunc_load_from_buffer

    function vfunc_load_from_buffer(dec: GstBadAudio.NonstreamAudioDecoder, source_data: Gst.Buffer, initial_subsong: Number, initial_subsong_mode: GstBadAudio.NonstreamAudioSubsongMode, initial_position: Number, initial_output_mode: GstBadAudio.NonstreamAudioOutputMode, initial_num_loops: Number): {
        // javascript implementation of the 'load_from_buffer' virtual method
    }

Required if loads_from_sinkpad is set to TRUE (the default value). Loads the media from the given buffer. The entire media is supplied at once, so after this call, loading should be finished. This function can also make use of a suggested initial subsong & subsong mode and initial playback position (but isn't required to). In case it chooses a different starting position, the function must pass this position to *initial_position. The subclass does not have to unref the input buffer; the base class does that already.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
`source_data` (Gst.Buffer) –
No description available
`initial_subsong` (Number) –
No description available
`initial_subsong_mode` (GstBadAudio.NonstreamAudioSubsongMode) –
No description available
`initial_position` (Number) –
No description available
`initial_output_mode` (GstBadAudio.NonstreamAudioOutputMode) –
No description available
`initial_num_loops` (Number) –
No description available
Returns (Number) –
No description available

#### do_load_from_buffer

    def do_load_from_buffer (dec, source_data, initial_subsong, initial_subsong_mode, initial_position, initial_output_mode, initial_num_loops):
        #python implementation of the 'load_from_buffer' virtual method

Required if loads_from_sinkpad is set to TRUE (the default value). Loads the media from the given buffer. The entire media is supplied at once, so after this call, loading should be finished. This function can also make use of a suggested initial subsong & subsong mode and initial playback position (but isn't required to). In case it chooses a different starting position, the function must pass this position to *initial_position. The subclass does not have to unref the input buffer; the base class does that already.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
`source_data` (Gst.Buffer) –
No description available
`initial_subsong` (int) –
No description available
`initial_subsong_mode` (GstBadAudio.NonstreamAudioSubsongMode) –
No description available
`initial_position` (int) –
No description available
`initial_output_mode` (GstBadAudio.NonstreamAudioOutputMode) –
No description available
`initial_num_loops` (int) –
No description available
Returns (bool) –
No description available

#### load_from_custom

    gboolean
    load_from_custom (GstNonstreamAudioDecoder * dec,
                      guint initial_subsong,
                      GstNonstreamAudioSubsongMode initial_subsong_mode,
                      GstClockTime * initial_position,
                      GstNonstreamAudioOutputMode * initial_output_mode,
                      gint * initial_num_loops)

Required if loads_from_sinkpad is set to FALSE. Loads the media in a way defined by the custom sink. Data is not supplied; the derived class has to handle this on its own. Otherwise, this function is identical to load_from_buffer.

Parameters:

`dec` –
No description available
`initial_subsong` –
No description available
`initial_subsong_mode` –
No description available
`initial_position` –
No description available
`initial_output_mode` –
No description available
`initial_num_loops` –
No description available
Returns –
No description available

#### vfunc_load_from_custom

    function vfunc_load_from_custom(dec: GstBadAudio.NonstreamAudioDecoder, initial_subsong: Number, initial_subsong_mode: GstBadAudio.NonstreamAudioSubsongMode, initial_position: Number, initial_output_mode: GstBadAudio.NonstreamAudioOutputMode, initial_num_loops: Number): {
        // javascript implementation of the 'load_from_custom' virtual method
    }

Required if loads_from_sinkpad is set to FALSE. Loads the media in a way defined by the custom sink. Data is not supplied; the derived class has to handle this on its own. Otherwise, this function is identical to load_from_buffer.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
`initial_subsong` (Number) –
No description available
`initial_subsong_mode` (GstBadAudio.NonstreamAudioSubsongMode) –
No description available
`initial_position` (Number) –
No description available
`initial_output_mode` (GstBadAudio.NonstreamAudioOutputMode) –
No description available
`initial_num_loops` (Number) –
No description available
Returns (Number) –
No description available

#### do_load_from_custom

    def do_load_from_custom (dec, initial_subsong, initial_subsong_mode, initial_position, initial_output_mode, initial_num_loops):
        #python implementation of the 'load_from_custom' virtual method

Required if loads_from_sinkpad is set to FALSE. Loads the media in a way defined by the custom sink. Data is not supplied; the derived class has to handle this on its own. Otherwise, this function is identical to load_from_buffer.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
`initial_subsong` (int) –
No description available
`initial_subsong_mode` (GstBadAudio.NonstreamAudioSubsongMode) –
No description available
`initial_position` (int) –
No description available
`initial_output_mode` (GstBadAudio.NonstreamAudioOutputMode) –
No description available
`initial_num_loops` (int) –
No description available
Returns (bool) –
No description available

#### negotiate

    gboolean
    negotiate (GstNonstreamAudioDecoder * dec)

Parameters:

`dec` –
No description available
Returns –
No description available

#### vfunc_negotiate

    function vfunc_negotiate(dec: GstBadAudio.NonstreamAudioDecoder): {
        // javascript implementation of the 'negotiate' virtual method
    }

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
Returns (Number) –
No description available

#### do_negotiate

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

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
Returns (bool) –
No description available

#### propose_allocation

    gboolean
    propose_allocation (GstNonstreamAudioDecoder * dec,
                        GstQuery * query)

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

Parameters:

`dec` –
No description available
`query` –
No description available
Returns –
No description available

#### vfunc_propose_allocation

    function vfunc_propose_allocation(dec: GstBadAudio.NonstreamAudioDecoder, query: Gst.Query): {
        // javascript implementation of the 'propose_allocation' virtual method
    }

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

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
`query` (Gst.Query) –
No description available
Returns (Number) –
No description available

#### do_propose_allocation

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

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

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
`query` (Gst.Query) –
No description available
Returns (bool) –
No description available

#### seek

    gboolean
    seek (GstNonstreamAudioDecoder * dec,
          GstClockTime * new_position)

Optional. Called when a seek event is received by the parent class. new_position is a pointer to a GstClockTime integer which contains a position relative to the current subsong. Minimum is 0, maximum is the subsong length. After this function finishes, new_position is set to the actual new position (which may differ from the request position, depending on the decoder).

Parameters:

`dec` –
No description available
`new_position` –
No description available
Returns –
No description available

#### vfunc_seek

    function vfunc_seek(dec: GstBadAudio.NonstreamAudioDecoder, new_position: Number): {
        // javascript implementation of the 'seek' virtual method
    }

Optional. Called when a seek event is received by the parent class. new_position is a pointer to a GstClockTime integer which contains a position relative to the current subsong. Minimum is 0, maximum is the subsong length. After this function finishes, new_position is set to the actual new position (which may differ from the request position, depending on the decoder).

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
`new_position` (Number) –
No description available
Returns (Number) –
No description available

#### do_seek

    def do_seek (dec, new_position):
        #python implementation of the 'seek' virtual method

Optional. Called when a seek event is received by the parent class. new_position is a pointer to a GstClockTime integer which contains a position relative to the current subsong. Minimum is 0, maximum is the subsong length. After this function finishes, new_position is set to the actual new position (which may differ from the request position, depending on the decoder).

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
`new_position` (int) –
No description available
Returns (bool) –
No description available

#### set_current_subsong

    gboolean
    set_current_subsong (GstNonstreamAudioDecoder * dec,
                         guint subsong,
                         GstClockTime * initial_position)

Optional. Sets the current subsong. This function is allowed to switch to a different subsong than the required one, and can optionally make use of the suggested initial position. In case it chooses a different starting position, the function must pass this position to *initial_position. This function switches the subsong mode to GST_NONSTREAM_AUDIO_SUBSONG_MODE_SINGLE automatically. If this function is implemented by the subclass, get_current_subsong and get_num_subsongs should be implemented as well.

Parameters:

`dec` –
No description available
`subsong` –
No description available
`initial_position` –
No description available
Returns –
No description available

#### vfunc_set_current_subsong

    function vfunc_set_current_subsong(dec: GstBadAudio.NonstreamAudioDecoder, subsong: Number, initial_position: Number): {
        // javascript implementation of the 'set_current_subsong' virtual method
    }

Optional. Sets the current subsong. This function is allowed to switch to a different subsong than the required one, and can optionally make use of the suggested initial position. In case it chooses a different starting position, the function must pass this position to *initial_position. This function switches the subsong mode to GST_NONSTREAM_AUDIO_SUBSONG_MODE_SINGLE automatically. If this function is implemented by the subclass, get_current_subsong and get_num_subsongs should be implemented as well.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
`subsong` (Number) –
No description available
`initial_position` (Number) –
No description available
Returns (Number) –
No description available

#### do_set_current_subsong

    def do_set_current_subsong (dec, subsong, initial_position):
        #python implementation of the 'set_current_subsong' virtual method

Optional. Sets the current subsong. This function is allowed to switch to a different subsong than the required one, and can optionally make use of the suggested initial position. In case it chooses a different starting position, the function must pass this position to *initial_position. This function switches the subsong mode to GST_NONSTREAM_AUDIO_SUBSONG_MODE_SINGLE automatically. If this function is implemented by the subclass, get_current_subsong and get_num_subsongs should be implemented as well.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
`subsong` (int) –
No description available
`initial_position` (int) –
No description available
Returns (bool) –
No description available

#### set_num_loops

    gboolean
    set_num_loops (GstNonstreamAudioDecoder * dec,
                   gint num_loops)

Optional. Sets the number of loops for playback. If this is called during playback, the subclass must set any internal loop counters to zero. A loop value of -1 means infinite looping; 0 means no looping; and when the num_loops is greater than 0, playback should loop exactly num_loops times. If this function is implemented, get_num_loops should be implemented as well. The function can ignore the given values and choose another; however, get_num_loops should return this other value afterwards. It is up to the subclass to define where the loop starts and ends. It can mean that only a subset at the end or in the middle of a song is repeated, for example. If the current subsong mode is GST_NONSTREAM_AUDIO_SUBSONG_MODE_SINGLE, then the subsong is repeated this many times. If it is GST_NONSTREAM_AUDIO_SUBSONG_MODE_ALL, then all subsongs are repeated this many times. With GST_NONSTREAM_AUDIO_SUBSONG_MODE_DECODER_DEFAULT, the behavior is decoder specific.

Parameters:

`dec` –
No description available
`num_loops` –
No description available
Returns –
No description available

#### vfunc_set_num_loops

    function vfunc_set_num_loops(dec: GstBadAudio.NonstreamAudioDecoder, num_loops: Number): {
        // javascript implementation of the 'set_num_loops' virtual method
    }

Optional. Sets the number of loops for playback. If this is called during playback, the subclass must set any internal loop counters to zero. A loop value of -1 means infinite looping; 0 means no looping; and when the num_loops is greater than 0, playback should loop exactly num_loops times. If this function is implemented, get_num_loops should be implemented as well. The function can ignore the given values and choose another; however, get_num_loops should return this other value afterwards. It is up to the subclass to define where the loop starts and ends. It can mean that only a subset at the end or in the middle of a song is repeated, for example. If the current subsong mode is GST_NONSTREAM_AUDIO_SUBSONG_MODE_SINGLE, then the subsong is repeated this many times. If it is GST_NONSTREAM_AUDIO_SUBSONG_MODE_ALL, then all subsongs are repeated this many times. With GST_NONSTREAM_AUDIO_SUBSONG_MODE_DECODER_DEFAULT, the behavior is decoder specific.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
`num_loops` (Number) –
No description available
Returns (Number) –
No description available

#### do_set_num_loops

    def do_set_num_loops (dec, num_loops):
        #python implementation of the 'set_num_loops' virtual method

Optional. Sets the number of loops for playback. If this is called during playback, the subclass must set any internal loop counters to zero. A loop value of -1 means infinite looping; 0 means no looping; and when the num_loops is greater than 0, playback should loop exactly num_loops times. If this function is implemented, get_num_loops should be implemented as well. The function can ignore the given values and choose another; however, get_num_loops should return this other value afterwards. It is up to the subclass to define where the loop starts and ends. It can mean that only a subset at the end or in the middle of a song is repeated, for example. If the current subsong mode is GST_NONSTREAM_AUDIO_SUBSONG_MODE_SINGLE, then the subsong is repeated this many times. If it is GST_NONSTREAM_AUDIO_SUBSONG_MODE_ALL, then all subsongs are repeated this many times. With GST_NONSTREAM_AUDIO_SUBSONG_MODE_DECODER_DEFAULT, the behavior is decoder specific.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
`num_loops` (int) –
No description available
Returns (bool) –
No description available

#### set_output_mode

    gboolean
    set_output_mode (GstNonstreamAudioDecoder * dec,
                     GstNonstreamAudioOutputMode mode,
                     GstClockTime * current_position)

Optional. Sets the output mode the subclass has to use. Unlike with most other functions, the subclass cannot choose a different mode; it must use the requested one. If the output mode is set to LOOPING, gst_nonstream_audio_decoder_handle_loop must be called after playback moved back to the start of a loop.

Parameters:

`dec` –
No description available
`mode` –
No description available
`current_position` –
No description available
Returns –
No description available

#### vfunc_set_output_mode

    function vfunc_set_output_mode(dec: GstBadAudio.NonstreamAudioDecoder, mode: GstBadAudio.NonstreamAudioOutputMode, current_position: Number): {
        // javascript implementation of the 'set_output_mode' virtual method
    }

Optional. Sets the output mode the subclass has to use. Unlike with most other functions, the subclass cannot choose a different mode; it must use the requested one. If the output mode is set to LOOPING, gst_nonstream_audio_decoder_handle_loop must be called after playback moved back to the start of a loop.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
`mode` (GstBadAudio.NonstreamAudioOutputMode) –
No description available
`current_position` (Number) –
No description available
Returns (Number) –
No description available

#### do_set_output_mode

    def do_set_output_mode (dec, mode, current_position):
        #python implementation of the 'set_output_mode' virtual method

Optional. Sets the output mode the subclass has to use. Unlike with most other functions, the subclass cannot choose a different mode; it must use the requested one. If the output mode is set to LOOPING, gst_nonstream_audio_decoder_handle_loop must be called after playback moved back to the start of a loop.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
`mode` (GstBadAudio.NonstreamAudioOutputMode) –
No description available
`current_position` (int) –
No description available
Returns (bool) –
No description available

#### set_subsong_mode

    gboolean
    set_subsong_mode (GstNonstreamAudioDecoder * dec,
                      GstNonstreamAudioSubsongMode mode,
                      GstClockTime * initial_position)

Optional. Sets the current subsong mode. Since this might influence the current playback position, this function must set the initial_position integer argument to a defined value. If the playback position is not affected at all, it must be set to GST_CLOCK_TIME_NONE. If the subsong is restarted after the mode switch, it is recommended to set the value to the position in the playback right after the switch (or 0 if the subsongs are always reset back to the beginning).

Parameters:

`dec` –
No description available
`mode` –
No description available
`initial_position` –
No description available
Returns –
No description available

#### vfunc_set_subsong_mode

    function vfunc_set_subsong_mode(dec: GstBadAudio.NonstreamAudioDecoder, mode: GstBadAudio.NonstreamAudioSubsongMode, initial_position: Number): {
        // javascript implementation of the 'set_subsong_mode' virtual method
    }

Optional. Sets the current subsong mode. Since this might influence the current playback position, this function must set the initial_position integer argument to a defined value. If the playback position is not affected at all, it must be set to GST_CLOCK_TIME_NONE. If the subsong is restarted after the mode switch, it is recommended to set the value to the position in the playback right after the switch (or 0 if the subsongs are always reset back to the beginning).

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
`mode` (GstBadAudio.NonstreamAudioSubsongMode) –
No description available
`initial_position` (Number) –
No description available
Returns (Number) –
No description available

#### do_set_subsong_mode

    def do_set_subsong_mode (dec, mode, initial_position):
        #python implementation of the 'set_subsong_mode' virtual method

Optional. Sets the current subsong mode. Since this might influence the current playback position, this function must set the initial_position integer argument to a defined value. If the playback position is not affected at all, it must be set to GST_CLOCK_TIME_NONE. If the subsong is restarted after the mode switch, it is recommended to set the value to the position in the playback right after the switch (or 0 if the subsongs are always reset back to the beginning).

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
`mode` (GstBadAudio.NonstreamAudioSubsongMode) –
No description available
`initial_position` (int) –
No description available
Returns (bool) –
No description available

#### tell

    GstClockTime
    tell (GstNonstreamAudioDecoder * dec)

Optional. Called when a position query is received by the parent class. The position that this function returns must be relative to the current subsong. Thus, the minimum is 0, and the maximum is the subsong length.

Parameters:

`dec` –
No description available
Returns –
No description available

#### vfunc_tell

    function vfunc_tell(dec: GstBadAudio.NonstreamAudioDecoder): {
        // javascript implementation of the 'tell' virtual method
    }

Optional. Called when a position query is received by the parent class. The position that this function returns must be relative to the current subsong. Thus, the minimum is 0, and the maximum is the subsong length.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
Returns (Number) –
No description available

#### do_tell

    def do_tell (dec):
        #python implementation of the 'tell' virtual method

Optional. Called when a position query is received by the parent class. The position that this function returns must be relative to the current subsong. Thus, the minimum is 0, and the maximum is the subsong length.

Parameters:

`dec` (GstBadAudio.NonstreamAudioDecoder) –
No description available
Returns (int) –
No description available

## Function Macros

### GST_NONSTREAM_AUDIO_DECODER_CAST

    #define GST_NONSTREAM_AUDIO_DECODER_CAST(obj)        ((GstNonstreamAudioDecoder *)(obj))

### GST_NONSTREAM_AUDIO_DECODER_LOCK_MUTEX

    #define GST_NONSTREAM_AUDIO_DECODER_LOCK_MUTEX(obj)      g_mutex_lock(&(((GstNonstreamAudioDecoder *)(obj))->mutex))

Locks the decoder mutex.

Internally, the mutex is locked before one of the class vfuncs are called, when position and duration queries are handled, and when properties are set/retrieved.

Derived classes should call lock during decoder related modifications (for example, setting/clearing filter banks), when at the same time audio might get decoded. An example are configuration changes that happen when properties are set. Properties might be set from another thread, so while the derived decoder is reconfigured, the mutex should be locked.

Parameters:

`obj` –

base nonstream audio codec instance

### GST_NONSTREAM_AUDIO_DECODER_SINK_PAD

    #define GST_NONSTREAM_AUDIO_DECODER_SINK_PAD(obj)        (((GstNonstreamAudioDecoder *) (obj))->sinkpad)

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

Parameters:

`obj` –

base nonstream audio codec instance

### GST_NONSTREAM_AUDIO_DECODER_SRC_PAD

    #define GST_NONSTREAM_AUDIO_DECODER_SRC_PAD(obj)         (((GstNonstreamAudioDecoder *) (obj))->srcpad)

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

Parameters:

`obj` –

base nonstream audio codec instance

### GST_NONSTREAM_AUDIO_DECODER_UNLOCK_MUTEX

    #define GST_NONSTREAM_AUDIO_DECODER_UNLOCK_MUTEX(obj)    g_mutex_unlock(&(((GstNonstreamAudioDecoder *)(obj))->mutex))

## Enumerations

### GstNonstreamAudioOutputMode

The output mode defines how the output behaves with regards to looping. Either the playback position is moved back to the beginning of the loop, acting like a backwards seek, or it increases steadily, as if loop were "unrolled".

##### Members

`GST_NONSTREAM_AUDIO_OUTPUT_MODE_LOOPING` (0) –

Playback position is moved back to the beginning of the loop

`GST_NONSTREAM_AUDIO_OUTPUT_MODE_STEADY` (1) –

Playback position increases steadily, even when looping

### GstBadAudio.NonstreamAudioOutputMode

The output mode defines how the output behaves with regards to looping. Either the playback position is moved back to the beginning of the loop, acting like a backwards seek, or it increases steadily, as if loop were "unrolled".

##### Members

`GstBadAudio.NonstreamAudioOutputMode.LOOPING` (0) –

Playback position is moved back to the beginning of the loop

`GstBadAudio.NonstreamAudioOutputMode.STEADY` (1) –

Playback position increases steadily, even when looping

### GstBadAudio.NonstreamAudioOutputMode

The output mode defines how the output behaves with regards to looping. Either the playback position is moved back to the beginning of the loop, acting like a backwards seek, or it increases steadily, as if loop were "unrolled".

##### Members

`GstBadAudio.NonstreamAudioOutputMode.LOOPING` (0) –

Playback position is moved back to the beginning of the loop

`GstBadAudio.NonstreamAudioOutputMode.STEADY` (1) –

Playback position increases steadily, even when looping

### GstNonstreamAudioSubsongMode

The subsong mode defines how the decoder shall handle subsongs.

##### Members

`GST_NONSTREAM_AUDIO_SUBSONG_MODE_SINGLE` (0) –

Only the current subsong is played

`GST_NONSTREAM_AUDIO_SUBSONG_MODE_ALL` (1) –

All subsongs are played (current subsong index is ignored)

`GST_NONSTREAM_AUDIO_SUBSONG_MODE_DECODER_DEFAULT` (2) –

Use decoder specific default behavior

### GstBadAudio.NonstreamAudioSubsongMode

The subsong mode defines how the decoder shall handle subsongs.

##### Members

`GstBadAudio.NonstreamAudioSubsongMode.SINGLE` (0) –

Only the current subsong is played

`GstBadAudio.NonstreamAudioSubsongMode.ALL` (1) –

All subsongs are played (current subsong index is ignored)

`GstBadAudio.NonstreamAudioSubsongMode.DECODER_DEFAULT` (2) –

Use decoder specific default behavior

### GstBadAudio.NonstreamAudioSubsongMode

The subsong mode defines how the decoder shall handle subsongs.

##### Members

`GstBadAudio.NonstreamAudioSubsongMode.SINGLE` (0) –

Only the current subsong is played

`GstBadAudio.NonstreamAudioSubsongMode.ALL` (1) –

All subsongs are played (current subsong index is ignored)

`GstBadAudio.NonstreamAudioSubsongMode.DECODER_DEFAULT` (2) –

Use decoder specific default behavior

## Constants

### GST_NONSTREAM_AUDIO_DECODER_SINK_NAME

    #define GST_NONSTREAM_AUDIO_DECODER_SINK_NAME    "sink"

The name of the template for the sink pad.

### GstBadAudio.NONSTREAM_AUDIO_DECODER_SINK_NAME

The name of the template for the sink pad.

### GstBadAudio.NONSTREAM_AUDIO_DECODER_SINK_NAME

The name of the template for the sink pad.

### GST_NONSTREAM_AUDIO_DECODER_SRC_NAME

    #define GST_NONSTREAM_AUDIO_DECODER_SRC_NAME     "src"

The name of the template for the source pad.

### GstBadAudio.NONSTREAM_AUDIO_DECODER_SRC_NAME

The name of the template for the source pad.

### GstBadAudio.NONSTREAM_AUDIO_DECODER_SRC_NAME

The name of the template for the source pad.

The results of the search are