summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-12-04 23:40:39 +0000
committerCarl Hetherington <cth@carlh.net>2013-12-04 23:40:39 +0000
commit47d5204ee41d891c5ad9a204a2b1fa10ed2e7658 (patch)
tree8e2abd982a1ed6cb34a24a82bd04cf7d190a7be3 /src
parenta3241f40b061480a0907699a5857075388216643 (diff)
Make signatures optional (#273).
Diffstat (limited to 'src')
-rw-r--r--src/lib/film.cc10
-rw-r--r--src/lib/film.h8
-rw-r--r--src/lib/writer.cc2
-rw-r--r--src/wx/film_editor.cc33
-rw-r--r--src/wx/film_editor.h2
5 files changed, 53 insertions, 2 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index 71836f254..5946d5bec 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -96,6 +96,7 @@ Film::Film (boost::filesystem::path dir)
, _resolution (RESOLUTION_2K)
, _scaler (Scaler::from_id ("bicubic"))
, _with_subtitles (false)
+ , _signed (true)
, _encrypted (false)
, _j2k_bandwidth (Config::instance()->default_j2k_bandwidth ())
, _dci_metadata (Config::instance()->default_dci_metadata ())
@@ -351,6 +352,7 @@ Film::write_metadata () const
root->add_child("ThreeD")->add_child_text (_three_d ? "1" : "0");
root->add_child("SequenceVideo")->add_child_text (_sequence_video ? "1" : "0");
root->add_child("Interop")->add_child_text (_interop ? "1" : "0");
+ root->add_child("Signed")->add_child_text (_signed ? "1" : "0");
root->add_child("Encrypted")->add_child_text (_encrypted ? "1" : "0");
root->add_child("Key")->add_child_text (_key.hex ());
_playlist->as_xml (root->add_child ("Playlist"));
@@ -399,6 +401,7 @@ Film::read_metadata ()
_dci_metadata = DCIMetadata (f.node_child ("DCIMetadata"));
_video_frame_rate = f.number_child<int> ("VideoFrameRate");
_dci_date = boost::gregorian::from_undelimited_string (f.string_child ("DCIDate"));
+ _signed = f.optional_bool_child("Signed").get_value_or (true);
_encrypted = f.bool_child ("Encrypted");
_audio_channels = f.number_child<int> ("AudioChannels");
_sequence_video = f.bool_child ("SequenceVideo");
@@ -763,6 +766,13 @@ Film::make_player () const
}
void
+Film::set_signed (bool s)
+{
+ _signed = s;
+ signal_changed (SIGNED);
+}
+
+void
Film::set_encrypted (bool e)
{
_encrypted = e;
diff --git a/src/lib/film.h b/src/lib/film.h
index 6bd04572b..4b07f84a9 100644
--- a/src/lib/film.h
+++ b/src/lib/film.h
@@ -149,6 +149,7 @@ public:
RESOLUTION,
SCALER,
WITH_SUBTITLES,
+ SIGNED,
ENCRYPTED,
J2K_BANDWIDTH,
DCI_METADATA,
@@ -195,6 +196,11 @@ public:
return _with_subtitles;
}
+ /* signed is a reserved word */
+ bool is_signed () const {
+ return _signed;
+ }
+
bool encrypted () const {
return _encrypted;
}
@@ -244,6 +250,7 @@ public:
void set_resolution (Resolution);
void set_scaler (Scaler const *);
void set_with_subtitles (bool);
+ void set_signed (bool);
void set_encrypted (bool);
void set_j2k_bandwidth (int);
void set_dci_metadata (DCIMetadata);
@@ -295,6 +302,7 @@ private:
Scaler const * _scaler;
/** True if subtitles should be shown for this film */
bool _with_subtitles;
+ bool _signed;
bool _encrypted;
/** bandwidth for J2K files in bits per second */
int _j2k_bandwidth;
diff --git a/src/lib/writer.cc b/src/lib/writer.cc
index 60b2a47ab..4c9749d89 100644
--- a/src/lib/writer.cc
+++ b/src/lib/writer.cc
@@ -400,7 +400,7 @@ Writer::finish ()
libdcp::XMLMetadata meta = Config::instance()->dcp_metadata ();
meta.set_issue_date_now ();
- dcp.write_xml (_film->interop (), meta, make_signer ());
+ dcp.write_xml (_film->interop (), meta, _film->is_signed() ? make_signer () : shared_ptr<const libdcp::Signer> ());
_film->log()->log (String::compose (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/film_editor.cc b/src/wx/film_editor.cc
index 11926b8a1..564b90d28 100644
--- a/src/wx/film_editor.cc
+++ b/src/wx/film_editor.cc
@@ -150,6 +150,10 @@ FilmEditor::make_dcp_panel ()
}
++r;
+ _signed = new wxCheckBox (_dcp_panel, wxID_ANY, _("Signed"));
+ grid->Add (_signed, wxGBPosition (r, 0), wxGBSpan (1, 2));
+ ++r;
+
_encrypted = new wxCheckBox (_dcp_panel, wxID_ANY, _("Encrypted"));
grid->Add (_encrypted, wxGBPosition (r, 0), wxGBSpan (1, 2));
++r;
@@ -238,6 +242,7 @@ FilmEditor::connect_to_widgets ()
_dcp_content_type->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&FilmEditor::dcp_content_type_changed, this));
_frame_rate->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&FilmEditor::frame_rate_changed, this));
_best_frame_rate->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&FilmEditor::best_frame_rate_clicked, this));
+ _signed->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&FilmEditor::signed_toggled, this));
_encrypted->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&FilmEditor::encrypted_toggled, this));
_audio_channels->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&FilmEditor::audio_channels_changed, this));
_j2k_bandwidth->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&FilmEditor::j2k_bandwidth_changed, this));
@@ -320,6 +325,16 @@ FilmEditor::j2k_bandwidth_changed ()
}
void
+FilmEditor::signed_toggled ()
+{
+ if (!_film) {
+ return;
+ }
+
+ _film->set_signed (_signed->GetValue ());
+}
+
+void
FilmEditor::encrypted_toggled ()
{
if (!_film) {
@@ -416,8 +431,17 @@ FilmEditor::film_changed (Film::Property p)
case Film::SCALER:
checked_set (_scaler, Scaler::as_index (_film->scaler ()));
break;
+ case Film::SIGNED:
+ checked_set (_signed, _film->is_signed ());
+ break;
case Film::ENCRYPTED:
checked_set (_encrypted, _film->encrypted ());
+ if (_film->encrypted ()) {
+ _film->set_signed (true);
+ _signed->Enable (false);
+ } else {
+ _signed->Enable (_generally_sensitive);
+ }
break;
case Film::RESOLUTION:
checked_set (_resolution, _film->resolution() == RESOLUTION_2K ? 0 : 1);
@@ -572,12 +596,12 @@ FilmEditor::set_film (shared_ptr<Film> f)
film_changed (Film::RESOLUTION);
film_changed (Film::SCALER);
film_changed (Film::WITH_SUBTITLES);
+ film_changed (Film::SIGNED);
film_changed (Film::ENCRYPTED);
film_changed (Film::J2K_BANDWIDTH);
film_changed (Film::DCI_METADATA);
film_changed (Film::VIDEO_FRAME_RATE);
film_changed (Film::AUDIO_CHANNELS);
- film_changed (Film::ENCRYPTED);
film_changed (Film::SEQUENCE_VIDEO);
film_changed (Film::THREE_D);
film_changed (Film::INTEROP);
@@ -606,6 +630,13 @@ FilmEditor::set_general_sensitivity (bool s)
_content_later->Enable (s);
_content_timeline->Enable (s);
_dcp_content_type->Enable (s);
+
+ bool si = s;
+ if (_film && _film->encrypted ()) {
+ si = false;
+ }
+ _signed->Enable (si);
+
_encrypted->Enable (s);
_frame_rate->Enable (s);
_audio_channels->Enable (s);
diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h
index 7fd61e5fc..23c87e678 100644
--- a/src/wx/film_editor.h
+++ b/src/wx/film_editor.h
@@ -96,6 +96,7 @@ private:
void content_right_click (wxListEvent &);
void three_d_changed ();
void standard_changed ();
+ void signed_toggled ();
void encrypted_toggled ();
/* Handle changes to the model */
@@ -147,6 +148,7 @@ private:
wxCheckBox* _three_d;
wxChoice* _resolution;
wxChoice* _standard;
+ wxCheckBox* _signed;
wxCheckBox* _encrypted;
ContentMenu _menu;