[][src]Struct gstreamer_audio::AudioStreamAlign

pub struct AudioStreamAlign(_);

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

See AudioStreamAlign::new for a description of its parameters and AudioStreamAlign::process for the details of the processing.

Feature: v1_14

Implementations

impl AudioStreamAlign[src]

pub fn new(
    rate: i32,
    alignment_threshold: ClockTime,
    discont_wait: ClockTime
) -> AudioStreamAlign
[src]

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

Feature: v1_14

rate

a sample rate

alignment_threshold

a alignment threshold in nanoseconds

discont_wait

discont wait in nanoseconds

Returns

a new AudioStreamAlign. free with AudioStreamAlign::free.

pub fn get_alignment_threshold(&self) -> ClockTime[src]

Gets the currently configured alignment threshold.

Feature: v1_14

Returns

The currently configured alignment threshold

pub fn get_discont_wait(&self) -> ClockTime[src]

Gets the currently configured discont wait.

Feature: v1_14

Returns

The currently configured discont wait

pub fn get_rate(&self) -> i32[src]

Gets the currently configured sample rate.

Feature: v1_14

Returns

The currently configured sample rate

pub fn get_samples_since_discont(&self) -> u64[src]

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

Feature: v1_14

Returns

The number of samples processed since the last discontinuity.

pub fn get_timestamp_at_discont(&self) -> ClockTime[src]

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

Feature: v1_14

Returns

The last timestamp at when a discontinuity was detected

pub fn mark_discont(&mut self)[src]

Marks the next buffer as discontinuous and resets timestamp tracking.

Feature: v1_14

pub fn set_alignment_threshold(&mut self, alignment_threshold: ClockTime)[src]

Sets alignment_treshold as new alignment threshold for the following processing.

Feature: v1_14

alignment_threshold

a new alignment threshold

pub fn set_discont_wait(&mut self, discont_wait: ClockTime)[src]

Sets alignment_treshold as new discont wait for the following processing.

Feature: v1_14

discont_wait

a new discont wait

pub fn set_rate(&mut self, rate: i32)[src]

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

Feature: v1_14

rate

a new sample rate

impl AudioStreamAlign[src]

pub fn process(
    &mut self,
    discont: bool,
    timestamp: ClockTime,
    n_samples: u32
) -> (bool, ClockTime, ClockTime, u64)
[src]

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.

Feature: v1_14

discont

if this data is considered to be discontinuous

timestamp

a gst::ClockTime of the start of the data

n_samples

number of samples to process

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

Returns

true if a discontinuity was detected, false otherwise.

Trait Implementations

impl Clone for AudioStreamAlign[src]

impl Debug for AudioStreamAlign[src]

impl Eq for AudioStreamAlign[src]

impl Hash for AudioStreamAlign[src]

impl Ord for AudioStreamAlign[src]

impl PartialEq<AudioStreamAlign> for AudioStreamAlign[src]

impl PartialOrd<AudioStreamAlign> for AudioStreamAlign[src]

impl Send for AudioStreamAlign[src]

impl StaticType for AudioStreamAlign[src]

impl StructuralEq for AudioStreamAlign[src]

impl StructuralPartialEq for AudioStreamAlign[src]

impl Sync for AudioStreamAlign[src]

Auto Trait Implementations

impl RefUnwindSafe for AudioStreamAlign

impl Unpin for AudioStreamAlign

impl UnwindSafe for AudioStreamAlign

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToSendValue for T where
    T: ToValue + SetValue + Send + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.