mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-04-01 07:15:39 -04:00
pulse-server: Surface volume control flags as properties
We could udpate the libpulse protocol to add more flag types, but this seems simpler than requiring a protocol and ABI update.
This commit is contained in:
parent
e863e71f6b
commit
3ef6618ce2
3 changed files with 55 additions and 2 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <spa/param/props.h>
|
||||
#include <spa/param/audio/raw.h>
|
||||
#include <spa/param/audio/volume.h>
|
||||
#include <spa/pod/iter.h>
|
||||
#include <spa/utils/defs.h>
|
||||
#include <pipewire/log.h>
|
||||
|
|
@ -86,6 +87,29 @@ int volume_parse_param(const struct spa_pod *param, struct volume_info *info, bo
|
|||
info->map.channels = spa_pod_copy_array(&prop->value, SPA_TYPE_Id,
|
||||
info->map.map, SPA_N_ELEMENTS(info->map.map));
|
||||
break;
|
||||
case SPA_PROP_volumeControlFlags:
|
||||
{
|
||||
uint32_t flags;
|
||||
if (spa_pod_get_id(&prop->value, &flags) >= 0) {
|
||||
SPA_FLAG_UPDATE(info->flags, VOLUME_READ,
|
||||
flags & SPA_AUDIO_VOLUME_CONTROL_READ_VOLUME);
|
||||
SPA_FLAG_UPDATE(info->flags, VOLUME_WRITE,
|
||||
flags & SPA_AUDIO_VOLUME_CONTROL_WRITE_VOLUME_VALUE);
|
||||
SPA_FLAG_UPDATE(info->flags, VOLUME_UPDOWN,
|
||||
flags & SPA_AUDIO_VOLUME_CONTROL_WRITE_VOLUME_UPDOWN);
|
||||
SPA_FLAG_UPDATE(info->flags, VOLUME_READ_MUTE,
|
||||
flags & SPA_AUDIO_VOLUME_CONTROL_READ_MUTE);
|
||||
SPA_FLAG_UPDATE(info->flags, VOLUME_WRITE_MUTE,
|
||||
flags & SPA_AUDIO_VOLUME_CONTROL_WRITE_MUTE_VALUE);
|
||||
SPA_FLAG_UPDATE(info->flags, VOLUME_TOGGLE_MUTE,
|
||||
flags & SPA_AUDIO_VOLUME_CONTROL_WRITE_MUTE_TOGGLE);
|
||||
SPA_FLAG_UPDATE(info->flags, VOLUME_READ_BALANCE,
|
||||
flags & SPA_AUDIO_VOLUME_CONTROL_READ_BALANCE);
|
||||
SPA_FLAG_UPDATE(info->flags, VOLUME_WRITE_BALANCE,
|
||||
flags & SPA_AUDIO_VOLUME_CONTROL_WRITE_BALANCE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue