Struct cros_codecs::decoders::h264::nalu_reader::NaluReader
source · [−]pub struct NaluReader<T> {
data: Cursor<T>,
curr_byte: u32,
num_remaining_bits_in_curr_byte: usize,
prev_two_bytes: u32,
num_epb: usize,
}
Expand description
A bit reader for h264 bitstreams. It properly handles emulation-prevention bytes and stop bits.
Fields
data: Cursor<T>
A reference into the next unread byte in the stream.
curr_byte: u32
Contents of the current byte. First unread bit starting at position 8 - num_remaining_bits_in_curr_bytes.
num_remaining_bits_in_curr_byte: usize
Number of bits remaining in curr_byte
prev_two_bytes: u32
Used in epb detection.
num_epb: usize
Number of epbs (i.e. 0x000003) we found.
Implementations
sourceimpl<T: AsRef<[u8]>> NaluReader<T>
impl<T: AsRef<[u8]>> NaluReader<T>
pub fn new(data: T) -> Self
sourcepub fn read_bits<U: TryFrom<u32>>(&mut self, num_bits: usize) -> Result<U>
pub fn read_bits<U: TryFrom<u32>>(&mut self, num_bits: usize) -> Result<U>
Read up to 31 bits from the stream.
sourcepub fn num_bits_left(&self) -> usize
pub fn num_bits_left(&self) -> usize
Returns the amount of bits left in the stream
sourcepub fn has_more_rsbp_data(&mut self) -> bool
pub fn has_more_rsbp_data(&mut self) -> bool
Whether the stream still has RBSP data. Implements more_rbsp_data(). See the spec for more details.
pub fn read_ue<U: TryFrom<u32>>(&mut self) -> Result<U>
pub fn read_ue_max<U: TryFrom<u32>>(&mut self, max: u32) -> Result<U>
pub fn read_se<U: TryFrom<i32>>(&mut self) -> Result<U>
pub fn read_se_bounded<U: TryFrom<i32>>(
&mut self,
min: i32,
max: i32
) -> Result<U>
fn get_byte(&mut self) -> Result<u8>
fn update_curr_byte(&mut self) -> Result<()>
Auto Trait Implementations
impl<T> RefUnwindSafe for NaluReader<T>where
T: RefUnwindSafe,
impl<T> Send for NaluReader<T>where
T: Send,
impl<T> Sync for NaluReader<T>where
T: Sync,
impl<T> Unpin for NaluReader<T>where
T: Unpin,
impl<T> UnwindSafe for NaluReader<T>where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more