From d7443f243896871a9f6b87d14c8bf7e882b86173 Mon Sep 17 00:00:00 2001 From: Keinsleif Date: Tue, 11 Feb 2025 18:56:34 +0900 Subject: [PATCH 1/4] [update] reorganize symphonia flags --- Cargo.lock | 26 ++++++++++++++++++++++++++ Cargo.toml | 28 +++++++++++----------------- 2 files changed, 37 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 32e6e284..d7151015 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1104,7 +1104,9 @@ dependencies = [ "symphonia-codec-pcm", "symphonia-codec-vorbis", "symphonia-core", + "symphonia-format-caf", "symphonia-format-isomp4", + "symphonia-format-mkv", "symphonia-format-ogg", "symphonia-format-riff", "symphonia-metadata", @@ -1199,6 +1201,17 @@ dependencies = [ "log", ] +[[package]] +name = "symphonia-format-caf" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e43c99c696a388295a29fe71b133079f5d8b18041cf734c5459c35ad9097af50" +dependencies = [ + "log", + "symphonia-core", + "symphonia-metadata", +] + [[package]] name = "symphonia-format-isomp4" version = "0.5.4" @@ -1212,6 +1225,19 @@ dependencies = [ "symphonia-utils-xiph", ] +[[package]] +name = "symphonia-format-mkv" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bb43471a100f7882dc9937395bd5ebee8329298e766250b15b3875652fe3d6f" +dependencies = [ + "lazy_static", + "log", + "symphonia-core", + "symphonia-metadata", + "symphonia-utils-xiph", +] + [[package]] name = "symphonia-format-ogg" version = "0.5.4" diff --git a/Cargo.toml b/Cargo.toml index 28d1cf01..0802464e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,24 +42,18 @@ noise = ["rand"] wasm-bindgen = ["cpal/wasm-bindgen"] cpal-shared-stdcxx = ["cpal/oboe-shared-stdcxx"] -symphonia-aac = ["symphonia/aac"] -symphonia-all = [ - "symphonia-aac", - "symphonia-flac", - "symphonia-isomp4", - "symphonia-mp3", - "symphonia-ogg", - "symphonia-vorbis", - "symphonia-wav", -] -symphonia-flac = ["symphonia/flac"] -symphonia-isomp4 = ["symphonia/isomp4"] -symphonia-mp3 = ["symphonia/mp3"] -symphonia-ogg = ["symphonia/ogg"] -symphonia-vorbis = ["symphonia/vorbis"] +symphonia-all = ["symphonia/all"] + +symphonia-aiff = ["symphonia/aiff", "symphonia/pcm"] +symphonia-caf = ["symphonia/caf", "symphonia/pcm", "symphonia/adpcm", "symphonia/mpa", "symphonia/aac", "symphonia/alac"] +symphonia-isomp4 = ["symphonia/isomp4", "symphonia/mpa", "symphonia/aac", "symphonia/alac"] +symphonia-mkv = ["symphonia/mkv", "symphonia/aac", "symphonia/mpa", "symphonia/vorbis", "symphonia/pcm", "symphonia/flac", "symphonia/alac"] +symphonia-ogg = ["symphonia/ogg", "symphonia/vorbis", "symphonia/flac", "symphonia/pcm"] symphonia-wav = ["symphonia/wav", "symphonia/pcm", "symphonia/adpcm"] +symphonia-flac = ["symphonia/flac"] +symphonia-aac = ["symphonia/aac"] symphonia-alac = ["symphonia/isomp4", "symphonia/alac"] -symphonia-aiff = ["symphonia/aiff", "symphonia/pcm"] +symphonia-mp3 = ["symphonia/mp3"] [dev-dependencies] quickcheck = "1" @@ -87,7 +81,7 @@ harness = false [[example]] name = "music_m4a" -required-features = ["symphonia-isomp4", "symphonia-aac"] +required-features = ["symphonia-isomp4"] [[example]] name = "noise_generator" From 65cb17c640e7bc681d18ce72c13f07d21237f62b Mon Sep 17 00:00:00 2001 From: Keinsleif Date: Tue, 11 Feb 2025 19:59:51 +0900 Subject: [PATCH 2/4] [update] flag names --- src/decoder/mod.rs | 22 +++++++++++----------- tests/mp4a_test.rs | 2 +- tests/seek.rs | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/decoder/mod.rs b/src/decoder/mod.rs index 868cb984..14d9612f 100644 --- a/src/decoder/mod.rs +++ b/src/decoder/mod.rs @@ -74,7 +74,7 @@ mod read_seek_source; #[cfg(feature = "symphonia")] /// Symphonia decoders types pub mod symphonia; -#[cfg(all(feature = "vorbis", not(feature = "symphonia-vorbis")))] +#[cfg(all(feature = "vorbis", not(feature = "symphonia-ogg")))] mod vorbis; #[cfg(all(feature = "wav", not(feature = "symphonia-wav")))] mod wav; @@ -111,7 +111,7 @@ pub struct LoopedDecoder { enum DecoderImpl { #[cfg(all(feature = "wav", not(feature = "symphonia-wav")))] Wav(wav::WavDecoder), - #[cfg(all(feature = "vorbis", not(feature = "symphonia-vorbis")))] + #[cfg(all(feature = "vorbis", not(feature = "symphonia-ogg")))] Vorbis(vorbis::VorbisDecoder), #[cfg(all(feature = "flac", not(feature = "symphonia-flac")))] Flac(flac::FlacDecoder), @@ -127,7 +127,7 @@ impl DecoderImpl { match self { #[cfg(all(feature = "wav", not(feature = "symphonia-wav")))] DecoderImpl::Wav(source) => source.next(), - #[cfg(all(feature = "vorbis", not(feature = "symphonia-vorbis")))] + #[cfg(all(feature = "vorbis", not(feature = "symphonia-ogg")))] DecoderImpl::Vorbis(source) => source.next(), #[cfg(all(feature = "flac", not(feature = "symphonia-flac")))] DecoderImpl::Flac(source) => source.next(), @@ -143,7 +143,7 @@ impl DecoderImpl { match self { #[cfg(all(feature = "wav", not(feature = "symphonia-wav")))] DecoderImpl::Wav(source) => source.size_hint(), - #[cfg(all(feature = "vorbis", not(feature = "symphonia-vorbis")))] + #[cfg(all(feature = "vorbis", not(feature = "symphonia-ogg")))] DecoderImpl::Vorbis(source) => source.size_hint(), #[cfg(all(feature = "flac", not(feature = "symphonia-flac")))] DecoderImpl::Flac(source) => source.size_hint(), @@ -159,7 +159,7 @@ impl DecoderImpl { match self { #[cfg(all(feature = "wav", not(feature = "symphonia-wav")))] DecoderImpl::Wav(source) => source.current_span_len(), - #[cfg(all(feature = "vorbis", not(feature = "symphonia-vorbis")))] + #[cfg(all(feature = "vorbis", not(feature = "symphonia-ogg")))] DecoderImpl::Vorbis(source) => source.current_span_len(), #[cfg(all(feature = "flac", not(feature = "symphonia-flac")))] DecoderImpl::Flac(source) => source.current_span_len(), @@ -175,7 +175,7 @@ impl DecoderImpl { match self { #[cfg(all(feature = "wav", not(feature = "symphonia-wav")))] DecoderImpl::Wav(source) => source.channels(), - #[cfg(all(feature = "vorbis", not(feature = "symphonia-vorbis")))] + #[cfg(all(feature = "vorbis", not(feature = "symphonia-ogg")))] DecoderImpl::Vorbis(source) => source.channels(), #[cfg(all(feature = "flac", not(feature = "symphonia-flac")))] DecoderImpl::Flac(source) => source.channels(), @@ -191,7 +191,7 @@ impl DecoderImpl { match self { #[cfg(all(feature = "wav", not(feature = "symphonia-wav")))] DecoderImpl::Wav(source) => source.sample_rate(), - #[cfg(all(feature = "vorbis", not(feature = "symphonia-vorbis")))] + #[cfg(all(feature = "vorbis", not(feature = "symphonia-ogg")))] DecoderImpl::Vorbis(source) => source.sample_rate(), #[cfg(all(feature = "flac", not(feature = "symphonia-flac")))] DecoderImpl::Flac(source) => source.sample_rate(), @@ -213,7 +213,7 @@ impl DecoderImpl { match self { #[cfg(all(feature = "wav", not(feature = "symphonia-wav")))] DecoderImpl::Wav(source) => source.total_duration(), - #[cfg(all(feature = "vorbis", not(feature = "symphonia-vorbis")))] + #[cfg(all(feature = "vorbis", not(feature = "symphonia-ogg")))] DecoderImpl::Vorbis(source) => source.total_duration(), #[cfg(all(feature = "flac", not(feature = "symphonia-flac")))] DecoderImpl::Flac(source) => source.total_duration(), @@ -229,7 +229,7 @@ impl DecoderImpl { match self { #[cfg(all(feature = "wav", not(feature = "symphonia-wav")))] DecoderImpl::Wav(source) => source.try_seek(pos), - #[cfg(all(feature = "vorbis", not(feature = "symphonia-vorbis")))] + #[cfg(all(feature = "vorbis", not(feature = "symphonia-ogg")))] DecoderImpl::Vorbis(source) => source.try_seek(pos), #[cfg(all(feature = "flac", not(feature = "symphonia-flac")))] DecoderImpl::Flac(source) => source.try_seek(pos), @@ -457,7 +457,7 @@ impl Decoder { /// let file = File::open("audio.ogg").unwrap(); /// let decoder = Decoder::new_vorbis(file).unwrap(); /// ``` - #[cfg(any(feature = "vorbis", feature = "symphonia-vorbis"))] + #[cfg(any(feature = "vorbis", feature = "symphonia-ogg"))] pub fn new_vorbis(data: R) -> Result { DecoderBuilder::new() .with_data(data) @@ -618,7 +618,7 @@ where let sample = source.next(); (DecoderImpl::Wav(source), sample) } - #[cfg(all(feature = "vorbis", not(feature = "symphonia-vorbis")))] + #[cfg(all(feature = "vorbis", not(feature = "symphonia-ogg")))] DecoderImpl::Vorbis(source) => { use lewton::inside_ogg::OggStreamReader; let mut reader = source.into_inner().into_inner(); diff --git a/tests/mp4a_test.rs b/tests/mp4a_test.rs index 62435447..be5e5762 100644 --- a/tests/mp4a_test.rs +++ b/tests/mp4a_test.rs @@ -1,4 +1,4 @@ -#![cfg(all(feature = "symphonia-aac", feature = "symphonia-isomp4"))] +#![cfg(feature = "symphonia-isomp4")] #[test] fn test_mp4a_encodings() { diff --git a/tests/seek.rs b/tests/seek.rs index c4a402e0..9986f1ed 100644 --- a/tests/seek.rs +++ b/tests/seek.rs @@ -8,7 +8,7 @@ use std::time::Duration; #[template] #[rstest] #[cfg_attr( - all(feature = "symphonia-ogg", feature = "symphonia-vorbis"), + all(feature = "symphonia-ogg"), case("ogg", true, "symphonia") )] #[cfg_attr( @@ -40,7 +40,7 @@ fn all_decoders( #[template] #[rstest] #[cfg_attr( - all(feature = "symphonia-ogg", feature = "symphonia-vorbis"), + all(feature = "symphonia-ogg"), case("ogg", "symphonia") )] #[cfg_attr( From cd2eb208db28ce5c84be0d86dd67d642e9860997 Mon Sep 17 00:00:00 2001 From: Keinsleif Date: Wed, 16 Apr 2025 15:54:06 +0900 Subject: [PATCH 3/4] [update] symphonia-vorbis to symphonia-ogg --- src/decoder/builder.rs | 2 +- tests/total_duration.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/decoder/builder.rs b/src/decoder/builder.rs index 60353127..b3a2031e 100644 --- a/src/decoder/builder.rs +++ b/src/decoder/builder.rs @@ -274,7 +274,7 @@ impl DecoderBuilder { Err(data) => data, }; - #[cfg(all(feature = "vorbis", not(feature = "symphonia-vorbis")))] + #[cfg(all(feature = "vorbis", not(feature = "symphonia-ogg")))] let data = match vorbis::VorbisDecoder::new(data) { Ok(decoder) => return Ok((DecoderImpl::Vorbis(decoder), self.settings)), Err(data) => data, diff --git a/tests/total_duration.rs b/tests/total_duration.rs index fecaaa3f..2abb1652 100644 --- a/tests/total_duration.rs +++ b/tests/total_duration.rs @@ -10,7 +10,7 @@ use rstest_reuse::{self, *}; #[template] #[rstest] #[cfg_attr( - feature = "symphonia-vorbis", + feature = "symphonia-ogg", case("ogg", Duration::from_secs_f64(69.328979591), "symphonia") )] #[cfg_attr( From 997307454dd00dfb26f86f6a73c76c9eab88bc4d Mon Sep 17 00:00:00 2001 From: Keinsleif Date: Wed, 16 Apr 2025 16:02:34 +0900 Subject: [PATCH 4/4] [fix] symphonia-all flag --- Cargo.toml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 0802464e..beba5c20 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,18 @@ noise = ["rand"] wasm-bindgen = ["cpal/wasm-bindgen"] cpal-shared-stdcxx = ["cpal/oboe-shared-stdcxx"] -symphonia-all = ["symphonia/all"] +symphonia-all = [ + "symphonia-aiff", + "symphonia-caf", + "symphonia-isomp4", + "symphonia-mkv", + "symphonia-ogg", + "symphonia-wav", + "symphonia-flac", + "symphonia-aac", + "symphonia-alac", + "symphonia-mp3", +] symphonia-aiff = ["symphonia/aiff", "symphonia/pcm"] symphonia-caf = ["symphonia/caf", "symphonia/pcm", "symphonia/adpcm", "symphonia/mpa", "symphonia/aac", "symphonia/alac"]