: TextSubtitle (content)
, _next (0)
{
- subtitle.reset (new SubtitleDecoder (this, content->subtitle, log));
+ ContentTime first;
+ if (!_subtitles.empty()) {
+ first = content_time_period(_subtitles[0]).from;
+ }
+ subtitle.reset (new SubtitleDecoder (this, content->subtitle, log, first));
}
void
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;