Remember the last directory used when opening DCPs in the player (#1121).
[dcpomatic.git] / src / lib / text_subtitle_decoder.cc
index 1b8ee131004bd4fdb8f50e8399960c9ae45f7372..846c3016ee1748f8c97aa08b27a1232ed3a8ec57 100644 (file)
@@ -42,8 +42,18 @@ TextSubtitleDecoder::TextSubtitleDecoder (shared_ptr<const TextSubtitleContent>
 }
 
 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;