Skip to main content

ahx_rs/
lib.rs

1#![doc = include_str!("../README.md")]
2#![no_std]
3#![forbid(unsafe_code)]
4
5#[cfg(any(feature = "std", test))]
6extern crate std;
7
8mod bits;
9mod dct;
10mod error;
11mod input;
12mod metadata;
13mod packet;
14mod quantization;
15mod stream;
16mod synthesis;
17mod tables;
18
19pub use error::{Error, InvalidData, UnsupportedData};
20pub use metadata::Metadata;
21pub use packet::{DecodedPacket, PacketDecoder};
22#[cfg(feature = "std")]
23pub use stream::Decoder;
24pub use stream::{DecoderState, SliceDecoder};
25
26/// Mono PCM16 elements produced by one complete compressed frame.
27/// Caller-owned output buffers need at least this many `i16` elements, even
28/// when the container trims the final block to a shorter declared duration.
29pub const SAMPLES_PER_FRAME: usize = 1152;
30
31/// Maximum compressed frame bytes, including its four-byte MPEG header.
32/// Useful for bounded custom streaming input. Frames are variable length;
33/// [`DecodedPacket::consumed_bytes`] reports the length actually consumed.
34pub const MAX_FRAME_BYTES: usize = 0x414;