mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
pulse-server: set source and sink flags
This commit is contained in:
parent
acfb48e3da
commit
1ec00e37fc
2 changed files with 36 additions and 2 deletions
|
|
@ -307,3 +307,26 @@ static inline bool pw_endswith(const char *s, const char *sfx)
|
|||
l2 = strlen(sfx);
|
||||
return l1 >= l2 && strcmp(s + l1 - l2, sfx) == 0;
|
||||
}
|
||||
|
||||
enum {
|
||||
SINK_HW_VOLUME_CTRL = 0x0001U,
|
||||
SINK_LATENCY = 0x0002U,
|
||||
SINK_HARDWARE = 0x0004U,
|
||||
SINK_NETWORK = 0x0008U,
|
||||
SINK_HW_MUTE_CTRL = 0x0010U,
|
||||
SINK_DECIBEL_VOLUME = 0x0020U,
|
||||
SINK_FLAT_VOLUME = 0x0040U,
|
||||
SINK_DYNAMIC_LATENCY = 0x0080U,
|
||||
SINK_SET_FORMATS = 0x0100U,
|
||||
};
|
||||
|
||||
enum {
|
||||
SOURCE_HW_VOLUME_CTRL = 0x0001U,
|
||||
SOURCE_LATENCY = 0x0002U,
|
||||
SOURCE_HARDWARE = 0x0004U,
|
||||
SOURCE_NETWORK = 0x0008U,
|
||||
SOURCE_HW_MUTE_CTRL = 0x0010U,
|
||||
SOURCE_DECIBEL_VOLUME = 0x0020U,
|
||||
SOURCE_DYNAMIC_LATENCY = 0x0040U,
|
||||
SOURCE_FLAT_VOLUME = 0x0080U,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2897,10 +2897,12 @@ static int fill_sink_info(struct client *client, struct message *m,
|
|||
uint32_t module_id = SPA_ID_INVALID;
|
||||
uint32_t card_id = SPA_ID_INVALID;
|
||||
struct pw_manager_param *p;
|
||||
uint32_t flags;
|
||||
|
||||
if (o == NULL || info == NULL || info->props == NULL || !is_sink(o))
|
||||
return ERR_NOENTITY;
|
||||
|
||||
|
||||
if ((name = spa_dict_lookup(info->props, PW_KEY_NODE_NAME)) != NULL) {
|
||||
size_t size = strlen(name) + 10;
|
||||
monitor_name = alloca(size);
|
||||
|
|
@ -2911,6 +2913,10 @@ static int fill_sink_info(struct client *client, struct message *m,
|
|||
if ((str = spa_dict_lookup(info->props, PW_KEY_DEVICE_ID)) != NULL)
|
||||
card_id = (uint32_t)atoi(str);
|
||||
|
||||
flags = SINK_LATENCY | SINK_DYNAMIC_LATENCY | SINK_DECIBEL_VOLUME;
|
||||
if ((str = spa_dict_lookup(info->props, PW_KEY_DEVICE_API)) != NULL)
|
||||
flags |= SINK_HARDWARE;
|
||||
|
||||
spa_list_for_each(p, &o->param_list, link) {
|
||||
switch (p->id) {
|
||||
case SPA_PARAM_EnumFormat:
|
||||
|
|
@ -2944,7 +2950,7 @@ static int fill_sink_info(struct client *client, struct message *m,
|
|||
TAG_STRING, monitor_name, /* monitor source name */
|
||||
TAG_USEC, 0LL, /* latency */
|
||||
TAG_STRING, "PipeWire", /* driver */
|
||||
TAG_U32, 0, /* flags */
|
||||
TAG_U32, flags, /* flags */
|
||||
TAG_INVALID);
|
||||
|
||||
if (client->version >= 13) {
|
||||
|
|
@ -2995,6 +3001,7 @@ static int fill_source_info(struct client *client, struct message *m,
|
|||
uint32_t module_id = SPA_ID_INVALID;
|
||||
uint32_t card_id = SPA_ID_INVALID;
|
||||
struct pw_manager_param *p;
|
||||
uint32_t flags;
|
||||
|
||||
is_monitor = is_sink(o);
|
||||
if (o == NULL || info == NULL || info->props == NULL ||
|
||||
|
|
@ -3016,6 +3023,10 @@ static int fill_source_info(struct client *client, struct message *m,
|
|||
if ((str = spa_dict_lookup(info->props, PW_KEY_DEVICE_ID)) != NULL)
|
||||
card_id = (uint32_t)atoi(str);
|
||||
|
||||
flags = SOURCE_LATENCY | SOURCE_DYNAMIC_LATENCY | SOURCE_DECIBEL_VOLUME;
|
||||
if ((str = spa_dict_lookup(info->props, PW_KEY_DEVICE_API)) != NULL)
|
||||
flags |= SOURCE_HARDWARE;
|
||||
|
||||
spa_list_for_each(p, &o->param_list, link) {
|
||||
switch (p->id) {
|
||||
case SPA_PARAM_EnumFormat:
|
||||
|
|
@ -3049,7 +3060,7 @@ static int fill_source_info(struct client *client, struct message *m,
|
|||
TAG_STRING, is_monitor ? name : NULL, /* monitor of sink name */
|
||||
TAG_USEC, 0LL, /* latency */
|
||||
TAG_STRING, "PipeWire", /* driver */
|
||||
TAG_U32, 0, /* flags */
|
||||
TAG_U32, flags, /* flags */
|
||||
TAG_INVALID);
|
||||
|
||||
if (client->version >= 13) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue