summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-07-24 18:41:55 +0200
committerwm4 <wm4@nowhere>2016-07-24 18:41:55 +0200
commitd60db967bda3e9910ec6bc78d0d0cb284f5d68fa (patch)
tree9658c2cf96ec79e2df0d524f501b5c18c60de2f8
parent99d9921f39706b90b00d5b97d07ed12c60ea5786 (diff)
downloadmpv-d60db967bda3e9910ec6bc78d0d0cb284f5d68fa.tar.bz2
mpv-d60db967bda3e9910ec6bc78d0d0cb284f5d68fa.tar.xz
demux_lavf: remove subtitle seeking special-case
It used not to work - but now it apparently does. Not sure when that got fixed in FFmpeg, but there's no longer a reason to keep this hack. This also gets rid of the check for the read_seek2 field, which is not part of the public API.
-rw-r--r--demux/demux_lavf.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index a6f51dc5f3..e2221135f4 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -953,30 +953,15 @@ static void demux_seek_lavf(demuxer_t *demuxer, double seek_pts, int flags)
seek_pts_av = seek_pts * AV_TIME_BASE;
}
- int r;
- if (!priv->avfc->iformat->read_seek2) {
- // Normal seeking.
+ int r = av_seek_frame(priv->avfc, -1, seek_pts_av, avsflags);
+ if (r < 0 && (avsflags & AVSEEK_FLAG_BACKWARD)) {
+ // When seeking before the beginning of the file, and seeking fails,
+ // try again without the backwards flag to make it seek to the
+ // beginning.
+ avsflags &= ~AVSEEK_FLAG_BACKWARD;
r = av_seek_frame(priv->avfc, -1, seek_pts_av, avsflags);
- if (r < 0 && (avsflags & AVSEEK_FLAG_BACKWARD)) {
- // When seeking before the beginning of the file, and seeking fails,
- // try again without the backwards flag to make it seek to the
- // beginning.
- avsflags &= ~AVSEEK_FLAG_BACKWARD;
- r = av_seek_frame(priv->avfc, -1, seek_pts_av, avsflags);
- }
- } else {
- // av_seek_frame() won't work. Use "new" seeking API. We don't use this
- // API by default, because there are some major issues.
- // Set max_ts==ts, so that demuxing starts from an earlier position in
- // the worst case.
- r = avformat_seek_file(priv->avfc, -1, INT64_MIN,
- seek_pts_av, seek_pts_av, avsflags);
- // Similar issue as in the normal seeking codepath.
- if (r < 0) {
- r = avformat_seek_file(priv->avfc, -1, INT64_MIN,
- seek_pts_av, INT64_MAX, avsflags);
- }
}
+
if (r < 0) {
char buf[180];
av_strerror(r, buf, sizeof(buf));