summaryrefslogtreecommitdiff
path: root/src/flac.rs
diff options
context:
space:
mode:
authorjakka <jakkadoujin@gmail.com>2025-06-05 11:57:46 +0300
committerjakka <jakkadoujin@gmail.com>2025-06-05 11:57:46 +0300
commit5b3c64bc68a22d9b6a1cc8fe7082f589ed8b6983 (patch)
tree17048224e03dce7807b2b688aab1ee0819582e5a /src/flac.rs
parentd7f2067c2f1f2e395f5550a2dc6b6c13bad0e692 (diff)
mminor additions
Diffstat (limited to 'src/flac.rs')
-rw-r--r--src/flac.rs20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/flac.rs b/src/flac.rs
index 8aaac00..7da93cb 100644
--- a/src/flac.rs
+++ b/src/flac.rs
@@ -3,8 +3,8 @@ use claxon::FlacReader;
use flac_bound::{FlacEncoder, WriteWrapper};
use i24::i24;
use md5::{Digest, Md5};
-use metaflac::{Tag, Block};
-use std::fs::{File, read};
+use metaflac::{Block, Tag};
+use std::fs::File;
struct StreamConfig {
channels: u32,
@@ -82,7 +82,7 @@ fn process_samples_i24(
Ok(())
}
-fn process_samples_i32(
+/* fn process_samples_i32(
hasher: &mut impl Digest,
mut reader: FlacReader<File>,
enc: &mut FlacEncoder,
@@ -101,8 +101,11 @@ fn process_samples_i32(
.map(|sample| hasher.update(sample.to_le_bytes()))
.collect::<Vec<_>>();
}
+ for sample in reader.samples() {
+ sample?;
+ }
Ok(())
-}
+} */
pub fn encode_file(file: &std::path::Path) -> Result<()> {
let reader = claxon::FlacReader::open(file)?;
@@ -133,7 +136,8 @@ pub fn encode_file(file: &std::path::Path) -> Result<()> {
match config.bits_per_sample {
Bps::_16 => process_samples_i16(&mut hasher, reader, &mut enc, &config)?,
Bps::_24 => process_samples_i24(&mut hasher, reader, &mut enc, &config)?,
- Bps::_32 => process_samples_i32(&mut hasher, reader, &mut enc, &config)?,
+ /* Bps::_32 => process_samples_i32(&mut hasher, reader, &mut enc, &config)?, */
+ Bps::_32 => unimplemented!("32bit flac isnt supported by claxon")
};
if let Err(enc) = enc.finish() {
@@ -146,15 +150,15 @@ pub fn encode_file(file: &std::path::Path) -> Result<()> {
streaminfo.md5 = hasher.finalize()[..].to_vec();
output.set_streaminfo(streaminfo);
-
+
for block in tags.blocks() {
match block {
Block::VorbisComment(comment) => {
for (key, val) in comment.comments.clone() {
output.set_vorbis(key, val);
}
- },
- Block::StreamInfo(_) => {},
+ }
+ Block::StreamInfo(_) => {}
_ => output.push_block(block.clone()),
}
}