diff options
author | Kevin Mitchell <kevmitch@gmail.com> | 2015-12-18 21:24:44 -0800 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2015-12-20 03:30:28 -0800 |
commit | 4b81398b4e1d66fece109aaa1d5a7422462ceee5 (patch) | |
tree | d86749d17254e5c4901555ef050be8a008fd5e81 | |
parent | d1cbff37be885108808c27311d79422dc0cb4a7f (diff) | |
download | mpv-4b81398b4e1d66fece109aaa1d5a7422462ceee5.tar.bz2 mpv-4b81398b4e1d66fece109aaa1d5a7422462ceee5.tar.xz |
ao_wasapi: don't cast control arg to something it isn't
the ao_control_vol_t cast was happening outside AOCONTROL_GET/SET_VOLUME
which is the only place that would be valid
-rw-r--r-- | audio/out/ao_wasapi.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/audio/out/ao_wasapi.c b/audio/out/ao_wasapi.c index 2b2cd890c9..2fc3c0a9a7 100644 --- a/audio/out/ao_wasapi.c +++ b/audio/out/ao_wasapi.c @@ -287,7 +287,6 @@ static int init(struct ao *ao) static int control(struct ao *ao, enum aocontrol cmd, void *arg) { struct wasapi_state *state = ao->priv; - ao_control_vol_t *vol = arg; float volume; BOOL mute; @@ -297,19 +296,22 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg) case AOCONTROL_GET_VOLUME: IAudioEndpointVolume_GetMasterVolumeLevelScalar(state->pEndpointVolumeProxy, &volume); - vol->left = vol->right = 100.0f * volume; + *(ao_control_vol_t *)arg = (ao_control_vol_t){ + .left = 100.0f * volume, + .right = 100.0f * volume, + }; return CONTROL_OK; case AOCONTROL_SET_VOLUME: - volume = vol->left / 100.f; + volume = ((ao_control_vol_t *)arg)->left / 100.f; IAudioEndpointVolume_SetMasterVolumeLevelScalar(state->pEndpointVolumeProxy, volume, NULL); return CONTROL_OK; case AOCONTROL_GET_MUTE: IAudioEndpointVolume_GetMute(state->pEndpointVolumeProxy, &mute); - *(bool*)arg = mute; + *(bool *)arg = mute; return CONTROL_OK; case AOCONTROL_SET_MUTE: - mute = *(bool*)arg; + mute = *(bool *)arg; IAudioEndpointVolume_SetMute(state->pEndpointVolumeProxy, mute, NULL); return CONTROL_OK; case AOCONTROL_HAS_PER_APP_VOLUME: @@ -321,19 +323,22 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg) case AOCONTROL_GET_VOLUME: ISimpleAudioVolume_GetMasterVolume(state->pAudioVolumeProxy, &volume); - vol->left = vol->right = 100.0f * volume; + *(ao_control_vol_t *)arg = (ao_control_vol_t){ + .left = 100.0f * volume, + .right = 100.0f * volume, + }; return CONTROL_OK; case AOCONTROL_SET_VOLUME: - volume = vol->left / 100.f; + volume = ((ao_control_vol_t *)arg)->left / 100.f; ISimpleAudioVolume_SetMasterVolume(state->pAudioVolumeProxy, volume, NULL); return CONTROL_OK; case AOCONTROL_GET_MUTE: ISimpleAudioVolume_GetMute(state->pAudioVolumeProxy, &mute); - *(bool*)arg = mute; + *(bool *)arg = mute; return CONTROL_OK; case AOCONTROL_SET_MUTE: - mute = *(bool*)arg; + mute = *(bool *)arg; ISimpleAudioVolume_SetMute(state->pAudioVolumeProxy, mute, NULL); return CONTROL_OK; case AOCONTROL_HAS_PER_APP_VOLUME: |