Fix build with shared_ptr dcp::Subtitle and subclasses.
[dcpomatic.git] / src / lib / dcp_decoder.cc
index 2433ad0fb8bf1a4ca6ee6b82b6526ebfff56cbaa..9893cf7fc7318740aef7a8347b89219839e54d28 100644 (file)
@@ -198,22 +198,27 @@ DCPDecoder::pass_subtitles (ContentTime next)
 
        if ((*_reel)->main_subtitle() && (_decode_referenced || !_dcp_content->reference_subtitle())) {
                int64_t const entry_point = (*_reel)->main_subtitle()->entry_point ();
-               list<dcp::SubtitleString> subs = (*_reel)->main_subtitle()->asset()->subtitles_during (
+               list<shared_ptr<dcp::Subtitle> > subs = (*_reel)->main_subtitle()->asset()->subtitles_during (
                        dcp::Time (entry_point + frame, vfr, vfr),
                        dcp::Time (entry_point + frame + 1, vfr, vfr),
                        true
                        );
 
-               BOOST_FOREACH (dcp::SubtitleString i, subs) {
-                       list<dcp::SubtitleString> s;
-                       s.push_back (i);
-                       subtitle->emit_text (
-                               ContentTimePeriod (
-                                       ContentTime::from_frames (_offset - entry_point, vfr) + ContentTime::from_seconds (i.in().as_seconds ()),
-                                       ContentTime::from_frames (_offset - entry_point, vfr) + ContentTime::from_seconds (i.out().as_seconds ())
-                                       ),
-                               s
-                               );
+               BOOST_FOREACH (shared_ptr<dcp::Subtitle> i, subs) {
+                       shared_ptr<dcp::SubtitleString> is = dynamic_pointer_cast<dcp::SubtitleString> (i);
+                       if (is) {
+                               list<dcp::SubtitleString> s;
+                               s.push_back (*is);
+                               subtitle->emit_text (
+                                       ContentTimePeriod (
+                                               ContentTime::from_frames (_offset - entry_point, vfr) + ContentTime::from_seconds (i->in().as_seconds ()),
+                                               ContentTime::from_frames (_offset - entry_point, vfr) + ContentTime::from_seconds (i->out().as_seconds ())
+                                               ),
+                                       s
+                                       );
+                       }
+
+                       /* XXX: image subtitles */
                }
        }
 }