summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-10-09 14:15:58 +0200
committerCarl Hetherington <cth@carlh.net>2022-10-09 14:38:11 +0200
commitaca38e865ed9907b4e739cfe944f84bae5924b22 (patch)
treed4195672475883b4a2e2e082a3f9f80ed2152948 /src
parent1ab78ed48d7b5a7930e0f6359d8e6ed3357a9be1 (diff)
Make CPL metadata writing optional.
Diffstat (limited to 'src')
-rw-r--r--src/lib/film.cc11
-rw-r--r--src/lib/film.h7
-rw-r--r--src/lib/writer.cc2
-rw-r--r--src/wx/advanced_dcp_settings_dialog.cc55
-rw-r--r--src/wx/advanced_dcp_settings_dialog.h40
-rw-r--r--src/wx/dcp_panel.cc17
-rw-r--r--src/wx/dcp_panel.h2
-rw-r--r--src/wx/wscript1
8 files changed, 134 insertions, 1 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index d5597b5a1..ca13772cb 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -468,6 +468,7 @@ Film::metadata (bool with_content_paths) const
if (_audio_language) {
root->add_child("AudioLanguage")->add_child_text(_audio_language->to_string());
}
+ root->add_child("WriteCPLMetadata")->add_child_text(_write_cpl_metadata ? "1" : "0");
_playlist->as_xml (root->add_child ("Playlist"), with_content_paths);
return doc;
@@ -698,6 +699,8 @@ Film::read_metadata (optional<boost::filesystem::path> path)
_chain = isdcf->optional_string_child("Chain");
}
+ _write_cpl_metadata = f.optional_bool_child("WriteCPLMetadata").get_value_or(true);
+
list<string> notes;
_playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"), _state_version, notes);
@@ -2208,3 +2211,11 @@ Film::last_written_by_earlier_than(int major, int minor, int micro) const
return our_micro < micro;
}
+
+void
+Film::set_write_cpl_metadata(bool write)
+{
+ FilmChangeSignaller ch (this, Property::WRITE_CPL_METADATA);
+ _write_cpl_metadata = write;
+}
+
diff --git a/src/lib/film.h b/src/lib/film.h
index 72d6d5e8d..8d0d6187a 100644
--- a/src/lib/film.h
+++ b/src/lib/film.h
@@ -257,6 +257,7 @@ public:
RED_BAND,
TWO_D_VERSION_OF_THREE_D,
LUMINANCE,
+ WRITE_CPL_METADATA,
};
@@ -418,6 +419,10 @@ public:
return _audio_frame_rate;
}
+ bool write_cpl_metadata() const {
+ return _write_cpl_metadata;
+ }
+
/* SET */
void set_directory (boost::filesystem::path);
@@ -465,6 +470,7 @@ public:
void set_luminance (boost::optional<dcp::Luminance> l = boost::none);
void set_audio_language (boost::optional<dcp::LanguageTag> language);
void set_audio_frame_rate (int rate);
+ void set_write_cpl_metadata(bool write);
void add_ffoc_lfoc (Markers& markers) const;
@@ -578,6 +584,7 @@ private:
boost::optional<dcp::Luminance> _luminance;
boost::optional<dcp::LanguageTag> _audio_language;
int _audio_frame_rate = 48000;
+ bool _write_cpl_metadata = true;
int _state_version;
diff --git a/src/lib/writer.cc b/src/lib/writer.cc
index 2dd46f0b2..50886d957 100644
--- a/src/lib/writer.cc
+++ b/src/lib/writer.cc
@@ -696,7 +696,7 @@ Writer::finish (boost::filesystem::path output_dcp)
dcp.set_creator(creator);
dcp.set_annotation_text(film()->dcp_name());
- dcp.write_xml (signer, Config::instance()->dcp_metadata_filename_format());
+ dcp.write_xml(signer, Config::instance()->dcp_metadata_filename_format(), film()->write_cpl_metadata());
LOG_GENERAL (
N_("Wrote %1 FULL, %2 FAKE, %3 REPEAT, %4 pushed to disk"), _full_written, _fake_written, _repeat_written, _pushed_to_disk
diff --git a/src/wx/advanced_dcp_settings_dialog.cc b/src/wx/advanced_dcp_settings_dialog.cc
new file mode 100644
index 000000000..f5419fb4e
--- /dev/null
+++ b/src/wx/advanced_dcp_settings_dialog.cc
@@ -0,0 +1,55 @@
+/*
+ Copyright (C) 2022 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 "advanced_dcp_settings_dialog.h"
+#include "check_box.h"
+#include "wx_util.h"
+#include "lib/film.h"
+
+
+using std::shared_ptr;
+
+
+AdvancedDCPSettingsDialog::AdvancedDCPSettingsDialog(wxWindow* parent, shared_ptr<const Film> film)
+ : wxDialog(parent, wxID_ANY, _("Advanced DCP settings"))
+{
+ auto sizer = new wxBoxSizer(wxVERTICAL);
+
+ _write_cpl_metadata = new CheckBox(this, _("Write CPL metadata"));
+ _write_cpl_metadata->set(film->write_cpl_metadata());
+
+ sizer->Add(_write_cpl_metadata, 0, wxALL, DCPOMATIC_SIZER_GAP);
+
+ auto buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
+ if (buttons) {
+ sizer->Add(buttons, wxSizerFlags().Expand().DoubleBorder());
+ }
+
+ SetSizerAndFit(sizer);
+}
+
+
+bool
+AdvancedDCPSettingsDialog::write_cpl_metadata() const
+{
+ return _write_cpl_metadata->get();
+}
+
diff --git a/src/wx/advanced_dcp_settings_dialog.h b/src/wx/advanced_dcp_settings_dialog.h
new file mode 100644
index 000000000..27c803a54
--- /dev/null
+++ b/src/wx/advanced_dcp_settings_dialog.h
@@ -0,0 +1,40 @@
+/*
+ Copyright (C) 2022 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 <wx/dialog.h>
+#include <memory>
+
+
+class CheckBox;
+class Film;
+
+
+class AdvancedDCPSettingsDialog : public wxDialog
+{
+public:
+ AdvancedDCPSettingsDialog(wxWindow* parent, std::shared_ptr<const Film> film);
+
+ bool write_cpl_metadata() const;
+
+private:
+ CheckBox* _write_cpl_metadata;
+};
+
diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc
index 895aed9c9..ea170d331 100644
--- a/src/wx/dcp_panel.cc
+++ b/src/wx/dcp_panel.cc
@@ -19,6 +19,7 @@
*/
+#include "advanced_dcp_settings_dialog.h"
#include "audio_dialog.h"
#include "check_box.h"
#include "check_box.h"
@@ -40,6 +41,7 @@
#include "lib/ffmpeg_content.h"
#include "lib/film.h"
#include "lib/ratio.h"
+#include "lib/scope_guard.h"
#include "lib/text_content.h"
#include "lib/util.h"
#include "lib/video_content.h"
@@ -121,6 +123,7 @@ DCPPanel::DCPPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmViewer> v
_markers = new Button (_panel, _("Markers..."));
_metadata = new Button (_panel, _("Metadata..."));
+ _advanced = new Button(_panel, _("Advanced..."));
_notebook = new wxNotebook (_panel, wxID_ANY);
_sizer->Add (_notebook, 1, wxEXPAND | wxTOP, 6);
@@ -138,6 +141,7 @@ 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));
+ _advanced->Bind (wxEVT_BUTTON, boost::bind(&DCPPanel::advanced_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));
@@ -223,6 +227,7 @@ DCPPanel::add_to_grid ()
auto extra = new wxBoxSizer (wxHORIZONTAL);
extra->Add (_markers, 1, wxRIGHT, DCPOMATIC_SIZER_X_GAP);
extra->Add (_metadata, 1, wxRIGHT, DCPOMATIC_SIZER_X_GAP);
+ extra->Add(_advanced, 1, wxRIGHT, DCPOMATIC_SIZER_X_GAP);
_grid->Add (extra, wxGBPosition(r, 0), wxGBSpan(1, 2));
++r;
}
@@ -362,6 +367,18 @@ DCPPanel::metadata_clicked ()
void
+DCPPanel::advanced_clicked()
+{
+ auto dialog = new AdvancedDCPSettingsDialog(_panel, _film);
+ ScopeGuard sg = [dialog]() { dialog->Destroy(); };
+
+ if (dialog->ShowModal() == wxID_OK) {
+ _film->set_write_cpl_metadata(dialog->write_cpl_metadata());
+ }
+}
+
+
+void
DCPPanel::film_changed (Film::Property p)
{
switch (p) {
diff --git a/src/wx/dcp_panel.h b/src/wx/dcp_panel.h
index 37bc20aa3..ebbc0f924 100644
--- a/src/wx/dcp_panel.h
+++ b/src/wx/dcp_panel.h
@@ -85,6 +85,7 @@ private:
void reel_length_changed ();
void markers_clicked ();
void metadata_clicked ();
+ void advanced_clicked();
void reencode_j2k_changed ();
void enable_audio_language_toggled ();
void edit_audio_language_clicked ();
@@ -157,6 +158,7 @@ private:
wxSpinCtrl* _reel_length;
wxButton* _markers;
wxButton* _metadata;
+ wxButton* _advanced;
wxSizer* _audio_panel_sizer;
AudioDialog* _audio_dialog = nullptr;
diff --git a/src/wx/wscript b/src/wx/wscript
index 236e99f97..fc3002d7c 100644
--- a/src/wx/wscript
+++ b/src/wx/wscript
@@ -26,6 +26,7 @@ import i18n
sources = """
about_dialog.cc
+ advanced_dcp_settings_dialog.cc
audio_dialog.cc
audio_gain_dialog.cc
audio_mapping_view.cc