summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-09-05 21:07:34 +0200
committerwm4 <wm4@nowhere>2016-09-05 21:26:39 +0200
commit1d9032f011a57a31f6a8ccc40a0aba08a8e74e0d (patch)
treec463f43610d73a127e2f62a6a39a669c38c36fd9 /audio
parent13786dc643fe250a9560792ef342751585ea15e9 (diff)
downloadmpv-1d9032f011a57a31f6a8ccc40a0aba08a8e74e0d.tar.bz2
mpv-1d9032f011a57a31f6a8ccc40a0aba08a8e74e0d.tar.xz
audio/out: deprecate "exclusive" sub-options
And introduce a global option which does this. Or more precisely, this deprecates the global wasapi and coreaudio options, and adds a new one that merges their functionality. (Due to the way the sub-option deprecation mechanism works, this is simpler.)
Diffstat (limited to 'audio')
-rw-r--r--audio/out/ao.h2
-rw-r--r--audio/out/ao_coreaudio.c5
-rw-r--r--audio/out/ao_wasapi.c5
3 files changed, 10 insertions, 2 deletions
diff --git a/audio/out/ao.h b/audio/out/ao.h
index 3b187e7355..fe09e2750a 100644
--- a/audio/out/ao.h
+++ b/audio/out/ao.h
@@ -58,6 +58,8 @@ enum {
AO_INIT_SAFE_MULTICHANNEL_ONLY = 1 << 1,
// Stream silence as long as no audio is playing.
AO_INIT_STREAM_SILENCE = 1 << 2,
+ // Force exclusive mode, i.e. lock out the system mixer.
+ AO_INIT_EXCLUSIVE = 1 << 3,
};
typedef struct ao_control_vol {
diff --git a/audio/out/ao_coreaudio.c b/audio/out/ao_coreaudio.c
index 1300489084..3a7aa2eac1 100644
--- a/audio/out/ao_coreaudio.c
+++ b/audio/out/ao_coreaudio.c
@@ -143,6 +143,8 @@ static int init(struct ao *ao)
{
struct priv *p = ao->priv;
+ p->exclusive |= ao->init_flags & AO_INIT_EXCLUSIVE;
+
if (!af_fmt_is_pcm(ao->format) || p->exclusive) {
MP_VERBOSE(ao, "redirecting to coreaudio_exclusive\n");
ao->redirect = "coreaudio_exclusive";
@@ -427,7 +429,8 @@ const struct ao_driver audio_out_coreaudio = {
.priv_size = sizeof(struct priv),
.options = (const struct m_option[]){
OPT_FLAG("change-physical-format", change_physical_format, 0),
- OPT_FLAG("exclusive", exclusive, 0),
+ OPT_FLAG("exclusive", exclusive, 0,
+ .deprecation_message = "use --audio-exclusive"),
{0}
},
.legacy_prefix = "coreaudio",
diff --git a/audio/out/ao_wasapi.c b/audio/out/ao_wasapi.c
index 23a958bb3b..17f3e98653 100644
--- a/audio/out/ao_wasapi.c
+++ b/audio/out/ao_wasapi.c
@@ -275,6 +275,8 @@ static int init(struct ao *ao)
struct wasapi_state *state = ao->priv;
state->log = ao->log;
+ state->opt_exclusive |= ao->init_flags & AO_INIT_EXCLUSIVE;
+
state->deviceID = wasapi_find_deviceID(ao);
if (!state->deviceID) {
uninit(ao);
@@ -495,7 +497,8 @@ const struct ao_driver audio_out_wasapi = {
.hotplug_uninit = hotplug_uninit,
.priv_size = sizeof(wasapi_state),
.options = (const struct m_option[]) {
- OPT_FLAG("exclusive", opt_exclusive, 0),
+ OPT_FLAG("exclusive", opt_exclusive, 0,
+ .deprecation_message = "use --audio-exclusive"),
OPT_STRING("device", opt_device, 0, DEVICE_OPT_DEPRECATION),
{NULL},
},