+ } catch (...) {}
+ return boost::none;
+ };
+
+ LOG_GENERAL("Looking at %1 reels", selected_cpl->reels().size());
+
+ int reel_index = 0;
+ for (auto reel: selected_cpl->reels()) {
+ LOG_GENERAL("Reel %1", reel->id());
+
+ if (reel->main_picture()) {
+ /* This will mean a VF can be displayed in the timeline even if its picture asset
+ * is yet be resolved.
+ */
+ _has_video = true;
+ _video_length += reel->main_picture()->actual_duration();
+
+ if (!reel->main_picture()->asset_ref().resolved()) {
+ LOG_GENERAL("Main picture %1 of reel %2 is missing", reel->main_picture()->id(), reel->id());
+ _needs_assets = true;
+ /* Use a dummy value here; it will be replaced when the VF is re-examined. */
+ _video_size = dcp::Size(1998, 1080);
+ } else {
+ LOG_GENERAL("Main picture %1 of reel %2 found", reel->main_picture()->id(), reel->id());
+
+ auto const frac = reel->main_picture()->edit_rate();
+ float const fr = float(frac.numerator) / frac.denominator;
+ if (!_video_frame_rate) {
+ _video_frame_rate = fr;
+ } else if (_video_frame_rate.get() != fr) {
+ throw DCPError (_("Mismatched frame rates in DCP"));
+ }
+
+ auto asset = reel->main_picture()->asset();
+ if (!_video_size) {
+ _video_size = asset->size ();
+ } else if (_video_size.get() != asset->size ()) {
+ throw DCPError (_("Mismatched video sizes in DCP"));
+ }
+ }
+ }
+
+ if (reel->main_sound()) {
+ _has_audio = true;
+ _audio_length += reel->main_sound()->actual_duration();
+
+ if (!reel->main_sound()->asset_ref().resolved()) {
+ LOG_GENERAL("Main sound %1 of reel %2 is missing", reel->main_sound()->id(), reel->id());
+ _needs_assets = true;
+ } else {
+ LOG_GENERAL("Main sound %1 of reel %2 found", reel->main_sound()->id(), reel->id());
+
+ auto asset = reel->main_sound()->asset();
+
+ if (!_audio_channels) {
+ _audio_channels = asset->channels();
+ } else if (_audio_channels.get() != asset->channels()) {
+ throw DCPError (_("Mismatched audio channel counts in DCP"));
+ }
+
+ _active_audio_channels = std::max(_active_audio_channels.get_value_or(0), asset->active_channels());