#[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::test_decode_audio;
+ use crate::codecs::generic_register_all_codecs;
+ use nihav_realmedia::demuxers::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_codecs(&mut dec_reg);
+
// let file = "assets/RV/rv40_weighted_mc.rmvb";
let file = "assets/RV/rv40_weighted_mc_2.rmvb";
- test_decode_audio("realmedia", file, Some(12000), "aac");
+ test_decode_audio("realmedia", file, Some(12000), "aac", &dmx_reg, &dec_reg);
}
}
#[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::test_decode_audio;
+ use crate::codecs::generic_register_all_codecs;
+ use nihav_realmedia::demuxers::realmedia_register_all_demuxers;
#[test]
fn test_atrac3() {
+ let mut dmx_reg = RegisteredDemuxers::new();
+ realmedia_register_all_demuxers(&mut dmx_reg);
+ let mut dec_reg = RegisteredDecoders::new();
+ generic_register_all_codecs(&mut dec_reg);
+
let file = "assets/RV/rv30_atrc_384x208_realproducer_plus_8.51.rm";
// let file = "assets/RV/rv20_svt_atrc_640x352_realproducer_plus_8.51.rm";
- test_decode_audio("realmedia", file, Some(12000), "atrac3");
+ test_decode_audio("realmedia", file, Some(12000), "atrac3", &dmx_reg, &dec_reg);
}
}
#[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::generic_register_all_codecs;
+ use crate::demuxers::generic_register_all_demuxers;
#[test]
fn test_clv() {
- test_file_decoding("avi", "assets/TalkingHead_352x288.avi", Some(10), true, false, None/*Some("clv")*/);
+ let mut dmx_reg = RegisteredDemuxers::new();
+ generic_register_all_demuxers(&mut dmx_reg);
+ let mut dec_reg = RegisteredDecoders::new();
+ generic_register_all_codecs(&mut dec_reg);
+ test_file_decoding("avi", "assets/TalkingHead_352x288.avi", Some(10), true, false, None/*Some("clv")*/, &dmx_reg, &dec_reg);
// test_file_decoding("avi", "assets/basketball.avi", None/*Some(10)*/, true, false, Some("clv1"));
//panic!("debug");
}
#[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::test_decode_audio;
+ use crate::codecs::generic_register_all_codecs;
+ use nihav_realmedia::demuxers::realmedia_register_all_demuxers;
#[test]
fn test_sipro() {
+ let mut dmx_reg = RegisteredDemuxers::new();
+ realmedia_register_all_demuxers(&mut dmx_reg);
+ let mut dec_reg = RegisteredDecoders::new();
+ generic_register_all_codecs(&mut dec_reg);
+
let file = "assets/RV/autahi-vox.rm";
- test_decode_audio("realmedia", file, Some(5000), "sipro");
+ test_decode_audio("realmedia", file, Some(5000), "sipro", &dmx_reg, &dec_reg);
}
}
#[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::test_decode_audio;
+ use crate::codecs::generic_register_all_codecs;
+ use nihav_realmedia::demuxers::realmedia_register_all_demuxers;
#[test]
fn test_ts102366() {
+ let mut dmx_reg = RegisteredDemuxers::new();
+ realmedia_register_all_demuxers(&mut dmx_reg);
+ let mut dec_reg = RegisteredDecoders::new();
+ generic_register_all_codecs(&mut dec_reg);
+
let file = "assets/RV/sp_sample1.rm";
- test_decode_audio("realmedia", file, Some(12000), "ac3");
+ test_decode_audio("realmedia", file, Some(12000), "ac3", &dmx_reg, &dec_reg);
}
}
#[cfg(feature="dsp")]
pub mod dsp;
-#[cfg(test)]
-mod test;
+pub mod test;
pub fn test_file_decoding(demuxer: &str, name: &str, limit: Option<u64>,
decode_video: bool, decode_audio: bool,
- video_pfx: Option<&str>) {
- let dmx_f = find_demuxer(demuxer).unwrap();
+ video_pfx: Option<&str>,
+ dmx_reg: &RegisteredDemuxers, dec_reg: &RegisteredDecoders) {
+ let dmx_f = dmx_reg.find_demuxer(demuxer).unwrap();
let mut file = File::open(name).unwrap();
let mut fr = FileReader::new_read(&mut file);
let mut br = ByteReader::new(&mut fr);
for i in 0..dmx.get_num_streams() {
let s = dmx.get_stream(i).unwrap();
let info = s.get_info();
- let decfunc = find_decoder(info.get_name());
+ let decfunc = dec_reg.find_decoder(info.get_name());
if let Some(df) = decfunc {
if (decode_video && info.is_video()) || (decode_audio && info.is_audio()) {
let mut dec = (df)();
}
}
-pub fn test_decode_audio(demuxer: &str, name: &str, limit: Option<u64>, audio_pfx: &str) {
- let dmx_f = find_demuxer(demuxer).unwrap();
+pub fn test_decode_audio(demuxer: &str, name: &str, limit: Option<u64>, audio_pfx: &str,
+ dmx_reg: &RegisteredDemuxers, dec_reg: &RegisteredDecoders) {
+ let dmx_f = dmx_reg.find_demuxer(demuxer).unwrap();
let mut file = File::open(name).unwrap();
let mut fr = FileReader::new_read(&mut file);
let mut br = ByteReader::new(&mut fr);
for i in 0..dmx.get_num_streams() {
let s = dmx.get_stream(i).unwrap();
let info = s.get_info();
- let decfunc = find_decoder(info.get_name());
+ let decfunc = dec_reg.find_decoder(info.get_name());
if let Some(df) = decfunc {
if info.is_audio() {
let mut dec = (df)();