pub struct Repacketizer { /* private fields */ }Expand description
Repackages Opus frames into packets.
Implementations§
Source§impl Repacketizer
impl Repacketizer
Sourcepub fn push(&mut self, packet: &[u8]) -> Result<()>
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.
Sourcepub fn frame_count(&self) -> i32
pub fn frame_count(&self) -> i32
Number of frames currently queued.
Sourcepub fn emit_range(
&mut self,
begin: i32,
end: i32,
out: &mut [u8],
) -> Result<usize>
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.
Sourcepub fn size() -> Result<usize>
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.
Sourcepub unsafe fn init_in_place(ptr: *mut OpusRepacketizer) -> Result<()>
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§
impl Send for Repacketizer
impl Sync for Repacketizer
Auto Trait Implementations§
impl Freeze for Repacketizer
impl RefUnwindSafe for Repacketizer
impl Unpin for Repacketizer
impl UnsafeUnpin for Repacketizer
impl UnwindSafe for Repacketizer
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
Mutably borrows from an owned value. Read more