pub struct OpusPacket<'a> {
pub toc: OpusTocByte,
pub padding: usize,
/* private fields */
}Expand description
A fully-parsed Opus packet: TOC byte plus the per-frame slices recovered by walking the §3.2 frame-packing layer.
Frame slices borrow from the original packet buffer; the parsed packet therefore carries the same lifetime.
Fields§
§toc: OpusTocByteDecoded TOC byte (RFC 6716 §3.1).
padding: usizeNumber of trailing Opus-padding bytes (§3.2.5). Always zero for
codes 0/1/2; non-zero only for a code-3 packet whose p bit is
set.
Implementations§
Source§impl<'a> OpusPacket<'a>
impl<'a> OpusPacket<'a>
Sourcepub fn parse(packet: &'a [u8]) -> Result<Self, Error>
pub fn parse(packet: &'a [u8]) -> Result<Self, Error>
Parse one complete Opus packet (TOC byte plus §3.2 frame packing).
Returns Error::EmptyPacket if the buffer is empty (R1), or
Error::MalformedPacket if any other §3.2 requirement is
violated.
Sourcepub fn frames(&self) -> &[&'a [u8]]
pub fn frames(&self) -> &[&'a [u8]]
Compressed frame payloads in packet order.
Each slice borrows from the original packet buffer. A zero-length slice represents a §3.2.1 DTX / lost-frame marker.
Sourcepub fn frame_count(&self) -> usize
pub fn frame_count(&self) -> usize
Number of compressed frames in the packet (equals
self.frames().len()).
Trait Implementations§
Source§impl<'a> Clone for OpusPacket<'a>
impl<'a> Clone for OpusPacket<'a>
Source§fn clone(&self) -> OpusPacket<'a>
fn clone(&self) -> OpusPacket<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for OpusPacket<'a>
impl<'a> Debug for OpusPacket<'a>
impl<'a> Eq for OpusPacket<'a>
Source§impl<'a> PartialEq for OpusPacket<'a>
impl<'a> PartialEq for OpusPacket<'a>
Source§fn eq(&self, other: &OpusPacket<'a>) -> bool
fn eq(&self, other: &OpusPacket<'a>) -> bool
self and other values to be equal, and is used by ==.