#[repr(transparent)]
pub struct AudioStreamAlign { /* private fields */ }
Expand description

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

See new() for a description of its parameters and process() for the details of the processing.

Implementations

This is supported on crate feature v1_14 only.

Allocate a new AudioStreamAlign with the given configuration. All processing happens according to sample rate rate, until 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 set_alignment_threshold() and set_discont_wait().

rate

a sample rate

alignment_threshold

a alignment threshold in nanoseconds

discont_wait

discont wait in nanoseconds

Returns

a new AudioStreamAlign. free with gst_audio_stream_align_free().

This is supported on crate feature v1_14 only.

Gets the currently configured alignment threshold.

Returns

The currently configured alignment threshold

This is supported on crate feature v1_14 only.

Gets the currently configured discont wait.

Returns

The currently configured discont wait

This is supported on crate feature v1_14 only.

Gets the currently configured sample rate.

Returns

The currently configured sample rate

This is supported on crate feature v1_14 only.

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

Returns

The number of samples processed since the last discontinuity.

This is supported on crate feature v1_14 only.

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

Returns

The last timestamp at when a discontinuity was detected

This is supported on crate feature v1_14 only.

Marks the next buffer as discontinuous and resets timestamp tracking.

This is supported on crate feature v1_14 only.

Sets alignment_treshold as new alignment threshold for the following processing.

alignment_threshold

a new alignment threshold

This is supported on crate feature v1_14 only.

Sets alignment_treshold as new discont wait for the following processing.

discont_wait

a new discont wait

This is supported on crate feature v1_14 only.

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

rate

a new sample rate

This is supported on crate feature v1_14 only.

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.

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

Returns

true if a discontinuity was detected, false otherwise.

out_timestamp

output timestamp of the data

out_duration

output duration of the data

out_sample_position

output sample position of the start of the data

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Returns the type identifier of Self.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Ensures that the type has been registered with the type system.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Returns a SendValue clone of self.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.