Unify props, params and formats

Make enum_params and set_param to configure properties, format
and other parameters. This allows us to remove some duplicate
code and make the properties and parameters much more extensible.
Use the object id to mark the id of the parameter.
Remove the spa_format and spa_props.
We can now make the client-node easier by merging the various
format methods into the params.
Make the stream API more powerful now that we can pass params
around.
This commit is contained in:
Wim Taymans 2017-11-07 17:39:31 +01:00
parent b6ee67905d
commit f3bca48398
87 changed files with 3773 additions and 3580 deletions

View file

@ -322,7 +322,7 @@ pw_protocol_native_connection_get_next(struct pw_protocol_native_connection *con
if (debug_messages) {
printf("<<<<<<<<< in: %d %d %zd\n", *dest_id, *opcode, len);
spa_debug_pod((struct spa_pod *)data);
spa_debug_pod((struct spa_pod *)data, 0);
}
return true;
@ -428,7 +428,7 @@ pw_protocol_native_connection_end(struct pw_protocol_native_connection *conn,
if (debug_messages) {
printf(">>>>>>>>> out: %d %d %d\n", impl->dest_id, impl->opcode, size);
spa_debug_pod((struct spa_pod *)p);
spa_debug_pod((struct spa_pod *)p, 0);
}
spa_hook_list_call(&conn->listener_list, struct pw_protocol_native_connection_events, need_flush);
}

View file

@ -117,7 +117,7 @@ core_marshal_create_link(void *object,
uint32_t output_port_id,
uint32_t input_node_id,
uint32_t input_port_id,
const struct spa_format *filter,
const struct spa_pod_object *filter,
const struct spa_dict *props,
uint32_t new_id)
{
@ -463,7 +463,7 @@ static bool core_demarshal_create_link(void *object, void *data, size_t size)
struct spa_pod_parser prs;
uint32_t new_id, i;
uint32_t output_node_id, output_port_id, input_node_id, input_port_id;
struct spa_format *filter = NULL;
struct spa_pod_object *filter = NULL;
struct spa_dict props;
spa_pod_parser_init(&prs, data, size, 0);
@ -703,18 +703,18 @@ static void node_marshal_info(void *object, struct pw_node_info *info)
"s", info->name,
"i", info->max_input_ports,
"i", info->n_input_ports,
"i", info->n_input_formats, NULL);
"i", info->n_input_params, NULL);
for (i = 0; i < info->n_input_formats; i++)
spa_pod_builder_add(b, "P", info->input_formats[i], NULL);
for (i = 0; i < info->n_input_params; i++)
spa_pod_builder_add(b, "P", info->input_params[i], NULL);
spa_pod_builder_add(b,
"i", info->max_output_ports,
"i", info->n_output_ports,
"i", info->n_output_formats, 0);
"i", info->n_output_params, 0);
for (i = 0; i < info->n_output_formats; i++)
spa_pod_builder_add(b, "P", info->output_formats[i], NULL);
for (i = 0; i < info->n_output_params; i++)
spa_pod_builder_add(b, "P", info->output_params[i], NULL);
n_items = info->props ? info->props->n_items : 0;
@ -748,23 +748,23 @@ static bool node_demarshal_info(void *object, void *data, size_t size)
"s", &info.name,
"i", &info.max_input_ports,
"i", &info.n_input_ports,
"i", &info.n_input_formats, NULL) < 0)
"i", &info.n_input_params, NULL) < 0)
return false;
info.input_formats = alloca(info.n_input_formats * sizeof(struct spa_format *));
for (i = 0; i < info.n_input_formats; i++)
if (spa_pod_parser_get(&prs, "P", &info.input_formats[i], NULL) < 0)
info.input_params = alloca(info.n_input_params * sizeof(struct spa_pod_object *));
for (i = 0; i < info.n_input_params; i++)
if (spa_pod_parser_get(&prs, "P", &info.input_params[i], NULL) < 0)
return false;
if (spa_pod_parser_get(&prs,
"i", &info.max_output_ports,
"i", &info.n_output_ports,
"i", &info.n_output_formats, NULL) < 0)
"i", &info.n_output_params, NULL) < 0)
return false;
info.output_formats = alloca(info.n_output_formats * sizeof(struct spa_format *));
for (i = 0; i < info.n_output_formats; i++)
if (spa_pod_parser_get(&prs, "P", &info.output_formats[i], NULL) < 0)
info.output_params = alloca(info.n_output_params * sizeof(struct spa_pod_object *));
for (i = 0; i < info.n_output_params; i++)
if (spa_pod_parser_get(&prs, "P", &info.output_params[i], NULL) < 0)
return false;
if (spa_pod_parser_get(&prs,