From 6a9cdf1f5ab9f7f7ecea865b2930bb4c385609c4 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 25 Mar 2021 22:58:50 +0100 Subject: [PATCH] Use XX as an audio language when there is no specified audio language (#1939). Previously we would omit the audio and subtitle language parts of the DCI name if there was no specified audio language. Sadly if we do do that EasyDCP player 4.0.1 reports a warning (whose details you can't see on the demo version). --- src/lib/film.cc | 56 ++++++++++++++++++++--------------------- test/isdcf_name_test.cc | 8 +++++- 2 files changed, 35 insertions(+), 29 deletions(-) diff --git a/src/lib/film.cc b/src/lib/film.cc index 321a932d1..46074e2ad 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -904,41 +904,41 @@ Film::isdcf_name (bool if_created_now) const } } - if (!dm.audio_language.empty ()) { - d += "_" + dm.audio_language; + auto const audio_language = dm.audio_language.empty() ? "XX" : dm.audio_language; - /* I'm not clear on the precise details of the convention for CCAP labelling; - for now I'm just appending -CCAP if we have any closed captions. - */ + d += "_" + audio_language; - auto burnt_in = true; - auto ccap = false; - for (auto i: content()) { - for (auto j: i->text) { - if (j->type() == TextType::OPEN_SUBTITLE && j->use() && !j->burn()) { - burnt_in = false; - } else if (j->type() == TextType::CLOSED_CAPTION && j->use()) { - ccap = true; - } - } - } + /* I'm not clear on the precise details of the convention for CCAP labelling; + for now I'm just appending -CCAP if we have any closed captions. + */ - if (!_subtitle_languages.empty()) { - auto lang = _subtitle_languages.front().language().get_value_or("en").subtag(); - if (burnt_in) { - transform (lang.begin(), lang.end(), lang.begin(), ::tolower); - } else { - transform (lang.begin(), lang.end(), lang.begin(), ::toupper); + auto burnt_in = true; + auto ccap = false; + for (auto i: content()) { + for (auto j: i->text) { + if (j->type() == TextType::OPEN_SUBTITLE && j->use() && !j->burn()) { + burnt_in = false; + } else if (j->type() == TextType::CLOSED_CAPTION && j->use()) { + ccap = true; } + } + } - d += "-" + lang; - if (ccap) { - d += "-CCAP"; - } + if (!_subtitle_languages.empty()) { + auto lang = _subtitle_languages.front().language().get_value_or("en").subtag(); + if (burnt_in) { + transform (lang.begin(), lang.end(), lang.begin(), ::tolower); } else { - /* No subtitles */ - d += "-XX"; + transform (lang.begin(), lang.end(), lang.begin(), ::toupper); } + + d += "-" + lang; + if (ccap) { + d += "-CCAP"; + } + } else { + /* No subtitles */ + d += "-XX"; } if (!dm.territory.empty ()) { diff --git a/test/isdcf_name_test.cc b/test/isdcf_name_test.cc index dc2263206..dad2ba7d9 100644 --- a/test/isdcf_name_test.cc +++ b/test/isdcf_name_test.cc @@ -42,7 +42,7 @@ using std::shared_ptr; BOOST_AUTO_TEST_CASE (isdcf_name_test) { - shared_ptr film = new_test_film ("isdcf_name_test"); + auto film = new_test_film ("isdcf_name_test"); /* A basic test */ @@ -61,6 +61,11 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test) film->set_interop (true); BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilm_FTR-1_F_EN-XX_UK-PG_MOS_2K_ST_20140704_FA_IOP_OV"); + /* Check that specifying no audio language writes XX */ + m.audio_language = ""; + film->set_isdcf_metadata (m); + BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilm_FTR-1_F_XX-XX_UK-PG_MOS_2K_ST_20140704_FA_IOP_OV"); + /* Test a long name and some different data */ film->set_name ("My Nice Film With A Very Long Name"); @@ -215,3 +220,4 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test) sound->audio->set_mapping (mapping); BOOST_CHECK_EQUAL (film->isdcf_name(false), "LikeShouting_XSN-2_F-133_DE-fr_US-R_71-HI-VI_4K_DI_20140704_PP_SMPTE_OV"); } + -- 2.30.2