Skip to main content

AudioStream

Struct AudioStream 

Source
pub struct AudioStream { /* private fields */ }
Expand description

An audio track decoded at the project rate.

Implementations§

Source§

impl AudioStream

Source

pub fn open_file( path: &Path, backends: &dyn AudioBackends, project_rate: u32, stream: Option<u32>, policy: DecodePolicy, ) -> Result<Self, DecodeError>

Opens audio track stream (an ordinal over the file’s audio tracks in container order; None is the default track) of the file at path, delivered at project_rate.

§Errors

DecodeError::Unsupported for a container this layer does not read, a missing track, or a track no session reads; read failures.

Source

pub fn open( reader: Box<dyn ContainerReader>, index: usize, backends: &dyn AudioBackends, project_rate: u32, policy: DecodePolicy, ) -> Result<Self, DecodeError>

Opens track index of reader, delivered at project_rate.

§Errors

DecodeError::Unsupported for a track that is not audio or that no session reads; DecodeError::OutOfRange for a zero rate.

Source

pub const fn track(&self) -> &TrackInfo

The track decoded.

Source

pub const fn speakers(&self) -> SpeakerLayout

The speaker order of every block.

Source

pub const fn recovery(&self) -> &Recovery

Gaps and overlaps recorded so far.

Source

pub fn next_block( &mut self, cancel: &CancelToken, ) -> Result<Option<AudioBlock>, DecodeError>

The next block of up to 1024 samples at the project rate; None at the end.

§Errors

Cancellation, a spent work budget, or a decoder failure.

Source

pub fn seek( &mut self, time: MediaTime, cancel: &CancelToken, ) -> Result<AudioBlock, DecodeError>

The block holding time’s sample, starting at that sample, or at the stream’s first sample for an earlier time.

§Errors

DecodeError::OutOfRange past the end; otherwise as Self::next_block.

Trait Implementations§

Source§

impl Debug for AudioStream

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Decoder for AudioStream

Source§

fn streams(&self) -> &[StreamInfo]

Returns deterministic stream metadata and stream selection.
Source§

fn flush(&mut self) -> Result<(), DecodeError>

Flushes queued packets and frames without changing stream selection. Read more
Source§

fn seek( &mut self, request: DecodeRequest, cancel: &CancelToken, ) -> Result<DecodeResult, DecodeError>

Seeks and returns what is presented at the request’s time. Read more
Source§

fn decode_next( &mut self, cancel: &CancelToken, ) -> Result<DecodeEvent, DecodeError>

Advances packet draining by one observable event. Read more
Source§

impl WindowedAudioDecoder for AudioStream

Available on crate feature engine only.

A stream behind a mix’s audio windows; its blocks hold at most BLOCK_FRAMES samples.

Source§

fn channels(&self) -> usize

Channels of every block it returns.
Source§

fn speakers(&self) -> SpeakerLayout

The speaker each channel feeds.
Source§

fn audio_duration(&self) -> Option<MediaTime>

Where the source’s audio ends, as the project reads it; None when unknown.

Auto Trait Implementations§

§

impl !Freeze for AudioStream

§

impl !RefUnwindSafe for AudioStream

§

impl !Sync for AudioStream

§

impl !UnwindSafe for AudioStream

§

impl Forget for AudioStream

§

impl Move for AudioStream

§

impl Send for AudioStream
where BoxRaw<dyn ContainerReader>: Send, RawVecInner: Send, Bytes: Send, BoxRaw<dyn AudioDecodeBackend>: Send, RawTable<(i64, (u32, u32))>: Send, BoxRaw<dyn Fn(DecodeDiagnostic) + Sync + Send>: Send, &'static str: Send,

§

impl Unpin for AudioStream
where Box<dyn ContainerReader>: Unpin, *const u8 is !null: Unpin, *const u8: Unpin, Align8<*mut ()>: Unpin, &'static Vtable: Unpin, Box<dyn AudioDecodeBackend>: Unpin, Box<dyn Fn(DecodeDiagnostic) + Sync + Send>: Unpin, &'static str: Unpin,

§

impl UnsafeUnpin for AudioStream

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,