From 2d039e691f4f8f7b340a113fc9f69fa5bfa6193a Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 20 Nov 2014 22:41:50 +0100 Subject: command: add drop_buffers This command was actually requested on IRC ages ago, but I forgot about it. The main purpose is that the decoding state can be reset without issuing a seek, in particular in situations where you can't seek. This restarts decoding from the middle of the packet stream; since it discards the packet buffer intentionally, and the decoder will typically not output "incomplete" frames until it has recovered, it can skip a large amount of data. It doesn't clear the byte stream cache - I'm not sure if it should. --- player/command.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index 0559221322..d9a0d99745 100644 --- a/player/command.c +++ b/player/command.c @@ -4440,6 +4440,16 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd) return r > 0; } + case MP_CMD_DROP_BUFFERS: { + reset_audio_state(mpctx); + reset_video_state(mpctx); + + if (mpctx->demuxer) + demux_flush(mpctx->demuxer); + + break; + } + case MP_CMD_VO_CMDLINE: if (mpctx->video_out) { char *s = cmd->args[0].v.s; -- cgit v1.2.3