Skip to main content

VorbisConfig

Struct VorbisConfig 

Source
pub struct VorbisConfig {
    pub channels: u8,
    pub sample_rate: u32,
    pub bitrate_maximum: i32,
    pub bitrate_nominal: i32,
    pub bitrate_minimum: i32,
    pub block_sizes: (u16, u16),
    pub identification_header: Vec<u8>,
    pub comment_header: Vec<u8>,
    pub setup_header: Vec<u8>,
    /* private fields */
}
Expand description

The three Vorbis I header packets and what zvidlib reads from them.

Fields§

§channels: u8§sample_rate: u32§bitrate_maximum: i32

The identification header’s maximum, nominal and minimum bit rates, in bits a second; zero where the stream does not say.

§bitrate_nominal: i32§bitrate_minimum: i32§block_sizes: (u16, u16)

The short and long block sizes, in samples.

§identification_header: Vec<u8>§comment_header: Vec<u8>§setup_header: Vec<u8>

Implementations§

Source§

impl VorbisConfig

Source

pub fn from_headers( identification_header: Vec<u8>, comment_header: Vec<u8>, setup_header: Vec<u8>, ) -> Result<VorbisConfig, Error>

Validates and parses the three header packets.

Source

pub fn from_codec_private(codec_private: &[u8]) -> Result<VorbisConfig, Error>

Parses the three header packets Xiph-laced, the form Matroska and WebM CodecPrivate use: a byte holding the packet count less one (two), the first two packets’ sizes as runs of 255 ending in a smaller byte, then the packets.

Source

pub fn to_codec_private(&self) -> Vec<u8> ⓘ

Writes the three header packets Xiph-laced, as Matroska and WebM CodecPrivate and a WebCodecs decoder description take them.

Source

pub fn packet_block_size(&self, packet: &[u8]) -> Result<u16, Error>

The block size an audio packet codes, read from its mode number.

Source

pub fn encoded_samples( &self, packets: Vec<Vec<u8>>, ) -> Result<Vec<EncodedAudioSample>, Error>

Assigns each audio packet, in stream order, the interval of decoded samples it produces: none for the first, and for every later one a quarter of its block size plus a quarter of the previous packet’s.

Trait Implementations§

Source§

impl Clone for VorbisConfig

Source§

fn clone(&self) -> VorbisConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VorbisConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for VorbisConfig

Source§

impl PartialEq for VorbisConfig

Source§

fn eq(&self, other: &VorbisConfig) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for VorbisConfig

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.