Repacketizer

Struct Repacketizer 

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

Repackages Opus frames into packets.

Implementations§

Source§

impl Repacketizer

Source

pub fn new() -> Result<Self>

Create a new repacketizer.

§Errors

Returns AllocFail if allocation fails.

Source

pub fn reset(&mut self)

Reset internal state.

Source

pub fn push(&mut self, packet: &[u8]) -> Result<()>

Add a packet to the current state.

The packet data is copied and retained until the next call to Self::reset.

§Errors

Returns an error if the packet is invalid for the current state.

Source

pub fn frame_count(&self) -> i32

Number of frames currently queued.

Source

pub fn len(&self) -> usize

Number of frames currently queued as a usize.

Source

pub fn is_empty(&self) -> bool

Returns true when there are no queued frames.

Source

pub fn emit_range( &mut self, begin: i32, end: i32, out: &mut [u8], ) -> Result<usize>

Emit a packet containing frames in range [begin, end).

§Errors

Returns an error if range is invalid or output buffer is too small.

Source

pub fn emit(&mut self, out: &mut [u8]) -> Result<usize>

Emit a packet with all queued frames.

§Errors

Returns an error if the output buffer is too small.

Source

pub fn size() -> Result<usize>

Size of a repacketizer state in bytes for external allocation.

§Errors

Returns Error::InternalError if libopus reports an invalid size.

Source

pub unsafe fn init_in_place(ptr: *mut OpusRepacketizer) -> Result<()>

Initialize a previously allocated repacketizer state.

§Safety

The caller must provide a valid pointer to Repacketizer::size() bytes, aligned to at least align_of::<usize>() (malloc-style alignment).

§Errors

Returns Error::BadArg if ptr is null.

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.