diff options
Diffstat (limited to 'audio/out')
-rw-r--r-- | audio/out/ao.c | 11 | ||||
-rw-r--r-- | audio/out/ao.h | 4 | ||||
-rw-r--r-- | audio/out/ao_coreaudio.c | 7 | ||||
-rw-r--r-- | audio/out/ao_dsound.c | 3 | ||||
-rw-r--r-- | audio/out/ao_openal.c | 3 | ||||
-rw-r--r-- | audio/out/ao_oss.c | 13 | ||||
-rw-r--r-- | audio/out/ao_pulse.c | 5 | ||||
-rw-r--r-- | audio/out/ao_sndio.c | 3 | ||||
-rw-r--r-- | audio/out/ao_wasapi.c | 3 | ||||
-rw-r--r-- | audio/out/internal.h | 2 |
10 files changed, 25 insertions, 29 deletions
diff --git a/audio/out/ao.c b/audio/out/ao.c index 56d9232189..00bda6d283 100644 --- a/audio/out/ao.c +++ b/audio/out/ao.c @@ -259,16 +259,7 @@ int ao_play(struct ao *ao, void **data, int samples, int flags) int ao_control(struct ao *ao, enum aocontrol cmd, void *arg) { - switch (cmd) { - case AOCONTROL_HAS_TEMP_VOLUME: - return !ao->no_persistent_volume; - case AOCONTROL_HAS_PER_APP_VOLUME: - return !!ao->per_application_mixer; - default: - if (ao->api->control) - return ao->api->control(ao, cmd, arg); - } - return CONTROL_UNKNOWN; + return ao->api->control ? ao->api->control(ao, cmd, arg) : CONTROL_UNKNOWN; } // Return size of the buffered data in seconds. Can include the device latency. diff --git a/audio/out/ao.h b/audio/out/ao.h index 3eb2925971..7badf90aef 100644 --- a/audio/out/ao.h +++ b/audio/out/ao.h @@ -36,7 +36,9 @@ enum aocontrol { AOCONTROL_SET_MUTE, // Has char* as argument, which contains the desired stream title. AOCONTROL_UPDATE_STREAM_TITLE, - AOCONTROL_HAS_TEMP_VOLUME, + // the AO does the equivalent of af_volume (return CONTROL_TRUE if yes) + AOCONTROL_HAS_SOFT_VOLUME, + // like above, but volume persists (per app), mpv won't restore volume AOCONTROL_HAS_PER_APP_VOLUME, }; diff --git a/audio/out/ao_coreaudio.c b/audio/out/ao_coreaudio.c index 7e5b3377c4..9335877208 100644 --- a/audio/out/ao_coreaudio.c +++ b/audio/out/ao_coreaudio.c @@ -136,6 +136,10 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg) return get_volume(ao, arg); case AOCONTROL_SET_VOLUME: return set_volume(ao, arg); + case AOCONTROL_HAS_SOFT_VOLUME: + return CONTROL_TRUE; + case AOCONTROL_HAS_PER_APP_VOLUME: + return CONTROL_TRUE; } return CONTROL_UNKNOWN; } @@ -149,9 +153,6 @@ static int init(struct ao *ao) if (p->opt_list) ca_print_device_list(ao); - ao->per_application_mixer = true; - ao->no_persistent_volume = true; - OSStatus err = ca_select_device(ao, p->opt_device_id, &p->device); CHECK_CA_ERROR("failed to select device"); diff --git a/audio/out/ao_dsound.c b/audio/out/ao_dsound.c index e03db481c8..126989936e 100644 --- a/audio/out/ao_dsound.c +++ b/audio/out/ao_dsound.c @@ -351,6 +351,8 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg) IDirectSoundBuffer_SetVolume(p->hdsbuf, volume); return CONTROL_OK; } + case AOCONTROL_HAS_SOFT_VOLUME: + return CONTROL_TRUE; } return CONTROL_UNKNOWN; } @@ -371,7 +373,6 @@ static int init(struct ao *ao) if (!InitDirectSound(ao)) return -1; - ao->no_persistent_volume = true; p->audio_volume = 100; // ok, now create the buffers diff --git a/audio/out/ao_openal.c b/audio/out/ao_openal.c index f2cbe78e94..73ad0857d4 100644 --- a/audio/out/ao_openal.c +++ b/audio/out/ao_openal.c @@ -76,6 +76,8 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg) vol->left = vol->right = volume * 100; return CONTROL_TRUE; } + case AOCONTROL_HAS_SOFT_VOLUME: + return CONTROL_TRUE; } return CONTROL_UNKNOWN; } @@ -132,7 +134,6 @@ static int init(struct ao *ao) return -1; } ao_data = ao; - ao->no_persistent_volume = true; struct mp_chmap_sel sel = {0}; for (i = 0; speaker_pos[i].id != -1; i++) mp_chmap_sel_add_speaker(&sel, speaker_pos[i].id); diff --git a/audio/out/ao_oss.c b/audio/out/ao_oss.c index 1d88291532..f84c7fffd1 100644 --- a/audio/out/ao_oss.c +++ b/audio/out/ao_oss.c @@ -178,8 +178,7 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg) struct priv *p = ao->priv; switch (cmd) { case AOCONTROL_GET_VOLUME: - case AOCONTROL_SET_VOLUME: - { + case AOCONTROL_SET_VOLUME: { ao_control_vol_t *vol = (ao_control_vol_t *)arg; int fd, v, devs; @@ -210,9 +209,13 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg) close(fd); return CONTROL_OK; } - } return CONTROL_ERROR; } +#ifdef SNDCTL_DSP_GETPLAYVOL + case AOCONTROL_HAS_SOFT_VOLUME: + return CONTROL_TRUE; +#endif + } return CONTROL_UNKNOWN; } @@ -223,10 +226,6 @@ static int init(struct ao *ao) struct priv *p = ao->priv; int oss_format; -#ifdef SNDCTL_DSP_GETPLAYVOL - ao->no_persistent_volume = true; -#endif - const char *mchan = NULL; if (p->cfg_oss_mixer_channel && p->cfg_oss_mixer_channel[0]) mchan = p->cfg_oss_mixer_channel; diff --git a/audio/out/ao_pulse.c b/audio/out/ao_pulse.c index 14b5161940..d6bb675b3c 100644 --- a/audio/out/ao_pulse.c +++ b/audio/out/ao_pulse.c @@ -284,8 +284,6 @@ static int init(struct ao *ao) pthread_mutex_init(&priv->wakeup_lock, NULL); pthread_cond_init(&priv->wakeup, NULL); - ao->per_application_mixer = true; - if (!(priv->mainloop = pa_threaded_mainloop_new())) { MP_ERR(ao, "Failed to allocate main loop\n"); goto fail; @@ -644,6 +642,9 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg) return CONTROL_OK; } + case AOCONTROL_HAS_PER_APP_VOLUME: + return CONTROL_TRUE; + case AOCONTROL_UPDATE_STREAM_TITLE: { char *title = (char *)arg; pa_threaded_mainloop_lock(priv->mainloop); diff --git a/audio/out/ao_sndio.c b/audio/out/ao_sndio.c index 286f158260..12bc6a97b2 100644 --- a/audio/out/ao_sndio.c +++ b/audio/out/ao_sndio.c @@ -60,6 +60,8 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg) return CONTROL_FALSE; sio_setvol(p->hdl, vol->left * SIO_MAXVOL / 100); break; + case AOCONTROL_HAS_SOFT_VOLUME: + return CONTROL_TRUE; default: return CONTROL_UNKNOWN; } @@ -193,7 +195,6 @@ static int init(struct ao *ao) } ao->bps = p->par.bps * p->par.pchan * p->par.rate; - ao->no_persistent_volume = true; p->havevol = sio_onvol(p->hdl, volcb, p); sio_onmove(p->hdl, movecb, p); p->delay = 0; diff --git a/audio/out/ao_wasapi.c b/audio/out/ao_wasapi.c index aef20fe2c4..39d6a5bda6 100644 --- a/audio/out/ao_wasapi.c +++ b/audio/out/ao_wasapi.c @@ -194,7 +194,6 @@ static int init(struct ao *ao) wasapi_enumerate_devices(state->log); } - ao->per_application_mixer = true; if (state->opt_exclusive) { state->share_mode = AUDCLNT_SHAREMODE_EXCLUSIVE; } else { @@ -284,6 +283,8 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg) ISimpleAudioVolume_SetMute(state->pAudioVolumeProxy, mute, NULL); return CONTROL_OK; + case AOCONTROL_HAS_PER_APP_VOLUME: + return CONTROL_TRUE; case AOCONTROL_UPDATE_STREAM_TITLE: { MP_VERBOSE(state, "Updating stream title to \"%s\"\n", (char*)arg); wchar_t *title = mp_from_utf8(NULL, (char*)arg); diff --git a/audio/out/internal.h b/audio/out/internal.h index e43b81a5ca..a17aa10f02 100644 --- a/audio/out/internal.h +++ b/audio/out/internal.h @@ -41,8 +41,6 @@ struct ao { int num_planes; bool probing; // if true, don't fail loudly on init bool untimed; // don't assume realtime playback - bool no_persistent_volume; // the AO does the equivalent of af_volume - bool per_application_mixer; // like above, but volume persists (per app) int device_buffer; // device buffer in samples (guessed by // common init code if not set by driver) const struct ao_driver *api; // entrypoints to the wrapper (push.c/pull.c) |