X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fdcp_subtitle_decoder.cc;h=04b264192cd9d43c184449820b9c16213118ed28;hb=89aa9d4ba69e471949f791cdafe4ae20cea554d2;hp=e3f724d936ef782ae945911c16d9582ce112497b;hpb=2603c3c5d94ce5e300337d71eeabb56ff3f55fc4;p=dcpomatic.git diff --git a/src/lib/dcp_subtitle_decoder.cc b/src/lib/dcp_subtitle_decoder.cc index e3f724d93..04b264192 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 (); @@ -47,7 +40,7 @@ DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr con void DCPSubtitleDecoder::seek (ContentTime time, bool accurate) { - subtitle->seek (time, accurate); + Decoder::seek (time, accurate); _next = _subtitles.begin (); list::const_iterator i = _subtitles.begin (); @@ -57,7 +50,7 @@ DCPSubtitleDecoder::seek (ContentTime time, bool accurate) } bool -DCPSubtitleDecoder::pass (PassReason, bool) +DCPSubtitleDecoder::pass () { if (_next == _subtitles.end ()) { return true; @@ -78,37 +71,10 @@ DCPSubtitleDecoder::pass (PassReason, bool) ++_next; } - subtitle->give_text (p, s); - + subtitle->emit_text (p, s); 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 DCPSubtitleDecoder::content_time_period (dcp::SubtitleString s) const {