From ef0b99e68b6dd253074ed36e1dc665231e91b3b3 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Tue, 9 Nov 2021 18:48:44 +0100 Subject: [PATCH] move AAC decoder to nihav-mpeg crate --- nihav-commonfmt/Cargo.toml | 2 +- nihav-commonfmt/src/codecs/mod.rs | 6 ------ nihav-mpeg/Cargo.toml | 5 +++-- {nihav-commonfmt => nihav-mpeg}/src/codecs/aac.rs | 4 ++-- nihav-mpeg/src/codecs/mod.rs | 6 ++++++ 5 files changed, 12 insertions(+), 11 deletions(-) rename {nihav-commonfmt => nihav-mpeg}/src/codecs/aac.rs (99%) diff --git a/nihav-commonfmt/Cargo.toml b/nihav-commonfmt/Cargo.toml index acccd96..229bd8a 100644 --- a/nihav-commonfmt/Cargo.toml +++ b/nihav-commonfmt/Cargo.toml @@ -12,7 +12,7 @@ path = "../nihav-registry" [dependencies.nihav_codec_support] path = "../nihav-codec-support" -features = ["h263", "mdct", "fft", "dsp_window", "vq"] +features = ["h263", "mdct", "fft", "vq"] [dev-dependencies] nihav_realmedia = { path = "../nihav-realmedia", default-features=false, features = ["all_demuxers"] } diff --git a/nihav-commonfmt/src/codecs/mod.rs b/nihav-commonfmt/src/codecs/mod.rs index cc1cf74..bf254ee 100644 --- a/nihav-commonfmt/src/codecs/mod.rs +++ b/nihav-commonfmt/src/codecs/mod.rs @@ -15,10 +15,6 @@ mod rawvideo_ms; #[cfg(feature="decoder_zmbv")] mod zmbv; -#[cfg(feature="decoder_aac")] -#[allow(clippy::manual_memcpy)] -#[allow(clippy::useless_let_if_seq)] -mod aac; #[cfg(feature="decoder_atrac3")] #[allow(clippy::identity_op)] #[allow(clippy::useless_let_if_seq)] @@ -59,8 +55,6 @@ const DECODERS: &[DecoderInfo] = &[ DecoderInfo { name: "ac3", get_decoder: ts102366::get_decoder }, #[cfg(feature="decoder_atrac3")] DecoderInfo { name: "atrac3", get_decoder: atrac3::get_decoder }, -#[cfg(feature="decoder_aac")] - DecoderInfo { name: "aac", get_decoder: aac::get_decoder }, ]; /// Registers all available codecs provided by this crate. diff --git a/nihav-mpeg/Cargo.toml b/nihav-mpeg/Cargo.toml index 0b21444..53a1d9e 100644 --- a/nihav-mpeg/Cargo.toml +++ b/nihav-mpeg/Cargo.toml @@ -9,7 +9,7 @@ path = "../nihav-core" [dependencies.nihav_codec_support] path = "../nihav-codec-support" -features = ["qmf"] +features = ["qmf", "fft", "mdct", "dsp_window"] [dev-dependencies] nihav_flash = { path = "../nihav-flash", default-features=false, features = ["all_demuxers"] } @@ -23,5 +23,6 @@ all_decoders = ["all_video_decoders", "all_audio_decoders"] all_video_decoders = [] -all_audio_decoders = ["decoder_mpa"] +all_audio_decoders = ["decoder_aac", "decoder_mpa"] +decoder_aac = ["decoders"] decoder_mpa = ["decoders"] diff --git a/nihav-commonfmt/src/codecs/aac.rs b/nihav-mpeg/src/codecs/aac.rs similarity index 99% rename from nihav-commonfmt/src/codecs/aac.rs rename to nihav-mpeg/src/codecs/aac.rs index 8585420..e11d564 100644 --- a/nihav-commonfmt/src/codecs/aac.rs +++ b/nihav-mpeg/src/codecs/aac.rs @@ -1339,14 +1339,14 @@ mod test { use nihav_core::codecs::RegisteredDecoders; use nihav_core::demuxers::RegisteredDemuxers; use nihav_codec_support::test::dec_video::test_decode_audio; - use crate::generic_register_all_decoders; + use crate::mpeg_register_all_decoders; use nihav_realmedia::realmedia_register_all_demuxers; #[test] fn test_aac() { let mut dmx_reg = RegisteredDemuxers::new(); realmedia_register_all_demuxers(&mut dmx_reg); let mut dec_reg = RegisteredDecoders::new(); - generic_register_all_decoders(&mut dec_reg); + mpeg_register_all_decoders(&mut dec_reg); // let file = "assets/RV/rv40_weighted_mc.rmvb"; let file = "assets/RV/rv40_weighted_mc_2.rmvb"; diff --git a/nihav-mpeg/src/codecs/mod.rs b/nihav-mpeg/src/codecs/mod.rs index eb58553..09b42bd 100644 --- a/nihav-mpeg/src/codecs/mod.rs +++ b/nihav-mpeg/src/codecs/mod.rs @@ -4,11 +4,17 @@ macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } }; } +#[cfg(feature="decoder_aac")] +#[allow(clippy::manual_memcpy)] +#[allow(clippy::useless_let_if_seq)] +mod aac; #[cfg(feature="decoder_mpa")] #[allow(clippy::excessive_precision)] mod mpegaudio; const DECODERS: &[DecoderInfo] = &[ +#[cfg(feature="decoder_aac")] + DecoderInfo { name: "aac", get_decoder: aac::get_decoder }, #[cfg(feature="decoder_mpa")] DecoderInfo { name: "mp3", get_decoder: mpegaudio::get_decoder_mp3 }, ]; -- 2.39.5