aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2021-08-08 12:55:53 +0200
committerKostya Shishkov <kostya.shishkov@gmail.com>2021-08-08 12:55:53 +0200
commitb09ecc095508e73b170333ff85d25f64bd8394db (patch)
tree9f7d774fb2c9957b4a4158a250657f026447eb6f
parent4ee6b98f1975795210f654d3365aac1be0043ceb (diff)
downloadnihav-b09ecc095508e73b170333ff85d25f64bd8394db.tar.gz
make encoder test functions accept encoder-specific options
-rw-r--r--nihav-codec-support/src/test/enc_video.rs6
-rw-r--r--nihav-commonfmt/src/codecs/cinepakenc.rs4
-rw-r--r--nihav-commonfmt/src/codecs/zmbvenc.rs20
-rw-r--r--nihav-ms/src/codecs/msadpcm.rs2
-rw-r--r--nihav-ms/src/codecs/msvideo1enc.rs4
5 files changed, 21 insertions, 15 deletions
diff --git a/nihav-codec-support/src/test/enc_video.rs b/nihav-codec-support/src/test/enc_video.rs
index e9fcf1f..16ea415 100644
--- a/nihav-codec-support/src/test/enc_video.rs
+++ b/nihav-codec-support/src/test/enc_video.rs
@@ -210,7 +210,7 @@ pub fn test_remuxing_md5(dec_config: &DecoderTestParams, muxer: &str, mux_reg: &
}
/// Tests an encoder by decoding a stream from input file, feeding it to the encoder and muxing the result into output file.
-pub fn test_encoding_to_file(dec_config: &DecoderTestParams, enc_config: &EncoderTestParams, mut enc_params: EncodeParameters) {
+pub fn test_encoding_to_file(dec_config: &DecoderTestParams, enc_config: &EncoderTestParams, mut enc_params: EncodeParameters, enc_options: &[NAOption]) {
let dmx_f = dec_config.dmx_reg.find_demuxer(dec_config.demuxer).unwrap();
let mut file = File::open(dec_config.in_name).unwrap();
let mut fr = FileReader::new_read(&mut file);
@@ -256,6 +256,7 @@ pub fn test_encoding_to_file(dec_config: &DecoderTestParams, enc_config: &Encode
let encfunc = enc_config.enc_reg.find_encoder(enc_config.enc_name).unwrap();
let mut encoder = (encfunc)();
+ encoder.set_options(enc_options);
let out_str = encoder.init(0, enc_params).unwrap();
out_sm.add_stream(NAStream::clone(&out_str));
@@ -318,7 +319,7 @@ pub fn test_encoding_to_file(dec_config: &DecoderTestParams, enc_config: &Encode
}
/// Tests an encoder by decoding a stream from input file, feeding it to the encoder and calculating the hash of codec information and packet data.
-pub fn test_encoding_md5(dec_config: &DecoderTestParams, enc_config: &EncoderTestParams, mut enc_params: EncodeParameters, ref_hash: &[u32; 4]) {
+pub fn test_encoding_md5(dec_config: &DecoderTestParams, enc_config: &EncoderTestParams, mut enc_params: EncodeParameters, enc_options: &[NAOption], ref_hash: &[u32; 4]) {
let dmx_f = dec_config.dmx_reg.find_demuxer(dec_config.demuxer).unwrap();
let mut file = File::open(dec_config.in_name).unwrap();
let mut fr = FileReader::new_read(&mut file);
@@ -363,6 +364,7 @@ pub fn test_encoding_md5(dec_config: &DecoderTestParams, enc_config: &EncoderTes
let encfunc = enc_config.enc_reg.find_encoder(enc_config.enc_name).unwrap();
let mut encoder = (encfunc)();
+ encoder.set_options(enc_options);
let out_str = encoder.init(0, enc_params).unwrap();
let mut md5 = MD5::new();
diff --git a/nihav-commonfmt/src/codecs/cinepakenc.rs b/nihav-commonfmt/src/codecs/cinepakenc.rs
index 38f7cec..01e5714 100644
--- a/nihav-commonfmt/src/codecs/cinepakenc.rs
+++ b/nihav-commonfmt/src/codecs/cinepakenc.rs
@@ -1128,8 +1128,8 @@ mod test {
tb_den: 0,
flags: 0,
};
- //test_encoding_to_file(&dec_config, &enc_config, enc_params);
- test_encoding_md5(&dec_config, &enc_config, enc_params,
+ //test_encoding_to_file(&dec_config, &enc_config, enc_params, &[]);
+ test_encoding_md5(&dec_config, &enc_config, enc_params, &[],
&[0xd73cb3c7, 0x30d59f90, 0x1d6e0e28, 0x5b72cc0c]);
}
}
diff --git a/nihav-commonfmt/src/codecs/zmbvenc.rs b/nihav-commonfmt/src/codecs/zmbvenc.rs
index 0d5c1af..7de6c23 100644
--- a/nihav-commonfmt/src/codecs/zmbvenc.rs
+++ b/nihav-commonfmt/src/codecs/zmbvenc.rs
@@ -588,8 +588,9 @@ mod test {
tb_den: 0,
flags: 0,
};
- //test_encoding_to_file(&dec_config, &enc_config, enc_params);
- test_encoding_md5(&dec_config, &enc_config, enc_params,
+ let enc_options = &[];
+ //test_encoding_to_file(&dec_config, &enc_config, enc_params, enc_options);
+ test_encoding_md5(&dec_config, &enc_config, enc_params, enc_options,
&[0x50df10e2, 0x606f3268, 0xdd4bc2ff, 0x844e7d87]);
}
@@ -632,8 +633,9 @@ mod test {
tb_den: 0,
flags: 0,
};
- //test_encoding_to_file(&dec_config, &enc_config, enc_params);
- test_encoding_md5(&dec_config, &enc_config, enc_params,
+ let enc_options = &[];
+ //test_encoding_to_file(&dec_config, &enc_config, enc_params, enc_options);
+ test_encoding_md5(&dec_config, &enc_config, enc_params, enc_options,
&[0x0b4cb528, 0x66c91f6c, 0x1c2187a5, 0x2723a08d]);
}
@@ -676,8 +678,9 @@ mod test {
tb_den: 0,
flags: 0,
};
- //test_encoding_to_file(&dec_config, &enc_config, enc_params);
- test_encoding_md5(&dec_config, &enc_config, enc_params,
+ let enc_options = &[];
+ //test_encoding_to_file(&dec_config, &enc_config, enc_params, enc_options);
+ test_encoding_md5(&dec_config, &enc_config, enc_params, enc_options,
&[0x1a522743, 0x6c320a6e, 0xd08539e1, 0x03fc17ea]);
}
@@ -720,8 +723,9 @@ mod test {
tb_den: 0,
flags: 0,
};
- //test_encoding_to_file(&dec_config, &enc_config, enc_params);
- test_encoding_md5(&dec_config, &enc_config, enc_params,
+ let enc_options = &[];
+ //test_encoding_to_file(&dec_config, &enc_config, enc_params, enc_options);
+ test_encoding_md5(&dec_config, &enc_config, enc_params, enc_options,
&[0x3880e045, 0xe6c88dc7, 0x21066058, 0xc789f1e9]);
}
}
diff --git a/nihav-ms/src/codecs/msadpcm.rs b/nihav-ms/src/codecs/msadpcm.rs
index 5010c03..dfcf640 100644
--- a/nihav-ms/src/codecs/msadpcm.rs
+++ b/nihav-ms/src/codecs/msadpcm.rs
@@ -464,7 +464,7 @@ mod test {
tb_den: 0,
flags: 0,
};
- test_encoding_md5(&dec_config, &enc_config, enc_params,
+ test_encoding_md5(&dec_config, &enc_config, enc_params, &[],
&[0xe1591a1e, 0x816d0239, 0x4cc42291, 0x4e6b69cb]);
}
}
diff --git a/nihav-ms/src/codecs/msvideo1enc.rs b/nihav-ms/src/codecs/msvideo1enc.rs
index d2e5c34..89b4b22 100644
--- a/nihav-ms/src/codecs/msvideo1enc.rs
+++ b/nihav-ms/src/codecs/msvideo1enc.rs
@@ -610,8 +610,8 @@ mod test {
tb_den: 0,
flags: 0,
};
- //test_encoding_to_file(&dec_config, &enc_config, enc_params);
- test_encoding_md5(&dec_config, &enc_config, enc_params,
+ //test_encoding_to_file(&dec_config, &enc_config, enc_params, &[]);
+ test_encoding_md5(&dec_config, &enc_config, enc_params, &[],
&[0x4339421d, 0x6393f1b6, 0x653d6cd2, 0x3a184382]);
}
}