BitReader

Struct BitReader 

Source
pub struct BitReader<R: BufRead + Clone> { /* private fields */ }
Expand description

Reads H.264 bitstream syntax elements from an RBSP representation (no NAL header byte or emulation prevention three bytes).

Implementations§

Source§

impl<R: BufRead + Clone> BitReader<R>

Source

pub fn new(inner: R) -> Self

Source

pub fn reader(&mut self) -> Option<&mut R>

Borrows the underlying reader if byte-aligned.

Source

pub fn into_reader(self) -> R

Unwraps internal reader and disposes of BitReader.

§Warning

Any unread partial bits are discarded.

Trait Implementations§

Source§

impl<R: BufRead + Clone> BitRead for BitReader<R>

Source§

fn read_ue(&mut self, name: &'static str) -> Result<u32, BitReaderError>

Reads an unsigned Exp-Golomb-coded value, as defined in the H.264 spec.
Source§

fn read_se(&mut self, name: &'static str) -> Result<i32, BitReaderError>

Reads a signed Exp-Golomb-coded value, as defined in the H.264 spec.
Source§

fn read_bool(&mut self, name: &'static str) -> Result<bool, BitReaderError>

Reads a single bit, as in [crate::bitstream_io::read::BitRead::read_bool].
Source§

fn read<U: Numeric>( &mut self, bit_count: u32, name: &'static str, ) -> Result<U, BitReaderError>

Reads an unsigned value from the bitstream with the given number of bytes, as in crate::bitstream_io::read::BitRead::read.
Source§

fn read_to<V: Primitive>( &mut self, name: &'static str, ) -> Result<V, BitReaderError>

Reads a whole value from the bitstream whose size is equal to its byte size, as in crate::bitstream_io::read::BitRead::read_to.
Source§

fn skip( &mut self, bit_count: u32, name: &'static str, ) -> Result<(), BitReaderError>

Skips the given number of bits in the bitstream, as in crate::bitstream_io::read::BitRead::skip.
Source§

fn has_more_rbsp_data( &mut self, name: &'static str, ) -> Result<bool, BitReaderError>

Returns true if positioned before the RBSP trailing bits. Read more
Source§

fn finish_rbsp(self) -> Result<(), BitReaderError>

Consumes the reader, returning error if it’s not positioned at the RBSP trailing bits.
Source§

fn finish_sei_payload(self) -> Result<(), BitReaderError>

Consumes the reader, returning error if this sei_payload message is unfinished. Read more

Auto Trait Implementations§

§

impl<R> Freeze for BitReader<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for BitReader<R>
where R: RefUnwindSafe,

§

impl<R> Send for BitReader<R>
where R: Send,

§

impl<R> Sync for BitReader<R>
where R: Sync,

§

impl<R> Unpin for BitReader<R>
where R: Unpin,

§

impl<R> UnwindSafe for BitReader<R>
where R: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.