X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fdcp_subtitle_decoder.cc;h=3c7bffdda440295cdc8033bb943922b6e5ba743b;hb=e60bb3e51bd1508b149e6b8f6608f09b5196ae26;hp=20a9f32fee031ddd99fc03f19ab1d5182614e6f7;hpb=fc56dc97103d00437843a31e1ef0c4915900ad1a;p=dcpomatic.git diff --git a/src/lib/dcp_subtitle_decoder.cc b/src/lib/dcp_subtitle_decoder.cc index 20a9f32fe..3c7bffdda 100644 --- a/src/lib/dcp_subtitle_decoder.cc +++ b/src/lib/dcp_subtitle_decoder.cc @@ -17,9 +17,9 @@ */ -#include #include "dcp_subtitle_decoder.h" #include "dcp_subtitle_content.h" +#include using std::list; using std::cout; @@ -28,8 +28,8 @@ using boost::shared_ptr; DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr content) : SubtitleDecoder (content) { - dcp::SubtitleContent c (content->path (0), false); - _subtitles = c.subtitles (); + shared_ptr c (load (content->path (0))); + _subtitles = c->subtitles (); _next = _subtitles.begin (); } @@ -40,7 +40,7 @@ DCPSubtitleDecoder::seek (ContentTime time, bool accurate) _next = _subtitles.begin (); list::const_iterator i = _subtitles.begin (); - while (i != _subtitles.end() && ContentTime::from_seconds (_next->in().to_seconds()) < time) { + while (i != _subtitles.end() && ContentTime::from_seconds (_next->in().as_seconds()) < time) { ++i; } } @@ -61,7 +61,13 @@ DCPSubtitleDecoder::pass () } list -DCPSubtitleDecoder::subtitles_during (ContentTimePeriod p, bool starting) const +DCPSubtitleDecoder::image_subtitles_during (ContentTimePeriod, bool) const +{ + return list (); +} + +list +DCPSubtitleDecoder::text_subtitles_during (ContentTimePeriod p, bool starting) const { /* XXX: inefficient */ @@ -69,10 +75,10 @@ DCPSubtitleDecoder::subtitles_during (ContentTimePeriod p, bool starting) const for (list::const_iterator i = _subtitles.begin(); i != _subtitles.end(); ++i) { ContentTimePeriod period ( - ContentTime::from_seconds (i->in().to_seconds ()), - ContentTime::from_seconds (i->out().to_seconds ()) + ContentTime::from_seconds (i->in().as_seconds ()), + ContentTime::from_seconds (i->out().as_seconds ()) ); - + if ((starting && p.contains (period.from)) || (!starting && p.overlaps (period))) { d.push_back (period); }