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: i32The 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
impl VorbisConfig
Sourcepub fn from_headers(
identification_header: Vec<u8>,
comment_header: Vec<u8>,
setup_header: Vec<u8>,
) -> Result<VorbisConfig, Error>
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.
Sourcepub fn from_codec_private(codec_private: &[u8]) -> Result<VorbisConfig, Error>
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.
Sourcepub fn to_codec_private(&self) -> Vec<u8> ⓘ
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.
Sourcepub fn packet_block_size(&self, packet: &[u8]) -> Result<u16, Error>
pub fn packet_block_size(&self, packet: &[u8]) -> Result<u16, Error>
The block size an audio packet codes, read from its mode number.
Sourcepub fn encoded_samples(
&self,
packets: Vec<Vec<u8>>,
) -> Result<Vec<EncodedAudioSample>, Error>
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
impl Clone for VorbisConfig
Source§fn clone(&self) -> VorbisConfig
fn clone(&self) -> VorbisConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more