From 93d57d46e52e0050efda894fc3089a6410d55754 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 24 May 2016 11:44:16 +0100 Subject: [PATCH] Disallow referencing of Interop DCPs in SMPTE films, and vice versa (#804). --- ChangeLog | 5 +++++ cscript | 2 +- src/lib/dcp_content.cc | 36 +++++++++++++++++++++++++++++++++++- src/lib/dcp_content.h | 2 ++ src/lib/dcp_examiner.cc | 2 ++ src/lib/dcp_examiner.h | 5 +++++ src/wx/video_panel.cc | 1 + 7 files changed, 51 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8092617c5..bf30c5f1c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-05-24 c.hetherington + + * Disallow referencing of Interop DCPs in SMPTE + films, and vice versa (#804). + 2016-05-23 c.hetherington * Fix missing words in properties window (#874). diff --git a/cscript b/cscript index 3854d29a0..e969a5236 100644 --- a/cscript +++ b/cscript @@ -236,7 +236,7 @@ def dependencies(target): ffmpeg_options = {} return (('ffmpeg-cdist', 'cd922b8', ffmpeg_options), - ('libdcp', '4e6b78d'), + ('libdcp', '043d382'), ('libsub', 'b082fb6')) def configure_options(target): diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 023af8e95..d41a59b71 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -97,6 +97,16 @@ DCPContent::DCPContent (shared_ptr film, cxml::ConstNodePtr node, in _reference_video = node->optional_bool_child ("ReferenceVideo").get_value_or (false); _reference_audio = node->optional_bool_child ("ReferenceAudio").get_value_or (false); _reference_subtitle = node->optional_bool_child ("ReferenceSubtitle").get_value_or (false); + if (node->optional_string_child("Standard")) { + string const s = node->optional_string_child("Standard").get(); + if (s == "Interop") { + _standard = dcp::INTEROP; + } else if (s == "SMPTE") { + _standard = dcp::SMPTE; + } else { + DCPOMATIC_ASSERT (false); + } + } } void @@ -143,6 +153,7 @@ DCPContent::examine (shared_ptr job) } _encrypted = examiner->encrypted (); _kdm_valid = examiner->kdm_valid (); + _standard = examiner->standard (); } if (could_be_played != can_be_played ()) { @@ -197,6 +208,18 @@ DCPContent::as_xml (xmlpp::Node* node) const node->add_child("ReferenceVideo")->add_child_text (_reference_video ? "1" : "0"); node->add_child("ReferenceAudio")->add_child_text (_reference_audio ? "1" : "0"); node->add_child("ReferenceSubtitle")->add_child_text (_reference_subtitle ? "1" : "0"); + if (_standard) { + switch (_standard.get ()) { + case dcp::INTEROP: + node->add_child("Standard")->add_child_text ("Interop"); + break; + case dcp::SMPTE: + node->add_child("Standard")->add_child_text ("SMPTE"); + break; + default: + DCPOMATIC_ASSERT (false); + } + } } DCPTime @@ -331,13 +354,24 @@ DCPContent::reel_split_points () const bool DCPContent::can_reference (function (shared_ptr)> part, string overlapping, list& why_not) const { + /* We must be using the same standard as the film */ + if (_standard) { + if (_standard.get() == dcp::INTEROP && !film()->interop()) { + why_not.push_back (_("The film is set to SMPTE and this DCP is Interop.")); + return false; + } else if (_standard.get() == dcp::SMPTE && film()->interop()) { + why_not.push_back (_("The film is set to Interop and this DCP is SMPTE.")); + return false; + } + } + list const fr = film()->reels (); /* fr must contain reels(). It can also contain other reels, but it must at least contain reels(). */ BOOST_FOREACH (DCPTimePeriod i, reels()) { if (find (fr.begin(), fr.end(), i) == fr.end ()) { - why_not.push_back (_("Reel lengths in the project differ from those in the DCP; set the reel mode to 'split by video content'.")); + why_not.push_back (_("Reel lengths in the film differ from those in the DCP; set the reel mode to 'split by video content'.")); return false; } } diff --git a/src/lib/dcp_content.h b/src/lib/dcp_content.h index 489151e03..7ea9c3500 100644 --- a/src/lib/dcp_content.h +++ b/src/lib/dcp_content.h @@ -138,6 +138,8 @@ private: * rather than by rewrapping. */ bool _reference_subtitle; + + boost::optional _standard; }; #endif diff --git a/src/lib/dcp_examiner.cc b/src/lib/dcp_examiner.cc index 81cb98b98..93d553476 100644 --- a/src/lib/dcp_examiner.cc +++ b/src/lib/dcp_examiner.cc @@ -134,4 +134,6 @@ DCPExaminer::DCPExaminer (shared_ptr content) throw runtime_error (_("The KDM does not decrypt the DCP. Perhaps it is targeted at the wrong CPL.")); } } + + _standard = dcp.standard (); } diff --git a/src/lib/dcp_examiner.h b/src/lib/dcp_examiner.h index f2609ed3e..542f018c9 100644 --- a/src/lib/dcp_examiner.h +++ b/src/lib/dcp_examiner.h @@ -75,6 +75,10 @@ public: return _kdm_valid; } + boost::optional standard () const { + return _standard; + } + private: boost::optional _video_frame_rate; boost::optional _video_size; @@ -86,4 +90,5 @@ private: bool _has_subtitles; bool _encrypted; bool _kdm_valid; + boost::optional _standard; }; diff --git a/src/wx/video_panel.cc b/src/wx/video_panel.cc index a8a1d98c8..3ab78727e 100644 --- a/src/wx/video_panel.cc +++ b/src/wx/video_panel.cc @@ -256,6 +256,7 @@ VideoPanel::film_changed (Film::Property property) setup_description (); break; case Film::REEL_TYPE: + case Film::INTEROP: setup_sensitivity (); default: break; -- 2.30.2