Put audio language back in the Film.
authorCarl Hetherington <cth@carlh.net>
Tue, 1 Jun 2021 09:28:48 +0000 (11:28 +0200)
committerCarl Hetherington <cth@carlh.net>
Tue, 1 Jun 2021 12:25:17 +0000 (14:25 +0200)
It feels neat to have audio language in the audio tab, to match
the subtitle language in the subtitle tab.  It also avoids the potential
confusion of there being an audio language setting in the DCP metadata
but no subtitle language setting.  However:

- I am yet to find a need to describe multiple audio languages in the
same DCP (all previous users of Film::audio_languages() were just taking
the first language off the list).

- As Carsten points out it's fiddly to have to set the audio language
for 5 separate-channel WAV files, for example (you wouldn't actually
have had to do this, but it would have felt like you did).

I think subtitle language remains neater where it is (per-content)
as there is this additional subtitle language metadata and it makes
much more sense (and is much more likely) that there are multiple
subtitle languages in a DCP than it does multiple audio languages.

12 files changed:
src/lib/audio_content.cc
src/lib/audio_content.h
src/lib/dcp_content.cc
src/lib/film.cc
src/lib/film.h
src/lib/reel_writer.cc
src/lib/writer.cc
src/wx/audio_panel.cc
src/wx/audio_panel.h
src/wx/dcp_panel.cc
src/wx/dcp_panel.h
test/isdcf_name_test.cc

index 3d9f6ac051ca9fa102daf1adffc42e8291bc89f9..748cbb7d0d6403b487ec540abd2ab2e8768b3d66 100644 (file)
@@ -52,7 +52,6 @@ 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)
@@ -90,10 +89,6 @@ 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");
@@ -117,16 +112,11 @@ 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 ();
 }
 
 
@@ -136,9 +126,6 @@ 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());
-       }
 }
 
 
@@ -156,13 +143,6 @@ 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 adb5c9556151e0aa02d876374042e8b6cd3f2b8b..67183d0a45b517887ea0f4625894f2adaa1dfc33 100644 (file)
@@ -31,7 +31,6 @@
 #include "content_part.h"
 #include "audio_stream.h"
 #include "audio_mapping.h"
-#include <dcp/language_tag.h>
 
 
 /** @class AudioContentProperty
@@ -43,7 +42,6 @@ public:
        static int const STREAMS;
        static int const GAIN;
        static int const DELAY;
-       static int const LANGUAGE;
 };
 
 
@@ -65,7 +63,6 @@ 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);
@@ -77,11 +74,6 @@ 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 {
@@ -108,7 +100,6 @@ 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 f6a74501c7cae8b13102e0f9a586bd9bd08d90cf..c380e6f84e2ab84f42cb2ee4fc25b3d42f1dd25b 100644 (file)
@@ -242,7 +242,6 @@ DCPContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
                        boost::mutex::scoped_lock lm (_mutex);
                        audio = make_shared<AudioContent>(this);
                }
-               audio->set_language (examiner->audio_language());
                auto as = make_shared<AudioStream>(examiner->audio_frame_rate(), examiner->audio_length(), examiner->audio_channels());
                audio->set_stream (as);
                auto m = as->mapping ();
index 62cbf0e5095458699f79f1697c5917ad7d1487ac..44c49220b94f6836935d132341dc7ff7d23aabe8 100644 (file)
@@ -505,6 +505,9 @@ Film::metadata (bool with_content_paths) const
        }
        root->add_child("UserExplicitContainer")->add_child_text(_user_explicit_container ? "1" : "0");
        root->add_child("UserExplicitResolution")->add_child_text(_user_explicit_resolution ? "1" : "0");
+       if (_audio_language) {
+               root->add_child("AudioLanguage")->add_child_text(_audio_language->to_string());
+       }
        _playlist->as_xml (root->add_child ("Playlist"), with_content_paths);
 
        return doc;
@@ -685,6 +688,11 @@ Film::read_metadata (optional<boost::filesystem::path> path)
        _user_explicit_container = f.optional_bool_child("UserExplicitContainer").get_value_or(true);
        _user_explicit_resolution = f.optional_bool_child("UserExplicitResolution").get_value_or(true);
 
+       auto audio_language = f.optional_string_child("AudioLanguage");
+       if (audio_language) {
+               _audio_language = dcp::LanguageTag(*audio_language);
+       }
+
        list<string> notes;
        _playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"), _state_version, notes);
 
@@ -760,23 +768,6 @@ 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
 {
@@ -922,8 +913,7 @@ Film::isdcf_name (bool if_created_now) const
                }
        }
 
-       auto audio_langs = audio_languages();
-       auto audio_language = (audio_langs.empty() || !audio_langs.front().language()) ? "XX" : audio_langs.front().language()->subtag();
+       auto audio_language = (_audio_language && _audio_language->language()) ? _audio_language->language()->subtag() : "XX";
 
        d += "_" + to_upper (audio_language);
 
@@ -2147,3 +2137,11 @@ Film::set_two_d_version_of_three_d (bool t)
        _two_d_version_of_three_d = t;
 }
 
+
+void
+Film::set_audio_language (optional<dcp::LanguageTag> language)
+{
+       FilmChangeSignaller ch (this, Property::AUDIO_LANGUAGE);
+       _audio_language = language;
+}
+
index bb868ffad346c7fa2436191e6152f6570486b2d8..d46f5e6b7a5061e51febe67cdf7c722170263918 100644 (file)
@@ -186,7 +186,11 @@ public:
 
        std::list<dcpomatic::DCPTimePeriod> reels () const;
        std::list<int> mapped_audio_channels () const;
-       std::vector<dcp::LanguageTag> audio_languages () const;
+
+       boost::optional<dcp::LanguageTag> audio_language () const {
+               return _audio_language;
+       }
+
        std::pair<boost::optional<dcp::LanguageTag>, std::vector<dcp::LanguageTag>> subtitle_languages () const;
 
        std::string content_summary (dcpomatic::DCPTimePeriod period) const;
@@ -395,6 +399,7 @@ public:
                return _luminance;
        }
 
+
        /* SET */
 
        void set_directory (boost::filesystem::path);
@@ -439,6 +444,7 @@ public:
        void set_two_d_version_of_three_d (bool t);
        void set_distributor (boost::optional<std::string> d = boost::none);
        void set_luminance (boost::optional<dcp::Luminance> l = boost::none);
+       void set_audio_language (boost::optional<dcp::LanguageTag> language);
 
        void add_ffoc_lfoc (Markers& markers) const;
 
@@ -546,6 +552,7 @@ private:
        bool _red_band = false;
        bool _two_d_version_of_three_d = false;
        boost::optional<dcp::Luminance> _luminance;
+       boost::optional<dcp::LanguageTag> _audio_language;
 
        int _state_version;
 
index 0b367ae38581a15649b9e3eef7de8c545561c1cf..521ba55df891f226393fdb7a6d12e5b139ebe6de 100644 (file)
@@ -168,12 +168,12 @@ ReelWriter::ReelWriter (
        }
 
        if (film()->audio_channels()) {
-               auto langs = film()->audio_languages();
+               auto lang = film()->audio_language();
                _sound_asset = make_shared<dcp::SoundAsset> (
                        dcp::Fraction(film()->video_frame_rate(), 1),
                        film()->audio_frame_rate(),
                        film()->audio_channels(),
-                       langs.empty() ? dcp::LanguageTag("en-US") : langs.front(),
+                       lang ? *lang : dcp::LanguageTag("en-US"),
                        standard
                        );
 
index bc299414bb8e72975e8399ee0ebc166041ed986a..3d8d9fe78ec37e79a93563bf800d29e1c487402c 100644 (file)
@@ -718,9 +718,9 @@ Writer::write_cover_sheet (boost::filesystem::path output_dcp)
        boost::algorithm::replace_all (text, "$TYPE", film()->dcp_content_type()->pretty_name());
        boost::algorithm::replace_all (text, "$CONTAINER", film()->container()->container_nickname());
 
-       auto audio_languages = film()->audio_languages();
-       if (!audio_languages.empty()) {
-               boost::algorithm::replace_all (text, "$AUDIO_LANGUAGE", audio_languages.front().description());
+       auto audio_language = film()->audio_language();
+       if (audio_language) {
+               boost::algorithm::replace_all (text, "$AUDIO_LANGUAGE", audio_language->description());
        } else {
                boost::algorithm::replace_all (text, "$AUDIO_LANGUAGE", _("None"));
        }
index ff710b1d1183e2170e14dd8a211197472d664228..a77922ed20a8d4475affcfb2eb460864cb231436 100644 (file)
@@ -26,7 +26,6 @@
 #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"
@@ -95,9 +94,6 @@ 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);
 
@@ -118,8 +114,6 @@ 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));
@@ -159,12 +153,6 @@ AudioPanel::add_to_grid ()
        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 ()
@@ -244,14 +232,6 @@ 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);
-               }
        }
 }
 
@@ -317,7 +297,6 @@ 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 ();
@@ -353,8 +332,6 @@ AudioPanel::setup_sensitivity ()
        _delay->wrapped()->Enable (!ref);
        _mapping->Enable (!ref && single);
        _description->Enable (!ref && single);
-       _enable_language->Enable (!ref && single);
-       _language->enable (!ref && single && _enable_language->GetValue());
 }
 
 void
@@ -460,24 +437,3 @@ AudioPanel::set_film (shared_ptr<Film>)
        }
 }
 
-
-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 aef2f76ad4ac33906bcff4c26d51678a7402980c..0ae9da88efa9a077d786d61db1409d861b377dec 100644 (file)
@@ -54,8 +54,6 @@ 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;
@@ -69,8 +67,6 @@ 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 3ea3479857436b7934e608fed1c323d5b72407bf..54db2632fcc86c4a40aef69cb5646a152978ab70 100644 (file)
@@ -27,6 +27,7 @@
 #include "dcpomatic_spin_ctrl.h"
 #include "focus_manager.h"
 #include "interop_metadata_dialog.h"
+#include "language_tag_dialog.h"
 #include "markers_dialog.h"
 #include "smpte_metadata_dialog.h"
 #include "static_text.h"
@@ -94,6 +95,10 @@ DCPPanel::DCPPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmViewer> v
                wxALIGN_CENTRE_HORIZONTAL | wxST_NO_AUTORESIZE | wxST_ELLIPSIZE_MIDDLE
                );
 
+       _enable_audio_language = new wxCheckBox (_panel, wxID_ANY, _("Audio language"));
+       _audio_language = new wxStaticText (_panel, wxID_ANY, wxT(""));
+       _edit_audio_language = new Button (_panel, _("Edit..."));
+
        _dcp_content_type_label = create_label (_panel, _("Content Type"), true);
        _dcp_content_type = new wxChoice (_panel, wxID_ANY);
 
@@ -132,6 +137,8 @@ DCPPanel::DCPPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmViewer> v
        _standard->Bind              (wxEVT_CHOICE,   boost::bind(&DCPPanel::standard_changed, this));
        _markers->Bind               (wxEVT_BUTTON,   boost::bind(&DCPPanel::markers_clicked, this));
        _metadata->Bind              (wxEVT_BUTTON,   boost::bind(&DCPPanel::metadata_clicked, this));
+       _enable_audio_language->Bind (wxEVT_CHECKBOX, boost::bind(&DCPPanel::enable_audio_language_toggled, this));
+       _edit_audio_language->Bind   (wxEVT_BUTTON,   boost::bind(&DCPPanel::edit_audio_language_clicked, this));
 
        for (auto i: DCPContentType::all()) {
                _dcp_content_type->Append (std_to_wx(i->pretty_name()));
@@ -179,6 +186,15 @@ DCPPanel::add_to_grid ()
        _grid->Add (_dcp_name, wxGBPosition(r, 0), wxGBSpan(1, 2), wxALIGN_CENTER_VERTICAL | wxEXPAND);
        ++r;
 
+       {
+               auto s = new wxBoxSizer (wxHORIZONTAL);
+               s->Add (_enable_audio_language, 0, wxALIGN_CENTER_VERTICAL);
+               s->Add (_audio_language, 1, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, DCPOMATIC_SIZER_GAP);
+               s->Add (_edit_audio_language, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, DCPOMATIC_SIZER_GAP);
+               _grid->Add (s, wxGBPosition(r, 0), wxGBSpan(1, 2), wxEXPAND | wxALIGN_CENTER_VERTICAL);
+       }
+       ++r;
+
        add_label_to_sizer (_grid, _dcp_content_type_label, true, wxGBPosition(r, 0));
        _grid->Add (_dcp_content_type, wxGBPosition(r, 1));
        ++r;
@@ -453,6 +469,15 @@ DCPPanel::film_changed (Film::Property p)
                setup_dcp_name ();
                setup_sensitivity ();
                break;
+       case Film::Property::AUDIO_LANGUAGE:
+       {
+               auto al = _film->audio_language();
+               checked_set (_enable_audio_language, static_cast<bool>(al));
+               checked_set (_audio_language, al ? std_to_wx(al->to_string()) : wxT(""));
+               setup_dcp_name ();
+               setup_sensitivity ();
+               break;
+       }
        case Film::Property::CONTENT_VERSIONS:
        case Film::Property::VERSION_NUMBER:
        case Film::Property::RELEASE_TERRITORY:
@@ -477,7 +502,6 @@ void
 DCPPanel::film_content_changed (int property)
 {
        if (property == AudioContentProperty::STREAMS ||
-           property == AudioContentProperty::LANGUAGE ||
            property == TextContentProperty::USE ||
            property == TextContentProperty::BURN ||
            property == TextContentProperty::LANGUAGE ||
@@ -597,6 +621,7 @@ DCPPanel::set_film (shared_ptr<Film> film)
        film_changed (Film::Property::REEL_TYPE);
        film_changed (Film::Property::REEL_LENGTH);
        film_changed (Film::Property::REENCODE_J2K);
+       film_changed (Film::Property::AUDIO_LANGUAGE);
 
        set_general_sensitivity(static_cast<bool>(_film));
 }
@@ -617,6 +642,9 @@ DCPPanel::setup_sensitivity ()
        _use_isdcf_name->Enable         (_generally_sensitive);
        _dcp_content_type->Enable       (_generally_sensitive);
        _copy_isdcf_name_button->Enable (_generally_sensitive);
+       _enable_audio_language->Enable  (_generally_sensitive);
+       _audio_language->Enable         (_enable_audio_language->GetValue());
+       _edit_audio_language->Enable    (_enable_audio_language->GetValue());
        _encrypted->Enable              (_generally_sensitive);
        _reel_type->Enable              (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->references_dcp_audio());
        _reel_length->Enable            (_generally_sensitive && _film && _film->reel_type() == ReelType::BY_LENGTH);
@@ -964,3 +992,28 @@ DCPPanel::add_audio_processors ()
        }
        _audio_panel_sizer->Layout();
 }
+
+
+void
+DCPPanel::enable_audio_language_toggled ()
+{
+       setup_sensitivity ();
+       if (_enable_audio_language->GetValue()) {
+               auto al = wx_to_std (_audio_language->GetLabel());
+               _film->set_audio_language (al.empty() ? dcp::LanguageTag("en-US") : dcp::LanguageTag(al));
+       } else {
+               _film->set_audio_language (boost::none);
+       }
+}
+
+
+void
+DCPPanel::edit_audio_language_clicked ()
+{
+       DCPOMATIC_ASSERT (_film->audio_language());
+       auto d = new LanguageTagDialog (_panel, *_film->audio_language());
+       d->ShowModal ();
+       _film->set_audio_language(d->get());
+       d->Destroy ();
+}
+
index dc5e9bcbf4f25bdda64d9c66679e34410c9db462..9da7a692989074821dacd99114e9d5071ea99b65 100644 (file)
@@ -23,6 +23,7 @@
 #include "lib/film.h"
 
 
+class Button;
 class wxNotebook;
 class wxPanel;
 class wxBoxSizer;
@@ -85,6 +86,8 @@ private:
        void markers_clicked ();
        void metadata_clicked ();
        void reencode_j2k_changed ();
+       void enable_audio_language_toggled ();
+       void edit_audio_language_clicked ();
 
        void setup_frame_rate_widget ();
        void setup_container ();
@@ -115,6 +118,9 @@ private:
        wxTextCtrl* _name;
        wxStaticText* _dcp_name;
        wxCheckBox* _use_isdcf_name;
+       wxCheckBox* _enable_audio_language = nullptr;
+       wxStaticText* _audio_language = nullptr;
+       Button* _edit_audio_language = nullptr;
        wxStaticText* _container_label;
        wxChoice* _container;
        wxStaticText* _container_size;
index 8fc2c8f643e9c4fbff692001c834e87439d82632..28df9b2b933a6a9fc49274469b8b69da92b382ab 100644 (file)
@@ -59,8 +59,7 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test)
        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"));
+       film->set_audio_language(dcp::LanguageTag("en-US"));
        film->set_content_versions({"1"});
        film->set_release_territory(dcp::LanguageTag::RegionSubtag("GB"));
        film->set_ratings({dcp::Rating("BBFC", "PG")});
@@ -70,7 +69,7 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test)
        BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilm_FTR-1_F_EN-XX_GB-PG_10_2K_ST_20140704_FAC_IOP_OV");
 
        /* Check that specifying no audio language writes XX */
-       audio->audio->set_language (boost::none);
+       film->set_audio_language (boost::none);
        BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilm_FTR-1_F_XX-XX_GB-PG_10_2K_ST_20140704_FAC_IOP_OV");
 
        /* Test a long name and some different data */
@@ -95,8 +94,7 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test)
        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"));
+       film->set_audio_language (dcp::LanguageTag("de-DE"));
        film->set_interop (false);
        BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_TLR-2_S_DE-fr_US-R_MOS_4K_DI_20140704_PPF_SMPTE_OV");