Struct gstreamer_audio::AudioStreamAlign
source · 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.
GLib type: Boxed type with copy-on-clone semantics.
Implementations§
source§impl AudioStreamAlign
impl AudioStreamAlign
sourcepub fn as_ptr(&self) -> *mut GstAudioStreamAlign
pub fn as_ptr(&self) -> *mut GstAudioStreamAlign
Return the inner pointer to the underlying C value.
sourcepub unsafe fn from_glib_ptr_borrow(ptr: &*mut GstAudioStreamAlign) -> &Self
pub unsafe fn from_glib_ptr_borrow(ptr: &*mut GstAudioStreamAlign) -> &Self
Borrows the underlying C value.
sourcepub unsafe fn from_glib_ptr_borrow_mut(
ptr: &mut *mut GstAudioStreamAlign,
) -> &mut Self
pub unsafe fn from_glib_ptr_borrow_mut( ptr: &mut *mut GstAudioStreamAlign, ) -> &mut Self
Borrows the underlying C value mutably.
source§impl AudioStreamAlign
impl AudioStreamAlign
sourcepub fn new(
rate: i32,
alignment_threshold: ClockTime,
discont_wait: ClockTime,
) -> AudioStreamAlign
pub fn new( rate: i32, alignment_threshold: ClockTime, discont_wait: ClockTime, ) -> AudioStreamAlign
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()
.
sourcepub fn alignment_threshold(&self) -> ClockTime
pub fn alignment_threshold(&self) -> ClockTime
Gets the currently configured alignment threshold.
§Returns
The currently configured alignment threshold
sourcepub fn discont_wait(&self) -> ClockTime
pub fn discont_wait(&self) -> ClockTime
sourcepub fn samples_since_discont(&self) -> u64
pub fn samples_since_discont(&self) -> u64
Returns the number of samples that were processed since the last discontinuity was detected.
§Returns
The number of samples processed since the last discontinuity.
sourcepub fn timestamp_at_discont(&self) -> Option<ClockTime>
pub fn timestamp_at_discont(&self) -> Option<ClockTime>
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
sourcepub fn mark_discont(&mut self)
pub fn mark_discont(&mut self)
Marks the next buffer as discontinuous and resets timestamp tracking.
sourcepub fn set_alignment_threshold(&mut self, alignment_threshold: ClockTime)
pub fn set_alignment_threshold(&mut self, alignment_threshold: ClockTime)
Sets alignment_treshold
as new alignment threshold for the following processing.
§alignment_threshold
a new alignment threshold
sourcepub fn set_discont_wait(&mut self, discont_wait: ClockTime)
pub fn set_discont_wait(&mut self, discont_wait: ClockTime)
Sets alignment_treshold
as new discont wait for the following processing.
§discont_wait
a new discont wait
source§impl AudioStreamAlign
impl AudioStreamAlign
sourcepub fn process(
&mut self,
discont: bool,
timestamp: ClockTime,
n_samples: u32,
) -> (bool, ClockTime, ClockTime, u64)
pub fn process( &mut self, discont: bool, timestamp: ClockTime, n_samples: u32, ) -> (bool, ClockTime, ClockTime, u64)
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§
source§impl Clone for AudioStreamAlign
impl Clone for AudioStreamAlign
source§impl Debug for AudioStreamAlign
impl Debug for AudioStreamAlign
source§impl From<AudioStreamAlign> for Value
impl From<AudioStreamAlign> for Value
source§fn from(o: AudioStreamAlign) -> Self
fn from(o: AudioStreamAlign) -> Self
source§impl HasParamSpec for AudioStreamAlign
impl HasParamSpec for AudioStreamAlign
type ParamSpec = ParamSpecBoxed
§type SetValue = AudioStreamAlign
type SetValue = AudioStreamAlign
type BuilderFn = fn(_: &str) -> ParamSpecBoxedBuilder<'_, AudioStreamAlign>
fn param_spec_builder() -> Self::BuilderFn
source§impl Hash for AudioStreamAlign
impl Hash for AudioStreamAlign
source§impl Ord for AudioStreamAlign
impl Ord for AudioStreamAlign
source§fn cmp(&self, other: &AudioStreamAlign) -> Ordering
fn cmp(&self, other: &AudioStreamAlign) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for AudioStreamAlign
impl PartialEq for AudioStreamAlign
source§fn eq(&self, other: &AudioStreamAlign) -> bool
fn eq(&self, other: &AudioStreamAlign) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for AudioStreamAlign
impl PartialOrd for AudioStreamAlign
source§fn partial_cmp(&self, other: &AudioStreamAlign) -> Option<Ordering>
fn partial_cmp(&self, other: &AudioStreamAlign) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl StaticType for AudioStreamAlign
impl StaticType for AudioStreamAlign
source§fn static_type() -> Type
fn static_type() -> Type
Self
.impl Eq for AudioStreamAlign
impl Send for AudioStreamAlign
impl StructuralPartialEq for AudioStreamAlign
impl Sync for AudioStreamAlign
Auto Trait Implementations§
impl Freeze for AudioStreamAlign
impl RefUnwindSafe for AudioStreamAlign
impl Unpin for AudioStreamAlign
impl UnwindSafe for AudioStreamAlign
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
unsafe fn from_glib_none_as_vec(ptr: *const GList) -> Vec<T>
unsafe fn from_glib_container_as_vec(_: *const GList) -> Vec<T>
unsafe fn from_glib_full_as_vec(_: *const GList) -> Vec<T>
source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
unsafe fn from_glib_none_as_vec(ptr: *const GPtrArray) -> Vec<T>
unsafe fn from_glib_container_as_vec(_: *const GPtrArray) -> Vec<T>
unsafe fn from_glib_full_as_vec(_: *const GPtrArray) -> Vec<T>
source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
unsafe fn from_glib_none_as_vec(ptr: *const GSList) -> Vec<T>
unsafe fn from_glib_container_as_vec(_: *const GSList) -> Vec<T>
unsafe fn from_glib_full_as_vec(_: *const GSList) -> Vec<T>
source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
unsafe fn from_glib_none_as_vec(ptr: *mut GList) -> Vec<T>
unsafe fn from_glib_container_as_vec(ptr: *mut GList) -> Vec<T>
unsafe fn from_glib_full_as_vec(ptr: *mut GList) -> Vec<T>
source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
unsafe fn from_glib_none_as_vec(ptr: *mut GPtrArray) -> Vec<T>
unsafe fn from_glib_container_as_vec(ptr: *mut GPtrArray) -> Vec<T>
unsafe fn from_glib_full_as_vec(ptr: *mut GPtrArray) -> Vec<T>
source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
unsafe fn from_glib_none_as_vec(ptr: *mut GSList) -> Vec<T>
unsafe fn from_glib_container_as_vec(ptr: *mut GSList) -> Vec<T>
unsafe fn from_glib_full_as_vec(ptr: *mut GSList) -> Vec<T>
source§impl<T> IntoClosureReturnValue for T
impl<T> IntoClosureReturnValue for T
fn into_closure_return_value(self) -> Option<Value>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> PropertyGet for Twhere
T: HasParamSpec,
impl<T> PropertyGet for Twhere
T: HasParamSpec,
source§impl<T> StaticTypeExt for Twhere
T: StaticType,
impl<T> StaticTypeExt for Twhere
T: StaticType,
source§fn ensure_type()
fn ensure_type()
source§impl<T> ToSendValue for T
impl<T> ToSendValue for T
source§fn to_send_value(&self) -> SendValue
fn to_send_value(&self) -> SendValue
SendValue
clone of self
.