pub struct SpeexBits<'a> {
pub buffer_ref: Option<&'a mut [u8]>,
/* private fields */
}Expand description
A struct that holds bits to be read or written to
Internally packs bits.
Fields§
§buffer_ref: Option<&'a mut [u8]>Implementations§
Source§impl<'a> SpeexBits<'a>
impl<'a> SpeexBits<'a>
pub fn buffer<'b>(&mut self) -> &'a mut [u8] ⓘ
Sourcepub fn new_with_buffer(buffer: &'a mut [u8]) -> Self
pub fn new_with_buffer(buffer: &'a mut [u8]) -> Self
Creates a new SpeexBits with an existing buffer
Sourcepub fn insert_terminator(&mut self)
pub fn insert_terminator(&mut self)
Inserts a terminator so the data can be sent as a packet while autodetecting how many frames were in the packet
Sourcepub fn num_bytes(&mut self) -> i32
pub fn num_bytes(&mut self) -> i32
Returns the number of bytes in the bitstream, including the last partial byte
Sourcepub fn peek(&mut self) -> i32
pub fn peek(&mut self) -> i32
Gets the value of the next bit in the stream without advancing the read pointer
Sourcepub fn peek_unsigned(&mut self, num_bits: i32) -> u32
pub fn peek_unsigned(&mut self, num_bits: i32) -> u32
Gets the value of the next num_bits in the stream without advancing
the read pointer
pub fn read_from(&mut self, buffer: &mut [u8])
Sourcepub fn read_whole_bytes(&mut self, bytes: &[u8])
pub fn read_whole_bytes(&mut self, bytes: &[u8])
Appends bytes to the bitstream
Sourcepub fn remaining(&mut self) -> u32
pub fn remaining(&mut self) -> u32
Returns the number of bits remaining to be read from a stream
Sourcepub fn set_bit_buffer(&mut self, buffer: &mut [u8])
pub fn set_bit_buffer(&mut self, buffer: &mut [u8])
Sets an existing SpeexBits to use data from an existing buffer
Sourcepub fn unpack_signed(&mut self, num_bits: i32) -> i32
pub fn unpack_signed(&mut self, num_bits: i32) -> i32
Interpret the next number of bits as a signed integer, advancing the read pointer
Sourcepub fn unpacked_unsigned(&mut self, num_bits: i32) -> u32
pub fn unpacked_unsigned(&mut self, num_bits: i32) -> u32
Interpret the next number of bits as an unsigned integer, advancing the read pointer
Sourcepub fn write(&mut self, buffer: &mut [u8]) -> u32
pub fn write(&mut self, buffer: &mut [u8]) -> u32
Writes the content of the bitstream to a buffer
Sourcepub fn write_whole_bytes(&mut self, buffer: &mut [u8]) -> u32
pub fn write_whole_bytes(&mut self, buffer: &mut [u8]) -> u32
Writes the content of the bitstream to a buffer, writing whole bytes only. Removes any bytes that are successfully written from the bitstream.