From 5a412bfa093a3ca6733e3031da9a3d001cc4e149 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Mon, 7 Jan 2013 17:39:55 +0100 Subject: [PATCH] demux_lavf: implement DEMUXER_CTRL_RESYNC This makes -chapter work with stream_dvd by telling ffmpeg to flush its internal buffers after a stream_dvd seek. --- demux/demux_lavf.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c index 552a9e8366..c067c376b5 100644 --- a/demux/demux_lavf.c +++ b/demux/demux_lavf.c @@ -1066,6 +1066,21 @@ redo: priv->cur_program = prog->progid = program->id; return DEMUXER_CTRL_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. + */ + av_seek_frame(priv->avfc, 0, avio_tell(priv->avfc->pb), + AVSEEK_FLAG_BYTE); + return DEMUXER_CTRL_OK; default: return DEMUXER_CTRL_NOTIMPL; }