tags: update to latest iso-code and support more languages

Some languages have an ISO 639-2 representation but no 639-1
representation, for example where "eng" has a two-letter
equivalent in "en", "enm" doesn't have one.

Discarding those languages from our static table caused functions
such as gst_tag_get_language_code_iso_639_2T() or
gst_tag_get_language_code_iso_639_2B() to return NULL for
valid language codes such as "enm", potentially causing users
of these API such as mpegtsmux to discard language code tags
as invalid.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/785>
This commit is contained in:
Mathieu Duponchelle 2020-08-11 22:54:50 +02:00 committed by GStreamer Merge Bot
parent 6500a76bfb
commit 1ce61b1b08
3 changed files with 890 additions and 217 deletions

File diff suppressed because it is too large Load diff

View file

@ -370,6 +370,10 @@ gst_tag_get_language_code_iso_639_1 (const gchar * lang_code)
if (strcmp (lang_code, iso_639_codes[i].iso_639_1) == 0 ||
strcmp (lang_code, iso_639_codes[i].iso_639_2) == 0) {
c = iso_639_codes[i].iso_639_1;
/* If the language code does not have a 2-letter representation, the table
* holds an empty string. We want to return NULL in that case. */
c = c[0] != '\0' ? c : NULL;
break;
}
}

View file

@ -76,10 +76,6 @@ dump_languages (void)
for (i = 0, num_escaped = 0; i < languages->len; ++i) {
IsoLang *lang = &g_array_index (languages, IsoLang, i);
/* For now just print those where there's both a ISO-639-1 and -2 code */
if (lang->code_1[0] == '\0')
continue;
/* save current offset */
lang->name_offset = names->len;