From d320695207abe9c77dff9ce1181c6db7bc2d6b27 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 20 Jul 2014 14:13:24 +0200 Subject: command: potentially fix dvd angle setting This called demux_flush(), but that doesn't make any sense with an asynchronously running demuxer. It would just keep reading and add new packets again. Explicitly pause the demuxer, so that this can't happen. Also, when flushing, data will be missing, so the decoders should always be reinitialized, even if the operation fails. --- player/command.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index 6b29fdc735..af9350f39c 100644 --- a/player/command.c +++ b/player/command.c @@ -876,13 +876,12 @@ static int mp_property_angle(void *ctx, struct m_property *prop, angle = *(int *)arg; if (angle < 0 || angle > angles) return M_PROPERTY_ERROR; - demux_flush(demuxer); + demux_pause(demuxer); + demux_flush(demuxer); ris = demux_stream_control(demuxer, STREAM_CTRL_SET_ANGLE, &angle); - if (ris != STREAM_OK) - return M_PROPERTY_ERROR; - demux_control(demuxer, DEMUXER_CTRL_RESYNC, NULL); + demux_unpause(demuxer); if (mpctx->d_video) video_reset_decoding(mpctx->d_video); @@ -890,7 +889,7 @@ static int mp_property_angle(void *ctx, struct m_property *prop, if (mpctx->d_audio) audio_reset_decoding(mpctx->d_audio); - return M_PROPERTY_OK; + return ris == STREAM_OK ? M_PROPERTY_OK : M_PROPERTY_ERROR; case M_PROPERTY_GET_TYPE: { struct m_option opt = { .type = CONF_TYPE_INT, -- cgit v1.2.3