mirror of
https://github.com/mpv-player/mpv
synced 2025-03-19 09:57:34 +00:00
demux_mkv: add BCP 47 language tags support
Section 12 of Matroska Media Container Format Specifications says: If a BCP 47 Language Element and an ISO 639-2 Language Element are used within the same Parent Element, then the ISO 639-2 Language Element MUST be ignored and precedence given to the BCP 47 Language Element. Fixes: #8144
This commit is contained in:
parent
2babe02f0f
commit
ab3b1744b9
@ -92,6 +92,7 @@ elements_matroska = (
|
||||
'MaxBlockAdditionID, 55ee, uint',
|
||||
'Name, 536e, str',
|
||||
'Language, 22b59c, str',
|
||||
'LanguageBCP47, 22b59d, str',
|
||||
'CodecID, 86, str',
|
||||
'CodecPrivate, 63a2, binary',
|
||||
'CodecName, 258688, str',
|
||||
@ -206,6 +207,7 @@ elements_matroska = (
|
||||
'ChapterDisplay*, 80, sub', (
|
||||
'ChapString, 85, str',
|
||||
'ChapLanguage*, 437c, str',
|
||||
'ChapLanguageBCP47*, 437d, str',
|
||||
'ChapCountry*, 437e, str',
|
||||
),
|
||||
),
|
||||
@ -224,6 +226,7 @@ elements_matroska = (
|
||||
'SimpleTag*, 67c8, sub', (
|
||||
'TagName, 45a3, str',
|
||||
'TagLanguage, 447a, str',
|
||||
'TagLanguageBCP47, 447b, str',
|
||||
'TagString, 4487, str',
|
||||
'TagDefault, 4484, uint',
|
||||
),
|
||||
|
@ -820,7 +820,10 @@ static void parse_trackentry(struct demuxer *demuxer,
|
||||
MP_DBG(demuxer, "| + CodecPrivate, length %u\n", track->private_size);
|
||||
}
|
||||
|
||||
if (entry->language) {
|
||||
if (entry->language_bcp47) {
|
||||
track->language = talloc_strdup(track, entry->language_bcp47);
|
||||
MP_DBG(demuxer, "| + LanguageBCP47: %s\n", track->language);
|
||||
} else if (entry->language) {
|
||||
track->language = talloc_strdup(track, entry->language);
|
||||
MP_DBG(demuxer, "| + Language: %s\n", track->language);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user