Add language to audio content and use it instead of the general metadata.
authorCarl Hetherington <cth@carlh.net>
Fri, 2 Apr 2021 08:47:35 +0000 (10:47 +0200)
committerCarl Hetherington <cth@carlh.net>
Fri, 2 Apr 2021 08:47:35 +0000 (10:47 +0200)
16 files changed:
src/lib/audio_content.cc
src/lib/audio_content.h
src/lib/film.cc
src/lib/film.h
src/lib/isdcf_metadata.cc
src/lib/isdcf_metadata.h
src/lib/writer.cc
src/wx/audio_panel.cc
src/wx/audio_panel.h
src/wx/dcp_panel.cc
src/wx/isdcf_metadata_dialog.cc
src/wx/isdcf_metadata_dialog.h
src/wx/smpte_metadata_dialog.cc
src/wx/smpte_metadata_dialog.h
test/data
test/isdcf_name_test.cc

index 748cbb7d0d6403b487ec540abd2ab2e8768b3d66..3d9f6ac051ca9fa102daf1adffc42e8291bc89f9 100644 (file)
@@ -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<double> ("AudioGain");
        _delay = node->number_child<int> ("AudioDelay");
+       auto lang = node->optional_node_child ("Language");
+       if (lang) {
+               _language = dcp::LanguageTag (lang->content());
+       }
 
        /* Backwards compatibility */
        auto r = node->optional_number_child<double>("AudioVideoFrameRate");
@@ -112,11 +117,16 @@ AudioContent::AudioContent (Content* parent, vector<shared_ptr<Content> > 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<string>(_gain));
        node->add_child("AudioDelay")->add_child_text(raw_convert<string>(_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<dcp::LanguageTag> language)
+{
+       maybe_set (_language, language, AudioContentProperty::LANGUAGE);
+}
+
+
 string
 AudioContent::technical_summary () const
 {
index 67183d0a45b517887ea0f4625894f2adaa1dfc33..adb5c9556151e0aa02d876374042e8b6cd3f2b8b 100644 (file)
@@ -31,6 +31,7 @@
 #include "content_part.h"
 #include "audio_stream.h"
 #include "audio_mapping.h"
+#include <dcp/language_tag.h>
 
 
 /** @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<dcp::LanguageTag> langauge);
 
        double gain () const {
                boost::mutex::scoped_lock lm (_mutex);
@@ -74,6 +77,11 @@ public:
                return _delay;
        }
 
+       boost::optional<dcp::LanguageTag> language () const {
+               boost::mutex::scoped_lock lm (_mutex);
+               return _language;
+       }
+
        std::string processing_description (std::shared_ptr<const Film> film) const;
 
        std::vector<AudioStreamPtr> streams () const {
@@ -100,6 +108,7 @@ private:
        /** Delay to apply to audio (positive moves audio later) in milliseconds */
        int _delay = 0;
        std::vector<AudioStreamPtr> _streams;
+       boost::optional<dcp::LanguageTag> _language;
 };
 
 #endif
index 945559a49a05dd8610a4fef1ef1d7eb6983daa01..7dd0ff6f158273fbceca4f204fbdffc04c19d29f 100644 (file)
@@ -752,6 +752,23 @@ Film::mapped_audio_channels () const
 }
 
 
+vector<dcp::LanguageTag>
+Film::audio_languages () const
+{
+       vector<dcp::LanguageTag> 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<optional<dcp::LanguageTag>, vector<dcp::LanguageTag>>
 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 {
index 9feb5d0d3d7d466c5566d4918126726c1123d881..6b50bba5e9759a2ffd39e83dce4f988863bb3451 100644 (file)
@@ -184,6 +184,7 @@ public:
 
        std::list<dcpomatic::DCPTimePeriod> reels () const;
        std::list<int> mapped_audio_channels () const;
+       std::vector<dcp::LanguageTag> audio_languages () const;
        std::pair<boost::optional<dcp::LanguageTag>, std::vector<dcp::LanguageTag>> subtitle_languages () const;
 
        std::string content_summary (dcpomatic::DCPTimePeriod period) const;
@@ -239,7 +240,6 @@ public:
                DISTRIBUTOR,
                FACILITY,
                LUMINANCE,
-               SUBTITLE_LANGUAGES
        };
 
 
index 368b6e3a52c90225a407eeb63d807f3f3bafce5d..6adbd0f3c95603e1ca9c28a9277c908ddf525530 100644 (file)
@@ -35,7 +35,6 @@ using dcp::raw_convert;
 
 ISDCFMetadata::ISDCFMetadata (cxml::ConstNodePtr node)
        : content_version (node->number_child<int> ("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<string> (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 &&
index 0c70fb6bc49666a3ba63626de4a939ff9514e41d..fd021b8dc7818231aed2a2e7a5272c056b546666 100644 (file)
@@ -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;
index 3448c5bcad1b5d33ab47be94c336148d496c0430..0285255e0d03be981101c40c0cb3770b5879d3e2 100644 (file)
@@ -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;
index 59c9cd2a898549a5e07d71ba6ad8cb8a4ffe0bb4..85ca19208f1429b86c91212bca7a999ff33ed603 100644 (file)
 
 */
 
-#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 <wx/spinctrl.h>
 #include <iostream>
 
+
 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<Film>)
                _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());
+       }
+}
+
index aee352a55952649c1282cd9ee15265e0a4c164fe..aef2f76ad4ac33906bcff4c26d51678a7402980c 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
+
 #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<float> peak () const;
 
        wxCheckBox* _reference;
@@ -63,6 +69,8 @@ private:
        wxStaticText* _delay_label;
        wxStaticText* _delay_ms_label;
        ContentSpinCtrl<AudioContent>* _delay;
+       wxCheckBox* _enable_language = nullptr;
+       LanguageTagWidget* _language = nullptr;
        AudioMappingView* _mapping;
        wxStaticText* _description;
        AudioDialog* _audio_dialog;
index d098c5c950e975319f79950b5f87d195efbfc56b..8501eae9ce8b62909297f7b0c7a4e61d6e4976df 100644 (file)
@@ -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 ||
index 2dcd85d3a287fa5b8ee398e0cfb2510601362e8f..2fde930c6b8fd04e58ceeaa020384dc28fe3a37d 100644 (file)
@@ -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 ());
index 9864492473a745feaa5691809b8af979beeb77c0..7780095514eb77ea744c8a037199d254230fc65a 100644 (file)
@@ -34,7 +34,6 @@ public:
 
 private:
        wxSpinCtrl* _content_version;
-       wxTextCtrl* _audio_language;
        wxTextCtrl* _territory;
        wxTextCtrl* _rating;
        wxTextCtrl* _studio;
index 3c35a5c7298c356e3211ceaf72c5a898bbb9bc2f..464da6710b71ecc4f4cc57204b1987e2e98065db 100644 (file)
@@ -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<Film> 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<Film> 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 ()
 {
index 83c1ab39cde3feeceb5005f72f089e7fba2b972c..46272adbb17b433606a42e067fcc4a5b212c6b07 100644 (file)
@@ -49,7 +49,6 @@ private:
        std::vector<std::string> content_versions () const;
        void set_content_versions (std::vector<std::string> 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
index c488ee62e04b03b915dac49a258bd13d64f281e4..451d2a5f010df7b722475952e5a7a3db1d6d72e8 160000 (submodule)
--- a/test/data
+++ b/test/data
@@ -1 +1 @@
-Subproject commit c488ee62e04b03b915dac49a258bd13d64f281e4
+Subproject commit 451d2a5f010df7b722475952e5a7a3db1d6d72e8
index 59d8ec1b02644559bc176d55b7f11e840d8ec654..dbac64a34c61b07ee2278adfdaef63887e50e908 100644 (file)
 
 */
 
+
 /** @file  test/isdcf_name_test.cc
  *  @brief Test creation of ISDCF names.
  *  @ingroup feature
  */
 
+
 #include <boost/test/unit_test.hpp>
 #include "lib/film.h"
 #include "lib/ratio.h"
 #include "test.h"
 #include <iostream>
 
+
 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<Content> 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<FFmpegContent> sound (new FFmpegContent("test/data/sine_440.wav"));
+       auto sound = make_shared<FFmpegContent>("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");