From a6696b9a58c14d81f0ae30482051c2cd47a004db Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 2 Apr 2021 10:47:35 +0200 Subject: [PATCH] Add language to audio content and use it instead of the general metadata. --- src/lib/audio_content.cc | 20 +++++++++++ src/lib/audio_content.h | 9 +++++ src/lib/film.cc | 27 +++++++++++--- src/lib/film.h | 2 +- src/lib/isdcf_metadata.cc | 3 -- src/lib/isdcf_metadata.h | 1 - src/lib/writer.cc | 10 ++++-- src/wx/audio_panel.cc | 64 ++++++++++++++++++++++++++++----- src/wx/audio_panel.h | 10 +++++- src/wx/dcp_panel.cc | 2 +- src/wx/isdcf_metadata_dialog.cc | 5 --- src/wx/isdcf_metadata_dialog.h | 1 - src/wx/smpte_metadata_dialog.cc | 17 --------- src/wx/smpte_metadata_dialog.h | 2 -- test/data | 2 +- test/isdcf_name_test.cc | 27 ++++++++++---- 16 files changed, 148 insertions(+), 54 deletions(-) diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc index 748cbb7d0..3d9f6ac05 100644 --- a/src/lib/audio_content.cc +++ b/src/lib/audio_content.cc @@ -52,6 +52,7 @@ using namespace dcpomatic; int const AudioContentProperty::STREAMS = 200; int const AudioContentProperty::GAIN = 201; int const AudioContentProperty::DELAY = 202; +int const AudioContentProperty::LANGUAGE = 203; AudioContent::AudioContent (Content* parent) @@ -89,6 +90,10 @@ AudioContent::AudioContent (Content* parent, cxml::ConstNodePtr node) { _gain = node->number_child ("AudioGain"); _delay = node->number_child ("AudioDelay"); + auto lang = node->optional_node_child ("Language"); + if (lang) { + _language = dcp::LanguageTag (lang->content()); + } /* Backwards compatibility */ auto r = node->optional_number_child("AudioVideoFrameRate"); @@ -112,11 +117,16 @@ AudioContent::AudioContent (Content* parent, vector > c) if (c[i]->audio->delay() != ref->delay()) { throw JoinError (_("Content to be joined must have the same audio delay.")); } + + if (c[i]->audio->language() != ref->language()) { + throw JoinError (_("Content to be joined must have the same audio language.")); + } } _gain = ref->gain (); _delay = ref->delay (); _streams = ref->streams (); + _language = ref->language (); } @@ -126,6 +136,9 @@ AudioContent::as_xml (xmlpp::Node* node) const boost::mutex::scoped_lock lm (_mutex); node->add_child("AudioGain")->add_child_text(raw_convert(_gain)); node->add_child("AudioDelay")->add_child_text(raw_convert(_delay)); + if (_language) { + node->add_child("Language")->add_child_text(_language->to_string()); + } } @@ -143,6 +156,13 @@ AudioContent::set_delay (int d) } +void +AudioContent::set_language (optional language) +{ + maybe_set (_language, language, AudioContentProperty::LANGUAGE); +} + + string AudioContent::technical_summary () const { diff --git a/src/lib/audio_content.h b/src/lib/audio_content.h index 67183d0a4..adb5c9556 100644 --- a/src/lib/audio_content.h +++ b/src/lib/audio_content.h @@ -31,6 +31,7 @@ #include "content_part.h" #include "audio_stream.h" #include "audio_mapping.h" +#include /** @class AudioContentProperty @@ -42,6 +43,7 @@ public: static int const STREAMS; static int const GAIN; static int const DELAY; + static int const LANGUAGE; }; @@ -63,6 +65,7 @@ public: void set_gain (double); void set_delay (int); + void set_language (boost::optional langauge); double gain () const { boost::mutex::scoped_lock lm (_mutex); @@ -74,6 +77,11 @@ public: return _delay; } + boost::optional language () const { + boost::mutex::scoped_lock lm (_mutex); + return _language; + } + std::string processing_description (std::shared_ptr film) const; std::vector streams () const { @@ -100,6 +108,7 @@ private: /** Delay to apply to audio (positive moves audio later) in milliseconds */ int _delay = 0; std::vector _streams; + boost::optional _language; }; #endif diff --git a/src/lib/film.cc b/src/lib/film.cc index 945559a49..7dd0ff6f1 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -752,6 +752,23 @@ Film::mapped_audio_channels () const } +vector +Film::audio_languages () const +{ + vector result; + for (auto i: content()) { + if (i->audio && !i->audio->mapping().mapped_output_channels().empty() && i->audio->language()) { + result.push_back (i->audio->language().get()); + } + } + + std::sort (result.begin(), result.end()); + auto last = std::unique (result.begin(), result.end()); + result.erase (last, result.end()); + return result; +} + + pair, vector> Film::subtitle_languages () const { @@ -889,7 +906,9 @@ Film::isdcf_name (bool if_created_now) const } } - auto const audio_language = dm.audio_language.empty() ? "XX" : dm.audio_language; + auto audio_langs = audio_languages(); + auto audio_language = (audio_langs.empty() || !audio_langs.front().language()) ? "XX" : audio_langs.front().language()->subtag(); + transform (audio_language.begin(), audio_language.end(), audio_language.begin(), ::toupper); d += "_" + audio_language; @@ -909,9 +928,9 @@ Film::isdcf_name (bool if_created_now) const } } - auto sublangs = subtitle_languages(); - if (sublangs.first && sublangs.first->language()) { - auto lang = sublangs.first->language()->subtag(); + auto sub_langs = subtitle_languages(); + if (sub_langs.first && sub_langs.first->language()) { + auto lang = sub_langs.first->language()->subtag(); if (burnt_in) { transform (lang.begin(), lang.end(), lang.begin(), ::tolower); } else { diff --git a/src/lib/film.h b/src/lib/film.h index 9feb5d0d3..6b50bba5e 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -184,6 +184,7 @@ public: std::list reels () const; std::list mapped_audio_channels () const; + std::vector audio_languages () const; std::pair, std::vector> subtitle_languages () const; std::string content_summary (dcpomatic::DCPTimePeriod period) const; @@ -239,7 +240,6 @@ public: DISTRIBUTOR, FACILITY, LUMINANCE, - SUBTITLE_LANGUAGES }; diff --git a/src/lib/isdcf_metadata.cc b/src/lib/isdcf_metadata.cc index 368b6e3a5..6adbd0f3c 100644 --- a/src/lib/isdcf_metadata.cc +++ b/src/lib/isdcf_metadata.cc @@ -35,7 +35,6 @@ using dcp::raw_convert; ISDCFMetadata::ISDCFMetadata (cxml::ConstNodePtr node) : content_version (node->number_child ("ContentVersion")) - , audio_language (node->string_child ("AudioLanguage")) , territory (node->string_child ("Territory")) , rating (node->string_child ("Rating")) , studio (node->string_child ("Studio")) @@ -55,7 +54,6 @@ void ISDCFMetadata::as_xml (xmlpp::Node* root) const { root->add_child("ContentVersion")->add_child_text (raw_convert (content_version)); - root->add_child("AudioLanguage")->add_child_text (audio_language); root->add_child("Territory")->add_child_text (territory); root->add_child("Rating")->add_child_text (rating); root->add_child("Studio")->add_child_text (studio); @@ -72,7 +70,6 @@ bool operator== (ISDCFMetadata const & a, ISDCFMetadata const & b) { return a.content_version == b.content_version && - a.audio_language == b.audio_language && a.territory == b.territory && a.rating == b.rating && a.studio == b.studio && diff --git a/src/lib/isdcf_metadata.h b/src/lib/isdcf_metadata.h index 0c70fb6bc..fd021b8dc 100644 --- a/src/lib/isdcf_metadata.h +++ b/src/lib/isdcf_metadata.h @@ -45,7 +45,6 @@ public: void read_old_metadata (std::string, std::string); int content_version; - std::string audio_language; std::string territory; std::string rating; std::string studio; diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 3448c5bca..0285255e0 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -706,13 +706,19 @@ Writer::write_cover_sheet (boost::filesystem::path output_dcp) boost::algorithm::replace_all (text, "$CPL_NAME", film()->name()); boost::algorithm::replace_all (text, "$TYPE", film()->dcp_content_type()->pretty_name()); boost::algorithm::replace_all (text, "$CONTAINER", film()->container()->container_nickname()); - boost::algorithm::replace_all (text, "$AUDIO_LANGUAGE", film()->isdcf_metadata().audio_language); + + auto audio_languages = film()->audio_languages(); + if (!audio_languages.empty()) { + boost::algorithm::replace_all (text, "$AUDIO_LANGUAGE", audio_languages.front().description()); + } else { + boost::algorithm::replace_all (text, "$AUDIO_LANGUAGE", _("None")); + } auto subtitle_languages = film()->subtitle_languages(); if (subtitle_languages.first) { boost::algorithm::replace_all (text, "$SUBTITLE_LANGUAGE", subtitle_languages.first->description()); } else { - boost::algorithm::replace_all (text, "$SUBTITLE_LANGUAGE", "None"); + boost::algorithm::replace_all (text, "$SUBTITLE_LANGUAGE", _("None")); } boost::uintmax_t size = 0; diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc index 59c9cd2a8..85ca19208 100644 --- a/src/wx/audio_panel.cc +++ b/src/wx/audio_panel.cc @@ -18,15 +18,17 @@ */ -#include "audio_panel.h" -#include "audio_mapping_view.h" -#include "wx_util.h" -#include "gain_calculator_dialog.h" -#include "content_panel.h" + #include "audio_dialog.h" -#include "static_text.h" +#include "audio_mapping_view.h" +#include "audio_panel.h" #include "check_box.h" +#include "content_panel.h" #include "dcpomatic_button.h" +#include "gain_calculator_dialog.h" +#include "language_tag_widget.h" +#include "static_text.h" +#include "wx_util.h" #include "lib/config.h" #include "lib/ffmpeg_audio_stream.h" #include "lib/ffmpeg_content.h" @@ -37,6 +39,7 @@ #include #include + using std::vector; using std::cout; using std::string; @@ -50,6 +53,7 @@ using boost::optional; using namespace boost::placeholders; #endif + AudioPanel::AudioPanel (ContentPanel* p) : ContentSubPanel (p, _("Audio")) , _audio_dialog (0) @@ -91,6 +95,9 @@ AudioPanel::AudioPanel (ContentPanel* p) /// TRANSLATORS: this is an abbreviation for milliseconds, the unit of time _delay_ms_label = create_label (this, _("ms"), false); + _enable_language = new wxCheckBox (this, wxID_ANY, _("Language")); + _language = new LanguageTagWidget (this, _("Language used for the dialogue in this content"), boost::none); + _mapping = new AudioMappingView (this, _("Content"), _("content"), _("DCP"), _("DCP")); _sizer->Add (_mapping, 1, wxEXPAND | wxALL, 6); @@ -111,6 +118,8 @@ AudioPanel::AudioPanel (ContentPanel* p) _reference->Bind (wxEVT_CHECKBOX, boost::bind (&AudioPanel::reference_clicked, this)); _show->Bind (wxEVT_BUTTON, boost::bind (&AudioPanel::show_clicked, this)); _gain_calculate_button->Bind (wxEVT_BUTTON, boost::bind (&AudioPanel::gain_calculate_button_clicked, this)); + _enable_language->Bind (wxEVT_CHECKBOX, boost::bind (&AudioPanel::enable_language_clicked, this)); + _language->Changed.connect (boost::bind(&AudioPanel::language_changed, this)); _mapping_connection = _mapping->Changed.connect (boost::bind (&AudioPanel::mapping_changed, this, _1)); _active_jobs_connection = JobManager::instance()->ActiveJobsChanged.connect (boost::bind (&AudioPanel::active_jobs_changed, this, _1, _2)); @@ -136,7 +145,7 @@ AudioPanel::add_to_grid () add_label_to_sizer (_grid, _gain_label, true, wxGBPosition(r, 0)); { auto s = new wxBoxSizer (wxHORIZONTAL); - s->Add (_gain->wrapped(), 1, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM | wxRIGHT, 6); + s->Add (_gain->wrapped(), 1, wxALIGN_CENTER_VERTICAL | wxRIGHT, DCPOMATIC_SIZER_GAP); s->Add (_gain_db_label, 0, wxALIGN_CENTER_VERTICAL); _grid->Add (s, wxGBPosition(r, 1)); } @@ -146,10 +155,16 @@ AudioPanel::add_to_grid () add_label_to_sizer (_grid, _delay_label, true, wxGBPosition(r, 0)); auto s = new wxBoxSizer (wxHORIZONTAL); - s->Add (_delay->wrapped(), 1, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM | wxRIGHT, 6); + s->Add (_delay->wrapped(), 1, wxALIGN_CENTER_VERTICAL | wxRIGHT, DCPOMATIC_SIZER_GAP); s->Add (_delay_ms_label, 0, wxALIGN_CENTER_VERTICAL); _grid->Add (s, wxGBPosition(r, 1)); ++r; + + s = new wxBoxSizer (wxHORIZONTAL); + s->Add (_enable_language, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, DCPOMATIC_SIZER_GAP); + s->Add (_language->sizer(), 1, wxALIGN_CENTER_VERTICAL | wxRIGHT); + _grid->Add (s, wxGBPosition(r, 0), wxGBSpan(1, 2), wxEXPAND); + ++r; } AudioPanel::~AudioPanel () @@ -229,6 +244,14 @@ AudioPanel::film_content_changed (int property) setup_sensitivity (); } else if (property == ContentProperty::VIDEO_FRAME_RATE) { setup_description (); + } else if (property == AudioContentProperty::LANGUAGE) { + if (ac.size() == 1 && ac.front()->audio->language()) { + _enable_language->SetValue (true); + _language->set (ac.front()->audio->language()); + } else { + _enable_language->SetValue (false); + _language->set (boost::none); + } } } @@ -294,6 +317,7 @@ AudioPanel::content_selection_changed () film_content_changed (AudioContentProperty::STREAMS); film_content_changed (AudioContentProperty::GAIN); + film_content_changed (AudioContentProperty::LANGUAGE); film_content_changed (DCPContentProperty::REFERENCE_AUDIO); setup_sensitivity (); @@ -336,6 +360,8 @@ AudioPanel::setup_sensitivity () _mapping->Enable (sel.size() == 1); _description->Enable (sel.size() == 1); } + + _language->enable (_enable_language->GetValue()); } void @@ -440,3 +466,25 @@ AudioPanel::set_film (shared_ptr) _audio_dialog = nullptr; } } + + +void +AudioPanel::enable_language_clicked () +{ + setup_sensitivity (); + auto sel = _parent->selected_audio (); + if (sel.size() == 1) { + sel.front()->audio->set_language (_enable_language->GetValue() ? _language->get() : boost::none); + } +} + + +void +AudioPanel::language_changed () +{ + auto sel = _parent->selected_audio (); + if (sel.size() == 1) { + sel.front()->audio->set_language (_language->get()); + } +} + diff --git a/src/wx/audio_panel.h b/src/wx/audio_panel.h index aee352a55..aef2f76ad 100644 --- a/src/wx/audio_panel.h +++ b/src/wx/audio_panel.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2015 Carl Hetherington + Copyright (C) 2012-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,16 +18,20 @@ */ + #include "lib/audio_mapping.h" #include "content_sub_panel.h" #include "content_widget.h" + class wxSpinCtrlDouble; class wxButton; class wxChoice; class wxStaticText; class AudioMappingView; class AudioDialog; +class LanguageTagWidget; + class AudioPanel : public ContentSubPanel { @@ -50,6 +54,8 @@ private: void setup_sensitivity (); void reference_clicked (); void add_to_grid (); + void enable_language_clicked (); + void language_changed (); boost::optional peak () const; wxCheckBox* _reference; @@ -63,6 +69,8 @@ private: wxStaticText* _delay_label; wxStaticText* _delay_ms_label; ContentSpinCtrl* _delay; + wxCheckBox* _enable_language = nullptr; + LanguageTagWidget* _language = nullptr; AudioMappingView* _mapping; wxStaticText* _description; AudioDialog* _audio_dialog; diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc index d098c5c95..8501eae9c 100644 --- a/src/wx/dcp_panel.cc +++ b/src/wx/dcp_panel.cc @@ -381,7 +381,6 @@ DCPPanel::film_changed (Film::Property p) break; } case Film::Property::ISDCF_METADATA: - case Film::Property::SUBTITLE_LANGUAGES: setup_dcp_name (); break; case Film::Property::VIDEO_FRAME_RATE: @@ -454,6 +453,7 @@ void DCPPanel::film_content_changed (int property) { if (property == AudioContentProperty::STREAMS || + property == AudioContentProperty::LANGUAGE || property == TextContentProperty::USE || property == TextContentProperty::BURN || property == TextContentProperty::LANGUAGE || diff --git a/src/wx/isdcf_metadata_dialog.cc b/src/wx/isdcf_metadata_dialog.cc index 2dcd85d3a..2fde930c6 100644 --- a/src/wx/isdcf_metadata_dialog.cc +++ b/src/wx/isdcf_metadata_dialog.cc @@ -38,9 +38,6 @@ ISDCFMetadataDialog::ISDCFMetadataDialog (wxWindow* parent, ISDCFMetadata dm, bo add (_("Content version"), true); _content_version = add (new wxSpinCtrl (this, wxID_ANY)); - add (_("Audio Language (e.g. EN)"), true); - _audio_language = add (new wxTextCtrl (this, wxID_ANY)); - add (_("Territory (e.g. UK)"), true); _territory = add (new wxTextCtrl (this, wxID_ANY)); @@ -78,7 +75,6 @@ ISDCFMetadataDialog::ISDCFMetadataDialog (wxWindow* parent, ISDCFMetadata dm, bo _content_version->SetRange (1, 1024); _content_version->SetValue (dm.content_version); - _audio_language->SetValue (std_to_wx (dm.audio_language)); _territory->SetValue (std_to_wx (dm.territory)); _rating->SetValue (std_to_wx (dm.rating)); _studio->SetValue (std_to_wx (dm.studio)); @@ -102,7 +98,6 @@ ISDCFMetadataDialog::isdcf_metadata () const ISDCFMetadata dm; dm.content_version = _content_version->GetValue (); - dm.audio_language = wx_to_std (_audio_language->GetValue ()); dm.territory = wx_to_std (_territory->GetValue ()); dm.rating = wx_to_std (_rating->GetValue ()); dm.studio = wx_to_std (_studio->GetValue ()); diff --git a/src/wx/isdcf_metadata_dialog.h b/src/wx/isdcf_metadata_dialog.h index 986449247..778009551 100644 --- a/src/wx/isdcf_metadata_dialog.h +++ b/src/wx/isdcf_metadata_dialog.h @@ -34,7 +34,6 @@ public: private: wxSpinCtrl* _content_version; - wxTextCtrl* _audio_language; wxTextCtrl* _territory; wxTextCtrl* _rating; wxTextCtrl* _studio; diff --git a/src/wx/smpte_metadata_dialog.cc b/src/wx/smpte_metadata_dialog.cc index 3c35a5c72..464da6710 100644 --- a/src/wx/smpte_metadata_dialog.cc +++ b/src/wx/smpte_metadata_dialog.cc @@ -76,14 +76,6 @@ SMPTEMetadataDialog::main_panel (wxWindow* parent) ); sizer->Add (_name_language->sizer(), 0, wxEXPAND); - add_label_to_sizer (sizer, panel, _("Audio language"), true, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL); - _audio_language = new LanguageTagWidget( - panel, - _("The main language that is spoken in the film's soundtrack"), - film()->audio_language() - ); - sizer->Add (_audio_language->sizer(), 0, wxEXPAND); - { int flags = wxALIGN_TOP | wxRIGHT | wxTOP; #ifdef __WXOSX__ @@ -227,7 +219,6 @@ SMPTEMetadataDialog::SMPTEMetadataDialog (wxWindow* parent, weak_ptr weak_ _luminance_unit->Append (_("foot lambert")); _name_language->Changed.connect (boost::bind(&SMPTEMetadataDialog::name_language_changed, this, _1)); - _audio_language->Changed.connect (boost::bind(&SMPTEMetadataDialog::audio_language_changed, this, _1)); _edit_release_territory->Bind (wxEVT_BUTTON, boost::bind(&SMPTEMetadataDialog::edit_release_territory, this)); _version_number->Bind (wxEVT_SPINCTRL, boost::bind(&SMPTEMetadataDialog::version_number_changed, this)); _status->Bind (wxEVT_CHOICE, boost::bind(&SMPTEMetadataDialog::status_changed, this)); @@ -254,7 +245,6 @@ SMPTEMetadataDialog::SMPTEMetadataDialog (wxWindow* parent, weak_ptr weak_ film_changed (ChangeType::DONE, Film::Property::FACILITY); film_changed (ChangeType::DONE, Film::Property::CONTENT_VERSIONS); film_changed (ChangeType::DONE, Film::Property::LUMINANCE); - film_changed (ChangeType::DONE, Film::Property::SUBTITLE_LANGUAGES); setup_sensitivity (); } @@ -360,13 +350,6 @@ SMPTEMetadataDialog::name_language_changed (dcp::LanguageTag tag) } -void -SMPTEMetadataDialog::audio_language_changed (dcp::LanguageTag tag) -{ - film()->set_audio_language (tag); -} - - void SMPTEMetadataDialog::edit_release_territory () { diff --git a/src/wx/smpte_metadata_dialog.h b/src/wx/smpte_metadata_dialog.h index 83c1ab39c..46272adbb 100644 --- a/src/wx/smpte_metadata_dialog.h +++ b/src/wx/smpte_metadata_dialog.h @@ -49,7 +49,6 @@ private: std::vector content_versions () const; void set_content_versions (std::vector v); void name_language_changed (dcp::LanguageTag tag); - void audio_language_changed (dcp::LanguageTag tag); void edit_release_territory (); void version_number_changed (); void status_changed (); @@ -65,7 +64,6 @@ private: void enable_facility_changed (); LanguageTagWidget* _name_language; - LanguageTagWidget* _audio_language; wxCheckBox* _enable_release_territory; /** The current release territory displayed in the UI; since we can't easily convert * the string in _release_territory_text to a RegionSubtag we just store the RegionSubtag diff --git a/test/data b/test/data index c488ee62e..451d2a5f0 160000 --- a/test/data +++ b/test/data @@ -1 +1 @@ -Subproject commit c488ee62e04b03b915dac49a258bd13d64f281e4 +Subproject commit 451d2a5f010df7b722475952e5a7a3db1d6d72e8 diff --git a/test/isdcf_name_test.cc b/test/isdcf_name_test.cc index 59d8ec1b0..dbac64a34 100644 --- a/test/isdcf_name_test.cc +++ b/test/isdcf_name_test.cc @@ -18,11 +18,13 @@ */ + /** @file test/isdcf_name_test.cc * @brief Test creation of ISDCF names. * @ingroup feature */ + #include #include "lib/film.h" #include "lib/ratio.h" @@ -37,8 +39,11 @@ #include "test.h" #include + using std::cout; using std::shared_ptr; +using std::make_shared; + BOOST_AUTO_TEST_CASE (isdcf_name_test) { @@ -50,21 +55,25 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test) film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); film->set_container (Ratio::from_id ("185")); film->_isdcf_date = boost::gregorian::date (2014, boost::gregorian::Jul, 4); + auto audio = content_factory("test/data/sine_440.wav").front(); + film->examine_and_add_content (audio); + BOOST_REQUIRE (!wait_for_jobs()); + BOOST_REQUIRE (audio->audio); + audio->audio->set_language(dcp::LanguageTag("en-US")); ISDCFMetadata m; m.content_version = 1; - m.audio_language = "EN"; m.territory = "UK"; m.rating = "PG"; m.studio = "ST"; m.facility = "FA"; film->set_isdcf_metadata (m); 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"); + BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilm_FTR-1_F_EN-XX_UK-PG_10_2K_ST_20140704_FA_IOP_OV"); /* Check that specifying no audio language writes XX */ - m.audio_language = ""; + audio->audio->set_language (boost::none); 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"); + BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilm_FTR-1_F_XX-XX_UK-PG_10_2K_ST_20140704_FA_IOP_OV"); /* Test a long name and some different data */ @@ -74,14 +83,18 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test) film->_isdcf_date = boost::gregorian::date (2014, boost::gregorian::Jul, 4); film->set_audio_channels (1); film->set_resolution (Resolution::FOUR_K); - shared_ptr text = content_factory("test/data/subrip.srt").front(); + auto text = content_factory("test/data/subrip.srt").front(); BOOST_REQUIRE_EQUAL (text->text.size(), 1U); text->text.front()->set_burn (true); text->text.front()->set_language (dcp::LanguageTag("fr-FR")); film->examine_and_add_content (text); BOOST_REQUIRE (!wait_for_jobs()); m.content_version = 2; - m.audio_language = "DE"; + audio = content_factory("test/data/sine_440.wav").front(); + film->examine_and_add_content (audio); + BOOST_REQUIRE (!wait_for_jobs()); + BOOST_REQUIRE (audio->audio); + audio->audio->set_language (dcp::LanguageTag("de-DE")); m.territory = "US"; m.rating = "R"; m.studio = "DI"; @@ -160,7 +173,7 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test) /* Test audio channel markup */ film->set_audio_channels (6); - shared_ptr sound (new FFmpegContent("test/data/sine_440.wav")); + auto sound = make_shared("test/data/sine_440.wav"); film->examine_and_add_content (sound); BOOST_REQUIRE (!wait_for_jobs()); BOOST_CHECK_EQUAL (film->isdcf_name(false), "LikeShouting_XSN-2_F-133_DE-fr_US-R_10_4K_DI_20140704_PP_SMPTE_OV"); -- 2.30.2