1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-09 00:17:07 +00:00

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.
This commit is contained in:
Alex B 2022-02-05 00:02:15 +03:00 committed by Philip Langdale
parent ef83498aef
commit bc9805c71a

View File

@ -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: {