summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--options/m_option.h3
-rw-r--r--options/options.c8
-rw-r--r--player/command.c7
3 files changed, 13 insertions, 5 deletions
diff --git a/options/m_option.h b/options/m_option.h
index 92d0575db8..6a7b4accc9 100644
--- a/options/m_option.h
+++ b/options/m_option.h
@@ -388,7 +388,8 @@ struct m_option {
#define UPDATE_BUILTIN_SCRIPTS (1 << 11) // osc/ytdl
#define UPDATE_IMGPAR (1 << 12) // video image params overrides
#define UPDATE_INPUT (1 << 13) // mostly --input-* options
-#define UPDATE_OPT_LAST (1 << 13)
+#define UPDATE_AUDIO (1 << 14) // --audio-channels etc.
+#define UPDATE_OPT_LAST (1 << 14)
// All bits between _FIRST and _LAST (inclusive)
#define UPDATE_OPTS_MASK \
diff --git a/options/options.c b/options/options.c
index cd51842ea3..f401b00803 100644
--- a/options/options.c
+++ b/options/options.c
@@ -384,10 +384,10 @@ const m_option_t mp_opts[] = {
// force video/audio rate:
OPT_DOUBLE("fps", force_fps, CONF_MIN, .min = 0),
- OPT_INTRANGE("audio-samplerate", force_srate, 0, 1000, 16*48000),
- OPT_CHANNELS("audio-channels", audio_output_channels, 0),
- OPT_AUDIOFORMAT("audio-format", audio_output_format, 0),
- OPT_FLAG("audio-normalize-downmix", audio_normalize, 0),
+ OPT_INTRANGE("audio-samplerate", force_srate, UPDATE_AUDIO, 1000, 16*48000),
+ OPT_CHANNELS("audio-channels", audio_output_channels, UPDATE_AUDIO),
+ OPT_AUDIOFORMAT("audio-format", audio_output_format, UPDATE_AUDIO),
+ OPT_FLAG("audio-normalize-downmix", audio_normalize, UPDATE_AUDIO),
OPT_DOUBLE("speed", playback_speed, M_OPT_RANGE, .min = 0.01, .max = 100.0),
OPT_FLAG("audio-pitch-correction", pitch_correction, 0),
diff --git a/player/command.c b/player/command.c
index d49b844caf..5983059448 100644
--- a/player/command.c
+++ b/player/command.c
@@ -5624,6 +5624,13 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags)
mpctx->ipc_ctx = mp_init_ipc(mpctx->clients, mpctx->global);
}
}
+
+ if ((flags & UPDATE_AUDIO) && mpctx->ao_chain) {
+ // Force full mid-stream reinit.
+ reinit_audio_filters(mpctx);
+ uninit_audio_out(mpctx);
+ mp_wakeup_core(mpctx);
+ }
}
void mp_notify_property(struct MPContext *mpctx, const char *property)