}
void
-TextSubtitleDecoder::seek (ContentTime time, bool)
+TextSubtitleDecoder::seek (ContentTime time, bool accurate)
{
+ /* It's worth back-tracking a little here as decoding is cheap and it's nice if we don't miss
+ too many subtitles when seeking.
+ */
+ time -= ContentTime::from_seconds (5);
+ if (time < ContentTime()) {
+ time = ContentTime();
+ }
+
+ Decoder::seek (time, accurate);
+
_next = 0;
while (_next < _subtitles.size() && ContentTime::from_seconds (_subtitles[_next].from.all_as_seconds ()) < time) {
++_next;
}
}
-void
+bool
TextSubtitleDecoder::pass ()
{
if (_next >= _subtitles.size ()) {
- return;
+ return true;
}
ContentTimePeriod const p = content_time_period (_subtitles[_next]);
subtitle->emit_text (p, _subtitles[_next]);
++_next;
- return;
+ return false;
}
ContentTimePeriod