Allow specifying and writing sign language video language metadata (#2062). v2.15.157
authorCarl Hetherington <cth@carlh.net>
Wed, 4 Aug 2021 20:47:49 +0000 (22:47 +0200)
committerCarl Hetherington <cth@carlh.net>
Wed, 4 Aug 2021 20:47:49 +0000 (22:47 +0200)
cscript
src/lib/film.cc
src/lib/film.h
src/lib/writer.cc
src/wx/metadata_dialog.cc
src/wx/metadata_dialog.h

diff --git a/cscript b/cscript
index 997ef90d885b6d9e600269710a87e1736c0603c4..a1684858a6a510a26976bb65fba0121b4e422172 100644 (file)
--- a/cscript
+++ b/cscript
@@ -388,8 +388,8 @@ def dependencies(target, options):
         # Use distro-provided FFmpeg on Arch
         deps = []
 
-    deps.append(('libdcp', 'cc4445c'))
-    deps.append(('libsub', '0515e41'))
+    deps.append(('libdcp', '9bc5ced'))
+    deps.append(('libsub', '749c204'))
     deps.append(('leqm-nrt', '93ae9e6'))
     deps.append(('rtaudio', 'f619b76'))
     # We get our OpenSSL libraries from the environment, but we
index 44c49220b94f6836935d132341dc7ff7d23aabe8..acfea99918d0baeebc833deea4c759b218876dd4 100644 (file)
@@ -481,6 +481,9 @@ Film::metadata (bool with_content_paths) const
        if (_release_territory) {
                root->add_child("ReleaseTerritory")->add_child_text(_release_territory->subtag());
        }
+       if (_sign_language_video_language) {
+               root->add_child("SignLanguageVideoLanguage")->add_child_text(_sign_language_video_language->to_string());
+       }
        root->add_child("VersionNumber")->add_child_text(raw_convert<string>(_version_number));
        root->add_child("Status")->add_child_text(dcp::status_to_string(_status));
        if (_chain) {
@@ -662,6 +665,11 @@ Film::read_metadata (optional<boost::filesystem::path> path)
                _release_territory = dcp::LanguageTag::RegionSubtag (*release_territory);
        }
 
+       auto sign_language_video_language = f.optional_string_child("SignLanguageVideoLanguage");
+       if (sign_language_video_language) {
+               _sign_language_video_language = dcp::LanguageTag(*sign_language_video_language);
+       }
+
        _version_number = f.optional_number_child<int>("VersionNumber").get_value_or(0);
 
        auto status = f.optional_string_child("Status");
@@ -2145,3 +2153,18 @@ Film::set_audio_language (optional<dcp::LanguageTag> language)
        _audio_language = language;
 }
 
+
+bool
+Film::has_sign_language_video_channel () const
+{
+       return _audio_channels >= static_cast<int>(dcp::Channel::SIGN_LANGUAGE);
+}
+
+
+void
+Film::set_sign_language_video_language (optional<dcp::LanguageTag> lang)
+{
+       FilmChangeSignaller ch (this, Property::SIGN_LANGUAGE_VIDEO_LANGUAGE);
+       _sign_language_video_language = lang;
+}
+
index a2e0c8b60e6be2a198bd788365664879876491cc..85d06f64dcccbf980362dc9d528dd8c11797662c 100644 (file)
@@ -153,6 +153,8 @@ public:
        uint64_t required_disk_space () const;
        bool should_be_enough_disk_space (double& required, double& available, bool& can_hard_link) const;
 
+       bool has_sign_language_video_channel () const;
+
        /* Proxies for some Playlist methods */
 
        ContentList content () const;
@@ -240,6 +242,7 @@ public:
                NAME_LANGUAGE,
                AUDIO_LANGUAGE,
                RELEASE_TERRITORY,
+               SIGN_LANGUAGE_VIDEO_LANGUAGE,
                VERSION_NUMBER,
                STATUS,
                CHAIN,
@@ -356,6 +359,10 @@ public:
                return _release_territory;
        }
 
+       boost::optional<dcp::LanguageTag> sign_language_video_language () const {
+               return _sign_language_video_language;
+       }
+
        int version_number () const {
                return _version_number;
        }
@@ -434,6 +441,7 @@ public:
        void set_content_versions (std::vector<std::string> v);
        void set_name_language (dcp::LanguageTag lang);
        void set_release_territory (boost::optional<dcp::LanguageTag::RegionSubtag> region = boost::none);
+       void set_sign_language_video_language (boost::optional<dcp::LanguageTag> tag);
        void set_version_number (int v);
        void set_status (dcp::Status s);
        void set_chain (boost::optional<std::string> c = boost::none);
@@ -542,6 +550,7 @@ private:
        std::vector<std::string> _content_versions;
        dcp::LanguageTag _name_language;
        boost::optional<dcp::LanguageTag::RegionSubtag> _release_territory;
+       boost::optional<dcp::LanguageTag> _sign_language_video_language;
        int _version_number;
        dcp::Status _status;
        boost::optional<std::string> _chain;
index 6b80768752b0c3db80a2091aacad6b983c64135e..66239c537c9a2a1489950ed4076fe4a4a5249e79 100644 (file)
@@ -654,6 +654,9 @@ Writer::finish (boost::filesystem::path output_dcp)
        if (film()->luminance()) {
                cpl->set_luminance (*film()->luminance());
        }
+       if (film()->sign_language_video_language()) {
+               cpl->set_sign_language_video_language (*film()->sign_language_video_language());
+       }
 
        auto ac = film()->mapped_audio_channels();
        dcp::MCASoundField field = (
index 6054e3abcf26e476955f98efc35d25647917880e..899118902cf84deb3ac48116c037e597e6394eb6 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "dcpomatic_button.h"
 #include "full_language_tag_dialog.h"
+#include "language_tag_widget.h"
 #include "metadata_dialog.h"
 #include "wx_util.h"
 #include "lib/film.h"
@@ -73,6 +74,7 @@ MetadataDialog::setup ()
        overall_sizer->Layout ();
        overall_sizer->SetSizeHints (this);
 
+       _sign_language_video_language->Changed.connect (boost::bind(&MetadataDialog::sign_language_video_language_changed, this));
        _edit_release_territory->Bind (wxEVT_BUTTON, boost::bind(&MetadataDialog::edit_release_territory, this));
        _enable_release_territory->Bind (wxEVT_CHECKBOX, boost::bind(&MetadataDialog::enable_release_territory_changed, this));
        _enable_facility->Bind (wxEVT_CHECKBOX, boost::bind(&MetadataDialog::enable_facility_changed, this));
@@ -92,6 +94,7 @@ MetadataDialog::setup ()
        _film_changed_connection = film()->Change.connect(boost::bind(&MetadataDialog::film_changed, this, _1, _2));
 
        film_changed (ChangeType::DONE, Film::Property::RELEASE_TERRITORY);
+       film_changed (ChangeType::DONE, Film::Property::SIGN_LANGUAGE_VIDEO_LANGUAGE);
        film_changed (ChangeType::DONE, Film::Property::FACILITY);
        film_changed (ChangeType::DONE, Film::Property::STUDIO);
        film_changed (ChangeType::DONE, Film::Property::TEMP_VERSION);
@@ -112,7 +115,9 @@ MetadataDialog::film_changed (ChangeType type, Film::Property property)
                return;
        }
 
-       if (property == Film::Property::RELEASE_TERRITORY) {
+       if (property == Film::Property::SIGN_LANGUAGE_VIDEO_LANGUAGE) {
+               _sign_language_video_language->set (film()->sign_language_video_language());
+       } else if (property == Film::Property::RELEASE_TERRITORY) {
                auto rt = film()->release_territory();
                checked_set (_enable_release_territory, static_cast<bool>(rt));
                if (rt) {
@@ -196,6 +201,7 @@ MetadataDialog::edit_release_territory ()
 void
 MetadataDialog::setup_sensitivity ()
 {
+       _sign_language_video_language->enable (film()->has_sign_language_video_channel());
        auto const enabled = _enable_release_territory->GetValue();
        _release_territory_text->Enable (enabled);
        _edit_release_territory->Enable (enabled);
@@ -222,6 +228,10 @@ MetadataDialog::enable_release_territory_changed ()
 void
 MetadataDialog::setup_advanced (wxPanel* panel, wxSizer* sizer)
 {
+       add_label_to_sizer (sizer, panel, _("Sign language video language"), true, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT);
+       _sign_language_video_language = new LanguageTagWidget (panel, _("Language used for any sign language video track"), {}, {});
+       sizer->Add (_sign_language_video_language->sizer(), 1, wxEXPAND);
+
        _enable_facility = new wxCheckBox (panel, wxID_ANY, _("Facility"));
        sizer->Add (_enable_facility, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL);
        _facility = new wxTextCtrl (panel, wxID_ANY);
@@ -387,3 +397,10 @@ MetadataDialog::luminance_changed ()
        film()->set_luminance (dcp::Luminance(_luminance_value->GetValue(), unit));
 }
 
+
+void
+MetadataDialog::sign_language_video_language_changed ()
+{
+       film()->set_sign_language_video_language(_sign_language_video_language->get());
+}
+
index 7c4471e59ed6482cc9f6148dc5338bc036e99896..a6f5cefda10d0449d0070450c1c052e841b433cd 100644 (file)
@@ -34,6 +34,7 @@ DCPOMATIC_ENABLE_WARNINGS
 
 class Button;
 class wxSpinCtrlDouble;
+class LanguageTagWidget;
 
 
 class MetadataDialog : public wxDialog, public WeakFilm
@@ -50,6 +51,7 @@ protected:
        virtual void setup_sensitivity ();
 
 private:
+       void sign_language_video_language_changed ();
        void edit_release_territory ();
        void enable_release_territory_changed ();
        void facility_changed ();
@@ -73,6 +75,7 @@ private:
        boost::optional<dcp::LanguageTag::RegionSubtag> _release_territory;
        wxStaticText* _release_territory_text;
        Button* _edit_release_territory;
+       LanguageTagWidget* _sign_language_video_language = nullptr;
        wxCheckBox* _enable_facility;
        wxTextCtrl* _facility;
        wxCheckBox* _enable_chain;