summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2015-02-02 23:01:11 +0100
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2015-02-03 00:40:02 +0100
commita3be14683a33211e3e07094246bb3342fc789763 (patch)
tree1db9298908cffa8906f076b4eec39858e49acb35 /player/command.c
parentdd287a3276153ec4e43567ed0eddba7d595168cf (diff)
downloadmpv-a3be14683a33211e3e07094246bb3342fc789763.tar.bz2
mpv-a3be14683a33211e3e07094246bb3342fc789763.tar.xz
command: add property returning detected audio device
This can be useful to adjust some other audio related properties at runtime depending on the audio device being used.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/player/command.c b/player/command.c
index e886dd4360..85e5b17be0 100644
--- a/player/command.c
+++ b/player/command.c
@@ -1577,6 +1577,15 @@ static int mp_property_ao(void *ctx, struct m_property *p, int action, void *arg
mpctx->ao ? ao_get_name(mpctx->ao) : NULL);
}
+static int mp_property_ao_detected_device(void *ctx,struct m_property *prop,
+ int action, void *arg)
+{
+ MPContext *mpctx = ctx;
+ if (!mpctx->ao)
+ return M_PROPERTY_UNAVAILABLE;
+ return m_property_strdup_ro(action, arg, ao_get_detected_device(mpctx->ao));
+}
+
/// Audio delay (RW)
static int mp_property_audio_delay(void *ctx, struct m_property *prop,
int action, void *arg)
@@ -3375,6 +3384,7 @@ static const struct m_property mp_properties[] = {
{"audio-device", mp_property_audio_device},
{"audio-device-list", mp_property_audio_devices},
{"current-ao", mp_property_ao},
+ {"audio-out-detected-device", mp_property_ao_detected_device},
// Video
{"fullscreen", mp_property_fullscreen},
@@ -3516,7 +3526,7 @@ static const char *const *const mp_event_property_change[] = {
"detected-hwdec"),
E(MPV_EVENT_AUDIO_RECONFIG, "audio-format", "audio-codec", "audio-bitrate",
"samplerate", "channels", "audio", "volume", "mute", "balance",
- "volume-restore-data", "current-ao"),
+ "volume-restore-data", "current-ao", "audio-out-detected-device"),
E(MPV_EVENT_SEEK, "seeking", "core-idle"),
E(MPV_EVENT_PLAYBACK_RESTART, "seeking", "core-idle"),
E(MPV_EVENT_METADATA_UPDATE, "metadata", "filtered-metadata"),