[audio] Fix: a track box belongs to the trak it is in (the hdlr of udta/meta overwrote the chapter track's)

This commit is contained in:
2026-11-17 21:57:12 +01:00
parent 7aa13d6c0a
commit 1d6693a195
4 changed files with 15 additions and 8 deletions
+3 -1
View File
@@ -295,7 +295,9 @@ fn m4b_with_chapter_track(titles: &[&str], starts_ms: &[u32]) -> Vec<u8> {
.concat(),
);
let mut f = ftyp(b"M4B ");
f.extend(bx(b"moov", &[mvhd(1000, 600_000), audio, text].concat()));
// iTunes metadata after the tracks, with its own `hdlr` (`mdir`): it belongs to no track.
let udta = bx(b"udta", &bx(b"meta", &[full(0), hdlr(b"mdir")].concat()));
f.extend(bx(b"moov", &[mvhd(1000, 600_000), audio, text, udta].concat()));
f
};
let head_len = build(0).len() as u32;