summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-04-17 22:25:50 +0200
committerCarl Hetherington <cth@carlh.net>2022-04-28 23:47:09 +0200
commit90640cdb4bd2bbc68b59010fd825e387e25d5862 (patch)
tree223e26c938a334460877a6036121363f8a8e3a22 /src
parentee89fcb0d593d884999d911375fcc1661b963e33 (diff)
Lookup the correct DCNC code to use for languages rather than just
using the language's subtag (#2235).
Diffstat (limited to 'src')
-rw-r--r--src/lib/film.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index 7fe078cd1..e49b7f78e 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -917,7 +917,18 @@ Film::isdcf_name (bool if_created_now) const
}
}
- auto audio_language = (_audio_language && _audio_language->language()) ? _audio_language->language()->subtag() : "XX";
+ auto entry_for_language = [](dcp::LanguageTag const& tag) {
+ /* Look up what we should be using for this tag in the DCNC name */
+ for (auto const& dcnc: dcp::dcnc_tags()) {
+ if (tag.to_string() == dcnc.first) {
+ return dcnc.second;
+ }
+ }
+ /* Fallback to the language subtag, if there is one */
+ return tag.language() ? tag.language()->subtag() : "XX";
+ };
+
+ auto audio_language = _audio_language ? entry_for_language(*_audio_language) : "XX";
d += "_" + to_upper (audio_language);
@@ -939,7 +950,7 @@ Film::isdcf_name (bool if_created_now) const
auto sub_langs = subtitle_languages();
if (sub_langs.first && sub_langs.first->language()) {
- auto lang = sub_langs.first->language()->subtag();
+ auto lang = entry_for_language(*sub_langs.first);
if (burnt_in) {
transform (lang.begin(), lang.end(), lang.begin(), ::tolower);
} else {