X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fdcp_subtitle_decoder.cc;h=9db3254019675061cc0f8095abb9f89604b111f1;hb=de2af791bdfdcd653752cba970e59efc7bf810c7;hp=fe383226ee7a33f27a474248feba3c9077bd13f3;hpb=f113b2aaca7a65f7b37e12a7d9f3f99e2d834e81;p=dcpomatic.git diff --git a/src/lib/dcp_subtitle_decoder.cc b/src/lib/dcp_subtitle_decoder.cc index fe383226e..9db325401 100644 --- a/src/lib/dcp_subtitle_decoder.cc +++ b/src/lib/dcp_subtitle_decoder.cc @@ -28,16 +28,9 @@ using std::cout; using boost::shared_ptr; using boost::bind; -DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr content) +DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr content, shared_ptr log) { - subtitle.reset ( - new SubtitleDecoder ( - this, - content->subtitle, - bind (&DCPSubtitleDecoder::image_subtitles_during, this, _1, _2), - bind (&DCPSubtitleDecoder::text_subtitles_during, this, _1, _2) - ) - ); + subtitle.reset (new SubtitleDecoder (this, content->subtitle, log)); shared_ptr c (load (content->path (0))); _subtitles = c->subtitles (); @@ -45,10 +38,8 @@ DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr con } void -DCPSubtitleDecoder::seek (ContentTime time, bool accurate) +DCPSubtitleDecoder::seek (ContentTime time, bool) { - subtitle->seek (time, accurate); - _next = _subtitles.begin (); list::const_iterator i = _subtitles.begin (); while (i != _subtitles.end() && ContentTime::from_seconds (_next->in().as_seconds()) < time) { @@ -56,11 +47,11 @@ DCPSubtitleDecoder::seek (ContentTime time, bool accurate) } } -bool -DCPSubtitleDecoder::pass (PassReason, bool) +void +DCPSubtitleDecoder::pass () { if (_next == _subtitles.end ()) { - return true; + return; } /* Gather all subtitles with the same time period that are next @@ -78,36 +69,8 @@ DCPSubtitleDecoder::pass (PassReason, bool) ++_next; } - subtitle->give_text (p, s); + subtitle->emit_text (p, s); subtitle->set_position (p.from); - - return false; -} - -list -DCPSubtitleDecoder::image_subtitles_during (ContentTimePeriod, bool) const -{ - return list (); -} - -list -DCPSubtitleDecoder::text_subtitles_during (ContentTimePeriod p, bool starting) const -{ - /* XXX: inefficient */ - - list d; - - for (list::const_iterator i = _subtitles.begin(); i != _subtitles.end(); ++i) { - ContentTimePeriod period = content_time_period (*i); - if ((starting && p.contains(period.from)) || (!starting && p.overlap(period))) { - d.push_back (period); - } - } - - d.sort (); - d.unique (); - - return d; } ContentTimePeriod