Store reel lengths in DCPContent to speed up e.g. timeline with many DCPs.
[dcpomatic.git] / src / lib / dcp_examiner.cc
index e25583cb69064b9ac3dd2fdb7352ab17c13efece..9969245305211b901a4ec66db317af6d53143c51 100644 (file)
@@ -163,6 +163,14 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content)
 
                        _has_subtitles = true;
                }
+
+               if (i->main_picture()) {
+                       _reel_lengths.push_back (i->main_picture()->duration());
+               } else if (i->main_sound()) {
+                       _reel_lengths.push_back (i->main_sound()->duration());
+               } else if (i->main_subtitle()) {
+                       _reel_lengths.push_back (i->main_subtitle()->duration());
+               }
        }
 
        _encrypted = cpl->encrypted ();
@@ -192,10 +200,6 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content)
                }
        } catch (dcp::DCPReadError& e) {
                _kdm_valid = false;
-               if (_encrypted && content->kdm ()) {
-                       /* XXX: maybe don't use an exception for this */
-                       throw runtime_error (_("The KDM does not decrypt the DCP.  Perhaps it is targeted at the wrong CPL."));
-               }
        }
 
        DCPOMATIC_ASSERT (cpl->standard ());