From b626119b67727f986339203a8a34a4c843fbf068 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 22 Aug 2018 19:58:23 +0100 Subject: [PATCH] Fix build with multiple closed captions. --- src/lib/dcp_content.cc | 3 ++- src/lib/player.cc | 15 ++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 2d375cf03..a2874a604 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -600,6 +600,7 @@ bool check_text (shared_ptr c) { return !c->text.empty(); } + bool DCPContent::can_reference_text (TextType type, string& why_not) const { @@ -620,7 +621,7 @@ DCPContent::can_reference_text (TextType type, string& why_not) const why_not = _("it does not have open subtitles in all its reels."); return false; } - if (type == TEXT_CLOSED_CAPTION && !i->closed_caption()) { + if (type == TEXT_CLOSED_CAPTION && i->closed_captions().empty()) { /// TRANSLATORS: this string will follow "Cannot reference this DCP: " why_not = _("it does not have closed captions in all its reels."); return false; diff --git a/src/lib/player.cc b/src/lib/player.cc index ce6912f0b..1e543fe1f 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -541,13 +541,14 @@ Player::get_reel_assets () } if (j->reference_text (TEXT_CLOSED_CAPTION)) { - shared_ptr ra = k->closed_caption (); - DCPOMATIC_ASSERT (ra); - ra->set_entry_point (ra->entry_point() + trim_start); - ra->set_duration (ra->duration() - trim_start - trim_end); - a.push_back ( - ReferencedReelAsset (ra, DCPTimePeriod (from, from + DCPTime::from_frames (ra->duration(), ffr))) - ); + BOOST_FOREACH (shared_ptr l, k->closed_captions()) { + DCPOMATIC_ASSERT (l); + l->set_entry_point (l->entry_point() + trim_start); + l->set_duration (l->duration() - trim_start - trim_end); + a.push_back ( + ReferencedReelAsset (l, DCPTimePeriod (from, from + DCPTime::from_frames (l->duration(), ffr))) + ); + } } /* Assume that main picture duration is the length of the reel */ -- 2.30.2