Round trip the chapter language between model and Matroska
ChapterDisplay/ChapterLanguage (0x437C) was read by the vendored parser but never surfaced, and the remuxer's chapter builder never wrote it, so any non-English chapter language silently degraded to the spec default "eng" the first time Subler rewrote the Chapters element. The importer now adopts the first ChapterDisplay language as the model track's language (the model is one-language-per-track; MKV allows per-atom but every common tool stamps one value). The remuxer stamps the track language back into every atom as ISO-639-2/B, omitting it when nil or eng so language-less files keep byte-identical rewrites. Unknown extended tags map to "und" via MP42Languages and are written explicitly, which is truthful rather than silently defaulting. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
1 parent
0cf79eca1c
commit
10dcee30a6
3 files changed
+39
-2
No files matched your search
@@ -360,6 +360,23 @@ MP42_OBJC_DIRECT_MEMBERS
|
||||
timestamp:timestamp];
|
||||
}
|
||||
}
|
||||
|
||||
// The model keeps one language per chapter track; ChapterDisplay
|
||||
// allows one per atom — adopt the first ChapterLanguage found.
|
||||
// Without this the remuxer's rebuild silently drops non-English
|
||||
// chapter languages (it derives ChapterLanguage from this very
|
||||
// property; absent/eng = omitted = spec default "eng").
|
||||
for (unsigned int xi = 0; xi < chapters->nChildren; xi++) {
|
||||
struct ChapterDisplay *display = chapters->Children[xi].Display;
|
||||
if (display && display->Language[0]) {
|
||||
NSString *chapterLang = [MP42Languages.defaultManager
|
||||
extendedTagForISO_639_2b:@(display->Language)];
|
||||
if (chapterLang.length) {
|
||||
newTrack.language = chapterLang;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
[self addTrack:newTrack];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user