diff options
author | Alex B <pkunk.ab@gmail.com> | 2022-02-05 00:02:15 +0300 |
---|---|---|
committer | Philip Langdale <github.philipl@overt.org> | 2022-02-11 11:27:57 -0800 |
commit | bc9805c71a67b2717c79533731608eff679cded1 (patch) | |
tree | 0ec2b85fd0c6520c18ba2d88268df7da4c8eb2ff /audio | |
parent | ef83498aefb91168292439c88e01723880eb6707 (diff) | |
download | mpv-bc9805c71a67b2717c79533731608eff679cded1.tar.bz2 mpv-bc9805c71a67b2717c79533731608eff679cded1.tar.xz |
ao_pipewire: fix ao-volume handling
Pass channel volumes to `pw_stream_set_control` as array.
This is correct calling conventions and prevents
right channel muting every time ao-volume property is changed.
Terminate `pw_stream_set_control` calls with 0.
Diffstat (limited to 'audio')
-rw-r--r-- | audio/out/ao_pipewire.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/audio/out/ao_pipewire.c b/audio/out/ao_pipewire.c index c61c0b4f69..0b2e178bbe 100644 --- a/audio/out/ao_pipewire.c +++ b/audio/out/ao_pipewire.c @@ -512,14 +512,17 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg) switch (cmd) { case AOCONTROL_SET_VOLUME: { struct ao_control_vol *vol = arg; - float left = mp_volume_to_spa_volume(vol->left), right = mp_volume_to_spa_volume(vol->right); - ret = CONTROL_RET(pw_stream_set_control(p->stream, SPA_PROP_channelVolumes, 2, &left, &right)); + float values[2] = { + mp_volume_to_spa_volume(vol->left), + mp_volume_to_spa_volume(vol->right), + }; + ret = CONTROL_RET(pw_stream_set_control(p->stream, SPA_PROP_channelVolumes, 2, values, 0)); break; } case AOCONTROL_SET_MUTE: { bool *muted = arg; float value = *muted ? 1.f : 0.f; - ret = CONTROL_RET(pw_stream_set_control(p->stream, SPA_PROP_mute, 1, &value)); + ret = CONTROL_RET(pw_stream_set_control(p->stream, SPA_PROP_mute, 1, &value, 0)); break; } case AOCONTROL_UPDATE_STREAM_TITLE: { |