Move some ISDCF flags to the Interop/SMPTE metadata.
authorCarl Hetherington <cth@carlh.net>
Fri, 2 Apr 2021 23:10:20 +0000 (01:10 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 4 Apr 2021 18:48:35 +0000 (20:48 +0200)
src/lib/film.cc
src/lib/film.h
src/lib/isdcf_metadata.cc
src/lib/isdcf_metadata.h
src/wx/dcp_panel.cc
src/wx/full_config_dialog.cc
src/wx/isdcf_metadata_dialog.cc
src/wx/isdcf_metadata_dialog.h
src/wx/metadata_dialog.cc
src/wx/metadata_dialog.h
test/isdcf_name_test.cc

index 1275c571b8b9fb47d92a2a38a57b6749778c7ed7..9857dc1f1adea434d099ad809fcb703c92b153ba 100644 (file)
@@ -493,6 +493,10 @@ Film::metadata (bool with_content_paths) const
        if (_studio) {
                root->add_child("Studio")->add_child_text(*_studio);
        }
+       root->add_child("TempVersion")->add_child_text(_temp_version ? "1" : "0");
+       root->add_child("PreRelease")->add_child_text(_pre_release ? "1" : "0");
+       root->add_child("RedBand")->add_child_text(_red_band ? "1" : "0");
+       root->add_child("TwoDVersionOfThreeD")->add_child_text(_two_d_version_of_three_d ? "1" : "0");
        if (_luminance) {
                root->add_child("LuminanceValue")->add_child_text(raw_convert<string>(_luminance->value()));
                root->add_child("LuminanceUnit")->add_child_text(dcp::Luminance::unit_to_string(_luminance->unit()));
@@ -670,6 +674,10 @@ Film::read_metadata (optional<boost::filesystem::path> path)
        _distributor = f.optional_string_child("Distributor");
        _facility = f.optional_string_child("Facility");
        _studio = f.optional_string_child("Studio");
+       _temp_version = f.optional_bool_child("TempVersion").get_value_or(false);
+       _pre_release = f.optional_bool_child("PreRelease").get_value_or(false);
+       _red_band = f.optional_bool_child("RedBand").get_value_or(false);
+       _two_d_version_of_three_d = f.optional_bool_child("TwoDVersionOfThreeD").get_value_or(false);
 
        auto value = f.optional_number_child<float>("LuminanceValue");
        auto unit = f.optional_string_child("LuminanceUnit");
@@ -866,15 +874,15 @@ Film::isdcf_name (bool if_created_now) const
 
        auto const dm = isdcf_metadata ();
 
-       if (dm.temp_version) {
+       if (_temp_version) {
                d += "-Temp";
        }
 
-       if (dm.pre_release) {
+       if (_pre_release) {
                d += "-Pre";
        }
 
-       if (dm.red_band) {
+       if (_red_band) {
                d += "-RedBand";
        }
 
@@ -886,7 +894,7 @@ Film::isdcf_name (bool if_created_now) const
                d += "-3D";
        }
 
-       if (dm.two_d_version_of_three_d) {
+       if (_two_d_version_of_three_d) {
                d += "-2D";
        }
 
@@ -1155,9 +1163,8 @@ Film::set_three_d (bool t)
        FilmChangeSignaller ch (this, Property::THREE_D);
        _three_d = t;
 
-       if (_three_d && _isdcf_metadata.two_d_version_of_three_d) {
-               FilmChangeSignaller ch (this, Property::ISDCF_METADATA);
-               _isdcf_metadata.two_d_version_of_three_d = false;
+       if (_three_d && _two_d_version_of_three_d) {
+               set_two_d_version_of_three_d (false);
        }
 }
 
@@ -2130,3 +2137,36 @@ Film::add_ffoc_lfoc (Markers& markers) const
                markers[dcp::Marker::LFOC] = length() - DCPTime::from_frames(1, video_frame_rate());
        }
 }
+
+
+void
+Film::set_temp_version (bool t)
+{
+       FilmChangeSignaller ch (this, Property::TEMP_VERSION);
+       _temp_version = t;
+}
+
+
+void
+Film::set_pre_release (bool p)
+{
+       FilmChangeSignaller ch (this, Property::PRE_RELEASE);
+       _pre_release = p;
+}
+
+
+void
+Film::set_red_band (bool r)
+{
+       FilmChangeSignaller ch (this, Property::RED_BAND);
+       _red_band = r;
+}
+
+
+void
+Film::set_two_d_version_of_three_d (bool t)
+{
+       FilmChangeSignaller ch (this, Property::TWO_D_VERSION_OF_THREE_D);
+       _two_d_version_of_three_d = t;
+}
+
index fa87c6c35f99e62bbe0619ba7d5b40f0f3c069b6..e0c5cb2f702f6c2d4baa62d7ba4eb2e92515223e 100644 (file)
@@ -240,6 +240,10 @@ public:
                DISTRIBUTOR,
                FACILITY,
                STUDIO,
+               TEMP_VERSION,
+               PRE_RELEASE,
+               RED_BAND,
+               TWO_D_VERSION_OF_THREE_D,
                LUMINANCE,
        };
 
@@ -378,6 +382,22 @@ public:
                return _studio;
        }
 
+       bool temp_version () const {
+               return _temp_version;
+       }
+
+       bool pre_release () const {
+               return _pre_release;
+       }
+
+       bool red_band () const {
+               return _red_band;
+       }
+
+       bool two_d_version_of_three_d () const {
+               return _two_d_version_of_three_d;
+       }
+
        boost::optional<dcp::Luminance> luminance () const {
                return _luminance;
        }
@@ -422,6 +442,10 @@ public:
        void set_chain (boost::optional<std::string> c = boost::none);
        void set_facility (boost::optional<std::string> f = boost::none);
        void set_studio (boost::optional<std::string> s = boost::none);
+       void set_temp_version (bool t);
+       void set_pre_release (bool p);
+       void set_red_band (bool r);
+       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);
 
@@ -529,6 +553,10 @@ private:
        boost::optional<std::string> _distributor;
        boost::optional<std::string> _facility;
        boost::optional<std::string> _studio;
+       bool _temp_version = false;
+       bool _pre_release = false;
+       bool _red_band = false;
+       bool _two_d_version_of_three_d = false;
        boost::optional<dcp::Luminance> _luminance;
 
        int _state_version;
index eb8bcb1a543af2c64fd44830573c8c8adb617c09..71f1fc6d08a6fb8538eea8dcd16a19cedc307c77 100644 (file)
@@ -34,11 +34,7 @@ using std::shared_ptr;
 using dcp::raw_convert;
 
 ISDCFMetadata::ISDCFMetadata (cxml::ConstNodePtr node)
-       : temp_version (node->optional_bool_child ("TempVersion").get_value_or (false))
-       , pre_release (node->optional_bool_child ("PreRelease").get_value_or (false))
-       , red_band (node->optional_bool_child ("RedBand").get_value_or (false))
-       , chain (node->optional_string_child ("Chain").get_value_or (""))
-       , two_d_version_of_three_d (node->optional_bool_child ("TwoDVersionOfThreeD").get_value_or (false))
+       : chain (node->optional_string_child ("Chain").get_value_or (""))
        , mastered_luminance (node->optional_string_child ("MasteredLuminance").get_value_or (""))
 {
 
@@ -47,21 +43,13 @@ ISDCFMetadata::ISDCFMetadata (cxml::ConstNodePtr node)
 void
 ISDCFMetadata::as_xml (xmlpp::Node* root) const
 {
-       root->add_child("TempVersion")->add_child_text (temp_version ? "1" : "0");
-       root->add_child("PreRelease")->add_child_text (pre_release ? "1" : "0");
-       root->add_child("RedBand")->add_child_text (red_band ? "1" : "0");
        root->add_child("Chain")->add_child_text (chain);
-       root->add_child("TwoDVersionOfThreeD")->add_child_text (two_d_version_of_three_d ? "1" : "0");
        root->add_child("MasteredLuminance")->add_child_text (mastered_luminance);
 }
 
 bool
 operator== (ISDCFMetadata const & a, ISDCFMetadata const & b)
 {
-        return a.temp_version == b.temp_version &&
-               a.pre_release == b.pre_release &&
-               a.red_band == b.red_band &&
-               a.chain == b.chain &&
-               a.two_d_version_of_three_d == b.two_d_version_of_three_d &&
+        return a.chain == b.chain &&
                a.mastered_luminance == b.mastered_luminance;
 }
index b578dc997872b71ce434289741bea1c40f753b88..722bb154f0cd73fd4c70c1016768084f18e0fac3 100644 (file)
@@ -31,28 +31,14 @@ namespace xmlpp {
 class ISDCFMetadata
 {
 public:
-       ISDCFMetadata ()
-               : temp_version (false)
-               , pre_release (false)
-               , red_band (false)
-               , two_d_version_of_three_d (false)
-       {}
-
+       ISDCFMetadata () {}
        explicit ISDCFMetadata (cxml::ConstNodePtr);
 
        void as_xml (xmlpp::Node *) const;
        void read_old_metadata (std::string, std::string);
 
-       /** true if this is a temporary version (without final picture or sound) */
-       bool temp_version;
-       /** true if this is a pre-release version (final picture and sound, but without accessibility features) */
-       bool pre_release;
-       /** true if this has adult content */
-       bool red_band;
        /** specific theatre chain or event */
        std::string chain;
-       /** true if this is a 2D version of content that also exists in 3D */
-       bool two_d_version_of_three_d;
        /** mastered luminance if there are multiple versions distributed (e.g. 35, 4fl, 6fl etc.) */
        std::string mastered_luminance;
 };
index a46ae0226c7819674be74360edf551402333b284..1213fe1fac18158074a80c7cb29919468bb3568e 100644 (file)
@@ -452,6 +452,10 @@ DCPPanel::film_changed (Film::Property p)
        case Film::Property::RATINGS:
        case Film::Property::FACILITY:
        case Film::Property::STUDIO:
+       case Film::Property::TEMP_VERSION:
+       case Film::Property::PRE_RELEASE:
+       case Film::Property::RED_BAND:
+       case Film::Property::TWO_D_VERSION_OF_THREE_D:
                setup_dcp_name ();
                break;
        default:
@@ -649,7 +653,7 @@ DCPPanel::edit_isdcf_button_clicked ()
                return;
        }
 
-       auto d = new ISDCFMetadataDialog (_panel, _film->isdcf_metadata (), _film->three_d ());
+       auto d = new ISDCFMetadataDialog (_panel, _film->isdcf_metadata ());
        d->ShowModal ();
        _film->set_isdcf_metadata (d->isdcf_metadata ());
        d->Destroy ();
index 3b07c7765f9a0299e95da1fe234d38d996e57564..27159e7f2834b05cb6f320f528cc621d71ffa4a0 100644 (file)
@@ -416,7 +416,7 @@ private:
 
        void edit_isdcf_metadata_clicked ()
        {
-               ISDCFMetadataDialog* d = new ISDCFMetadataDialog (_panel, Config::instance()->default_isdcf_metadata (), false);
+               auto d = new ISDCFMetadataDialog (_panel, Config::instance()->default_isdcf_metadata ());
                d->ShowModal ();
                Config::instance()->set_default_isdcf_metadata (d->isdcf_metadata ());
                d->Destroy ();
index 559047742203a8ca8f04df141e7d4fe1abeb286c..4faf88ee60ec586ed13b2d0f8b27cd557cabdc24 100644 (file)
@@ -32,36 +32,16 @@ using std::shared_ptr;
  *  @param dm Initial ISDCF metadata.
  *  @param threed true if the film is in 3D.
  */
-ISDCFMetadataDialog::ISDCFMetadataDialog (wxWindow* parent, ISDCFMetadata dm, bool threed)
+ISDCFMetadataDialog::ISDCFMetadataDialog (wxWindow* parent, ISDCFMetadata dm)
        : TableDialog (parent, _("ISDCF name"), 2, 1, true)
 {
-       _temp_version = add (new CheckBox(this, _("Temp version")));
-       add_spacer ();
-
-       _pre_release = add (new CheckBox(this, _("Pre-release")));
-       add_spacer ();
-
-       _red_band = add (new CheckBox(this, _("Red band")));
-       add_spacer ();
-
        add (_("Chain"), true);
        _chain = add (new wxTextCtrl (this, wxID_ANY));
 
-       _two_d_version_of_three_d = add (new CheckBox(this, _("2D version of content available in 3D")));
-       add_spacer ();
-
-       if (threed) {
-               _two_d_version_of_three_d->Enable (false);
-       }
-
        add (_("Mastered luminance (e.g. 14fl)"), true);
        _mastered_luminance = add (new wxTextCtrl (this, wxID_ANY));
 
-       _temp_version->SetValue (dm.temp_version);
-       _pre_release->SetValue (dm.pre_release);
-       _red_band->SetValue (dm.red_band);
        _chain->SetValue (std_to_wx (dm.chain));
-       _two_d_version_of_three_d->SetValue (dm.two_d_version_of_three_d);
        _mastered_luminance->SetValue (std_to_wx (dm.mastered_luminance));
 
        layout ();
@@ -73,11 +53,7 @@ ISDCFMetadataDialog::isdcf_metadata () const
 {
        ISDCFMetadata dm;
 
-       dm.temp_version = _temp_version->GetValue ();
-       dm.pre_release = _pre_release->GetValue ();
-       dm.red_band = _red_band->GetValue ();
        dm.chain = wx_to_std (_chain->GetValue ());
-       dm.two_d_version_of_three_d = _two_d_version_of_three_d->GetValue ();
        dm.mastered_luminance = wx_to_std (_mastered_luminance->GetValue ());
 
        return dm;
index 47cfd54a703c85de946e45a971b3c0ffd56794d9..4f5e8889b73bccf0de820c27aa9ba417c052b169 100644 (file)
@@ -28,15 +28,11 @@ class Film;
 class ISDCFMetadataDialog : public TableDialog
 {
 public:
-       ISDCFMetadataDialog (wxWindow *, ISDCFMetadata, bool threed);
+       ISDCFMetadataDialog (wxWindow *, ISDCFMetadata);
 
        ISDCFMetadata isdcf_metadata () const;
 
 private:
-       wxCheckBox* _temp_version;
-       wxCheckBox* _pre_release;
-       wxCheckBox* _red_band;
        wxTextCtrl* _chain;
-       wxCheckBox* _two_d_version_of_three_d;
        wxTextCtrl* _mastered_luminance;
 };
index 17151161ca7d0463f7e302a1ff2419632f49feb8..75b2eff6996af8329e31a6773388ab58a6351f39 100644 (file)
@@ -72,16 +72,26 @@ MetadataDialog::setup ()
        overall_sizer->Layout ();
        overall_sizer->SetSizeHints (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));
        _facility->Bind (wxEVT_TEXT, boost::bind(&MetadataDialog::facility_changed, this));
        _enable_studio->Bind (wxEVT_CHECKBOX, boost::bind(&MetadataDialog::enable_studio_changed, this));
        _studio->Bind (wxEVT_TEXT, boost::bind(&MetadataDialog::studio_changed, this));
+       _temp_version->Bind (wxEVT_CHECKBOX, boost::bind(&MetadataDialog::temp_version_changed, this));
+       _pre_release->Bind (wxEVT_CHECKBOX, boost::bind(&MetadataDialog::pre_release_changed, this));
+       _red_band->Bind (wxEVT_CHECKBOX, boost::bind(&MetadataDialog::red_band_changed, this));
+       _two_d_version_of_three_d->Bind (wxEVT_CHECKBOX, boost::bind(&MetadataDialog::two_d_version_of_three_d_changed, this));
 
        _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::FACILITY);
        film_changed (ChangeType::DONE, Film::Property::STUDIO);
+       film_changed (ChangeType::DONE, Film::Property::TEMP_VERSION);
+       film_changed (ChangeType::DONE, Film::Property::PRE_RELEASE);
+       film_changed (ChangeType::DONE, Film::Property::RED_BAND);
+       film_changed (ChangeType::DONE, Film::Property::TWO_D_VERSION_OF_THREE_D);
 
        setup_sensitivity ();
 }
@@ -111,6 +121,14 @@ MetadataDialog::film_changed (ChangeType type, Film::Property property)
                if (film()->studio()) {
                        checked_set (_studio, *film()->studio());
                }
+       } else if (property == Film::Property::TEMP_VERSION) {
+               checked_set (_temp_version, film()->temp_version());
+       } else if (property == Film::Property::PRE_RELEASE) {
+               checked_set (_pre_release, film()->pre_release());
+       } else if (property == Film::Property::RED_BAND) {
+               checked_set (_red_band, film()->red_band());
+       } else if (property == Film::Property::TWO_D_VERSION_OF_THREE_D) {
+               checked_set (_two_d_version_of_three_d, film()->two_d_version_of_three_d());
        }
 }
 
@@ -128,9 +146,6 @@ MetadataDialog::setup_standard (wxPanel* panel, wxSizer* sizer)
                s->Add (_edit_release_territory, 0, wxLEFT, DCPOMATIC_SIZER_GAP);
                sizer->Add (s, 0, wxEXPAND);
        }
-
-       _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));
 }
 
 
@@ -184,6 +199,22 @@ MetadataDialog::setup_advanced (wxPanel* panel, wxSizer* sizer)
        sizer->Add (_enable_studio, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL);
        _studio = new wxTextCtrl (panel, wxID_ANY);
        sizer->Add (_studio, 1, wxEXPAND);
+
+       _temp_version = new wxCheckBox (panel, wxID_ANY, _("Temporary version"));
+       sizer->Add (_temp_version, 0, wxALIGN_CENTER_VERTICAL);
+       sizer->AddSpacer (0);
+
+       _pre_release = new wxCheckBox (panel, wxID_ANY, _("Pre-release"));
+       sizer->Add (_pre_release, 0, wxALIGN_CENTER_VERTICAL);
+       sizer->AddSpacer (0);
+
+       _red_band = new wxCheckBox (panel, wxID_ANY, _("Red band"));
+       sizer->Add (_red_band, 0, wxALIGN_CENTER_VERTICAL);
+       sizer->AddSpacer (0);
+
+       _two_d_version_of_three_d = new wxCheckBox (panel, wxID_ANY, _("2D version of 3D DCP"));
+       sizer->Add (_two_d_version_of_three_d, 0, wxALIGN_CENTER_VERTICAL);
+       sizer->AddSpacer (0);
 }
 
 
@@ -225,3 +256,30 @@ MetadataDialog::enable_studio_changed ()
 }
 
 
+void
+MetadataDialog::temp_version_changed ()
+{
+       film()->set_temp_version(_temp_version->GetValue());
+}
+
+
+void
+MetadataDialog::pre_release_changed ()
+{
+       film()->set_pre_release(_pre_release->GetValue());
+}
+
+
+void
+MetadataDialog::red_band_changed ()
+{
+       film()->set_red_band(_red_band->GetValue());
+}
+
+
+void
+MetadataDialog::two_d_version_of_three_d_changed ()
+{
+       film()->set_two_d_version_of_three_d(_two_d_version_of_three_d->GetValue());
+}
+
index 50533fc0fe7fd2962727cd39e6511008e5aca44c..1d49d7cfcc7072a093f51d5e1e2c8186dd04e85d 100644 (file)
@@ -55,6 +55,10 @@ private:
        void enable_facility_changed ();
        void studio_changed ();
        void enable_studio_changed ();
+       void temp_version_changed ();
+       void pre_release_changed ();
+       void red_band_changed ();
+       void two_d_version_of_three_d_changed ();
 
        wxCheckBox* _enable_release_territory;
        /** The current release territory displayed in the UI; since we can't easily convert
@@ -68,6 +72,10 @@ private:
        wxTextCtrl* _facility;
        wxCheckBox* _enable_studio;
        wxTextCtrl* _studio;
+       wxCheckBox* _temp_version;
+       wxCheckBox* _pre_release;
+       wxCheckBox* _red_band;
+       wxCheckBox* _two_d_version_of_three_d;
 
        boost::signals2::scoped_connection _film_changed_connection;
 };
index b55cea1adfaf487f0a27539136276f18772f11a4..54b9a24d7f88c46cafd5aae5c3224ad1490192cb 100644 (file)
@@ -139,11 +139,11 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test)
        /* Test content type modifiers */
 
        film->set_three_d (false);
-       m.temp_version = true;
-       m.pre_release = true;
-       m.red_band = true;
+       film->set_temp_version (true);
+       film->set_pre_release (true);
+       film->set_red_band (true);
+       film->set_two_d_version_of_three_d (true);
        m.chain = "MyChain";
-       m.two_d_version_of_three_d = true;
        m.mastered_luminance = "4fl";
        film->set_isdcf_metadata (m);
        film->set_video_frame_rate (48);
@@ -152,11 +152,11 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test)
        /* Test a name which is already in camelCase */
 
        film->set_three_d (false);
-       m.temp_version = false;
-       m.pre_release = false;
-       m.red_band = false;
+       film->set_temp_version (false);
+       film->set_pre_release (false);
+       film->set_red_band (false);
+       film->set_two_d_version_of_three_d (false);
        m.chain = "";
-       m.two_d_version_of_three_d = false;
        m.mastered_luminance = "";
        film->set_isdcf_metadata (m);
        film->set_video_frame_rate (24);