Skip to main content

AudioDecodeBackend

Trait AudioDecodeBackend 

Source
pub trait AudioDecodeBackend: Send {
    // Required methods
    fn submit(&mut self, packet: &Packet) -> Result<Submit, BackendError>;
    fn receive(&mut self, wait: bool) -> Result<AudioPoll, BackendError>;
    fn finish_input(&mut self) -> Result<(), BackendError>;
    fn flush(&mut self) -> Result<(), BackendError>;
}
Expand description

One decoder session for one audio track, used from one thread at a time.

Required Methods§

Source

fn submit(&mut self, packet: &Packet) -> Result<Submit, BackendError>

Queues a packet for decoding.

§Errors

A lost session, a damaged packet, or a failed decoder.

Source

fn receive(&mut self, wait: bool) -> Result<AudioPoll, BackendError>

Takes decoded samples, in packet order. With wait, blocks briefly for them.

§Errors

A lost session or a failed decoder.

Source

fn finish_input(&mut self) -> Result<(), BackendError>

No more packets follow until a Self::flush.

§Errors

A lost session or a failed decoder.

Source

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

Drops every queued packet and sample.

§Errors

A lost session or a failed decoder.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§