mirror of
https://github.com/freemkv/libfreemkv.git
synced 2026-10-07 18:13:10 +00:00
audit: module-by-module code audit fixes and test coverage
Lands the code-audit branches for aacs, css, keys, labels, udf, ifo and dvd, bdnav/mpls/clpi, disc/bluray, extract, io, scsi, the mkv, mp4, network and mpg muxers, the audio and video codecs, and CI. Fixes include MKB and FMTS validation, UDF bounds, IFO fallback to the BUP, DTS Express framing, MPEG-2 field pairing and mpg re-basing; the rest pins existing behaviour with tests.
This commit is contained in:
+20
-30
@@ -126,11 +126,7 @@ fn open_input_bare_path_errors() {
|
||||
Err(e) => e.to_string(),
|
||||
Ok(_) => panic!("expected error"),
|
||||
};
|
||||
assert!(
|
||||
msg.contains("not a valid stream URL") || msg.contains("E9002"),
|
||||
"got: {}",
|
||||
msg
|
||||
);
|
||||
assert!(msg.contains("E9002"), "got: {}", msg);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -142,11 +138,7 @@ fn open_output_bare_path_errors() {
|
||||
Err(e) => e.to_string(),
|
||||
Ok(_) => panic!("expected error"),
|
||||
};
|
||||
assert!(
|
||||
msg.contains("not a valid stream URL") || msg.contains("E9002"),
|
||||
"got: {}",
|
||||
msg
|
||||
);
|
||||
assert!(msg.contains("E9002"), "got: {}", msg);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -157,11 +149,7 @@ fn open_input_m2ts_empty_path_errors() {
|
||||
Err(e) => e.to_string(),
|
||||
Ok(_) => panic!("expected error"),
|
||||
};
|
||||
assert!(
|
||||
msg.contains("requires a file path") || msg.contains("E9003"),
|
||||
"got: {}",
|
||||
msg
|
||||
);
|
||||
assert!(msg.contains("E9003"), "got: {}", msg);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -172,11 +160,7 @@ fn open_output_null_input_errors() {
|
||||
Err(e) => e.to_string(),
|
||||
Ok(_) => panic!("expected error"),
|
||||
};
|
||||
assert!(
|
||||
msg.contains("write-only") || msg.contains("E9001"),
|
||||
"got: {}",
|
||||
msg
|
||||
);
|
||||
assert!(msg.contains("E9001"), "got: {}", msg);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -188,11 +172,7 @@ fn open_output_disc_errors() {
|
||||
Err(e) => e.to_string(),
|
||||
Ok(_) => panic!("expected error"),
|
||||
};
|
||||
assert!(
|
||||
msg.contains("read-only") || msg.contains("E9000"),
|
||||
"got: {}",
|
||||
msg
|
||||
);
|
||||
assert!(msg.contains("E9000"), "got: {}", msg);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -203,11 +183,7 @@ fn open_input_network_no_port_errors() {
|
||||
Err(e) => e.to_string(),
|
||||
Ok(_) => panic!("expected error"),
|
||||
};
|
||||
assert!(
|
||||
msg.contains("PES pipeline") || msg.contains("missing port") || msg.contains("E9004"),
|
||||
"got: {}",
|
||||
msg
|
||||
);
|
||||
assert!(msg.contains("E9004"), "got: {}", msg);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -379,6 +355,20 @@ fn disc_title_empty() {
|
||||
assert!(dt.playlist.is_empty());
|
||||
}
|
||||
|
||||
// Every named codec must round-trip through its serialized id (FMKV meta headers).
|
||||
#[test]
|
||||
fn codec_id_roundtrips_for_every_named_codec() {
|
||||
use Codec::*;
|
||||
let all = [
|
||||
Hevc, H264, Vc1, Mpeg2, Mpeg1, Av1, TrueHd, DtsHdMa, DtsHdHr, Dts, Ac3, Ac3Plus, Lpcm, Aac,
|
||||
Mp2, Mp3, Flac, Opus, Pgs, DvdSub, Srt, Ssa,
|
||||
];
|
||||
for c in all {
|
||||
assert_ne!(c.id(), "unknown", "{c:?} missing from the codec table");
|
||||
assert_eq!(c.id().parse::<Codec>(), Ok(c), "{c:?} id must parse back");
|
||||
}
|
||||
}
|
||||
|
||||
// ── Meta codec roundtrip ─────────────────────────────────────
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user