# GstAudioStreamAlign

GstAudioStreamAlign provides a helper object that helps tracking audio stream alignment and discontinuities, and detects discontinuities if possible.

See gst_audio_stream_align_new for a description of its parameters and gst_audio_stream_align_process for the details of the processing.

## GstAudioStreamAlign

The opaque GstAudioStreamAlign data structure.

Since : 1.14

## GstAudio.AudioStreamAlign

The opaque GstAudio.AudioStreamAlign data structure.

Since : 1.14

## GstAudio.AudioStreamAlign

The opaque GstAudio.AudioStreamAlign data structure.

Since : 1.14

### Constructors

#### gst_audio_stream_align_new

    GstAudioStreamAlign *
    gst_audio_stream_align_new (gint rate,
                                GstClockTime alignment_threshold,
                                GstClockTime discont_wait)

Allocate a new GstAudioStreamAlign with the given configuration. All processing happens according to sample rate rate, until gst_audio_stream_align_set_rate is called with a new rate. A negative rate can be used for reverse playback.

alignment_threshold gives the tolerance in nanoseconds after which a timestamp difference is considered a discontinuity. Once detected, discont_wait nanoseconds have to pass without going below the threshold again until the output buffer is marked as a discontinuity. These can later be re-configured with gst_audio_stream_align_set_alignment_threshold and gst_audio_stream_align_set_discont_wait.

Parameters:

`rate` –

a sample rate

`alignment_threshold` –

a alignment threshold in nanoseconds

`discont_wait` –

discont wait in nanoseconds

Returns –

a new GstAudioStreamAlign. free with gst_audio_stream_align_free.

Since : 1.14

#### GstAudio.AudioStreamAlign.prototype.new

    function GstAudio.AudioStreamAlign.prototype.new(rate: Number, alignment_threshold: Number, discont_wait: Number): {
        // javascript wrapper for 'gst_audio_stream_align_new'
    }

Allocate a new GstAudio.AudioStreamAlign with the given configuration. All processing happens according to sample rate rate, until GstAudio.AudioStreamAlign.prototype.set_rate is called with a new rate. A negative rate can be used for reverse playback.

alignment_threshold gives the tolerance in nanoseconds after which a timestamp difference is considered a discontinuity. Once detected, discont_wait nanoseconds have to pass without going below the threshold again until the output buffer is marked as a discontinuity. These can later be re-configured with GstAudio.AudioStreamAlign.prototype.set_alignment_threshold and GstAudio.AudioStreamAlign.prototype.set_discont_wait.

Parameters:

`rate` (Number) –

a sample rate

`alignment_threshold` (Number) –

a alignment threshold in nanoseconds

`discont_wait` (Number) –

discont wait in nanoseconds

Returns (GstAudio.AudioStreamAlign) –

a new GstAudio.AudioStreamAlign. free with GstAudio.AudioStreamAlign.prototype.free.

Since : 1.14

#### GstAudio.AudioStreamAlign.new

    def GstAudio.AudioStreamAlign.new (rate, alignment_threshold, discont_wait):
        #python wrapper for 'gst_audio_stream_align_new'

Allocate a new GstAudio.AudioStreamAlign with the given configuration. All processing happens according to sample rate rate, until GstAudio.AudioStreamAlign.set_rate is called with a new rate. A negative rate can be used for reverse playback.

alignment_threshold gives the tolerance in nanoseconds after which a timestamp difference is considered a discontinuity. Once detected, discont_wait nanoseconds have to pass without going below the threshold again until the output buffer is marked as a discontinuity. These can later be re-configured with GstAudio.AudioStreamAlign.set_alignment_threshold and GstAudio.AudioStreamAlign.set_discont_wait.

Parameters:

`rate` (int) –

a sample rate

`alignment_threshold` (int) –

a alignment threshold in nanoseconds

`discont_wait` (int) –

discont wait in nanoseconds

Returns (GstAudio.AudioStreamAlign) –

a new GstAudio.AudioStreamAlign. free with GstAudio.AudioStreamAlign.free.

Since : 1.14

### Methods

#### gst_audio_stream_align_copy

    GstAudioStreamAlign *
    gst_audio_stream_align_copy (const GstAudioStreamAlign * align)

Copy a GstAudioStreamAlign structure.

Parameters:

`align` –

a GstAudioStreamAlign

Returns –

a new GstAudioStreamAlign. free with gst_audio_stream_align_free.

Since : 1.14

#### GstAudio.AudioStreamAlign.prototype.copy

    function GstAudio.AudioStreamAlign.prototype.copy(): {
        // javascript wrapper for 'gst_audio_stream_align_copy'
    }

Copy a GstAudioStreamAlign structure.

Parameters:

`align` (GstAudio.AudioStreamAlign) –

a GstAudio.AudioStreamAlign

Returns (GstAudio.AudioStreamAlign) –

a new GstAudio.AudioStreamAlign. free with gst_audio_stream_align_free.

Since : 1.14

#### GstAudio.AudioStreamAlign.copy

    def GstAudio.AudioStreamAlign.copy (self):
        #python wrapper for 'gst_audio_stream_align_copy'

Copy a GstAudioStreamAlign structure.

Parameters:

`align` (GstAudio.AudioStreamAlign) –

a GstAudio.AudioStreamAlign

Returns (GstAudio.AudioStreamAlign) –

a new GstAudio.AudioStreamAlign. free with gst_audio_stream_align_free.

Since : 1.14

#### gst_audio_stream_align_free

    gst_audio_stream_align_free (GstAudioStreamAlign * align)

Free a GstAudioStreamAlign structure previously allocated with gst_audio_stream_align_new or gst_audio_stream_align_copy.

Parameters:

`align` –

a GstAudioStreamAlign

Since : 1.14

#### GstAudio.AudioStreamAlign.prototype.free

    function GstAudio.AudioStreamAlign.prototype.free(): {
        // javascript wrapper for 'gst_audio_stream_align_free'
    }

Free a GstAudioStreamAlign structure previously allocated with GstAudio.AudioStreamAlign.prototype.new or GstAudio.AudioStreamAlign.prototype.copy.

Parameters:

`align` (GstAudio.AudioStreamAlign) –

a GstAudio.AudioStreamAlign

Since : 1.14

#### GstAudio.AudioStreamAlign.free

    def GstAudio.AudioStreamAlign.free (self):
        #python wrapper for 'gst_audio_stream_align_free'

Free a GstAudioStreamAlign structure previously allocated with GstAudio.AudioStreamAlign.new or GstAudio.AudioStreamAlign.copy.

Parameters:

`align` (GstAudio.AudioStreamAlign) –

a GstAudio.AudioStreamAlign

Since : 1.14

#### gst_audio_stream_align_get_alignment_threshold

    GstClockTime
    gst_audio_stream_align_get_alignment_threshold (const GstAudioStreamAlign * align)

Gets the currently configured alignment threshold.

Parameters:

`align` –

a GstAudioStreamAlign

Returns –

The currently configured alignment threshold

Since : 1.14

#### GstAudio.AudioStreamAlign.prototype.get_alignment_threshold

    function GstAudio.AudioStreamAlign.prototype.get_alignment_threshold(): {
        // javascript wrapper for 'gst_audio_stream_align_get_alignment_threshold'
    }

Gets the currently configured alignment threshold.

Parameters:

`align` (GstAudio.AudioStreamAlign) –

a GstAudio.AudioStreamAlign

Returns (Number) –

The currently configured alignment threshold

Since : 1.14

#### GstAudio.AudioStreamAlign.get_alignment_threshold

    def GstAudio.AudioStreamAlign.get_alignment_threshold (self):
        #python wrapper for 'gst_audio_stream_align_get_alignment_threshold'

Gets the currently configured alignment threshold.

Parameters:

`align` (GstAudio.AudioStreamAlign) –

a GstAudio.AudioStreamAlign

Returns (int) –

The currently configured alignment threshold

Since : 1.14

#### gst_audio_stream_align_get_discont_wait

    GstClockTime
    gst_audio_stream_align_get_discont_wait (const GstAudioStreamAlign * align)

Gets the currently configured discont wait.

Parameters:

`align` –

a GstAudioStreamAlign

Returns –

The currently configured discont wait

Since : 1.14

#### GstAudio.AudioStreamAlign.prototype.get_discont_wait

    function GstAudio.AudioStreamAlign.prototype.get_discont_wait(): {
        // javascript wrapper for 'gst_audio_stream_align_get_discont_wait'
    }

Gets the currently configured discont wait.

Parameters:

`align` (GstAudio.AudioStreamAlign) –

a GstAudio.AudioStreamAlign

Returns (Number) –

The currently configured discont wait

Since : 1.14

#### GstAudio.AudioStreamAlign.get_discont_wait

    def GstAudio.AudioStreamAlign.get_discont_wait (self):
        #python wrapper for 'gst_audio_stream_align_get_discont_wait'

Gets the currently configured discont wait.

Parameters:

`align` (GstAudio.AudioStreamAlign) –

a GstAudio.AudioStreamAlign

Returns (int) –

The currently configured discont wait

Since : 1.14

#### gst_audio_stream_align_get_rate

    gint
    gst_audio_stream_align_get_rate (const GstAudioStreamAlign * align)

Gets the currently configured sample rate.

Parameters:

`align` –

a GstAudioStreamAlign

Returns –

The currently configured sample rate

Since : 1.14

#### GstAudio.AudioStreamAlign.prototype.get_rate

    function GstAudio.AudioStreamAlign.prototype.get_rate(): {
        // javascript wrapper for 'gst_audio_stream_align_get_rate'
    }

Gets the currently configured sample rate.

Parameters:

`align` (GstAudio.AudioStreamAlign) –

a GstAudio.AudioStreamAlign

Returns (Number) –

The currently configured sample rate

Since : 1.14

#### GstAudio.AudioStreamAlign.get_rate

    def GstAudio.AudioStreamAlign.get_rate (self):
        #python wrapper for 'gst_audio_stream_align_get_rate'

Gets the currently configured sample rate.

Parameters:

`align` (GstAudio.AudioStreamAlign) –

a GstAudio.AudioStreamAlign

Returns (int) –

The currently configured sample rate

Since : 1.14

#### gst_audio_stream_align_get_samples_since_discont

    guint64
    gst_audio_stream_align_get_samples_since_discont (const GstAudioStreamAlign * align)

Returns the number of samples that were processed since the last discontinuity was detected.

Parameters:

`align` –

a GstAudioStreamAlign

Returns –

The number of samples processed since the last discontinuity.

Since : 1.14

#### GstAudio.AudioStreamAlign.prototype.get_samples_since_discont

    function GstAudio.AudioStreamAlign.prototype.get_samples_since_discont(): {
        // javascript wrapper for 'gst_audio_stream_align_get_samples_since_discont'
    }

Returns the number of samples that were processed since the last discontinuity was detected.

Parameters:

`align` (GstAudio.AudioStreamAlign) –

a GstAudio.AudioStreamAlign

Returns (Number) –

The number of samples processed since the last discontinuity.

Since : 1.14

#### GstAudio.AudioStreamAlign.get_samples_since_discont

    def GstAudio.AudioStreamAlign.get_samples_since_discont (self):
        #python wrapper for 'gst_audio_stream_align_get_samples_since_discont'

Returns the number of samples that were processed since the last discontinuity was detected.

Parameters:

`align` (GstAudio.AudioStreamAlign) –

a GstAudio.AudioStreamAlign

Returns (int) –

The number of samples processed since the last discontinuity.

Since : 1.14

#### gst_audio_stream_align_get_timestamp_at_discont

    GstClockTime
    gst_audio_stream_align_get_timestamp_at_discont (const GstAudioStreamAlign * align)

Timestamp that was passed when a discontinuity was detected, i.e. the first timestamp after the discontinuity.

Parameters:

`align` –

a GstAudioStreamAlign

Returns –

The last timestamp at when a discontinuity was detected

Since : 1.14

#### GstAudio.AudioStreamAlign.prototype.get_timestamp_at_discont

    function GstAudio.AudioStreamAlign.prototype.get_timestamp_at_discont(): {
        // javascript wrapper for 'gst_audio_stream_align_get_timestamp_at_discont'
    }

Timestamp that was passed when a discontinuity was detected, i.e. the first timestamp after the discontinuity.

Parameters:

`align` (GstAudio.AudioStreamAlign) –

a GstAudio.AudioStreamAlign

Returns (Number) –

The last timestamp at when a discontinuity was detected

Since : 1.14

#### GstAudio.AudioStreamAlign.get_timestamp_at_discont

    def GstAudio.AudioStreamAlign.get_timestamp_at_discont (self):
        #python wrapper for 'gst_audio_stream_align_get_timestamp_at_discont'

Timestamp that was passed when a discontinuity was detected, i.e. the first timestamp after the discontinuity.

Parameters:

`align` (GstAudio.AudioStreamAlign) –

a GstAudio.AudioStreamAlign

Returns (int) –

The last timestamp at when a discontinuity was detected

Since : 1.14

#### gst_audio_stream_align_mark_discont

    gst_audio_stream_align_mark_discont (GstAudioStreamAlign * align)

Marks the next buffer as discontinuous and resets timestamp tracking.

Parameters:

`align` –

a GstAudioStreamAlign

Since : 1.14

#### GstAudio.AudioStreamAlign.prototype.mark_discont

    function GstAudio.AudioStreamAlign.prototype.mark_discont(): {
        // javascript wrapper for 'gst_audio_stream_align_mark_discont'
    }

Marks the next buffer as discontinuous and resets timestamp tracking.

Parameters:

`align` (GstAudio.AudioStreamAlign) –

a GstAudio.AudioStreamAlign

Since : 1.14

#### GstAudio.AudioStreamAlign.mark_discont

    def GstAudio.AudioStreamAlign.mark_discont (self):
        #python wrapper for 'gst_audio_stream_align_mark_discont'

Marks the next buffer as discontinuous and resets timestamp tracking.

Parameters:

`align` (GstAudio.AudioStreamAlign) –

a GstAudio.AudioStreamAlign

Since : 1.14

#### gst_audio_stream_align_process

    gboolean
    gst_audio_stream_align_process (GstAudioStreamAlign * align,
                                    gboolean discont,
                                    GstClockTime timestamp,
                                    guint n_samples,
                                    GstClockTime * out_timestamp,
                                    GstClockTime * out_duration,
                                    guint64 * out_sample_position)

Processes data with timestamp and n_samples, and returns the output timestamp, duration and sample position together with a boolean to signal whether a discontinuity was detected or not. All non-discontinuous data will have perfect timestamps and durations.

A discontinuity is detected once the difference between the actual timestamp and the timestamp calculated from the sample count since the last discontinuity differs by more than the alignment threshold for a duration longer than discont wait.

Note: In reverse playback, every buffer is considered discontinuous in the context of buffer flags because the last sample of the previous buffer is discontinuous with the first sample of the current one. However for this function they are only considered discontinuous in reverse playback if the first sample of the previous buffer is discontinuous with the last sample of the current one.

Parameters:

`align` –

a GstAudioStreamAlign

`discont` –

if this data is considered to be discontinuous

`timestamp` –

a GstClockTime of the start of the data

`n_samples` –

number of samples to process

`out_timestamp` ( [out]) –

output timestamp of the data

`out_duration` ( [out]) –

output duration of the data

`out_sample_position` ( [out]) –

output sample position of the start of the data

Returns –

TRUE if a discontinuity was detected, FALSE otherwise.

Since : 1.14

#### GstAudio.AudioStreamAlign.prototype.process

    function GstAudio.AudioStreamAlign.prototype.process(discont: Number, timestamp: Number, n_samples: Number): {
        // javascript wrapper for 'gst_audio_stream_align_process'
    }

Processes data with timestamp and n_samples, and returns the output timestamp, duration and sample position together with a boolean to signal whether a discontinuity was detected or not. All non-discontinuous data will have perfect timestamps and durations.

A discontinuity is detected once the difference between the actual timestamp and the timestamp calculated from the sample count since the last discontinuity differs by more than the alignment threshold for a duration longer than discont wait.

Note: In reverse playback, every buffer is considered discontinuous in the context of buffer flags because the last sample of the previous buffer is discontinuous with the first sample of the current one. However for this function they are only considered discontinuous in reverse playback if the first sample of the previous buffer is discontinuous with the last sample of the current one.

Parameters:

`align` (GstAudio.AudioStreamAlign) –

a GstAudio.AudioStreamAlign

`discont` (Number) –

if this data is considered to be discontinuous

`timestamp` (Number) –

a Number of the start of the data

`n_samples` (Number) –

number of samples to process

Returns a tuple made of:

(Number ) –

true if a discontinuity was detected, false otherwise.

`out_timestamp` (Number ) –

true if a discontinuity was detected, false otherwise.

`out_duration` (Number ) –

true if a discontinuity was detected, false otherwise.

`out_sample_position` (Number ) –

true if a discontinuity was detected, false otherwise.

Since : 1.14

#### GstAudio.AudioStreamAlign.process

    def GstAudio.AudioStreamAlign.process (self, discont, timestamp, n_samples):
        #python wrapper for 'gst_audio_stream_align_process'

Processes data with timestamp and n_samples, and returns the output timestamp, duration and sample position together with a boolean to signal whether a discontinuity was detected or not. All non-discontinuous data will have perfect timestamps and durations.

A discontinuity is detected once the difference between the actual timestamp and the timestamp calculated from the sample count since the last discontinuity differs by more than the alignment threshold for a duration longer than discont wait.

Note: In reverse playback, every buffer is considered discontinuous in the context of buffer flags because the last sample of the previous buffer is discontinuous with the first sample of the current one. However for this function they are only considered discontinuous in reverse playback if the first sample of the previous buffer is discontinuous with the last sample of the current one.

Parameters:

`align` (GstAudio.AudioStreamAlign) –

a GstAudio.AudioStreamAlign

`discont` (bool) –

if this data is considered to be discontinuous

`timestamp` (int) –

a int of the start of the data

`n_samples` (int) –

number of samples to process

Returns a tuple made of:

(bool ) –

True if a discontinuity was detected, False otherwise.

`out_timestamp` (int ) –

True if a discontinuity was detected, False otherwise.

`out_duration` (int ) –

True if a discontinuity was detected, False otherwise.

`out_sample_position` (int ) –

True if a discontinuity was detected, False otherwise.

Since : 1.14

#### gst_audio_stream_align_set_alignment_threshold

    gst_audio_stream_align_set_alignment_threshold (GstAudioStreamAlign * align,
                                                    GstClockTime alignment_threshold)

Sets alignment_treshold as new alignment threshold for the following processing.

Parameters:

`align` –

a GstAudioStreamAlign

`alignment_threshold` –

a new alignment threshold

Since : 1.14

#### GstAudio.AudioStreamAlign.prototype.set_alignment_threshold

    function GstAudio.AudioStreamAlign.prototype.set_alignment_threshold(alignment_threshold: Number): {
        // javascript wrapper for 'gst_audio_stream_align_set_alignment_threshold'
    }

Sets alignment_treshold as new alignment threshold for the following processing.

Parameters:

`align` (GstAudio.AudioStreamAlign) –

a GstAudio.AudioStreamAlign

`alignment_threshold` (Number) –

a new alignment threshold

Since : 1.14

#### GstAudio.AudioStreamAlign.set_alignment_threshold

    def GstAudio.AudioStreamAlign.set_alignment_threshold (self, alignment_threshold):
        #python wrapper for 'gst_audio_stream_align_set_alignment_threshold'

Sets alignment_treshold as new alignment threshold for the following processing.

Parameters:

`align` (GstAudio.AudioStreamAlign) –

a GstAudio.AudioStreamAlign

`alignment_threshold` (int) –

a new alignment threshold

Since : 1.14

#### gst_audio_stream_align_set_discont_wait

    gst_audio_stream_align_set_discont_wait (GstAudioStreamAlign * align,
                                             GstClockTime discont_wait)

Sets alignment_treshold as new discont wait for the following processing.

Parameters:

`align` –

a GstAudioStreamAlign

`discont_wait` –

a new discont wait

Since : 1.14

#### GstAudio.AudioStreamAlign.prototype.set_discont_wait

    function GstAudio.AudioStreamAlign.prototype.set_discont_wait(discont_wait: Number): {
        // javascript wrapper for 'gst_audio_stream_align_set_discont_wait'
    }

Sets alignment_treshold as new discont wait for the following processing.

Parameters:

`align` (GstAudio.AudioStreamAlign) –

a GstAudio.AudioStreamAlign

`discont_wait` (Number) –

a new discont wait

Since : 1.14

#### GstAudio.AudioStreamAlign.set_discont_wait

    def GstAudio.AudioStreamAlign.set_discont_wait (self, discont_wait):
        #python wrapper for 'gst_audio_stream_align_set_discont_wait'

Sets alignment_treshold as new discont wait for the following processing.

Parameters:

`align` (GstAudio.AudioStreamAlign) –

a GstAudio.AudioStreamAlign

`discont_wait` (int) –

a new discont wait

Since : 1.14

#### gst_audio_stream_align_set_rate

    gst_audio_stream_align_set_rate (GstAudioStreamAlign * align,
                                     gint rate)

Sets rate as new sample rate for the following processing. If the sample rate differs this implicitly marks the next data as discontinuous.

Parameters:

`align` –

a GstAudioStreamAlign

`rate` –

a new sample rate

Since : 1.14

#### GstAudio.AudioStreamAlign.prototype.set_rate

    function GstAudio.AudioStreamAlign.prototype.set_rate(rate: Number): {
        // javascript wrapper for 'gst_audio_stream_align_set_rate'
    }

Sets rate as new sample rate for the following processing. If the sample rate differs this implicitly marks the next data as discontinuous.

Parameters:

`align` (GstAudio.AudioStreamAlign) –

a GstAudio.AudioStreamAlign

`rate` (Number) –

a new sample rate

Since : 1.14

#### GstAudio.AudioStreamAlign.set_rate

    def GstAudio.AudioStreamAlign.set_rate (self, rate):
        #python wrapper for 'gst_audio_stream_align_set_rate'

Sets rate as new sample rate for the following processing. If the sample rate differs this implicitly marks the next data as discontinuous.

Parameters:

`align` (GstAudio.AudioStreamAlign) –

a GstAudio.AudioStreamAlign

`rate` (int) –

a new sample rate

Since : 1.14

## Constants

### GST_TYPE_AUDIO_INFO_STREAM_ALIGN

    #define GST_TYPE_AUDIO_INFO_STREAM_ALIGN (gst_audio_stream_align_get_type ())

The results of the search are