diff options
2 files changed, 24 insertions, 0 deletions
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index dca64657fe..b335339590 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -1395,6 +1395,19 @@ Property list
human readable free form text. The description is an empty string if none
was received.
+``audio-device`` (RW)
+ Set the audio device. This directly reads/writes the ``--audio-device``
+ option, but on write accesses, the audio output will be scheduled for
+ reloading.
+ Writing this property while no audio output is active will not automatically
+ enable audio. (This is also true in the case when audio was disabled due to
+ reinitialization failure after a previous write access to ``audio-device``.)
+ This property also doesn't tell you which audio device is actually in use.
+ How these details are handled may change in the future.
``options/<name>`` (RW)
Read-only access to value of option ``--<name>``. Most options can be
changed at runtime by writing to this property. Note that many options
diff --git a/player/command.c b/player/command.c
index a4ef70082c..b28103a954 100644
--- a/player/command.c
+++ b/player/command.c
@@ -1466,6 +1466,16 @@ static void reload_audio_output(struct MPContext *mpctx)
+static int mp_property_audio_device(void *ctx, struct m_property *prop,
+ int action, void *arg)
+ struct MPContext *mpctx = ctx;
+ int r = mp_property_generic_option(mpctx, prop, action, arg);
+ if (action == M_PROPERTY_SET)
+ reload_audio_output(mpctx);
+ return r;
static int mp_property_audio_devices(void *ctx, struct m_property *prop,
int action, void *arg)
@@ -3049,6 +3059,7 @@ static const struct m_property mp_properties[] = {
{"aid", mp_property_audio},
{"balance", mp_property_balance},
{"volume-restore-data", mp_property_volrestore},
+ {"audio-device", mp_property_audio_device},
{"audio-device-list", mp_property_audio_devices},
// Video