Struct symphonia_core::io::vlc::CodebookBuilder

source ·
pub struct CodebookBuilder { /* private fields */ }
Expand description

CodebookBuilder generates a Codebook using a provided codebook specification and description.

Implementations§

source§

impl CodebookBuilder

source

pub fn new(bit_order: BitOrder) -> Self

Instantiates a new CodebookBuilder.

The bit_order parameter specifies if the codeword bits should be reversed when constructing the codebook. If the BitReader or BitStream reading the constructed codebook reads bits in an order different from the order of the provided codewords, then this option can be used to make them compatible.

source

pub fn new_sparse(bit_order: BitOrder) -> Self

Instantiates a new CodebookBuilder for sparse codebooks.

A sparse codebook is one in which not all codewords are valid. These invalid codewords are effectively “unused” and have no value. Therefore, it is illegal for a bitstream to contain the codeword bit pattern.

Unused codewords are marked by having a length of 0.

source

pub fn bits_per_read(&mut self, max_bits_per_read: u8) -> &mut Self

Specify the maximum number of bits that should be consumed from the source at a time. This value must be within the range 1 <= max_bits_per_read <= 16. Values outside of this range will cause this function to panic. If not provided, a value will be automatically chosen.

source

pub fn make<E: CodebookEntry>( &mut self, code_words: &[u32], code_lens: &[u8], values: &[E::ValueType], ) -> Result<Codebook<E>>

Construct a Codebook using the given codewords, their respective lengths, and values.

This function may fail if the provided codewords do not form a complete VLC tree, or if the CodebookEntry is undersized.

This function will panic if the number of code words, code lengths, and values differ.

Auto Trait Implementations§

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<F, T> IntoSample<T> for F
where T: FromSample<F>,

source§

fn into_sample(self) -> T

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.