forge
Explore
Log in

Don't you dare go Hollow

The tests name a key, the machine names the file

Browse files at this commit

a893c91f5ddb30e6c286e70ea7ac62b094a22a9bAhmet Kaan GümüşParent: 28e2853
  • chore
    • the tests name a key, the machine names the file
Show full message
🔒 chore(privacy): the tests name a key, the machine names the file

Nothing in this tree says what is in anybody's library or where it lives.
The handful of tests that are worth nothing against a fixture -- a real
HDR10 grade, a header-stripped BluRay remux, a disc's PGS tracks -- asked
for absolute paths written into their source, and the comments around them
recorded which films the measurements were taken on.

Both go. `engine::real_library::film(key)` reads `real_library.toml` at the
workspace root, which is gitignored: three logical keys named for what the
file *is* (`hevc_4k_hdr`, `h264_dual_audio`, `hevc_4k_pgs`), mapped to
wherever that machine keeps them. A missing manifest, a missing key or a
missing file each say so on stderr and the test passes, which is the
existence gate every one of these already had, in one line instead of five.
`real_library.toml.example` documents the shape and what each key must be.

The comments keep the technical fact and lose the title: a peak of 1759
cd/m^2 is still 1759, the 37 BCP-47 elements are still 37, and the Opus
pre-skip is still measured against ffmpeg -- on "a real 5.1 Opus remux"
rather than on a named one. The synthetic paths in the app's unit tests
("/films/…") were never real and are now anonymous too.
.gitignoremodified+1 -0
@@ -1,2 +1,3 @@
1 /target1 /target
2 /assets2 /assets
3+/real_library.toml
crates/app/src/main.rsmodified+4 -4
@@ -10786,7 +10786,7 @@ fn open_ahead(
10786 /// Reads, off the UI thread, exactly what the import that follows is about to10786 /// Reads, off the UI thread, exactly what the import that follows is about to
10787 /// read. The container's header is read for the page cache and thrown away: a10787 /// read. The container's header is read for the page cache and thrown away: a
10788 /// cold header walk of a 29 GB remux is 11 s and a warm one is 150 ms10788 /// cold header walk of a 29 GB remux is 11 s and a warm one is 150 ms
10789-/// (measured, `a real 4K HEVC film` 2160p h265), so this call is the eleven10789+/// (measured on a real 2160p h265 remux), so this call is the eleven
10790 /// seconds and [`Player::take_import`] is the hundred and fifty milliseconds.10790 /// seconds and [`Player::take_import`] is the hundred and fifty milliseconds.
10791 /// The window keeps painting through the eleven.10791 /// The window keeps painting through the eleven.
10792 ///10792 ///
@@ -11713,7 +11713,7 @@ fn stream_detail(info: &StreamInfo) -> String {
11713 /// The marker costs the word "sound", the way the whole file's rate costs the11713 /// The marker costs the word "sound", the way the whole file's rate costs the
11714 /// word "total" above, and for the same reason. Measured in Noto Sans 11 px11714 /// word "total" above, and for the same reason. Measured in Noto Sans 11 px
11715 /// against the 186 px this value has beside a "Bitrate" label: "0.16 sound 1/2"11715 /// against the 186 px this value has beside a "Bitrate" label: "0.16 sound 1/2"
11716-/// wants 192 px on a small film's 4.7 Mb/s and 205 on the 39.8 Mb/s remux --11716+/// wants 192 px on a 4.7 Mb/s film and 205 on the 39.8 Mb/s remux --
11717 /// the marker is what gets cut, which is the one part of the line that is new.11717 /// the marker is what gets cut, which is the one part of the line that is new.
11718 /// Nothing that keeps the word fits the wide files -- the shortest, "snd 1/2",11718 /// Nothing that keeps the word fits the wide files -- the shortest, "snd 1/2",
11719 /// still wants 188 px on that remux -- so the word goes and the number keeps11719 /// still wants 188 px on that remux -- so the word goes and the number keeps
@@ -18638,7 +18638,7 @@ mod tests {
18638 );18638 );
18639 // Both ends survive: the release's name at the front, the number18639 // Both ends survive: the release's name at the front, the number
18640 // that tells them apart at the back.18640 // that tells them apart at the back.
18641- assert!(clip_middle(a, width).starts_with('F'));18641+ assert!(clip_middle(a, width).starts_with(&a[..2]));
18642 assert!(clip_middle(a, width).ends_with("01"));18642 assert!(clip_middle(a, width).ends_with("01"));
18643 assert!(clip_middle(a, width).contains('…'));18643 assert!(clip_middle(a, width).contains('…'));
18644 // Never wider than the column can hold, gap included.18644 // Never wider than the column can hold, gap included.
@@ -19347,7 +19347,7 @@ mod tests {
19347 /// three lines the same line counts instead.19347 /// three lines the same line counts instead.
19348 #[test]19348 #[test]
19349 fn the_card_names_the_subtitle_it_leaves_off_and_counts_them_when_it_cannot() {19349 fn the_card_names_the_subtitle_it_leaves_off_and_counts_them_when_it_cannot() {
19350- let film = "/films/a-real-h264-dual-audio-film.mkv";19350+ let film = "/films/An Episode 01.mkv";
19351 let two = [19351 let two = [
19352 sub(film, Some(1), "[ASS]"),19352 sub(film, Some(1), "[ASS]"),
19353 sub(film, Some(2), "[ASS] [FOR DUB]"),19353 sub(film, Some(2), "[ASS] [FOR DUB]"),
crates/engine/Cargo.tomlmodified+2 -2
@@ -70,8 +70,8 @@ rusty_vorbis = "0.1.1"
70 # sibling pick, `rusty-opus 0.9.1` -- same family as `rusty_aac`/`rusty_mp3`70 # sibling pick, `rusty-opus 0.9.1` -- same family as `rusty_aac`/`rusty_mp3`
71 # above -- hands each self-delimited slice to a decoder that parses it as an71 # above -- hands each self-delimited slice to a decoder that parses it as an
72 # ordinary packet, so every stream but the last decodes the length prefix as72 # ordinary packet, so every stream but the last decodes the length prefix as
73-# payload: measured on a real 5.1 Opus remux as full-scale noise at -13 dBFS where the73+# payload: measured on a real 5.1 Opus remux as full-scale noise at -13 dBFS
74-# film is silent. This one matches ffmpeg's own decode of the same file to a74+# where the film is silent. This one matches ffmpeg's own decode of the same file to a
75 # correlation of 1.0000 on all six channels. Pinned exactly, like `oxideav-ac3`75 # correlation of 1.0000 on all six channels. Pinned exactly, like `oxideav-ac3`
76 # below, because a decoder is a bit-exactness dependency.76 # below, because a decoder is a bit-exactness dependency.
77 ruopus = { version = "=0.1.2", default-features = false, features = ["std"] }77 ruopus = { version = "=0.1.2", default-features = false, features = ["std"] }
crates/engine/src/audio.rsmodified+2 -2
@@ -1576,8 +1576,8 @@ impl SymTrack {
1576 Err(e) => eprintln!("audio reopen failed: {e}"),1576 Err(e) => eprintln!("audio reopen failed: {e}"),
1577 }1577 }
1578 // Asking for the beginning is asking for nothing: a fresh reader is1578 // Asking for the beginning is asking for nothing: a fresh reader is
1579- // already there, and *seeking* there is how the first 167 ms of1579+ // already there, and *seeking* there is how the first 167 ms of a
1580- // the remux went missing -- the cue table's first point put the1580+ // real 5.1 Opus remux went missing -- the cue table's first point put the
1581 // reader past them and no window rule can reach back.1581 // reader past them and no window rule can reach back.
1582 if from == 0 {1582 if from == 0 {
1583 return;1583 return;
crates/engine/src/colorspace.rsmodified+11 -23
@@ -974,7 +974,7 @@ fn av1_color_config(b: &mut Bits, seq_profile: u32) -> Tags {
974 mod tests {974 mod tests {
975 use super::*;975 use super::*;
976 use crate::demux::Demuxer;976 use crate::demux::Demuxer;
977- use std::path::{Path, PathBuf};977+ use std::path::PathBuf;
978 978
979 fn asset(name: &str) -> PathBuf {979 fn asset(name: &str) -> PathBuf {
980 PathBuf::from(env!("CARGO_MANIFEST_DIR"))980 PathBuf::from(env!("CARGO_MANIFEST_DIR"))
@@ -1225,17 +1225,13 @@ mod tests {
1225 1225
1226 /// A real HDR film: BT.2020 non-constant-luminance, PQ, limited range, all1226 /// A real HDR film: BT.2020 non-constant-luminance, PQ, limited range, all
1227 /// three off the Matroska `Colour` element. Gated on the file being here --1227 /// three off the Matroska `Colour` element. Gated on the file being here --
1228- /// it is a 25 GB download, not a fixture.1228+ /// it is a 25 GB remux, not a fixture (`crate::real_library`).
1229 #[test]1229 #[test]
1230 fn real_hdr_film_reads_bt2020_pq() {1230 fn real_hdr_film_reads_bt2020_pq() {
1231- let path = Path::new(1231+ let Some(path) = crate::real_library::film("hevc_4k_hdr") else {
1232- "/path/to/a-real-4k-hdr10-film.mkv",
1233- );
1234- if !path.exists() {
1235- eprintln!("skipped: {} is not on this machine", path.display());
1236 return;1232 return;
1237- }1233+ };
1238- let (meta, _) = Demuxer::open(path).expect("open the HDR film");1234+ let (meta, _) = Demuxer::open(&path).expect("open the HDR film");
1239 assert_eq!(1235 assert_eq!(
1240 meta.color,1236 meta.color,
1241 ColorDescription {1237 ColorDescription {
@@ -1251,14 +1247,10 @@ mod tests {
1251 /// HD material. Gated for the same reason as the one above.1247 /// HD material. Gated for the same reason as the one above.
1252 #[test]1248 #[test]
1253 fn real_untagged_hd_film_reads_bt709() {1249 fn real_untagged_hd_film_reads_bt709() {
1254- let path = Path::new(1250+ let Some(path) = crate::real_library::film("h264_dual_audio") else {
1255- "/path/to/a-real-h264-dual-audio-film.mkv",
1256- );
1257- if !path.exists() {
1258- eprintln!("skipped: {} is not on this machine", path.display());
1259 return;1251 return;
1260- }1252+ };
1261- let (meta, _) = Demuxer::open(path).expect("open the untagged film");1253+ let (meta, _) = Demuxer::open(&path).expect("open the untagged film");
1262 assert_eq!(1254 assert_eq!(
1263 meta.color,1255 meta.color,
1264 ColorDescription {1256 ColorDescription {
@@ -1575,14 +1567,10 @@ mod tests {
1575 /// 50/10000). Skipped, loudly, on a machine without the film.1567 /// 50/10000). Skipped, loudly, on a machine without the film.
1576 #[test]1568 #[test]
1577 fn a_real_hdr_film_reports_the_peak_ffprobe_reports() {1569 fn a_real_hdr_film_reports_the_peak_ffprobe_reports() {
1578- let film = Path::new(1570+ let Some(film) = crate::real_library::film("hevc_4k_hdr") else {
1579- "/path/to/a-real-4k-hdr10-film.mkv",
1580- );
1581- if !film.exists() {
1582- eprintln!("skipped: {} is not on this machine", film.display());
1583 return;1571 return;
1584- }1572+ };
1585- let (_, demuxer) = Demuxer::open(film).expect("open the film");1573+ let (_, demuxer) = Demuxer::open(&film).expect("open the film");
1586 same_light(1574 same_light(
1587 demuxer.light(),1575 demuxer.light(),
1588 ContentLight {1576 ContentLight {
crates/engine/src/demux.rsmodified+2 -2
@@ -1367,8 +1367,8 @@ enum MkvEntry {
1367 ///1367 ///
1368 /// **`LanguageBCP47` wins**, which is the spec's own precedence and not a1368 /// **`LanguageBCP47` wins**, which is the spec's own precedence and not a
1369 /// preference: a modern file states its languages there and leaves the legacy1369 /// preference: a modern file states its languages there and leaves the legacy
1370-/// element out, so reading only the old one lost them. A1370+/// element out, so reading only the old one lost them. One real 4K web remux
1371-/// dual-language remux carries 37 `LanguageBCP47` elements against 33 legacy1371+/// carries 37 `LanguageBCP47` elements against 33 legacy
1372 /// ones and every English track of it is BCP-47 only -- they all used to come in1372 /// ones and every English track of it is BCP-47 only -- they all used to come in
1373 /// as `und` and export with no language at all.1373 /// as `und` and export with no language at all.
1374 ///1374 ///
crates/engine/src/lib.rsmodified+1 -0
@@ -17,6 +17,7 @@ pub mod limiter;
17 pub mod mux;17 pub mod mux;
18 pub mod playback;18 pub mod playback;
19 pub mod project;19 pub mod project;
20+pub mod real_library;
20 pub mod scale;21 pub mod scale;
21 pub mod scratch;22 pub mod scratch;
22 pub mod silence;23 pub mod silence;
crates/engine/src/real_library.rsadded+89 -0
@@ -0,0 +1,89 @@
1+//! Where the real films are, on the machine that has them.
2+//!
3+//! A handful of tests are worth nothing against a fixture: a 4K HDR10 grade, a
4+//! header-stripped BluRay remux, a disc's PGS tracks. None of those can live in
5+//! this repository -- they are tens of gigabytes of somebody's library -- and
6+//! their paths are nobody's business but that machine's, so they are not in the
7+//! tree either. `real_library.toml` at the workspace root maps a logical key to
8+//! an absolute path; it is gitignored, and `real_library.toml.example` shows the
9+//! shape. Without it every test that asks here says so and passes.
10+//!
11+//! The format is the `key = "path"` subset of TOML, one per line, `#` comments:
12+//! enough for a path table and no dependency to parse.
13+
14+use std::path::PathBuf;
15+
16+/// The manifest, beside the workspace `Cargo.toml`.
17+const MANIFEST: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/../../real_library.toml");
18+
19+/// The file `key` names, if this machine is one that has it.
20+///
21+/// [`None`] -- with the reason on stderr, in the skip wording the rest of these
22+/// tests use -- when the manifest is absent, when it does not name the key, or
23+/// when what it names is not there. A test's whole gate is therefore one line:
24+///
25+/// ```no_run
26+/// let Some(film) = engine::real_library::film("hevc_4k_hdr") else {
27+/// return;
28+/// };
29+/// ```
30+pub fn film(key: &str) -> Option<PathBuf> {
31+ let Ok(text) = std::fs::read_to_string(MANIFEST) else {
32+ eprintln!(
33+ "skipped: no real_library.toml at the workspace root (copy real_library.toml.example)"
34+ );
35+ return None;
36+ };
37+ let Some(path) = text.lines().find_map(|line| entry(line, key)) else {
38+ eprintln!("skipped: real_library.toml does not name `{key}`");
39+ return None;
40+ };
41+ let path = PathBuf::from(path);
42+ if !path.exists() {
43+ eprintln!("skipped: `{key}` is not on this machine");
44+ return None;
45+ }
46+ Some(path)
47+}
48+
49+/// One `key = "value"` line, if it is this key's: comments and blank lines
50+/// answer [`None`], and so does any line whose value is not quoted.
51+fn entry(line: &str, key: &str) -> Option<String> {
52+ let line = line.trim();
53+ if line.starts_with('#') {
54+ return None;
55+ }
56+ let (name, value) = line.split_once('=')?;
57+ if name.trim() != key {
58+ return None;
59+ }
60+ let path = value.trim().strip_prefix('"')?.strip_suffix('"')?;
61+ Some(path.to_string())
62+}
63+
64+#[cfg(test)]
65+mod tests {
66+ use super::entry;
67+
68+ /// The parser, against the lines a hand-written manifest really holds: the
69+ /// key it was asked for and no other, quotes off, whitespace either side of
70+ /// the `=`, and a commented-out line is not an entry however much it looks
71+ /// like one.
72+ #[test]
73+ fn a_manifest_line_answers_for_its_own_key_only() {
74+ assert_eq!(entry(r#"k = "/a/b.mkv""#, "k").as_deref(), Some("/a/b.mkv"));
75+ assert_eq!(
76+ entry(r#" k="/a/b.mkv" "#, "k").as_deref(),
77+ Some("/a/b.mkv")
78+ );
79+ // A path with an `=` in it survives: only the first one splits.
80+ assert_eq!(
81+ entry(r#"k = "/a/b=c.mkv""#, "k").as_deref(),
82+ Some("/a/b=c.mkv")
83+ );
84+ assert_eq!(entry(r#"other = "/a/b.mkv""#, "k"), None);
85+ assert_eq!(entry(r#"# k = "/a/b.mkv""#, "k"), None);
86+ assert_eq!(entry("k = /a/b.mkv", "k"), None);
87+ assert_eq!(entry("", "k"), None);
88+ }
89+}
crates/engine/src/tonemap.rsmodified+2 -2
@@ -904,8 +904,8 @@ mod tests {
904 }904 }
905 905
906 /// The paid debt: the film's own declared peak is what the reference906 /// The paid debt: the film's own declared peak is what the reference
907- /// rendition converts at. 1759 cd/m^2 is a real number -- the MaxCLL of the907+ /// rendition converts at. 1759 cd/m^2 is a real number -- the MaxCLL of a
908- /// HDR10 grade of *a real film*, which the container never says908+ /// real HDR10 grade, which the container never says
909 /// and the HEVC SEI does -- and every anchor moves with it, downward,909 /// and the HEVC SEI does -- and every anchor moves with it, downward,
910 /// because a peak this far above the 1000 an undeclared file is assumed at910 /// because a peak this far above the 1000 an undeclared file is assumed at
911 /// is *headroom*: the same code is a smaller fraction of a brighter peak.911 /// is *headroom*: the same code is a smaller fraction of a brighter peak.
crates/engine/tests/audio_streams.rsmodified+2 -7
@@ -240,14 +240,9 @@ fn flag_default_on_a_later_track_is_still_stream_0() {
240 /// the second one has to play. Existence-gated -- it is not in the repo.240 /// the second one has to play. Existence-gated -- it is not in the repo.
241 #[test]241 #[test]
242 fn a_real_dual_audio_remux_lists_both_tracks_and_plays_the_second() {242 fn a_real_dual_audio_remux_lists_both_tracks_and_plays_the_second() {
243- let path = PathBuf::from(243+ let Some(path) = engine::real_library::film("h264_dual_audio") else {
244- "/path/to/\
245-a-real-h264-dual-audio-film.mkv",
246- );
247- if !path.exists() {
248- eprintln!("skipped: {} is not on this machine", path.display());
249 return;244 return;
250- }245+ };
251 let streams = AudioSession::probe_streams(&path).expect("probes");246 let streams = AudioSession::probe_streams(&path).expect("probes");
252 assert_eq!(streams.len(), 2, "two audio tracks: {streams:?}");247 assert_eq!(streams.len(), 2, "two audio tracks: {streams:?}");
253 for (index, info) in streams.iter().enumerate() {248 for (index, info) in streams.iter().enumerate() {
crates/engine/tests/bitrate.rsmodified+1 -1
@@ -217,7 +217,7 @@ fn the_mp4_rows_are_what_the_encoder_was_asked_for() {
217 217
218 #[test]218 #[test]
219 fn a_dual_audio_file_names_the_track_it_would_play_and_says_there_are_others() {219 fn a_dual_audio_file_names_the_track_it_would_play_and_says_there_are_others() {
220- // `test_multiaudio.mp4` is the shape an AC-3 5.1 mp4 has:220+ // `test_multiaudio.mp4` is the shape a real dual-audio mp4 has:
221 // an AAC stereo track and a fatter AC-3 one in the same file. Whichever the221 // an AAC stereo track and a fatter AC-3 one in the same file. Whichever the
222 // bitrate row names, it names *one* of three, and the danger is calling a222 // bitrate row names, it names *one* of three, and the danger is calling a
223 // 0.13 Mb/s stereo track "sound" on a file whose selling point is the AC-3.223 // 0.13 Mb/s stereo track "sound" on a file whose selling point is the AC-3.
crates/engine/tests/export_color.rsmodified+3 -6
@@ -488,13 +488,10 @@ fn an_hdr_clip_is_tone_mapped_before_it_is_graded() {
488 /// double-applied conversion produces, and both are one mean away.488 /// double-applied conversion produces, and both are one mean away.
489 #[test]489 #[test]
490 fn a_real_hdr_film_exports_as_a_picture() {490 fn a_real_hdr_film_exports_as_a_picture() {
491- let film = Path::new(491+ let Some(film) = engine::real_library::film("hevc_4k_hdr") else {
492- "/path/to/a-real-4k-hdr10-film.mkv",
493- );
494- if !film.exists() {
495- eprintln!("skipped: {} is not on this machine", film.display());
496 return;492 return;
497- }493+ };
494+ let film = film.as_path();
498 let mut session = PlaybackSession::open(film).expect("open the film");495 let mut session = PlaybackSession::open(film).expect("open the film");
499 assert_eq!(session.meta().color.transfer, Transfer::Pq, "an HDR10 film");496 assert_eq!(session.meta().color.transfer, Transfer::Pq, "an HDR10 film");
500 // What this film declares about itself, and therefore what the reference497 // What this film declares about itself, and therefore what the reference
crates/engine/tests/hw_decode.rsmodified+3 -6
@@ -234,13 +234,10 @@ fn range_stops_at_end() {
234 fn the_hdr_film_renders_tone_mapped() {234 fn the_hdr_film_renders_tone_mapped() {
235 // Two minutes in: past the studio logos, inside lit footage.235 // Two minutes in: past the studio logos, inside lit footage.
236 const TARGET: u32 = 3000;236 const TARGET: u32 = 3000;
237- let path = Path::new(237+ let Some(path) = engine::real_library::film("hevc_4k_hdr") else {
238- "/path/to/a-real-4k-hdr10-film.mkv",
239- );
240- if !path.exists() {
241- eprintln!("skipped: {} is not on this machine", path.display());
242 return;238 return;
243- }239+ };
240+ let path = path.as_path();
244 // SAFETY: --test-threads=1. There is no software HEVC decoder, so a pinned241 // SAFETY: --test-threads=1. There is no software HEVC decoder, so a pinned
245 // VE_SW from another test in this binary would refuse the file outright.242 // VE_SW from another test in this binary would refuse the file outright.
246 unsafe { std::env::remove_var("VE_SW") };243 unsafe { std::env::remove_var("VE_SW") };
crates/engine/tests/mkv_encodings.rsmodified+6 -12
@@ -393,13 +393,10 @@ fn what_cannot_be_undone_is_refused_by_name() {
393 /// proves is a picture on the timeline and not a well-shaped byte string.393 /// proves is a picture on the timeline and not a well-shaped byte string.
394 #[test]394 #[test]
395 fn the_stripped_bluray_remux_decodes_a_picture() {395 fn the_stripped_bluray_remux_decodes_a_picture() {
396- let path = Path::new(396+ let Some(path) = engine::real_library::film("h264_dual_audio") else {
397- "/path/to/a-real-h264-dual-audio-film.mkv",
398- );
399- if !path.exists() {
400- eprintln!("skipped: {} is not on this machine", path.display());
401 return;397 return;
402- }398+ };
399+ let path = path.as_path();
403 let mut session = engine::PlaybackSession::open(path).expect("open the remux");400 let mut session = engine::PlaybackSession::open(path).expect("open the remux");
404 assert_eq!(session.meta().codec, Codec::H264);401 assert_eq!(session.meta().codec, Codec::H264);
405 let deadline = std::time::Instant::now() + std::time::Duration::from_secs(60);402 let deadline = std::time::Instant::now() + std::time::Duration::from_secs(60);
@@ -431,13 +428,10 @@ fn the_stripped_bluray_remux_decodes_a_picture() {
431 /// `AudioSession`, which is what the timeline opens it with.428 /// `AudioSession`, which is what the timeline opens it with.
432 #[test]429 #[test]
433 fn the_laced_eac3_remux_decodes_sound() {430 fn the_laced_eac3_remux_decodes_sound() {
434- let path = Path::new(431+ let Some(path) = engine::real_library::film("hevc_4k_hdr") else {
435- "/path/to/a-real-4k-hdr10-film.mkv",
436- );
437- if !path.exists() {
438- eprintln!("skipped: {} is not on this machine", path.display());
439 return;432 return;
440- }433+ };
434+ let path = path.as_path();
441 let (meta, rx) = engine::AudioSession::open(path)435 let (meta, rx) = engine::AudioSession::open(path)
442 .expect("open the sound")436 .expect("open the sound")
443 .expect("the film has an E-AC-3 track");437 .expect("the film has an E-AC-3 track");
crates/engine/tests/pgs_bitmaps.rsmodified+6 -10
@@ -2,8 +2,8 @@
2 //! the session lists the track, maps its cues onto the timeline and hands over2 //! the session lists the track, maps its cues onto the timeline and hands over
3 //! the picture of one -- which is what the window draws over the film.3 //! the picture of one -- which is what the window draws over the film.
4 //!4 //!
5-//! Gated on the film being there: it is a 4K remux in a local folder and no5+//! Gated on the film being there: it is a 4K remux named by the local
6-//! fixture in this repository, so on a machine without it this says so and6+//! `real_library.toml` and no fixture in this repository, so without it this says so and
7 //! passes. What it guards is what a hand-made display set cannot -- that a real7 //! passes. What it guards is what a hand-made display set cannot -- that a real
8 //! disc's blocks come whole out of the demuxer and decode, and that the map a8 //! disc's blocks come whole out of the demuxer and decode, and that the map a
9 //! repaint asks for is cheap enough to ask sixty times a second.9 //! repaint asks for is cheap enough to ask sixty times a second.
@@ -12,19 +12,15 @@
12 //! cargo test -p engine --release --test pgs_bitmaps -- --nocapture12 //! cargo test -p engine --release --test pgs_bitmaps -- --nocapture
13 //! ```13 //! ```
14 14
15-use std::path::Path;
16 use std::time::Instant;15 use std::time::Instant;
17 16
18-/// A remux with `S_TEXT/UTF8` + 4x `S_HDMV/PGS`.
19-const FILM: &str = "/path/to/a-real-4k-pgs-film.mkv";
20-
21 #[test]17 #[test]
22 fn the_session_maps_a_pgs_track_onto_the_timeline_and_draws_it() {18 fn the_session_maps_a_pgs_track_onto_the_timeline_and_draws_it() {
23- let film = Path::new(FILM);19+ // A remux with `S_TEXT/UTF8` + 4x `S_HDMV/PGS`.
24- if !film.exists() {20+ let Some(film) = engine::real_library::film("hevc_4k_pgs") else {
25- eprintln!("skipped: {FILM} is not on this machine");
26 return;21 return;
27- }22+ };
23+ let film = film.as_path();
28 let opened = Instant::now();24 let opened = Instant::now();
29 let mut session = engine::PlaybackSession::open(film).expect("the film opens");25 let mut session = engine::PlaybackSession::open(film).expect("the film opens");
30 session.set_gain(0.0);26 session.set_gain(0.0);
crates/engine/tests/subtitles.rsmodified+6 -10
@@ -190,17 +190,13 @@ fn a_block_holding_the_erase_after_the_picture_still_draws_the_picture() {
190 190
191 /// The film that reported the bug: four PGS tracks beside one `S_TEXT/UTF8`191 /// The film that reported the bug: four PGS tracks beside one `S_TEXT/UTF8`
192 /// one, none of them refused any more. Skipped where the file is not -- it is192 /// one, none of them refused any more. Skipped where the file is not -- it is
193-/// a 4K remux and lives in a local folder, not in this repository.193+/// a 4K remux named by the local `real_library.toml`, not in this repository.
194 #[test]194 #[test]
195 fn the_remux_that_reported_the_bug_reads_all_five_of_its_tracks() {195 fn the_remux_that_reported_the_bug_reads_all_five_of_its_tracks() {
196- let film = std::path::Path::new(196+ let Some(film) = engine::real_library::film("hevc_4k_pgs") else {
197- "/path/to/a-real-4k-pgs-film.mkv",
198- );
199- if !film.exists() {
200- eprintln!("skipped: {} is not here", film.display());
201 return;197 return;
202- }198+ };
203- let tracks = subtitle::of_matroska(film).expect("the walk");199+ let tracks = subtitle::of_matroska(&film).expect("the walk");
204 assert_eq!(tracks.len(), 5);200 assert_eq!(tracks.len(), 5);
205 assert!(201 assert!(
206 tracks.iter().all(|t| t.refused.is_none()),202 tracks.iter().all(|t| t.refused.is_none()),
@@ -604,8 +600,8 @@ fn a_matroska_that_is_the_subtitles_alone_imports_like_any_other() {
604 /// `LanguageBCP47` and no legacy `Language` element at all -- keeps that600 /// `LanguageBCP47` and no legacy `Language` element at all -- keeps that
605 /// language, where it used to come in as `und`.601 /// language, where it used to come in as `und`.
606 ///602 ///
607-/// The shape of every English track of a dual-language remux and all four603+/// The shape of every English track of one real 4K web remux and all four
608-/// of the 17-track library file ones: they read as `und` while the file said `en`,604+/// of another film's: they read as `und` while the file said `en`,
609 /// and the loss survived into the exported file's track list.605 /// and the loss survived into the exported file's track list.
610 #[test]606 #[test]
611 fn a_track_that_states_its_language_the_modern_way_keeps_it() {607 fn a_track_that_states_its_language_the_modern_way_keeps_it() {
real_library.toml.exampleadded+20 -0
@@ -0,0 +1,20 @@
1+# The films a few tests need and this repository cannot hold: tens of gigabytes
2+# each, and every one of them somebody's own library. Copy this file to
3+# `real_library.toml` beside it (gitignored) and put your own absolute paths in.
4+# Every test that asks for a key this file does not name, or names at a path that
5+# is not there, says so on stderr and passes.
6+#
7+# `key = "path"`, one per line, `#` comments. See `engine::real_library`.
8+
9+# 4K HDR10, HEVC Main 10 in Matroska, whose grade lives only in the bitstream
10+# (MaxCLL/MaxFALL in the HEVC SEI, four code points in the `Colour` element),
11+# with a fixed-laced 5.1 E-AC-3 track and BCP-47-only subtitle languages.
12+hevc_4k_hdr = "/path/to/a-4k-hdr10-web-remux.mkv"
13+
14+# A 720p dual-audio Blu-ray rip: H.264 with its video track header stripped,
15+# two AAC tracks, no colour tags anywhere in container or SPS.
16+h264_dual_audio = "/path/to/a-dual-audio-bluray-rip.mkv"
17+
18+# A 4K Blu-ray x265 remux carrying four PGS subtitle tracks beside one
19+# `S_TEXT/UTF8` one.
20+hevc_4k_pgs = "/path/to/a-4k-bluray-remux-with-pgs.mkv"
scripts/gen_fixtures.shmodified+2 -2
@@ -223,8 +223,8 @@ ffmpeg -y -i crates/engine/tests/data/test_subs.srt \
223 -f matroska assets/test_subs.mks223 -f matroska assets/test_subs.mks
224 # ...and the same file stating its languages the way a modern muxer does: in224 # ...and the same file stating its languages the way a modern muxer does: in
225 # `LanguageBCP47` (0x22B59D) and *not* in the legacy `Language` (0x22B59C),225 # `LanguageBCP47` (0x22B59D) and *not* in the legacy `Language` (0x22B59C),
226-# which is the shape of every English track of a dual-language remux and226+# which is the shape of every English track of two real Blu-ray-sourced films.
227-# `a 17-track library file`. ffmpeg writes only the legacy element (8.1.2 does not read227+# ffmpeg writes only the legacy element (8.1.2 does not read
228 # the BCP-47 one either), so the element is swapped in place afterwards: the228 # the BCP-47 one either), so the element is swapped in place afterwards: the
229 # 4-byte id, then the length as a two-byte VINT (`40 02`, a legal non-minimal229 # 4-byte id, then the length as a two-byte VINT (`40 02`, a legal non-minimal
230 # encoding) so the tag is two bytes and the element stays the eight bytes it230 # encoding) so the tag is two bytes and the element stays the eight bytes it