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.
This commit is contained in:
wm4 2014-07-20 14:13:24 +02:00
parent 6a556f524e
commit d320695207
1 changed files with 4 additions and 5 deletions

View File

@ -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_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,