From 3167c45c8087a692192021e08a8063dff680001c Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Thu, 17 Jan 2019 18:39:45 +0100 Subject: [PATCH] fix the rest of tests --- nihav-game/src/codecs/gremlinvideo.rs | 13 +++++++++++-- nihav-indeo/Cargo.toml | 3 +++ nihav-indeo/src/codecs/imc.rs | 13 +++++++++++-- nihav-indeo/src/codecs/indeo2.rs | 13 +++++++++++-- nihav-indeo/src/codecs/indeo3.rs | 13 +++++++++++-- nihav-indeo/src/codecs/indeo4.rs | 13 +++++++++++-- nihav-indeo/src/codecs/indeo5.rs | 13 +++++++++++-- nihav-indeo/src/codecs/intel263.rs | 13 +++++++++++-- nihav-indeo/src/lib.rs | 3 +++ nihav-realmedia/src/codecs/cook.rs | 13 +++++++++++-- nihav-realmedia/src/codecs/ra144.rs | 13 +++++++++++-- nihav-realmedia/src/codecs/ra288.rs | 13 +++++++++++-- nihav-realmedia/src/codecs/ralf.rs | 13 +++++++++++-- nihav-realmedia/src/codecs/rv10.rs | 13 +++++++++++-- nihav-realmedia/src/codecs/rv20.rs | 13 +++++++++++-- nihav-realmedia/src/codecs/rv30.rs | 13 +++++++++++-- nihav-realmedia/src/codecs/rv40.rs | 13 +++++++++++-- nihav-realmedia/src/codecs/rv60.rs | 13 +++++++++++-- 18 files changed, 182 insertions(+), 32 deletions(-) diff --git a/nihav-game/src/codecs/gremlinvideo.rs b/nihav-game/src/codecs/gremlinvideo.rs index b6929d1..b899630 100644 --- a/nihav-game/src/codecs/gremlinvideo.rs +++ b/nihav-game/src/codecs/gremlinvideo.rs @@ -561,9 +561,18 @@ pub fn get_decoder_audio() -> Box { #[cfg(test)] mod test { - use crate::test::dec_video::test_file_decoding; + use nihav_core::codecs::RegisteredDecoders; + use nihav_core::demuxers::RegisteredDemuxers; + use nihav_core::test::dec_video::test_file_decoding; + use crate::codecs::game_register_all_codecs; + use crate::demuxers::game_register_all_demuxers; #[test] fn test_gdv() { - test_file_decoding("gdv", "assets/intro1.gdv", Some(10), true, false, None); + let mut dmx_reg = RegisteredDemuxers::new(); + game_register_all_demuxers(&mut dmx_reg); + let mut dec_reg = RegisteredDecoders::new(); + game_register_all_codecs(&mut dec_reg); + + test_file_decoding("gdv", "assets/intro1.gdv", Some(10), true, false, None, &dmx_reg, &dec_reg); } } diff --git a/nihav-indeo/Cargo.toml b/nihav-indeo/Cargo.toml index f257862..901d0e4 100644 --- a/nihav-indeo/Cargo.toml +++ b/nihav-indeo/Cargo.toml @@ -8,6 +8,9 @@ edition = "2018" path = "../nihav-core" features = ["h263", "fft", "dsp_window"] +[dev-dependencies] +nihav_commonfmt = { path = "../nihav-commonfmt" } + [features] default = ["all_decoders"] diff --git a/nihav-indeo/src/codecs/imc.rs b/nihav-indeo/src/codecs/imc.rs index 5840846..a48e43e 100644 --- a/nihav-indeo/src/codecs/imc.rs +++ b/nihav-indeo/src/codecs/imc.rs @@ -1109,15 +1109,24 @@ const IMC_CB_SELECTOR: [[usize; BANDS]; 4] = [ #[cfg(test)] mod test { - use crate::test::dec_video::*; + use nihav_core::codecs::RegisteredDecoders; + use nihav_core::demuxers::RegisteredDemuxers; + use nihav_core::test::dec_video::*; + use crate::codecs::indeo_register_all_codecs; + use nihav_commonfmt::demuxers::generic_register_all_demuxers; #[test] fn test_imc() { + let mut dmx_reg = RegisteredDemuxers::new(); + generic_register_all_demuxers(&mut dmx_reg); + let mut dec_reg = RegisteredDecoders::new(); + indeo_register_all_codecs(&mut dec_reg); + // let file = "assets/neal73_saber.avi"; // let file = "assets/IMC/hvalen.avi"; let file = "assets/IMC/8khz.avi"; // let file = "assets/STsKlassFist-1a.avi"; // let file = "assets/IMC/Angel Bday.avi"; - test_decode_audio("avi", file, None, "imc"); + test_decode_audio("avi", file, None, "imc", &dmx_reg, &dec_reg); //test_file_decoding("avi", file, None, false, true, None); } } diff --git a/nihav-indeo/src/codecs/indeo2.rs b/nihav-indeo/src/codecs/indeo2.rs index ffd36c6..a218625 100644 --- a/nihav-indeo/src/codecs/indeo2.rs +++ b/nihav-indeo/src/codecs/indeo2.rs @@ -370,9 +370,18 @@ pub fn get_decoder() -> Box { #[cfg(test)] mod test { - use crate::test::dec_video::test_file_decoding; + use nihav_core::codecs::RegisteredDecoders; + use nihav_core::demuxers::RegisteredDemuxers; + use nihav_core::test::dec_video::*; + use crate::codecs::indeo_register_all_codecs; + use nihav_commonfmt::demuxers::generic_register_all_demuxers; #[test] fn test_indeo2() { - test_file_decoding("avi", "assets/laser05.avi", Some(10), true, false, None); + let mut dmx_reg = RegisteredDemuxers::new(); + generic_register_all_demuxers(&mut dmx_reg); + let mut dec_reg = RegisteredDecoders::new(); + indeo_register_all_codecs(&mut dec_reg); + + test_file_decoding("avi", "assets/laser05.avi", Some(10), true, false, None, &dmx_reg, &dec_reg); } } diff --git a/nihav-indeo/src/codecs/indeo3.rs b/nihav-indeo/src/codecs/indeo3.rs index e17c118..793ef63 100644 --- a/nihav-indeo/src/codecs/indeo3.rs +++ b/nihav-indeo/src/codecs/indeo3.rs @@ -786,10 +786,19 @@ pub fn get_decoder() -> Box { #[cfg(test)] mod test { - use crate::test::dec_video::test_file_decoding; + use nihav_core::codecs::RegisteredDecoders; + use nihav_core::demuxers::RegisteredDemuxers; + use nihav_core::test::dec_video::*; + use crate::codecs::indeo_register_all_codecs; + use nihav_commonfmt::demuxers::generic_register_all_demuxers; #[test] fn test_indeo3() { - test_file_decoding("avi", "assets/iv32_example.avi", Some(10), true, false, None); + let mut dmx_reg = RegisteredDemuxers::new(); + generic_register_all_demuxers(&mut dmx_reg); + let mut dec_reg = RegisteredDecoders::new(); + indeo_register_all_codecs(&mut dec_reg); + + test_file_decoding("avi", "assets/iv32_example.avi", Some(10), true, false, None, &dmx_reg, &dec_reg); } } diff --git a/nihav-indeo/src/codecs/indeo4.rs b/nihav-indeo/src/codecs/indeo4.rs index 58c246e..c1e6902 100644 --- a/nihav-indeo/src/codecs/indeo4.rs +++ b/nihav-indeo/src/codecs/indeo4.rs @@ -766,10 +766,19 @@ pub fn get_decoder() -> Box { #[cfg(test)] mod test { - use crate::test::dec_video::test_file_decoding; + use nihav_core::codecs::RegisteredDecoders; + use nihav_core::demuxers::RegisteredDemuxers; + use nihav_core::test::dec_video::*; + use crate::codecs::indeo_register_all_codecs; + use nihav_commonfmt::demuxers::generic_register_all_demuxers; #[test] fn test_indeo4() { - test_file_decoding("avi", "assets/IV4/volcano.avi", /*None*/Some(16), true, false, None/*Some("iv4")*/); + let mut dmx_reg = RegisteredDemuxers::new(); + generic_register_all_demuxers(&mut dmx_reg); + let mut dec_reg = RegisteredDecoders::new(); + indeo_register_all_codecs(&mut dec_reg); + + test_file_decoding("avi", "assets/IV4/volcano.avi", /*None*/Some(16), true, false, None/*Some("iv4")*/, &dmx_reg, &dec_reg); //panic!("the end"); } } diff --git a/nihav-indeo/src/codecs/indeo5.rs b/nihav-indeo/src/codecs/indeo5.rs index 5256fa4..0e67ecf 100644 --- a/nihav-indeo/src/codecs/indeo5.rs +++ b/nihav-indeo/src/codecs/indeo5.rs @@ -719,10 +719,19 @@ pub fn get_decoder() -> Box { #[cfg(test)] mod test { - use crate::test::dec_video::test_file_decoding; + use nihav_core::codecs::RegisteredDecoders; + use nihav_core::demuxers::RegisteredDemuxers; + use nihav_core::test::dec_video::*; + use crate::codecs::indeo_register_all_codecs; + use nihav_commonfmt::demuxers::generic_register_all_demuxers; #[test] fn test_indeo5() { - test_file_decoding("avi", "assets/IV5/sample.avi", /*None*/Some(2), true, false, None); + let mut dmx_reg = RegisteredDemuxers::new(); + generic_register_all_demuxers(&mut dmx_reg); + let mut dec_reg = RegisteredDecoders::new(); + indeo_register_all_codecs(&mut dec_reg); + + test_file_decoding("avi", "assets/IV5/sample.avi", /*None*/Some(2), true, false, None, &dmx_reg, &dec_reg); // test_file_decoding("avi", "assets/IV5/W32mdl_1.avi", None/*Some(2)*/, true, false, Some("iv5")); //panic!("the end"); } diff --git a/nihav-indeo/src/codecs/intel263.rs b/nihav-indeo/src/codecs/intel263.rs index df9b852..2a837a1 100644 --- a/nihav-indeo/src/codecs/intel263.rs +++ b/nihav-indeo/src/codecs/intel263.rs @@ -415,9 +415,18 @@ pub fn get_decoder() -> Box { #[cfg(test)] mod test { - use crate::test::dec_video::test_file_decoding; + use nihav_core::codecs::RegisteredDecoders; + use nihav_core::demuxers::RegisteredDemuxers; + use nihav_core::test::dec_video::*; + use crate::codecs::indeo_register_all_codecs; + use nihav_commonfmt::demuxers::generic_register_all_demuxers; #[test] fn test_intel263() { - test_file_decoding("avi", "assets/neal73_saber.avi", Some(16), true, false, None/*Some("i263")*/); + let mut dmx_reg = RegisteredDemuxers::new(); + generic_register_all_demuxers(&mut dmx_reg); + let mut dec_reg = RegisteredDecoders::new(); + indeo_register_all_codecs(&mut dec_reg); + + test_file_decoding("avi", "assets/neal73_saber.avi", Some(16), true, false, None/*Some("i263")*/, &dmx_reg, &dec_reg); } } diff --git a/nihav-indeo/src/lib.rs b/nihav-indeo/src/lib.rs index adda3bf..ccc3595 100644 --- a/nihav-indeo/src/lib.rs +++ b/nihav-indeo/src/lib.rs @@ -1,3 +1,6 @@ extern crate nihav_core; pub mod codecs; + +#[cfg(test)] +extern crate nihav_commonfmt; \ No newline at end of file diff --git a/nihav-realmedia/src/codecs/cook.rs b/nihav-realmedia/src/codecs/cook.rs index de7ac54..5f61d2e 100644 --- a/nihav-realmedia/src/codecs/cook.rs +++ b/nihav-realmedia/src/codecs/cook.rs @@ -680,12 +680,21 @@ pub fn get_decoder() -> Box { #[cfg(test)] mod test { - use crate::test::dec_video::*; + use nihav_core::codecs::RegisteredDecoders; + use nihav_core::demuxers::RegisteredDemuxers; + use nihav_core::test::dec_video::*; + use crate::codecs::realmedia_register_all_codecs; + use crate::demuxers::realmedia_register_all_demuxers; #[test] fn test_cook() { + let mut dmx_reg = RegisteredDemuxers::new(); + realmedia_register_all_demuxers(&mut dmx_reg); + let mut dec_reg = RegisteredDecoders::new(); + realmedia_register_all_codecs(&mut dec_reg); + // let file = "assets/RV/rv30_weighted_mc.rm"; let file = "assets/RV/multichannel.rma"; - test_decode_audio("realmedia", file, Some(2000), "cook"); + test_decode_audio("realmedia", file, Some(2000), "cook", &dmx_reg, &dec_reg); } } diff --git a/nihav-realmedia/src/codecs/ra144.rs b/nihav-realmedia/src/codecs/ra144.rs index 45e98eb..23e32f2 100644 --- a/nihav-realmedia/src/codecs/ra144.rs +++ b/nihav-realmedia/src/codecs/ra144.rs @@ -317,11 +317,20 @@ pub fn get_decoder() -> Box { #[cfg(test)] mod test { - use crate::test::dec_video::*; + use nihav_core::codecs::RegisteredDecoders; + use nihav_core::demuxers::RegisteredDemuxers; + use nihav_core::test::dec_video::*; + use crate::codecs::realmedia_register_all_codecs; + use crate::demuxers::realmedia_register_all_demuxers; #[test] fn test_ra144() { + let mut dmx_reg = RegisteredDemuxers::new(); + realmedia_register_all_demuxers(&mut dmx_reg); + let mut dec_reg = RegisteredDecoders::new(); + realmedia_register_all_codecs(&mut dec_reg); + let file = "assets/RV/ra3_in_rm_file.rm"; - test_decode_audio("realmedia", file, Some(5000), "ra14.4"); + test_decode_audio("realmedia", file, Some(5000), "ra14.4", &dmx_reg, &dec_reg); } } diff --git a/nihav-realmedia/src/codecs/ra288.rs b/nihav-realmedia/src/codecs/ra288.rs index 3d9b51b..00e0bd6 100644 --- a/nihav-realmedia/src/codecs/ra288.rs +++ b/nihav-realmedia/src/codecs/ra288.rs @@ -207,11 +207,20 @@ pub fn get_decoder() -> Box { #[cfg(test)] mod test { - use crate::test::dec_video::*; + use nihav_core::codecs::RegisteredDecoders; + use nihav_core::demuxers::RegisteredDemuxers; + use nihav_core::test::dec_video::*; + use crate::codecs::realmedia_register_all_codecs; + use crate::demuxers::realmedia_register_all_demuxers; #[test] fn test_ra288() { + let mut dmx_reg = RegisteredDemuxers::new(); + realmedia_register_all_demuxers(&mut dmx_reg); + let mut dec_reg = RegisteredDecoders::new(); + realmedia_register_all_codecs(&mut dec_reg); + let file = "assets/RV/A0000044.rm"; - test_decode_audio("realmedia", file, Some(5000), "ra28.8"); + test_decode_audio("realmedia", file, Some(5000), "ra28.8", &dmx_reg, &dec_reg); } } diff --git a/nihav-realmedia/src/codecs/ralf.rs b/nihav-realmedia/src/codecs/ralf.rs index f65eaea..e114dd0 100644 --- a/nihav-realmedia/src/codecs/ralf.rs +++ b/nihav-realmedia/src/codecs/ralf.rs @@ -477,11 +477,20 @@ pub fn get_decoder() -> Box { #[cfg(test)] mod test { - use crate::test::dec_video::*; + use nihav_core::codecs::RegisteredDecoders; + use nihav_core::demuxers::RegisteredDemuxers; + use nihav_core::test::dec_video::*; + use crate::codecs::realmedia_register_all_codecs; + use crate::demuxers::realmedia_register_all_demuxers; #[test] fn test_ralf() { + let mut dmx_reg = RegisteredDemuxers::new(); + realmedia_register_all_demuxers(&mut dmx_reg); + let mut dec_reg = RegisteredDecoders::new(); + realmedia_register_all_codecs(&mut dec_reg); + let file = "assets/RV/rv40_ralf.rmvb"; - test_decode_audio("realmedia", file, Some(2000), "ralf"); + test_decode_audio("realmedia", file, Some(2000), "ralf", &dmx_reg, &dec_reg); //panic!("end"); } } diff --git a/nihav-realmedia/src/codecs/rv10.rs b/nihav-realmedia/src/codecs/rv10.rs index 3e21315..348a7ff 100644 --- a/nihav-realmedia/src/codecs/rv10.rs +++ b/nihav-realmedia/src/codecs/rv10.rs @@ -460,10 +460,19 @@ pub fn get_decoder() -> Box { #[cfg(test)] mod test { - use crate::test::dec_video::test_file_decoding; + use nihav_core::codecs::RegisteredDecoders; + use nihav_core::demuxers::RegisteredDemuxers; + use nihav_core::test::dec_video::*; + use crate::codecs::realmedia_register_all_codecs; + use crate::demuxers::realmedia_register_all_demuxers; #[test] fn test_rv10() { - test_file_decoding("realmedia", "assets/RV/rv10_dnet_640x352_realvideo_encoder_4.0.rm", Some(1000), true, false, None/*Some("rv10")*/); + let mut dmx_reg = RegisteredDemuxers::new(); + realmedia_register_all_demuxers(&mut dmx_reg); + let mut dec_reg = RegisteredDecoders::new(); + realmedia_register_all_codecs(&mut dec_reg); + + test_file_decoding("realmedia", "assets/RV/rv10_dnet_640x352_realvideo_encoder_4.0.rm", Some(1000), true, false, None/*Some("rv10")*/, &dmx_reg, &dec_reg); } } diff --git a/nihav-realmedia/src/codecs/rv20.rs b/nihav-realmedia/src/codecs/rv20.rs index d839840..eeb56cf 100644 --- a/nihav-realmedia/src/codecs/rv20.rs +++ b/nihav-realmedia/src/codecs/rv20.rs @@ -524,10 +524,19 @@ pub fn get_decoder() -> Box { #[cfg(test)] mod test { - use crate::test::dec_video::test_file_decoding; + use nihav_core::codecs::RegisteredDecoders; + use nihav_core::demuxers::RegisteredDemuxers; + use nihav_core::test::dec_video::*; + use crate::codecs::realmedia_register_all_codecs; + use crate::demuxers::realmedia_register_all_demuxers; #[test] fn test_rv20() { - test_file_decoding("realmedia", "assets/RV/rv20_svt_atrc_640x352_realproducer_plus_8.51.rm", /*None*/Some(3000), true, false, None/*Some("rv20")*/); + let mut dmx_reg = RegisteredDemuxers::new(); + realmedia_register_all_demuxers(&mut dmx_reg); + let mut dec_reg = RegisteredDecoders::new(); + realmedia_register_all_codecs(&mut dec_reg); + + test_file_decoding("realmedia", "assets/RV/rv20_svt_atrc_640x352_realproducer_plus_8.51.rm", /*None*/Some(3000), true, false, None/*Some("rv20")*/, &dmx_reg, &dec_reg); // test_file_decoding("realmedia", "assets/RV/rv20_cook_640x352_realproducer_plus_8.51.rm", /*None*/Some(1000), true, false, Some("rv20")); } } diff --git a/nihav-realmedia/src/codecs/rv30.rs b/nihav-realmedia/src/codecs/rv30.rs index 3482090..acdefb6 100644 --- a/nihav-realmedia/src/codecs/rv30.rs +++ b/nihav-realmedia/src/codecs/rv30.rs @@ -165,11 +165,20 @@ pub fn get_decoder() -> Box { #[cfg(test)] mod test { - use crate::test::dec_video::test_file_decoding; + use nihav_core::codecs::RegisteredDecoders; + use nihav_core::demuxers::RegisteredDemuxers; + use nihav_core::test::dec_video::*; + use crate::codecs::realmedia_register_all_codecs; + use crate::demuxers::realmedia_register_all_demuxers; #[test] fn test_rv30() { + let mut dmx_reg = RegisteredDemuxers::new(); + realmedia_register_all_demuxers(&mut dmx_reg); + let mut dec_reg = RegisteredDecoders::new(); + realmedia_register_all_codecs(&mut dec_reg); + // test_file_decoding("realmedia", "assets/RV/rv30_chroma_drift.rm", Some(1000), true, false, /*None*/Some("rv30")); - test_file_decoding("realmedia", "assets/RV/rv30_weighted_mc.rm", Some(400), true, false, None/*Some("rv30")*/); + test_file_decoding("realmedia", "assets/RV/rv30_weighted_mc.rm", Some(400), true, false, None/*Some("rv30")*/, &dmx_reg, &dec_reg); // test_file_decoding("realmedia", "assets/RV/simpsons-clip.rm", Some(1337)/*Some(6666)*/, true, false, /*None*/Some("rv30")); //panic!("end"); } diff --git a/nihav-realmedia/src/codecs/rv40.rs b/nihav-realmedia/src/codecs/rv40.rs index 542b644..d664dce 100644 --- a/nihav-realmedia/src/codecs/rv40.rs +++ b/nihav-realmedia/src/codecs/rv40.rs @@ -358,11 +358,20 @@ pub fn get_decoder() -> Box { #[cfg(test)] mod test { - use crate::test::dec_video::test_file_decoding; + use nihav_core::codecs::RegisteredDecoders; + use nihav_core::demuxers::RegisteredDemuxers; + use nihav_core::test::dec_video::*; + use crate::codecs::realmedia_register_all_codecs; + use crate::demuxers::realmedia_register_all_demuxers; #[test] fn test_rv40() { + let mut dmx_reg = RegisteredDemuxers::new(); + realmedia_register_all_demuxers(&mut dmx_reg); + let mut dec_reg = RegisteredDecoders::new(); + realmedia_register_all_codecs(&mut dec_reg); + // test_file_decoding("realmedia", "assets/RV/rv40_ralf.rmvb", Some(1000), true, false, /*None*/Some("rv40")); - test_file_decoding("realmedia", "assets/RV/rv40_weighted_mc.rmvb", Some(400), true, false, None/*Some("rv40")*/); + test_file_decoding("realmedia", "assets/RV/rv40_weighted_mc.rmvb", Some(400), true, false, None/*Some("rv40")*/, &dmx_reg, &dec_reg); // test_file_decoding("realmedia", "assets/RV/rv40_weighted_mc_2.rmvb", Some(1000), true, false, /*None*/Some("rv40")); //panic!("end"); } diff --git a/nihav-realmedia/src/codecs/rv60.rs b/nihav-realmedia/src/codecs/rv60.rs index 20a0f7a..a076d87 100644 --- a/nihav-realmedia/src/codecs/rv60.rs +++ b/nihav-realmedia/src/codecs/rv60.rs @@ -1481,10 +1481,19 @@ pub fn get_decoder() -> Box { #[cfg(test)] mod test { - use crate::test::dec_video::test_file_decoding; + use nihav_core::codecs::RegisteredDecoders; + use nihav_core::demuxers::RegisteredDemuxers; + use nihav_core::test::dec_video::*; + use crate::codecs::realmedia_register_all_codecs; + use crate::demuxers::realmedia_register_all_demuxers; #[test] fn test_rv60() { - test_file_decoding("realmedia", "assets/RV/RV60.rmhd", Some(4000), true, false, None/*Some("rv60")*/); + let mut dmx_reg = RegisteredDemuxers::new(); + realmedia_register_all_demuxers(&mut dmx_reg); + let mut dec_reg = RegisteredDecoders::new(); + realmedia_register_all_codecs(&mut dec_reg); + + test_file_decoding("realmedia", "assets/RV/RV60.rmhd", Some(4000), true, false, None/*Some("rv60")*/, &dmx_reg, &dec_reg); //panic!("end"); } } -- 2.39.5