From 028e51d8afcaba20d6b0743fbe39795cf2e0015d Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 16 Apr 2018 17:40:00 +0200 Subject: demux_lavf: use new libavformat semantics for stream resync I changed avio_flush() and introduced avformat_flush() exactly for this reason. Used with DVD/BD only (on seeks and when setting the "angle" property). Seems to work, but wasn't tested too thoroughly (I don't care about optical discs, I only want this ugly stuff gone that might even violate the API/ABI). --- demux/demux_lavf.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c index 320df49df5..a8f631d142 100644 --- a/demux/demux_lavf.c +++ b/demux/demux_lavf.c @@ -1148,24 +1148,9 @@ redo: return CONTROL_OK; } case DEMUXER_CTRL_RESYNC: - /* NOTE: - * - * We actually want to call ff_read_frame_flush() here, but it is - * internal. - * - * This function call seems to do the same for now. - * - * Once ff_read_frame_flush() is exported in some way, change this to - * call the new API instead of relying on av_seek_frame() to do this - * for us. - */ - // avio_flush() is designed for write-only streams, and does the wrong - // thing when reading. Flush it manually instead. stream_drop_buffers(priv->stream); - priv->avfc->pb->buf_ptr = priv->avfc->pb->buf_end = priv->avfc->pb->buffer; - priv->avfc->pb->pos = stream_tell(priv->stream); - av_seek_frame(priv->avfc, 0, stream_tell(priv->stream), - AVSEEK_FLAG_BYTE); + avio_flush(priv->avfc->pb); + avformat_flush(priv->avfc); return CONTROL_OK; case DEMUXER_CTRL_REPLACE_STREAM: if (priv->own_stream) -- cgit v1.2.3