Skip to main content

BitRead

Trait BitRead 

Source
pub trait BitRead {
    // Required methods
    fn read_ue(&mut self, name: &'static str) -> Result<u32, BitReaderError>;
    fn read_se(&mut self, name: &'static str) -> Result<i32, BitReaderError>;
    fn read_bit(&mut self, name: &'static str) -> Result<bool, BitReaderError>;
    fn read<const BITS: u32, I: Integer>(
        &mut self,
        name: &'static str,
    ) -> Result<I, BitReaderError>;
    fn read_var<I: Integer>(
        &mut self,
        bit_count: u32,
        name: &'static str,
    ) -> Result<I, BitReaderError>;
    fn read_to<V: Primitive>(
        &mut self,
        name: &'static str,
    ) -> Result<V, BitReaderError>;
    fn skip(
        &mut self,
        bit_count: u32,
        name: &'static str,
    ) -> Result<(), BitReaderError>;
    fn byte_aligned(&self) -> bool;
    fn has_more_rbsp_data(
        &mut self,
        name: &'static str,
    ) -> Result<bool, BitReaderError>;
    fn finish_rbsp(self) -> Result<(), BitReaderError>;
    fn finish_sei_payload(self) -> Result<(), BitReaderError>;
}
Expand description

Reads H.26x bitstream elements as specified in H.264 section 7.2.

Required Methods§

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_bit(&mut self, name: &'static str) -> Result<bool, BitReaderError>

Reads a single bit, as in [crate::bitstream_io::read::BitRead::read_bit].

Source

fn read<const BITS: u32, I: Integer>( &mut self, name: &'static str, ) -> Result<I, BitReaderError>

Reads a value from the bitstream with a statically-known number of bits, as in [crate::bitstream_io::read::BitRead::read]. This matches the u(BITS) and i(BITS) syntax elements.

Source

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

Reads a value from the bitstream with a runtime-determined number of bits, as in [crate::bitstream_io::read::BitRead::read_var]. This matches the u(bit_count) and i(bit_count) syntax elements.

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 byte_aligned(&self) -> bool

Returns true if the reader is at a byte boundary.

Source

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

Returns true if positioned before the RBSP trailing bits.

This matches the definition of more_rbsp_data() in Rec. ITU-T H.264 (03/2010) section 7.2.

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.

This is similar to finish_rbsp, but SEI payloads have no trailing bits if already byte-aligned.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§