- dcp::DCP dcp (c->directory ());
- dcp.read (false, 0, true);
- if (c->kdm ()) {
- dcp.add (dcp::DecryptedKDM (c->kdm().get (), Config::instance()->decryption_chain()->key().get ()));
+ video.reset (new VideoDecoder (this, c, log));
+ if (c->audio) {
+ audio.reset (new AudioDecoder (this, c->audio, log, fast));
+ }
+ if (c->subtitle) {
+ /* XXX: this time here should be the time of the first subtitle, not 0 */
+ subtitle.reset (new SubtitleDecoder (this, c->subtitle, log, ContentTime()));
+ }
+
+ shared_ptr<dcp::CPL> cpl;
+ BOOST_FOREACH (shared_ptr<dcp::CPL> i, cpls ()) {
+ 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 ();
+ }
+
+ if (!_decode_referenced) {
+ if (c->reference_video()) {
+ video->set_ignore();
+ }
+ if (c->reference_audio()) {
+ audio->set_ignore();
+ }