Include sample-to-chunk mappings in CR3 fixtures

This commit is contained in:
Dylan M. Taylor committed 2026-11-15 17:37:25 -05:00
1 parent a5756f84d4
commit 482ee7bac3
3 files changed
+12 -3

No files matched your search

+4 -1
View File
@@ -101,7 +101,10 @@ fn cr3_file(coding: &[u8], sample: &[u8]) -> Vec<u8> {
let mut co64 = vec![0u8; 4];
co64.extend(1u32.to_be_bytes()); // entry count
co64.extend([0u8; 8]); // sample offset, patched once the layout is known
let tables = [box_bytes(b"stsd", &stsd), box_bytes(b"stsz", &stsz), box_bytes(b"co64", &co64)].concat();
// One sample in chunk 1, using sample description 1. The shared parser
// deliberately refuses sample access without this mapping.
let stsc: Vec<u8> = [0u32, 1, 1, 1, 1].into_iter().flat_map(u32::to_be_bytes).collect();
let tables = [box_bytes(b"stsd", &stsd), box_bytes(b"stsc", &stsc), box_bytes(b"stsz", &stsz), box_bytes(b"co64", &co64)].concat();
let trak = box_bytes(b"trak", &box_bytes(b"mdia", &box_bytes(b"minf", &box_bytes(b"stbl", &tables))));
let mut file = box_bytes(b"ftyp", b"crx \0\0\0\x01crx isom");
file.extend(box_bytes(b"moov", &trak));
+4 -1
View File
@@ -399,7 +399,10 @@ fn track_box(entry: &[u8], offset: u64, size: u32) -> Vec<u8> {
let mut co64 = vec![0u8; 4];
co64.extend(1u32.to_be_bytes());
co64.extend(offset.to_be_bytes());
let tables = [box_bytes(b"stsd", &stsd), box_bytes(b"stsz", &stsz), box_bytes(b"co64", &co64)].concat();
// One sample in chunk 1, using sample description 1. The shared parser
// deliberately refuses sample access without this mapping.
let stsc: Vec<u8> = [0u32, 1, 1, 1, 1].into_iter().flat_map(u32::to_be_bytes).collect();
let tables = [box_bytes(b"stsd", &stsd), box_bytes(b"stsc", &stsc), box_bytes(b"stsz", &stsz), box_bytes(b"co64", &co64)].concat();
box_bytes(b"trak", &box_bytes(b"mdia", &box_bytes(b"minf", &box_bytes(b"stbl", &tables))))
}
+4 -1
View File
@@ -202,7 +202,10 @@ mod cr3 {
let mut co64 = vec![0u8; 4];
co64.extend(1u32.to_be_bytes());
co64.extend(offset.to_be_bytes());
let tables = [box_bytes(b"stsd", &stsd), box_bytes(b"stsz", &stsz), box_bytes(b"co64", &co64)].concat();
// One sample in chunk 1, using sample description 1. The shared parser
// deliberately refuses sample access without this mapping.
let stsc: Vec<u8> = [0u32, 1, 1, 1, 1].into_iter().flat_map(u32::to_be_bytes).collect();
let tables = [box_bytes(b"stsd", &stsd), box_bytes(b"stsc", &stsc), box_bytes(b"stsz", &stsz), box_bytes(b"co64", &co64)].concat();
box_bytes(b"trak", &box_bytes(b"mdia", &box_bytes(b"minf", &box_bytes(b"stbl", &tables))))
}