summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-07-05 16:58:48 +0200
committerAlessandro Ghedini <alessandro@ghedini.me>2014-07-05 19:03:32 +0200
commit2db094203d22c8e9c13e2d745c510ce61e058382 (patch)
tree8273f36e2629b95867a15852665e801a03b03273
parent958858f9204deb17494b4916be0029023c7d9036 (diff)
downloadmpv-2db094203d22c8e9c13e2d745c510ce61e058382.tar.bz2
mpv-2db094203d22c8e9c13e2d745c510ce61e058382.tar.xz
dvd: flush buffers properly on seek
Suggested by tholin on github issue #882. This is not entirely clean, but the fields we're accessing might be considered internal to libavformat. On the other hand, existence of the fields is guaranteed by the ABI, and nothing in the libavformat doxygen suggestes they're not allowed to be accessed. CC: @mpv-player/stable
-rw-r--r--demux/demux_lavf.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index e922708626..71f3f62e85 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -1009,11 +1009,12 @@ redo:
* call the new API instead of relying on av_seek_frame() to do this
* for us.
*/
- stream_drop_buffers(demuxer->stream);
- avio_flush(priv->avfc->pb);
av_seek_frame(priv->avfc, 0, stream_tell(demuxer->stream),
AVSEEK_FLAG_BYTE);
- avio_flush(priv->avfc->pb);
+ // avio_flush() is designed for write-only streams, and does the wrong
+ // thing when reading. Flush it manually instead.
+ priv->avfc->pb->buf_ptr = priv->avfc->pb->buf_end;
+ stream_drop_buffers(demuxer->stream);
return DEMUXER_CTRL_OK;
default:
return DEMUXER_CTRL_NOTIMPL;