summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-07-05 16:58:48 +0200
committerwm4 <wm4@nowhere>2014-07-05 17:07:15 +0200
commit0cc35946235bd356db2836b77a842c7363bdde5c (patch)
tree7b574c166a58680bb81c3170bb49050a4f737002
parent338004bcfc224727d1477d303aa1521bf3ac21be (diff)
downloadmpv-0cc35946235bd356db2836b77a842c7363bdde5c.tar.bz2
mpv-0cc35946235bd356db2836b77a842c7363bdde5c.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 3c18866312..1a16eecaf9 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -983,11 +983,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;