mirror of
https://github.com/storytold/filmcraft.git
synced 2026-10-14 19:26:59 -04:00
#1303: frame times in i128 via Tick::from_rational (a hostile F1:i64::MAX rate can't overflow)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
ee414e8b9e
commit
62aed1acc2
2 files changed
+13
-5
No files matched your search
@@ -180,7 +180,7 @@ impl Y4mSource {
|
||||
return Err(bad("no complete frames"));
|
||||
}
|
||||
let color = ColorInfo { matrix: filmcraft_frame::default_matrix(w, h), range: if full { Range::Full } else { Range::Limited }, ..ColorInfo::REC709 };
|
||||
let duration = Tick::from_rational(frames.len() as i64 * rate.den, 1, rate.num);
|
||||
let duration = Tick::from_rational(frames.len() as i64, rate.den, rate.num);
|
||||
let bitrate = (frame_bytes as u64 * 8).checked_mul(rate.num as u64).map(|b| b / rate.den as u64);
|
||||
let info = MediaInfo {
|
||||
name: name.to_string(),
|
||||
@@ -244,7 +244,7 @@ impl Y4mSource {
|
||||
data: pixels,
|
||||
color: v.color,
|
||||
par: v.par,
|
||||
pts: Tick::from_rational(idx as i64 * self.rate.den, 1, self.rate.num),
|
||||
pts: Tick::from_rational(idx as i64, self.rate.den, self.rate.num),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,9 +99,17 @@ fn damaged_and_hostile_y4m_files_fail_without_panicking() {
|
||||
b[i] ^= 0x41;
|
||||
cases.push(b);
|
||||
}
|
||||
for header in
|
||||
["W99999999 H99999999 F25:1", "W0 H4 F25:1", "W6 H4 F0:0", "W6 H4 F25:0", "W6 H4 F25:1 C411", "W6 H4 F25:1 Cbogus", "W6 H4 A0:0 F-5:1", "H4 F25:1"]
|
||||
{
|
||||
for header in [
|
||||
"W99999999 H99999999 F25:1",
|
||||
"W0 H4 F25:1",
|
||||
"W6 H4 F0:0",
|
||||
"W6 H4 F25:0",
|
||||
"W6 H4 F25:1 C411",
|
||||
"W6 H4 F25:1 Cbogus",
|
||||
"W6 H4 A0:0 F-5:1",
|
||||
"H4 F25:1",
|
||||
"W6 H4 F1:9223372036854775807",
|
||||
] {
|
||||
cases.push(y4m(header, "FRAME", &[vec![0; 36]]));
|
||||
}
|
||||
for (i, b) in cases.into_iter().enumerate() {
|
||||
|
||||
Reference in new issue
Block a user