summaryrefslogtreecommitdiff
path: root/src/lib/text_subtitle_decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-11-21 16:57:15 +0000
committerCarl Hetherington <cth@carlh.net>2017-04-19 23:04:32 +0100
commitde2af791bdfdcd653752cba970e59efc7bf810c7 (patch)
tree1aa5dbc35daee0babd0def347944a6bea4154deb /src/lib/text_subtitle_decoder.cc
parent06152300e69e8faca44ff8d7f12a6fd354848b9a (diff)
Basic grunt-work, untested and unfinished, but it compiles.
Diffstat (limited to 'src/lib/text_subtitle_decoder.cc')
-rw-r--r--src/lib/text_subtitle_decoder.cc64
1 files changed, 8 insertions, 56 deletions
diff --git a/src/lib/text_subtitle_decoder.cc b/src/lib/text_subtitle_decoder.cc
index dd64cb5d9..b59808728 100644
--- a/src/lib/text_subtitle_decoder.cc
+++ b/src/lib/text_subtitle_decoder.cc
@@ -38,73 +38,31 @@ TextSubtitleDecoder::TextSubtitleDecoder (shared_ptr<const TextSubtitleContent>
: TextSubtitle (content)
, _next (0)
{
- subtitle.reset (
- new SubtitleDecoder (
- this,
- content->subtitle,
- log,
- bind (&TextSubtitleDecoder::image_subtitles_during, this, _1, _2),
- bind (&TextSubtitleDecoder::text_subtitles_during, this, _1, _2)
- )
- );
+ subtitle.reset (new SubtitleDecoder (this, content->subtitle, log));
}
void
-TextSubtitleDecoder::seek (ContentTime time, bool accurate)
+TextSubtitleDecoder::seek (ContentTime time, bool)
{
- subtitle->seek (time, accurate);
-
_next = 0;
while (_next < _subtitles.size() && ContentTime::from_seconds (_subtitles[_next].from.all_as_seconds ()) < time) {
++_next;
}
}
-bool
-TextSubtitleDecoder::pass (PassReason, bool)
+void
+TextSubtitleDecoder::pass ()
{
if (_next >= _subtitles.size ()) {
- return true;
+ return;
}
ContentTimePeriod const p = content_time_period (_subtitles[_next]);
- subtitle->give_text (p, _subtitles[_next]);
+ subtitle->emit_text (p, _subtitles[_next]);
+ subtitle->set_position (p.from);
++_next;
- return false;
-}
-
-list<ContentTimePeriod>
-TextSubtitleDecoder::image_subtitles_during (ContentTimePeriod, bool) const
-{
- return list<ContentTimePeriod> ();
-}
-
-list<ContentTimePeriod>
-TextSubtitleDecoder::text_subtitles_during (ContentTimePeriod p, bool starting) const
-{
- /* XXX: inefficient */
-
- list<ContentTimePeriod> d;
-
- /* Only take `during' (not starting) subs if they overlap more than half the requested period;
- here's the threshold for being significant.
- */
- ContentTime const significant (p.duration().get() / 2);
-
- for (vector<sub::Subtitle>::const_iterator i = _subtitles.begin(); i != _subtitles.end(); ++i) {
- ContentTimePeriod t = content_time_period (*i);
- if (starting && p.contains(t.from)) {
- d.push_back (t);
- } else if (!starting) {
- optional<ContentTimePeriod> const o = p.overlap (t);
- if (o && o->duration() > significant) {
- d.push_back (t);
- }
- }
- }
-
- return d;
+ return;
}
ContentTimePeriod
@@ -115,9 +73,3 @@ TextSubtitleDecoder::content_time_period (sub::Subtitle s) const
ContentTime::from_seconds (s.to.all_as_seconds())
);
}
-
-void
-TextSubtitleDecoder::reset ()
-{
- subtitle->reset ();
-}