+
+ _encrypted = dcp.encrypted ();
+ _kdm_valid = true;
+
+ /* Check that we can read the first picture frame */
+ try {
+ if (!dcp.cpls().empty () && !dcp.cpls().front()->reels().empty ()) {
+ shared_ptr<dcp::PictureMXF> mxf = dcp.cpls().front()->reels().front()->main_picture()->mxf ();
+ shared_ptr<dcp::MonoPictureMXF> mono = dynamic_pointer_cast<dcp::MonoPictureMXF> (mxf);
+ shared_ptr<dcp::StereoPictureMXF> stereo = dynamic_pointer_cast<dcp::StereoPictureMXF> (mxf);
+
+ shared_ptr<Image> image (new Image (PIX_FMT_RGB24, _video_size.get(), false));
+
+ if (mono) {
+ mono->get_frame(0)->rgb_frame (image->data()[0]);
+ } else {
+ stereo->get_frame(0)->rgb_frame (dcp::EYE_LEFT, image->data()[0]);
+ }
+
+ }
+ } catch (dcp::DCPReadError& e) {
+ _kdm_valid = false;
+ if (_encrypted && content->kdm ()) {
+ /* XXX: maybe don't use an exception for this */
+ throw StringError (_("The KDM does not decrypt the DCP. Perhaps it is targeted at the wrong CPL"));
+ }
+ }