diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-11-21 16:57:15 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-04-19 23:04:32 +0100 |
| commit | de2af791bdfdcd653752cba970e59efc7bf810c7 (patch) | |
| tree | 1aa5dbc35daee0babd0def347944a6bea4154deb /src/lib/dcp_subtitle_decoder.cc | |
| parent | 06152300e69e8faca44ff8d7f12a6fd354848b9a (diff) | |
Basic grunt-work, untested and unfinished, but it compiles.
Diffstat (limited to 'src/lib/dcp_subtitle_decoder.cc')
| -rw-r--r-- | src/lib/dcp_subtitle_decoder.cc | 51 |
1 files changed, 7 insertions, 44 deletions
diff --git a/src/lib/dcp_subtitle_decoder.cc b/src/lib/dcp_subtitle_decoder.cc index 824ddba19..9db325401 100644 --- a/src/lib/dcp_subtitle_decoder.cc +++ b/src/lib/dcp_subtitle_decoder.cc @@ -30,15 +30,7 @@ using boost::bind; DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr<const DCPSubtitleContent> content, shared_ptr<Log> log) { - subtitle.reset ( - new SubtitleDecoder ( - this, - content->subtitle, - log, - 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<dcp::SubtitleAsset> c (load (content->path (0))); _subtitles = c->subtitles (); @@ -46,10 +38,8 @@ DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr<const DCPSubtitleContent> con } void -DCPSubtitleDecoder::seek (ContentTime time, bool accurate) +DCPSubtitleDecoder::seek (ContentTime time, bool) { - subtitle->seek (time, accurate); - _next = _subtitles.begin (); list<dcp::SubtitleString>::const_iterator i = _subtitles.begin (); while (i != _subtitles.end() && ContentTime::from_seconds (_next->in().as_seconds()) < time) { @@ -57,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 @@ -79,35 +69,8 @@ DCPSubtitleDecoder::pass (PassReason, bool) ++_next; } - subtitle->give_text (p, s); - - return false; -} - -list<ContentTimePeriod> -DCPSubtitleDecoder::image_subtitles_during (ContentTimePeriod, bool) const -{ - return list<ContentTimePeriod> (); -} - -list<ContentTimePeriod> -DCPSubtitleDecoder::text_subtitles_during (ContentTimePeriod p, bool starting) const -{ - /* XXX: inefficient */ - - list<ContentTimePeriod> d; - - for (list<dcp::SubtitleString>::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; + subtitle->emit_text (p, s); + subtitle->set_position (p.from); } ContentTimePeriod |
