diff options
author | wm4 <wm4@nowhere> | 2016-03-09 23:55:16 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-03-09 23:55:34 +0100 |
commit | 953ff6b3908bcfdd69a9189c991e55f362d2d2dc (patch) | |
tree | c50f6df2a686154346f3b1455db8a91d69b7b9ec /player | |
parent | 7387766445f7aae47a4e8095128ea9b688299091 (diff) | |
download | mpv-953ff6b3908bcfdd69a9189c991e55f362d2d2dc.tar.bz2 mpv-953ff6b3908bcfdd69a9189c991e55f362d2d2dc.tar.xz |
demux: replace demux_pause/demux_unpause with demux_run_on_thread
This pause stuff is bothersome and is needed only for a few corner-
cases. This commit removes it from the demuxer public API and replaces
it with a demux_run_on_thread() function and refactors the code which
needed demux_pause(). The next commit will change the implementation.
Diffstat (limited to 'player')
-rw-r--r-- | player/command.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/player/command.c b/player/command.c index fe2eb3eb22..d2a8308a58 100644 --- a/player/command.c +++ b/player/command.c @@ -419,6 +419,17 @@ static int mp_property_stream_path(void *ctx, struct m_property *prop, return m_property_strdup_ro(action, arg, stream->url); } +struct change_stream_capture_args { + char *filename; + struct demuxer *demux; +}; + +static void do_change_stream_capture(void *p) +{ + struct change_stream_capture_args *args = p; + stream_set_capture_file(args->demux->stream, args->filename); +} + static int mp_property_stream_capture(void *ctx, struct m_property *prop, int action, void *arg) { @@ -427,10 +438,8 @@ static int mp_property_stream_capture(void *ctx, struct m_property *prop, return M_PROPERTY_UNAVAILABLE; if (action == M_PROPERTY_SET) { - char *filename = *(char **)arg; - demux_pause(mpctx->demuxer); - stream_set_capture_file(mpctx->demuxer->stream, filename); - demux_unpause(mpctx->demuxer); + struct change_stream_capture_args args = {*(char **)arg, mpctx->demuxer}; + demux_run_on_thread(mpctx->demuxer, do_change_stream_capture, &args); // fall through to mp_property_generic_option } return mp_property_generic_option(mpctx, prop, action, arg); @@ -1077,11 +1086,12 @@ static int mp_property_angle(void *ctx, struct m_property *prop, 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); - demux_control(demuxer, DEMUXER_CTRL_RESYNC, NULL); - demux_unpause(demuxer); + if (ris == STREAM_OK) { + demux_control(demuxer, DEMUXER_CTRL_RESYNC, NULL); + demux_flush(demuxer); + } reset_audio_state(mpctx); reset_video_state(mpctx); |