Recognize subtitle language and type tokens in filenames

getFilenameLanguage now tokenizes the name and scans right-to-left the way mkvmerge's own heuristics do, so a language code survives behind a trailing flag token ("...eng.hearing_impaired.srt" was read as "und"). Three-char tokens try ISO 639-2/T and the library's B codes; the dash stays out of the separator set so region subtags ("pt-BR") are not split into a bogus ISO 639-1 hit.

getFilenameSubtitlesTrackName maps community type tokens (sdh / hearing_impaired / deaf, cc / closed caption, forced, commentary, lyrics) to a bare conventional track name ("SDH"); the language rides its own element. MP4 has no SDH flag and the name-keyword pass in MP42File organizeMediaCharacteristicsForMediaType: turns these names into the real QuickTime tags (public.subtitles.forced-only, public.accessibility.*).

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
Scott GarrettandClaude Code committed 2026-11-28 18:17:53 -05:00
1 parent 7ff1ed4d0b
commit 30dd96ff79
4 files changed
+125 -49

No files matched your search

+4
View File
@@ -57,6 +57,10 @@ MP42_OBJC_DIRECT_MEMBERS
}
}
// "...eng.sdh.srt" style type tokens name the track after the type
// (MP4 has no SDH/CC flag; the name is the convention players show)
track.name = getFilenameSubtitlesTrackName((__bridge CFStringRef)self.fileURL.path);
NSInteger success = 0;
MP4Duration duration = 0;