- shared_ptr<dcp::CPL> cpl;
- BOOST_FOREACH (shared_ptr<dcp::CPL> i, cpl_list) {
- if (_dcp_content->cpl() && i->id() == _dcp_content->cpl().get()) {
- cpl = i;
+ _lazy_digest = calculate_lazy_digest (c);
+
+ if (old && old->lazy_digest() == _lazy_digest) {
+ _reels = old->_reels;
+ } else {
+
+ list<shared_ptr<dcp::CPL> > cpl_list = cpls ();
+
+ if (cpl_list.empty()) {
+ throw DCPError (_("No CPLs found in DCP."));
+ }
+
+ shared_ptr<dcp::CPL> cpl;
+ BOOST_FOREACH (shared_ptr<dcp::CPL> i, cpl_list) {
+ if (_dcp_content->cpl() && i->id() == _dcp_content->cpl().get()) {
+ cpl = i;
+ }
+ }
+
+ if (!cpl) {
+ /* No CPL found; probably an old file that doesn't specify it;
+ just use the first one.
+ */
+ cpl = cpls().front ();