mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
pod: add HARDWARE flag to spa_pod_prop
Add HARDWARE flag to mark a property that does some hardware control. Mark the device volume/mute property as HARDWARE or not. Use the HARDWARE property in pulse to set the right flags.
This commit is contained in:
parent
8e6b276d51
commit
cf8db93cd4
5 changed files with 25 additions and 11 deletions
|
|
@ -344,7 +344,7 @@ static void device_event_info(void *object, const struct pw_device_info *info)
|
|||
global_sync(g);
|
||||
}
|
||||
|
||||
static void parse_props(struct global *g, const struct spa_pod *param, bool hw)
|
||||
static void parse_props(struct global *g, const struct spa_pod *param, bool device)
|
||||
{
|
||||
struct spa_pod_prop *prop;
|
||||
struct spa_pod_object *obj = (struct spa_pod_object *) param;
|
||||
|
|
@ -353,11 +353,15 @@ static void parse_props(struct global *g, const struct spa_pod *param, bool hw)
|
|||
switch (prop->key) {
|
||||
case SPA_PROP_volume:
|
||||
spa_pod_get_float(&prop->value, &g->node_info.volume);
|
||||
SPA_FLAG_UPDATE(g->node_info.flags, NODE_FLAG_HW_VOLUME, hw);
|
||||
SPA_FLAG_UPDATE(g->node_info.flags, NODE_FLAG_DEVICE_VOLUME, device);
|
||||
SPA_FLAG_UPDATE(g->node_info.flags, NODE_FLAG_HW_VOLUME,
|
||||
prop->flags & SPA_POD_PROP_FLAG_HARDWARE);
|
||||
break;
|
||||
case SPA_PROP_mute:
|
||||
spa_pod_get_bool(&prop->value, &g->node_info.mute);
|
||||
SPA_FLAG_UPDATE(g->node_info.flags, NODE_FLAG_HW_MUTE, hw);
|
||||
SPA_FLAG_UPDATE(g->node_info.flags, NODE_FLAG_DEVICE_MUTE, device);
|
||||
SPA_FLAG_UPDATE(g->node_info.flags, NODE_FLAG_HW_MUTE,
|
||||
prop->flags & SPA_POD_PROP_FLAG_HARDWARE);
|
||||
break;
|
||||
case SPA_PROP_channelVolumes:
|
||||
{
|
||||
|
|
@ -375,7 +379,9 @@ static void parse_props(struct global *g, const struct spa_pod *param, bool hw)
|
|||
* params are updated */
|
||||
g->init = true;
|
||||
}
|
||||
SPA_FLAG_UPDATE(g->node_info.flags, NODE_FLAG_HW_VOLUME, hw);
|
||||
SPA_FLAG_UPDATE(g->node_info.flags, NODE_FLAG_DEVICE_VOLUME, device);
|
||||
SPA_FLAG_UPDATE(g->node_info.flags, NODE_FLAG_HW_VOLUME,
|
||||
prop->flags & SPA_POD_PROP_FLAG_HARDWARE);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
@ -806,7 +812,7 @@ static void node_event_param(void *object, int seq,
|
|||
|
||||
switch (id) {
|
||||
case SPA_PARAM_Props:
|
||||
if (!SPA_FLAG_IS_SET(g->node_info.flags, NODE_FLAG_HW_VOLUME | NODE_FLAG_HW_MUTE))
|
||||
if (!SPA_FLAG_IS_SET(g->node_info.flags, NODE_FLAG_DEVICE_VOLUME | NODE_FLAG_DEVICE_MUTE))
|
||||
parse_props(g, param, false);
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -273,7 +273,9 @@ struct global {
|
|||
uint32_t client_id; /* if of owner client */
|
||||
uint32_t monitor;
|
||||
#define NODE_FLAG_HW_VOLUME (1 << 0)
|
||||
#define NODE_FLAG_DEVICE_VOLUME (1 << 1)
|
||||
#define NODE_FLAG_HW_MUTE (1 << 4)
|
||||
#define NODE_FLAG_DEVICE_MUTE (1 << 5)
|
||||
uint32_t flags;
|
||||
float volume;
|
||||
bool mute;
|
||||
|
|
|
|||
|
|
@ -450,7 +450,7 @@ static int set_volume(pa_context *c, struct global *g, const pa_cvolume *volume,
|
|||
|
||||
pw_log_info("card:%u global:%u flags:%08x", card_id, g->id, g->node_info.flags);
|
||||
|
||||
if (SPA_FLAG_IS_SET(g->node_info.flags, NODE_FLAG_HW_VOLUME | NODE_FLAG_HW_MUTE) &&
|
||||
if (SPA_FLAG_IS_SET(g->node_info.flags, NODE_FLAG_DEVICE_VOLUME | NODE_FLAG_DEVICE_MUTE) &&
|
||||
(cg = pa_context_find_global(c, card_id)) != NULL) {
|
||||
if (mask & PA_SUBSCRIPTION_MASK_SINK)
|
||||
id = cg->card_info.active_port_output;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue