Move luminance to Interop/SMPTE metadata and remove the ISDCF metadata dialogue.
authorCarl Hetherington <cth@carlh.net>
Sat, 3 Apr 2021 18:08:12 +0000 (20:08 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 4 Apr 2021 18:48:35 +0000 (20:48 +0200)
20 files changed:
src/lib/config.cc
src/lib/config.h
src/lib/film.cc
src/lib/film.h
src/lib/isdcf_metadata.cc [deleted file]
src/lib/isdcf_metadata.h [deleted file]
src/lib/wscript
src/wx/dcp_panel.cc
src/wx/dcp_panel.h
src/wx/full_config_dialog.cc
src/wx/isdcf_metadata_dialog.cc [deleted file]
src/wx/isdcf_metadata_dialog.h [deleted file]
src/wx/metadata_dialog.cc
src/wx/metadata_dialog.h
src/wx/player_config_dialog.cc
src/wx/smpte_metadata_dialog.cc
src/wx/smpte_metadata_dialog.h
src/wx/wscript
test/isdcf_name_test.cc
test/test.cc

index 0dcc8411775f5f6e138a4055fa0604cf13b239e5..6ec3b0588fcfcd0c47a22b4fd2099fe18c00e630 100644 (file)
@@ -309,12 +309,6 @@ try
        _dcp_product_version = f.optional_string_child("DCPProductVersion").get_value_or("");
        _dcp_j2k_comment = f.optional_string_child("DCPJ2KComment").get_value_or("");
 
-       if (version && version.get() >= 2) {
-               _default_isdcf_metadata = ISDCFMetadata (f.node_child ("ISDCFMetadata"));
-       } else {
-               _default_isdcf_metadata = ISDCFMetadata (f.node_child ("DCIMetadata"));
-       }
-
        _default_still_length = f.optional_number_child<int>("DefaultStillLength").get_value_or (10);
        _default_j2k_bandwidth = f.optional_number_child<int>("DefaultJ2KBandwidth").get_value_or (200000000);
        _default_audio_delay = f.optional_number_child<int>("DefaultAudioDelay").get_value_or (0);
@@ -688,14 +682,6 @@ Config::write_config () const
        /* [XML] UploadAfterMakeDCP 1 to upload to a TMS after making a DCP, 0 for no upload. */
        root->add_child("UploadAfterMakeDCP")->add_child_text (_upload_after_make_dcp ? "1" : "0");
 
-       /* [XML] ISDCFMetadata Default ISDCF metadata to use for new films; child tags are <code>&lt;ContentVersion&gt;</code>,
-          <code>&lt;AudioLanguage&gt;</code>, <code>&lt;SubtitleLanguage&gt;</code>, <code>&lt;Territory&gt;</code>,
-          <code>&lt;Rating&gt;</code>, <code>&lt;Studio&gt;</code>, <code>&lt;Facility&gt;</code>, <code>&lt;TempVersion&gt;</code>,
-          <code>&lt;PreRelease&gt;</code>, <code>&lt;RedBand&gt;</code>, <code>&lt;Chain&gt;</code>, <code>&lt;TwoDVersionOFThreeD&gt;</code>,
-          <code>&lt;MasteredLuminance&gt;</code>.
-       */
-       _default_isdcf_metadata.as_xml (root->add_child ("ISDCFMetadata"));
-
        /* [XML] DefaultStillLength Default length (in seconds) for still images in new films. */
        root->add_child("DefaultStillLength")->add_child_text (raw_convert<string> (_default_still_length));
        /* [XML] DefaultJ2KBandwidth Default bitrate (in bits per second) for JPEG2000 data in new films. */
index 0a48a00e1dfc8a71ac66e77ca26a07d73610e2c4..eb8f88da9566f061e70ccf5e87ebbcfd11ab5279 100644 (file)
@@ -25,7 +25,6 @@
 #ifndef DCPOMATIC_CONFIG_H
 #define DCPOMATIC_CONFIG_H
 
-#include "isdcf_metadata.h"
 #include "types.h"
 #include "state.h"
 #include "edid.h"
@@ -166,10 +165,6 @@ public:
                return _show_experimental_audio_processors;
        }
 
-       ISDCFMetadata default_isdcf_metadata () const {
-               return _default_isdcf_metadata;
-       }
-
        boost::optional<std::string> language () const {
                return _language;
        }
@@ -636,10 +631,6 @@ public:
                maybe_set (_show_experimental_audio_processors, e, SHOW_EXPERIMENTAL_AUDIO_PROCESSORS);
        }
 
-       void set_default_isdcf_metadata (ISDCFMetadata d) {
-               maybe_set (_default_isdcf_metadata, d);
-       }
-
        void set_language (std::string l) {
                if (_language && _language.get() == l) {
                        return;
@@ -1174,8 +1165,6 @@ private:
        bool _allow_any_container;
        /** Offer the upmixers in the audio processor settings */
        bool _show_experimental_audio_processors;
-       /** Default ISDCF metadata for newly-created Films */
-       ISDCFMetadata _default_isdcf_metadata;
        boost::optional<std::string> _language;
        /** Default length of still image content (seconds) */
        int _default_still_length;
index 14747058548a5a3bd4bda5a8aa11e585c3db1bba..a9ac82b5a227224a1a01ea97c074f4028ac94a67 100644 (file)
@@ -155,7 +155,6 @@ Film::Film (optional<boost::filesystem::path> dir)
        , _encrypted (false)
        , _context_id (dcp::make_uuid ())
        , _j2k_bandwidth (Config::instance()->default_j2k_bandwidth ())
-       , _isdcf_metadata (Config::instance()->default_isdcf_metadata ())
        , _video_frame_rate (24)
        , _audio_channels (Config::instance()->default_dcp_audio_channels ())
        , _three_d (false)
@@ -446,7 +445,6 @@ Film::metadata (bool with_content_paths) const
 
        root->add_child("Resolution")->add_child_text (resolution_to_string (_resolution));
        root->add_child("J2KBandwidth")->add_child_text (raw_convert<string> (_j2k_bandwidth));
-       _isdcf_metadata.as_xml (root->add_child ("ISDCFMetadata"));
        root->add_child("VideoFrameRate")->add_child_text (raw_convert<string> (_video_frame_rate));
        root->add_child("ISDCFDate")->add_child_text (boost::gregorian::to_iso_string (_isdcf_date));
        root->add_child("AudioChannels")->add_child_text (raw_convert<string> (_audio_channels));
@@ -572,11 +570,9 @@ Film::read_metadata (optional<boost::filesystem::path> path)
        _name = f.string_child ("Name");
        if (_state_version >= 9) {
                _use_isdcf_name = f.bool_child ("UseISDCFName");
-               _isdcf_metadata = ISDCFMetadata (f.node_child ("ISDCFMetadata"));
                _isdcf_date = boost::gregorian::from_undelimited_string (f.string_child ("ISDCFDate"));
        } else {
                _use_isdcf_name = f.bool_child ("UseDCIName");
-               _isdcf_metadata = ISDCFMetadata (f.node_child ("DCIMetadata"));
                _isdcf_date = boost::gregorian::from_undelimited_string (f.string_child ("DCIDate"));
        }
 
@@ -872,8 +868,6 @@ Film::isdcf_name (bool if_created_now) const
                d += "-" + version;
        }
 
-       auto const dm = isdcf_metadata ();
-
        if (_temp_version) {
                d += "-Temp";
        }
@@ -898,8 +892,11 @@ Film::isdcf_name (bool if_created_now) const
                d += "-2D";
        }
 
-       if (!dm.mastered_luminance.empty ()) {
-               d += "-" + dm.mastered_luminance;
+       if (_luminance) {
+               auto fl = _luminance->value_in_foot_lamberts();
+               char buffer[64];
+               snprintf (buffer, sizeof(buffer), "%.1f", fl);
+               d += String::compose("-%1fl", buffer);
        }
 
        if (video_frame_rate() != 24) {
@@ -1129,13 +1126,6 @@ Film::set_j2k_bandwidth (int b)
        _j2k_bandwidth = b;
 }
 
-void
-Film::set_isdcf_metadata (ISDCFMetadata m)
-{
-       FilmChangeSignaller ch (this, Property::ISDCF_METADATA);
-       _isdcf_metadata = m;
-}
-
 /** @param f New frame rate.
  *  @param user_explicit true if this comes from a direct user instruction, false if it is from
  *  DCP-o-matic being helpful.
@@ -1889,7 +1879,6 @@ Film::use_template (string name)
        _audio_processor = _template_film->_audio_processor;
        _reel_type = _template_film->_reel_type;
        _reel_length = _template_film->_reel_length;
-       _isdcf_metadata = _template_film->_isdcf_metadata;
 }
 
 pair<double, double>
index e0c5cb2f702f6c2d4baa62d7ba4eb2e92515223e..5fc56acfb0613570bc29b1067181703cc03b5319 100644 (file)
@@ -29,7 +29,6 @@
 #include "change_signaller.h"
 #include "dcp_text_track.h"
 #include "frame_rate_change.h"
-#include "isdcf_metadata.h"
 #include "signaller.h"
 #include "types.h"
 #include "util.h"
@@ -217,7 +216,6 @@ public:
                RESOLUTION,
                ENCRYPTED,
                J2K_BANDWIDTH,
-               ISDCF_METADATA,
                VIDEO_FRAME_RATE,
                AUDIO_CHANNELS,
                /** The setting of _three_d has changed */
@@ -286,10 +284,6 @@ public:
                return _j2k_bandwidth;
        }
 
-       ISDCFMetadata isdcf_metadata () const {
-               return _isdcf_metadata;
-       }
-
        /** @return The frame rate of the DCP */
        int video_frame_rate () const {
                return _video_frame_rate;
@@ -418,7 +412,6 @@ public:
        void set_resolution (Resolution, bool user_explicit = true);
        void set_encrypted (bool);
        void set_j2k_bandwidth (int);
-       void set_isdcf_metadata (ISDCFMetadata);
        void set_video_frame_rate (int rate, bool user_explicit = false);
        void set_audio_channels (int);
        void set_three_d (bool);
@@ -518,8 +511,6 @@ private:
        std::string _context_id;
        /** bandwidth for J2K files in bits per second */
        int _j2k_bandwidth;
-       /** ISDCF naming stuff */
-       ISDCFMetadata _isdcf_metadata;
        /** Frames per second to run our DCP at */
        int _video_frame_rate;
        /** The date that we should use in a ISDCF name */
diff --git a/src/lib/isdcf_metadata.cc b/src/lib/isdcf_metadata.cc
deleted file mode 100644 (file)
index 22e094b..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-    Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
-
-    This file is part of DCP-o-matic.
-
-    DCP-o-matic is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    DCP-o-matic is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#include "isdcf_metadata.h"
-#include "warnings.h"
-#include <dcp/raw_convert.h>
-#include <libcxml/cxml.h>
-DCPOMATIC_DISABLE_WARNINGS
-#include <libxml++/libxml++.h>
-DCPOMATIC_ENABLE_WARNINGS
-#include <iostream>
-
-#include "i18n.h"
-
-using std::string;
-using std::shared_ptr;
-using dcp::raw_convert;
-
-ISDCFMetadata::ISDCFMetadata (cxml::ConstNodePtr node)
-       : mastered_luminance (node->optional_string_child ("MasteredLuminance").get_value_or (""))
-{
-
-}
-
-void
-ISDCFMetadata::as_xml (xmlpp::Node* root) const
-{
-       root->add_child("MasteredLuminance")->add_child_text (mastered_luminance);
-}
-
-bool
-operator== (ISDCFMetadata const & a, ISDCFMetadata const & b)
-{
-        return a.mastered_luminance == b.mastered_luminance;
-}
diff --git a/src/lib/isdcf_metadata.h b/src/lib/isdcf_metadata.h
deleted file mode 100644 (file)
index 4237b6a..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-    Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
-
-    This file is part of DCP-o-matic.
-
-    DCP-o-matic is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    DCP-o-matic is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifndef DCPOMATIC_ISDCF_METADATA_H
-#define DCPOMATIC_ISDCF_METADATA_H
-
-#include <libcxml/cxml.h>
-#include <string>
-
-namespace xmlpp {
-       class Node;
-}
-
-class ISDCFMetadata
-{
-public:
-       ISDCFMetadata () {}
-       explicit ISDCFMetadata (cxml::ConstNodePtr);
-
-       void as_xml (xmlpp::Node *) const;
-       void read_old_metadata (std::string, std::string);
-
-       /** mastered luminance if there are multiple versions distributed (e.g. 35, 4fl, 6fl etc.) */
-       std::string mastered_luminance;
-};
-
-bool operator== (ISDCFMetadata const & a, ISDCFMetadata const & b);
-
-#endif
index 1b45152a4fd9bab8c5c781e3e998b9f25d5e41bc..7cbd85a4c2cbc66f7594cacf9630016589181e90 100644 (file)
@@ -121,7 +121,6 @@ sources = """
           image_examiner.cc
           image_filename_sorter.cc
           image_proxy.cc
-          isdcf_metadata.cc
           j2k_image_proxy.cc
           job.cc
           job_manager.cc
index a6f4d53c0ef868a0e750fef77ba6c2efeb94832b..302ed4184b8064de4bdcc356a90ae3734f7da76d 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "dcp_panel.h"
 #include "wx_util.h"
-#include "isdcf_metadata_dialog.h"
 #include "audio_dialog.h"
 #include "focus_manager.h"
 #include "check_box.h"
@@ -85,7 +84,6 @@ DCPPanel::DCPPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmViewer> v
        FocusManager::instance()->add(_name);
 
        _use_isdcf_name = new CheckBox (_panel, _("Use ISDCF name"));
-       _edit_isdcf_button = new Button (_panel, _("Details..."));
        _copy_isdcf_name_button = new Button (_panel, _("Copy as name"));
 
        /* wxST_ELLIPSIZE_MIDDLE works around a bug in GTK2 and/or wxWidgets, see
@@ -126,7 +124,6 @@ DCPPanel::DCPPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmViewer> v
 
        _name->Bind                  (wxEVT_TEXT,     boost::bind (&DCPPanel::name_changed, this));
        _use_isdcf_name->Bind        (wxEVT_CHECKBOX, boost::bind (&DCPPanel::use_isdcf_name_toggled, this));
-       _edit_isdcf_button->Bind     (wxEVT_BUTTON,   boost::bind (&DCPPanel::edit_isdcf_button_clicked, this));
        _copy_isdcf_name_button->Bind(wxEVT_BUTTON,   boost::bind (&DCPPanel::copy_isdcf_name_button_clicked, this));
        _dcp_content_type->Bind      (wxEVT_CHOICE,   boost::bind (&DCPPanel::dcp_content_type_changed, this));
        _encrypted->Bind             (wxEVT_CHECKBOX, boost::bind (&DCPPanel::encrypted_toggled, this));
@@ -162,8 +159,8 @@ DCPPanel::add_to_grid ()
 
        auto name_sizer = new wxBoxSizer (wxHORIZONTAL);
        name_sizer->Add (_name_label, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_X_GAP);
-       name_sizer->Add (_name, 1, wxALIGN_CENTER_VERTICAL);
-       _grid->Add (name_sizer, wxGBPosition(r, 0), wxGBSpan(1, 2), wxEXPAND);
+       name_sizer->Add (_name, 1, wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_X_GAP);
+       _grid->Add (name_sizer, wxGBPosition(r, 0), wxGBSpan(1, 2), wxRIGHT | wxEXPAND, DCPOMATIC_DIALOG_BORDER);
        ++r;
 
        int flags = wxALIGN_CENTER_VERTICAL;
@@ -173,14 +170,13 @@ DCPPanel::add_to_grid ()
 
        _grid->Add (_use_isdcf_name, wxGBPosition (r, 0), wxDefaultSpan, flags);
        {
-               wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
-               s->Add (_edit_isdcf_button, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
-               s->Add (_copy_isdcf_name_button, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_X_GAP);
+               auto s = new wxBoxSizer (wxHORIZONTAL);
+               s->Add (_copy_isdcf_name_button, 0, wxLEFT, DCPOMATIC_SIZER_X_GAP);
                _grid->Add (s, wxGBPosition (r, 1), wxDefaultSpan, wxEXPAND);
        }
        ++r;
 
-       _grid->Add (_dcp_name, wxGBPosition(r, 0), wxGBSpan (1, 2), wxALIGN_CENTER_VERTICAL | wxEXPAND);
+       _grid->Add (_dcp_name, wxGBPosition(r, 0), wxGBSpan(1, 2), wxALIGN_CENTER_VERTICAL);
        ++r;
 
        add_label_to_sizer (_grid, _dcp_content_type_label, true, wxGBPosition (r, 0));
@@ -379,12 +375,8 @@ DCPPanel::film_changed (Film::Property p)
                        }
                }
                setup_dcp_name ();
-               _edit_isdcf_button->Enable (_film->use_isdcf_name ());
                break;
        }
-       case Film::Property::ISDCF_METADATA:
-               setup_dcp_name ();
-               break;
        case Film::Property::VIDEO_FRAME_RATE:
        {
                bool done = false;
@@ -457,6 +449,7 @@ DCPPanel::film_changed (Film::Property p)
        case Film::Property::RED_BAND:
        case Film::Property::TWO_D_VERSION_OF_THREE_D:
        case Film::Property::CHAIN:
+       case Film::Property::LUMINANCE:
                setup_dcp_name ();
                break;
        default:
@@ -575,7 +568,6 @@ DCPPanel::set_film (shared_ptr<Film> film)
        film_changed (Film::Property::RESOLUTION);
        film_changed (Film::Property::ENCRYPTED);
        film_changed (Film::Property::J2K_BANDWIDTH);
-       film_changed (Film::Property::ISDCF_METADATA);
        film_changed (Film::Property::VIDEO_FRAME_RATE);
        film_changed (Film::Property::AUDIO_CHANNELS);
        film_changed (Film::Property::SEQUENCE);
@@ -601,7 +593,6 @@ DCPPanel::setup_sensitivity ()
 {
        _name->Enable                   (_generally_sensitive);
        _use_isdcf_name->Enable         (_generally_sensitive);
-       _edit_isdcf_button->Enable      (_generally_sensitive);
        _dcp_content_type->Enable       (_generally_sensitive);
        _copy_isdcf_name_button->Enable (_generally_sensitive);
        _encrypted->Enable              (_generally_sensitive);
@@ -647,19 +638,6 @@ DCPPanel::use_isdcf_name_toggled ()
        _film->set_use_isdcf_name (_use_isdcf_name->GetValue ());
 }
 
-void
-DCPPanel::edit_isdcf_button_clicked ()
-{
-       if (!_film) {
-               return;
-       }
-
-       auto d = new ISDCFMetadataDialog (_panel, _film->isdcf_metadata ());
-       d->ShowModal ();
-       _film->set_isdcf_metadata (d->isdcf_metadata ());
-       d->Destroy ();
-}
-
 void
 DCPPanel::setup_dcp_name ()
 {
index 9b362a26cd540118a433e2860dc9f64ef3649458..a076e4bb4eabd9acca21b31e1106825cb8881c0d 100644 (file)
@@ -64,7 +64,6 @@ public:
 private:
        void name_changed ();
        void use_isdcf_name_toggled ();
-       void edit_isdcf_button_clicked ();
        void copy_isdcf_name_button_clicked ();
        void container_changed ();
        void dcp_content_type_changed ();
@@ -118,7 +117,6 @@ private:
        wxStaticText* _container_label;
        wxChoice* _container;
        wxStaticText* _container_size;
-       wxButton* _edit_isdcf_button;
        wxButton* _copy_isdcf_name_button;
        wxStaticText* _j2k_bandwidth_label;
        wxStaticText* _mbits_label;
index 27159e7f2834b05cb6f320f528cc621d71ffa4a0..9622955282725648e2e346ef78e77f59876df11d 100644 (file)
@@ -28,7 +28,6 @@
 #include "filter_dialog.h"
 #include "dir_picker_ctrl.h"
 #include "file_picker_ctrl.h"
-#include "isdcf_metadata_dialog.h"
 #include "server_dialog.h"
 #include "make_chain_dialog.h"
 #include "email_dialog.h"
@@ -275,10 +274,6 @@ private:
 #endif
                table->Add (_directory, 1, wxEXPAND);
 
-               add_label_to_sizer (table, _panel, _("Default ISDCF name details"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
-               _isdcf_metadata_button = new Button (_panel, _("Edit..."));
-               table->Add (_isdcf_metadata_button);
-
                add_label_to_sizer (table, _panel, _("Default container"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
                _container = new wxChoice (_panel, wxID_ANY);
                table->Add (_container);
@@ -328,8 +323,6 @@ private:
                _directory->Bind (wxEVT_DIRPICKER_CHANGED, boost::bind (&DefaultsPage::directory_changed, this));
                _kdm_directory->Bind (wxEVT_DIRPICKER_CHANGED, boost::bind (&DefaultsPage::kdm_directory_changed, this));
 
-               _isdcf_metadata_button->Bind (wxEVT_BUTTON, boost::bind (&DefaultsPage::edit_isdcf_metadata_clicked, this));
-
                for (auto i: Ratio::containers()) {
                        _container->Append (std_to_wx(i->container_nickname()));
                }
@@ -414,14 +407,6 @@ private:
                Config::instance()->set_default_kdm_directory (wx_to_std (_kdm_directory->GetPath ()));
        }
 
-       void edit_isdcf_metadata_clicked ()
-       {
-               auto d = new ISDCFMetadataDialog (_panel, Config::instance()->default_isdcf_metadata ());
-               d->ShowModal ();
-               Config::instance()->set_default_isdcf_metadata (d->isdcf_metadata ());
-               d->Destroy ();
-       }
-
        void still_length_changed ()
        {
                Config::instance()->set_default_still_length (_still_length->GetValue ());
@@ -446,7 +431,6 @@ private:
 
        wxSpinCtrl* _j2k_bandwidth;
        wxSpinCtrl* _audio_delay;
-       wxButton* _isdcf_metadata_button;
        wxSpinCtrl* _still_length;
 #ifdef DCPOMATIC_USE_OWN_PICKER
        DirPickerCtrl* _directory;
diff --git a/src/wx/isdcf_metadata_dialog.cc b/src/wx/isdcf_metadata_dialog.cc
deleted file mode 100644 (file)
index ea390c1..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-    Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
-
-    This file is part of DCP-o-matic.
-
-    DCP-o-matic is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    DCP-o-matic is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#include "isdcf_metadata_dialog.h"
-#include "wx_util.h"
-#include "check_box.h"
-#include "lib/film.h"
-#include <wx/wx.h>
-#include <wx/sizer.h>
-#include <wx/spinctrl.h>
-
-using std::shared_ptr;
-
-/** @param parent Parent window.
- *  @param dm Initial ISDCF metadata.
- *  @param threed true if the film is in 3D.
- */
-ISDCFMetadataDialog::ISDCFMetadataDialog (wxWindow* parent, ISDCFMetadata dm)
-       : TableDialog (parent, _("ISDCF name"), 2, 1, true)
-{
-       add (_("Mastered luminance (e.g. 14fl)"), true);
-       _mastered_luminance = add (new wxTextCtrl (this, wxID_ANY));
-
-       _mastered_luminance->SetValue (std_to_wx (dm.mastered_luminance));
-
-       layout ();
-}
-
-
-ISDCFMetadata
-ISDCFMetadataDialog::isdcf_metadata () const
-{
-       ISDCFMetadata dm;
-
-       dm.mastered_luminance = wx_to_std (_mastered_luminance->GetValue ());
-
-       return dm;
-}
diff --git a/src/wx/isdcf_metadata_dialog.h b/src/wx/isdcf_metadata_dialog.h
deleted file mode 100644 (file)
index 1eb7c86..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-    Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
-
-    This file is part of DCP-o-matic.
-
-    DCP-o-matic is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    DCP-o-matic is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#include "table_dialog.h"
-#include "lib/isdcf_metadata.h"
-#include <wx/textctrl.h>
-
-class wxSpinCtrl;
-class Film;
-
-class ISDCFMetadataDialog : public TableDialog
-{
-public:
-       ISDCFMetadataDialog (wxWindow *, ISDCFMetadata);
-
-       ISDCFMetadata isdcf_metadata () const;
-
-private:
-       wxTextCtrl* _mastered_luminance;
-};
index c6d28922b2328adc4c964e1ab74d46af68326516..c0e543b3499f3f15c398f41a14960ec36b4af6fd 100644 (file)
@@ -27,6 +27,7 @@
 #include <boost/bind.hpp>
 #include <boost/weak_ptr.hpp>
 #include <wx/notebook.h>
+#include <wx/spinctrl.h>
 #include <wx/wx.h>
 
 
@@ -84,6 +85,9 @@ MetadataDialog::setup ()
        _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));
+       _enable_luminance->Bind (wxEVT_CHECKBOX, boost::bind(&MetadataDialog::enable_luminance_changed, this));
+       _luminance_value->Bind (wxEVT_SPINCTRLDOUBLE, boost::bind(&MetadataDialog::luminance_changed, this));
+       _luminance_unit->Bind (wxEVT_CHOICE, boost::bind(&MetadataDialog::luminance_changed, this));
 
        _film_changed_connection = film()->Change.connect(boost::bind(&MetadataDialog::film_changed, this, _1, _2));
 
@@ -95,6 +99,7 @@ MetadataDialog::setup ()
        film_changed (ChangeType::DONE, Film::Property::RED_BAND);
        film_changed (ChangeType::DONE, Film::Property::TWO_D_VERSION_OF_THREE_D);
        film_changed (ChangeType::DONE, Film::Property::CHAIN);
+       film_changed (ChangeType::DONE, Film::Property::LUMINANCE);
 
        setup_sensitivity ();
 }
@@ -137,6 +142,20 @@ MetadataDialog::film_changed (ChangeType type, Film::Property property)
                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());
+       } else if (property == Film::Property::LUMINANCE) {
+               auto lum = film()->luminance();
+               checked_set (_enable_luminance, static_cast<bool>(lum));
+               if (lum) {
+                       checked_set (_luminance_value, lum->value());
+                       switch (lum->unit()) {
+                       case dcp::Luminance::Unit::CANDELA_PER_SQUARE_METRE:
+                               checked_set (_luminance_unit, 0);
+                               break;
+                       case dcp::Luminance::Unit::FOOT_LAMBERT:
+                               checked_set (_luminance_unit, 1);
+                               break;
+                       }
+               }
        }
 }
 
@@ -181,6 +200,8 @@ MetadataDialog::setup_sensitivity ()
        _facility->Enable (_enable_facility->GetValue());
        _chain->Enable (_enable_chain->GetValue());
        _studio->Enable (_enable_studio->GetValue());
+       _luminance_value->Enable (_enable_luminance->GetValue());
+       _luminance_unit->Enable (_enable_luminance->GetValue());
 }
 
 
@@ -229,6 +250,23 @@ MetadataDialog::setup_advanced (wxPanel* panel, wxSizer* sizer)
        _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);
+
+       _enable_luminance = new wxCheckBox (panel, wxID_ANY, _("Luminance"));
+       sizer->Add (_enable_luminance, 0, wxALIGN_CENTER_VERTICAL);
+       {
+               auto s = new wxBoxSizer (wxHORIZONTAL);
+               _luminance_value = new wxSpinCtrlDouble (panel, wxID_ANY);
+               _luminance_value->SetDigits (1);
+               _luminance_value->SetIncrement (0.1);
+               s->Add (_luminance_value, 0);
+               _luminance_unit = new wxChoice (panel, wxID_ANY);
+               s->Add (_luminance_unit, 0, wxLEFT, DCPOMATIC_SIZER_X_GAP);
+               sizer->Add (s, 1, wxEXPAND);
+       }
+
+       _luminance_unit->Append (wxString::FromUTF8(_("candela per m²")));
+       _luminance_unit->Append (_("foot lambert"));
+
 }
 
 
@@ -310,10 +348,40 @@ MetadataDialog::enable_chain_changed ()
 {
        setup_sensitivity ();
        if (_enable_chain->GetValue()) {
-               film()->set_chain (wx_to_std(_chain->GetValue()));
+               chain_changed ();
        } else {
                film()->set_chain ();
        }
 }
 
 
+void
+MetadataDialog::enable_luminance_changed ()
+{
+       setup_sensitivity ();
+       if (_enable_luminance->GetValue()) {
+               luminance_changed ();
+       } else {
+               film()->set_luminance ();
+       }
+}
+
+
+void
+MetadataDialog::luminance_changed ()
+{
+       dcp::Luminance::Unit unit;
+       switch (_luminance_unit->GetSelection()) {
+       case 0:
+               unit = dcp::Luminance::Unit::CANDELA_PER_SQUARE_METRE;
+               break;
+       case 1:
+               unit = dcp::Luminance::Unit::FOOT_LAMBERT;
+               break;
+       default:
+               DCPOMATIC_ASSERT (false);
+       }
+
+       film()->set_luminance (dcp::Luminance(_luminance_value->GetValue(), unit));
+}
+
index 3ac5d10a3935bd721eb3ce87b8a93b79df330404..7c4471e59ed6482cc9f6148dc5338bc036e99896 100644 (file)
@@ -33,6 +33,7 @@ DCPOMATIC_ENABLE_WARNINGS
 
 
 class Button;
+class wxSpinCtrlDouble;
 
 
 class MetadataDialog : public wxDialog, public WeakFilm
@@ -61,6 +62,8 @@ private:
        void two_d_version_of_three_d_changed ();
        void chain_changed ();
        void enable_chain_changed ();
+       void enable_luminance_changed ();
+       void luminance_changed ();
 
        wxCheckBox* _enable_release_territory;
        /** The current release territory displayed in the UI; since we can't easily convert
@@ -80,6 +83,9 @@ private:
        wxCheckBox* _pre_release;
        wxCheckBox* _red_band;
        wxCheckBox* _two_d_version_of_three_d;
+       wxCheckBox* _enable_luminance;
+       wxSpinCtrlDouble* _luminance_value;
+       wxChoice* _luminance_unit;
 
        boost::signals2::scoped_connection _film_changed_connection;
 };
index c32e892d9b30ed8ac10d393e2f645db1d5443893..3c480e37ed2b19ad58d00d1ec1e879867ffad8a7 100644 (file)
@@ -28,7 +28,6 @@
 #include "filter_dialog.h"
 #include "file_picker_ctrl.h"
 #include "dir_picker_ctrl.h"
-#include "isdcf_metadata_dialog.h"
 #include "server_dialog.h"
 #include "make_chain_dialog.h"
 #include "email_dialog.h"
index 3bc6760523299495c02f0d464da2ff12c2d53506..e4d2d96224a9a4cd02a468417d1c5f80b2aa6b98 100644 (file)
@@ -115,18 +115,6 @@ SMPTEMetadataDialog::setup_advanced (wxPanel* panel, wxSizer* sizer)
        _distributor = new wxTextCtrl (panel, wxID_ANY);
        sizer->Add (_distributor, 1, wxEXPAND);
 
-       add_label_to_sizer (sizer, panel, _("Luminance"), true, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL);
-       {
-               auto s = new wxBoxSizer (wxHORIZONTAL);
-               _luminance_value = new wxSpinCtrlDouble (panel, wxID_ANY);
-               _luminance_value->SetDigits (1);
-               _luminance_value->SetIncrement (0.1);
-               s->Add (_luminance_value, 0);
-               _luminance_unit = new wxChoice (panel, wxID_ANY);
-               s->Add (_luminance_unit, 0, wxLEFT, DCPOMATIC_SIZER_X_GAP);
-               sizer->Add (s, 1, wxEXPAND);
-       }
-
        {
                int flags = wxALIGN_TOP | wxRIGHT | wxTOP;
 #ifdef __WXOSX__
@@ -167,23 +155,17 @@ SMPTEMetadataDialog::setup ()
        _status->Append (_("Pre-release"));
        _status->Append (_("Final"));
 
-       _luminance_unit->Append (wxString::FromUTF8(_("candela per m²")));
-       _luminance_unit->Append (_("foot lambert"));
-
        _name_language->Changed.connect (boost::bind(&SMPTEMetadataDialog::name_language_changed, this, _1));
        _version_number->Bind (wxEVT_SPINCTRL, boost::bind(&SMPTEMetadataDialog::version_number_changed, this));
        _status->Bind (wxEVT_CHOICE, boost::bind(&SMPTEMetadataDialog::status_changed, this));
        _enable_distributor->Bind (wxEVT_CHECKBOX, boost::bind(&SMPTEMetadataDialog::enable_distributor_changed, this));
        _distributor->Bind (wxEVT_TEXT, boost::bind(&SMPTEMetadataDialog::distributor_changed, this));
-       _luminance_value->Bind (wxEVT_SPINCTRLDOUBLE, boost::bind(&SMPTEMetadataDialog::luminance_changed, this));
-       _luminance_unit->Bind (wxEVT_CHOICE, boost::bind(&SMPTEMetadataDialog::luminance_changed, this));
 
        film_changed (ChangeType::DONE, Film::Property::NAME_LANGUAGE);
        film_changed (ChangeType::DONE, Film::Property::VERSION_NUMBER);
        film_changed (ChangeType::DONE, Film::Property::STATUS);
        film_changed (ChangeType::DONE, Film::Property::DISTRIBUTOR);
        film_changed (ChangeType::DONE, Film::Property::CONTENT_VERSIONS);
-       film_changed (ChangeType::DONE, Film::Property::LUMINANCE);
 
        setup_sensitivity ();
 }
@@ -219,22 +201,6 @@ SMPTEMetadataDialog::film_changed (ChangeType type, Film::Property property)
                if (film()->distributor()) {
                        checked_set (_distributor, *film()->distributor());
                }
-       } else if (property == Film::Property::LUMINANCE) {
-               auto lum = film()->luminance();
-               if (lum) {
-                       checked_set (_luminance_value, lum->value());
-                       switch (lum->unit()) {
-                       case dcp::Luminance::Unit::CANDELA_PER_SQUARE_METRE:
-                               checked_set (_luminance_unit, 0);
-                               break;
-                       case dcp::Luminance::Unit::FOOT_LAMBERT:
-                               checked_set (_luminance_unit, 1);
-                               break;
-                       }
-               } else {
-                       checked_set (_luminance_value, 4.5);
-                       checked_set (_luminance_unit, 1);
-               }
        }
 }
 
@@ -305,25 +271,6 @@ SMPTEMetadataDialog::distributor_changed ()
 }
 
 
-void
-SMPTEMetadataDialog::luminance_changed ()
-{
-       dcp::Luminance::Unit unit;
-       switch (_luminance_unit->GetSelection()) {
-       case 0:
-               unit = dcp::Luminance::Unit::CANDELA_PER_SQUARE_METRE;
-               break;
-       case 1:
-               unit = dcp::Luminance::Unit::FOOT_LAMBERT;
-               break;
-       default:
-               DCPOMATIC_ASSERT (false);
-       }
-
-       film()->set_luminance (dcp::Luminance(_luminance_value->GetValue(), unit));
-}
-
-
 void
 SMPTEMetadataDialog::setup_sensitivity ()
 {
index acf1ac111685f62c9931cde269626c79a57540cf..d1a792a363239edadf8fb11fab1c6b171febbfd2 100644 (file)
@@ -58,7 +58,6 @@ private:
        void version_number_changed ();
        void status_changed ();
        void distributor_changed ();
-       void luminance_changed ();
        void enable_distributor_changed ();
 
        LanguageTagWidget* _name_language;
@@ -66,8 +65,6 @@ private:
        wxChoice* _status;
        wxCheckBox* _enable_distributor;
        wxTextCtrl* _distributor;
-       wxSpinCtrlDouble* _luminance_value;
-       wxChoice* _luminance_unit;
        EditableList<dcp::Rating, RatingDialog>* _ratings;
        EditableList<std::string, ContentVersionDialog>* _content_versions;
 };
index 013377e1658fe8b05e60a60d59688437313c8936..1d0fb0810339da93532f5250a526055e519e1f3a 100644 (file)
@@ -85,7 +85,6 @@ sources = """
           image_sequence_dialog.cc
           instant_i18n_dialog.cc
           interop_metadata_dialog.cc
-          isdcf_metadata_dialog.cc
           job_manager_view.cc
           job_view.cc
           job_view_dialog.cc
index c559e433fe5b976560babedf89f45e2ebff969f5..325ee62f46cfbab00a6aa0d11fcb0a501abe87ba 100644 (file)
@@ -66,8 +66,6 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test)
        film->set_ratings({dcp::Rating("BBFC", "PG")});
        film->set_studio (string("ST"));
        film->set_facility (string("FAC"));
-       ISDCFMetadata m;
-       film->set_isdcf_metadata (m);
        film->set_interop (true);
        BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilm_FTR-1_F_EN-XX_GB-PG_10_2K_ST_20140704_FAC_IOP_OV");
 
@@ -99,7 +97,6 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test)
        BOOST_REQUIRE (!wait_for_jobs());
        BOOST_REQUIRE (audio->audio);
        audio->audio->set_language (dcp::LanguageTag("de-DE"));
-       film->set_isdcf_metadata (m);
        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");
 
@@ -144,8 +141,7 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test)
        film->set_red_band (true);
        film->set_two_d_version_of_three_d (true);
        film->set_chain (string("MyChain"));
-       m.mastered_luminance = "4fl";
-       film->set_isdcf_metadata (m);
+       film->set_luminance (dcp::Luminance(4.5, dcp::Luminance::Unit::FOOT_LAMBERT));
        film->set_video_frame_rate (48);
        BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_XSN-2-Temp-Pre-RedBand-MyChain-2D-4fl-48_F-133_DE-fr_US-R_MOS_4K_DI_20140704_PPF_SMPTE_OV");
 
@@ -157,8 +153,7 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test)
        film->set_red_band (false);
        film->set_two_d_version_of_three_d (false);
        film->set_chain (string(""));
-       m.mastered_luminance = "";
-       film->set_isdcf_metadata (m);
+       film->set_luminance (boost::none);
        film->set_video_frame_rate (24);
        film->set_name ("IKnowCamels");
        BOOST_CHECK_EQUAL (film->isdcf_name(false), "IKnowCamels_XSN-2_F-133_DE-fr_US-R_MOS_4K_DI_20140704_PPF_SMPTE_OV");
index 8cbb2408b467a7004bea352c5a3c3f779118ef06..ed8a93135ca96c1cf0a82705fd4467d121977485 100644 (file)
@@ -105,7 +105,6 @@ setup_test_config ()
        Config::instance()->set_master_encoding_threads (boost::thread::hardware_concurrency());
        Config::instance()->set_server_encoding_threads (1);
        Config::instance()->set_server_port_base (61921);
-       Config::instance()->set_default_isdcf_metadata (ISDCFMetadata ());
        Config::instance()->set_default_container (Ratio::from_id ("185"));
        Config::instance()->set_default_dcp_content_type (static_cast<DCPContentType*> (0));
        Config::instance()->set_default_audio_delay (0);