summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-05-24 11:44:16 +0100
committerCarl Hetherington <cth@carlh.net>2016-05-24 11:44:16 +0100
commit93d57d46e52e0050efda894fc3089a6410d55754 (patch)
treee24d7a4a71d03b18b171f45a8695316f0f4e905f /src/lib
parentf74ed4201c1d393982439724de5fa81ce0393550 (diff)
Disallow referencing of Interop DCPs in SMPTE films, and vice versa (#804).
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/dcp_content.cc36
-rw-r--r--src/lib/dcp_content.h2
-rw-r--r--src/lib/dcp_examiner.cc2
-rw-r--r--src/lib/dcp_examiner.h5
4 files changed, 44 insertions, 1 deletions
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<const Film> 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> 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<ContentPart> (shared_ptr<const Content>)> part, string overlapping, list<string>& 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<DCPTimePeriod> 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<dcp::Standard> _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<const DCPContent> 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<dcp::Standard> standard () const {
+ return _standard;
+ }
+
private:
boost::optional<double> _video_frame_rate;
boost::optional<dcp::Size> _video_size;
@@ -86,4 +90,5 @@ private:
bool _has_subtitles;
bool _encrypted;
bool _kdm_valid;
+ boost::optional<dcp::Standard> _standard;
};