mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
pw-*: Use user data to track param changes
Use the new param_info user field to track individual param changes and only notify thos that changed.
This commit is contained in:
parent
43601ad722
commit
e9884fcfb5
2 changed files with 22 additions and 16 deletions
|
|
@ -234,10 +234,12 @@ static void print_params(struct spa_param_info *params, uint32_t n_params, char
|
||||||
for (i = 0; i < n_params; i++) {
|
for (i = 0; i < n_params; i++) {
|
||||||
const struct spa_type_info *type_info = spa_type_param;
|
const struct spa_type_info *type_info = spa_type_param;
|
||||||
|
|
||||||
fprintf(stdout, "%c\t %d (%s) %c%c\n", mark, params[i].id,
|
fprintf(stdout, "%c\t %d (%s) %c%c\n",
|
||||||
spa_debug_type_find_name(type_info, params[i].id),
|
params[i].user > 0 ? mark : ' ', params[i].id,
|
||||||
params[i].flags & SPA_PARAM_INFO_READ ? 'r' : '-',
|
spa_debug_type_find_name(type_info, params[i].id),
|
||||||
params[i].flags & SPA_PARAM_INFO_WRITE ? 'w' : '-');
|
params[i].flags & SPA_PARAM_INFO_READ ? 'r' : '-',
|
||||||
|
params[i].flags & SPA_PARAM_INFO_WRITE ? 'w' : '-');
|
||||||
|
params[i].user = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ struct param {
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
int seq;
|
int seq;
|
||||||
struct spa_pod *param;
|
struct spa_pod *param;
|
||||||
|
unsigned int changed:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct data {
|
struct data {
|
||||||
|
|
@ -145,6 +146,7 @@ static void event_param(void *object, int seq, uint32_t id,
|
||||||
p->id = id;
|
p->id = id;
|
||||||
p->seq = seq;
|
p->seq = seq;
|
||||||
p->param = SPA_MEMBER(p, sizeof(struct param), struct spa_pod);
|
p->param = SPA_MEMBER(p, sizeof(struct param), struct spa_pod);
|
||||||
|
p->changed = true;
|
||||||
memcpy(p->param, param, SPA_POD_SIZE(param));
|
memcpy(p->param, param, SPA_POD_SIZE(param));
|
||||||
spa_list_append(&data->param_list, &p->link);
|
spa_list_append(&data->param_list, &p->link);
|
||||||
}
|
}
|
||||||
|
|
@ -155,11 +157,12 @@ static void print_params(struct proxy_data *data, char mark)
|
||||||
|
|
||||||
printf("%c\tparams:\n", mark);
|
printf("%c\tparams:\n", mark);
|
||||||
spa_list_for_each(p, &data->param_list, link) {
|
spa_list_for_each(p, &data->param_list, link) {
|
||||||
printf("%c\t id:%u\n", mark, p->id);
|
printf("%c\t id:%u\n", p->changed ? mark : ' ', p->id);
|
||||||
if (spa_pod_is_object_type(p->param, SPA_TYPE_OBJECT_Format))
|
if (spa_pod_is_object_type(p->param, SPA_TYPE_OBJECT_Format))
|
||||||
spa_debug_format(10, NULL, p->param);
|
spa_debug_format(10, NULL, p->param);
|
||||||
else
|
else
|
||||||
spa_debug_pod(10, NULL, p->param);
|
spa_debug_pod(10, NULL, p->param);
|
||||||
|
p->changed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -273,22 +276,23 @@ static void print_node(struct proxy_data *data)
|
||||||
static void node_event_info(void *object, const struct pw_node_info *info)
|
static void node_event_info(void *object, const struct pw_node_info *info)
|
||||||
{
|
{
|
||||||
struct proxy_data *data = object;
|
struct proxy_data *data = object;
|
||||||
struct pw_node_info *old = data->info;
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
|
info = data->info = pw_node_info_update(data->info, info);
|
||||||
|
|
||||||
if (info->change_mask & PW_NODE_CHANGE_MASK_PARAMS) {
|
if (info->change_mask & PW_NODE_CHANGE_MASK_PARAMS) {
|
||||||
for (i = 0; i < info->n_params; i++) {
|
for (i = 0; i < info->n_params; i++) {
|
||||||
if (old != NULL && info->params[i].flags == old->params[i].flags)
|
if (info->params[i].user == 0)
|
||||||
continue;
|
continue;
|
||||||
remove_params(data, info->params[i].id, 0);
|
remove_params(data, info->params[i].id, 0);
|
||||||
if (!SPA_FLAG_IS_SET(info->params[i].flags, SPA_PARAM_INFO_READ))
|
if (!SPA_FLAG_IS_SET(info->params[i].flags, SPA_PARAM_INFO_READ))
|
||||||
continue;
|
continue;
|
||||||
pw_node_enum_params((struct pw_node*)data->proxy,
|
pw_node_enum_params((struct pw_node*)data->proxy,
|
||||||
0, info->params[i].id, 0, 0, NULL);
|
0, info->params[i].id, 0, 0, NULL);
|
||||||
|
info->params[i].user = 0;
|
||||||
}
|
}
|
||||||
add_pending(data);
|
add_pending(data);
|
||||||
}
|
}
|
||||||
data->info = pw_node_info_update(data->info, info);
|
|
||||||
|
|
||||||
if (data->pending_seq == 0)
|
if (data->pending_seq == 0)
|
||||||
data->print_func(data);
|
data->print_func(data);
|
||||||
|
|
@ -332,22 +336,23 @@ static void print_port(struct proxy_data *data)
|
||||||
static void port_event_info(void *object, const struct pw_port_info *info)
|
static void port_event_info(void *object, const struct pw_port_info *info)
|
||||||
{
|
{
|
||||||
struct proxy_data *data = object;
|
struct proxy_data *data = object;
|
||||||
struct pw_port_info *old = data->info;
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
|
info = data->info = pw_port_info_update(data->info, info);
|
||||||
|
|
||||||
if (info->change_mask & PW_PORT_CHANGE_MASK_PARAMS) {
|
if (info->change_mask & PW_PORT_CHANGE_MASK_PARAMS) {
|
||||||
for (i = 0; i < info->n_params; i++) {
|
for (i = 0; i < info->n_params; i++) {
|
||||||
if (old != NULL && info->params[i].flags == old->params[i].flags)
|
if (info->params[i].user == 0)
|
||||||
continue;
|
continue;
|
||||||
remove_params(data, info->params[i].id, 0);
|
remove_params(data, info->params[i].id, 0);
|
||||||
if (!SPA_FLAG_IS_SET(info->params[i].flags, SPA_PARAM_INFO_READ))
|
if (!SPA_FLAG_IS_SET(info->params[i].flags, SPA_PARAM_INFO_READ))
|
||||||
continue;
|
continue;
|
||||||
pw_port_enum_params((struct pw_port*)data->proxy,
|
pw_port_enum_params((struct pw_port*)data->proxy,
|
||||||
0, info->params[i].id, 0, 0, NULL);
|
0, info->params[i].id, 0, 0, NULL);
|
||||||
|
info->params[i].user = 0;
|
||||||
}
|
}
|
||||||
add_pending(data);
|
add_pending(data);
|
||||||
}
|
}
|
||||||
data->info = pw_port_info_update(data->info, info);
|
|
||||||
|
|
||||||
if (data->pending_seq == 0)
|
if (data->pending_seq == 0)
|
||||||
data->print_func(data);
|
data->print_func(data);
|
||||||
|
|
@ -507,24 +512,23 @@ static void print_device(struct proxy_data *data)
|
||||||
static void device_event_info(void *object, const struct pw_device_info *info)
|
static void device_event_info(void *object, const struct pw_device_info *info)
|
||||||
{
|
{
|
||||||
struct proxy_data *data = object;
|
struct proxy_data *data = object;
|
||||||
struct pw_device_info *old = data->info;
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
|
info = data->info = pw_device_info_update(data->info, info);
|
||||||
|
|
||||||
if (info->change_mask & PW_DEVICE_CHANGE_MASK_PARAMS) {
|
if (info->change_mask & PW_DEVICE_CHANGE_MASK_PARAMS) {
|
||||||
for (i = 0; i < info->n_params; i++) {
|
for (i = 0; i < info->n_params; i++) {
|
||||||
if (old != NULL && info->params[i].flags == old->params[i].flags)
|
if (info->params[i].user == 0)
|
||||||
continue;
|
continue;
|
||||||
remove_params(data, info->params[i].id, 0);
|
remove_params(data, info->params[i].id, 0);
|
||||||
if (!SPA_FLAG_IS_SET(info->params[i].flags, SPA_PARAM_INFO_READ))
|
if (!SPA_FLAG_IS_SET(info->params[i].flags, SPA_PARAM_INFO_READ))
|
||||||
continue;
|
continue;
|
||||||
pw_device_enum_params((struct pw_device*)data->proxy,
|
pw_device_enum_params((struct pw_device*)data->proxy,
|
||||||
0, info->params[i].id, 0, 0, NULL);
|
0, info->params[i].id, 0, 0, NULL);
|
||||||
|
info->params[i].user = 0;
|
||||||
}
|
}
|
||||||
add_pending(data);
|
add_pending(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
data->info = pw_device_info_update(data->info, info);
|
|
||||||
|
|
||||||
if (data->pending_seq == 0)
|
if (data->pending_seq == 0)
|
||||||
data->print_func(data);
|
data->print_func(data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue