Take ISDCF metadata from templates.
[dcpomatic.git] / src / lib / dcp_content.cc
index 70914b39cd022ecc03f1f80d9047a44b5f1cb756..ad489917d65c41e6a328ec6b0dd0f37b046085e9 100644 (file)
@@ -146,7 +146,9 @@ DCPContent::examine (shared_ptr<Job> job)
        string const old_name = name ();
        bool had_subtitles = static_cast<bool> (subtitle);
 
-       job->set_progress_unknown ();
+       if (job) {
+               job->set_progress_unknown ();
+       }
        Content::examine (job);
 
        shared_ptr<DCPExaminer> examiner (new DCPExaminer (shared_from_this ()));
@@ -454,6 +456,9 @@ DCPContent::can_reference (function<shared_ptr<ContentPart> (shared_ptr<const Co
        } catch (dcp::DCPReadError) {
                /* We couldn't read the DCP; it's probably missing */
                return false;
+       } catch (dcp::KDMDecryptionError) {
+               /* We have an incorrect KDM */
+               return false;
        }
 
        /* fr must contain reels().  It can also contain other reels, but it must at
@@ -491,10 +496,13 @@ DCPContent::can_reference_audio (list<string>& why_not) const
 {
        shared_ptr<DCPDecoder> decoder;
        try {
-               decoder.reset (new DCPDecoder (shared_from_this(), film()->log()));
+               decoder.reset (new DCPDecoder (shared_from_this(), film()->log(), false));
        } catch (dcp::DCPReadError) {
                /* We couldn't read the DCP, so it's probably missing */
                return false;
+       } catch (dcp::KDMDecryptionError) {
+               /* We have an incorrect KDM */
+               return false;
        }
 
         BOOST_FOREACH (shared_ptr<dcp::Reel> i, decoder->reels()) {
@@ -512,10 +520,13 @@ DCPContent::can_reference_subtitle (list<string>& why_not) const
 {
        shared_ptr<DCPDecoder> decoder;
        try {
-               decoder.reset (new DCPDecoder (shared_from_this(), film()->log()));
+               decoder.reset (new DCPDecoder (shared_from_this(), film()->log(), false));
        } catch (dcp::DCPReadError) {
                /* We couldn't read the DCP, so it's probably missing */
                return false;
+       } catch (dcp::KDMDecryptionError) {
+               /* We have an incorrect KDM */
+               return false;
        }
 
         BOOST_FOREACH (shared_ptr<dcp::Reel> i, decoder->reels()) {
@@ -529,10 +540,12 @@ DCPContent::can_reference_subtitle (list<string>& why_not) const
 }
 
 void
-DCPContent::use_template (shared_ptr<const Content> c)
+DCPContent::take_settings_from (shared_ptr<const Content> c)
 {
        shared_ptr<const DCPContent> dc = dynamic_pointer_cast<const DCPContent> (c);
-       DCPOMATIC_ASSERT (dc);
+       if (!dc) {
+               return;
+       }
 
        _reference_video = dc->_reference_video;
        _reference_audio = dc->_reference_audio;