Skip to main content

shine_rs/
lib.rs

1//! # Rust MP3 Encoder
2//!
3//! A pure Rust implementation of an MP3 encoder based on the shine library.
4//! This library provides a complete MP3 Layer III encoding solution with
5//! support for various sample rates, bitrates, and channel configurations.
6//!
7
8pub mod bitstream;
9pub mod encoder;
10pub mod error;
11pub mod huffman;
12pub mod mdct;
13pub mod mp3_encoder;
14pub mod quantization;
15pub mod reservoir;
16pub mod subband;
17pub mod tables;
18pub mod types;
19
20#[cfg(feature = "diagnostics")]
21pub mod diagnostics;
22
23// Re-export diagnostics functions for backward compatibility
24#[cfg(feature = "diagnostics")]
25pub use diagnostics::{get_current_frame_number, get_next_frame_number, reset_frame_counter};
26
27// Stub functions when diagnostics feature is not enabled
28#[cfg(not(feature = "diagnostics"))]
29pub fn reset_frame_counter() {}
30
31#[cfg(not(feature = "diagnostics"))]
32pub fn get_next_frame_number() -> i32 {
33    1
34}
35
36#[cfg(not(feature = "diagnostics"))]
37pub fn get_current_frame_number() -> i32 {
38    1
39}
40
41// Re-export high-level interface (recommended for most users)
42pub use mp3_encoder::{
43    encode_pcm_to_mp3, Mp3Encoder, Mp3EncoderConfig, StereoMode, SUPPORTED_BITRATES,
44    SUPPORTED_SAMPLE_RATES,
45};
46
47// Re-export low-level interface (for advanced users)
48pub use encoder::{
49    shine_close, shine_encode_buffer_interleaved, shine_flush, shine_initialise,
50    shine_set_config_mpeg_defaults, ShineConfig, ShineMpeg, ShineWave,
51};
52pub use error::{ConfigError, EncoderError, EncodingError, EncodingResult, InputDataError};
53pub use types::ShineGlobalConfig;