Add support to encode flac

Update ExtraConfig's default value
This commit is contained in:
2025-08-28 23:12:10 +08:00
parent 7b3b852483
commit 03e7dd220c
10 changed files with 461 additions and 9 deletions

View File

@@ -0,0 +1,19 @@
//! Lossless audio utilities.
use super::flac::*;
use super::pcm::*;
use crate::types::*;
use anyhow::Result;
use std::io::{Read, Seek, Write};
pub fn write_audio<W: Write + Seek, R: Read>(
header: &PcmFormat,
reader: R,
writer: W,
config: &ExtraConfig,
) -> Result<()> {
match config.lossless_audio_fmt {
LosslessAudioFormat::Wav => write_pcm(header, reader, writer)?,
LosslessAudioFormat::Flac => write_flac(header, reader, writer, config)?,
}
Ok(())
}