Fix build with multiple closed captions.
authorCarl Hetherington <cth@carlh.net>
Wed, 22 Aug 2018 18:58:23 +0000 (19:58 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 22 Aug 2018 18:58:23 +0000 (19:58 +0100)
src/lib/dcp_content.cc
src/lib/player.cc

index 2d375cf037faecc63b3cbd94662cbd5b8f9a940a..a2874a6044811a0524e3f8adf6fd080420443ca1 100644 (file)
@@ -600,6 +600,7 @@ bool check_text (shared_ptr<const Content> 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;
index ce6912f0b8aae9843a0782f8931def19fdb0b695..1e543fe1f2f79410d39461937bf20fad1e89b596 100644 (file)
@@ -541,13 +541,14 @@ Player::get_reel_assets ()
                        }
 
                        if (j->reference_text (TEXT_CLOSED_CAPTION)) {
-                               shared_ptr<dcp::ReelAsset> 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<dcp::ReelClosedCaptionAsset> 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 */