+ if (i->main_subtitle ()) {
+ if (!i->main_subtitle()->asset_ref().resolved()) {
+ /* We are missing this asset so we can't continue; examination will be repeated later */
+ _needs_assets = true;
+ return;
+ }
+
+ _text_count[TEXT_OPEN_SUBTITLE] = 1;
+ }
+
+ BOOST_FOREACH (shared_ptr<dcp::ReelClosedCaptionAsset> j, i->closed_captions()) {
+ if (!j->asset_ref().resolved()) {
+ /* We are missing this asset so we can't continue; examination will be repeated later */
+ _needs_assets = true;
+ return;
+ }
+
+ _text_count[TEXT_CLOSED_CAPTION]++;
+ }
+
+ if (i->main_markers ()) {
+ map<dcp::Marker, dcp::Time> rm = i->main_markers()->get();
+ _markers.insert (rm.begin(), rm.end());
+ }
+
+ if (i->main_picture()) {
+ _reel_lengths.push_back (i->main_picture()->actual_duration());
+ } else if (i->main_sound()) {
+ _reel_lengths.push_back (i->main_sound()->actual_duration());
+ } else if (i->main_subtitle()) {
+ _reel_lengths.push_back (i->main_subtitle()->actual_duration());
+ } else if (!i->closed_captions().empty()) {
+ _reel_lengths.push_back (i->closed_captions().front()->actual_duration());
+ }
+ }
+
+ _encrypted = cpl->encrypted ();
+ _kdm_valid = true;
+
+ /* Check that we can read the first picture, sound and subtitle frames of each reel */
+ try {
+ BOOST_FOREACH (shared_ptr<dcp::Reel> i, cpl->reels()) {
+ shared_ptr<dcp::PictureAsset> pic = i->main_picture()->asset ();
+ shared_ptr<dcp::MonoPictureAsset> mono = dynamic_pointer_cast<dcp::MonoPictureAsset> (pic);
+ shared_ptr<dcp::StereoPictureAsset> stereo = dynamic_pointer_cast<dcp::StereoPictureAsset> (pic);
+
+ if (mono) {
+ mono->start_read()->get_frame(0)->xyz_image ();
+ } else {
+ stereo->start_read()->get_frame(0)->xyz_image (dcp::EYE_LEFT);
+ }
+
+ if (i->main_sound()) {
+ shared_ptr<dcp::SoundAsset> sound = i->main_sound()->asset ();
+ i->main_sound()->asset()->start_read()->get_frame(0);
+ }
+
+ if (i->main_subtitle()) {
+ i->main_subtitle()->asset()->subtitles ();
+ }