mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-07 13:30:09 -05:00
More type fixes
Param ids and IO ids are now simple enums. Move some type info in one place, delete some type-info files Fix type debug Make audio layout an enum Mark more enums as enums in types so they show us with their names in the debug.
This commit is contained in:
parent
93a8747a44
commit
d26aecfef2
82 changed files with 869 additions and 1118 deletions
|
|
@ -502,7 +502,7 @@ do_update_port(struct node *this,
|
|||
for (i = 0; i < port->n_params; i++) {
|
||||
port->params[i] = pw_spa_pod_copy(params[i]);
|
||||
|
||||
if (spa_pod_is_object_id(port->params[i], SPA_ID_PARAM_Format))
|
||||
if (spa_pod_is_object_id(port->params[i], SPA_PARAM_Format))
|
||||
port->have_format = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1279,7 +1279,7 @@ static void node_initialized(void *data)
|
|||
pw_log_debug("client-node %p: io areas %p", node, impl->io_areas->ptr);
|
||||
|
||||
pw_client_node_resource_set_io(this->resource,
|
||||
PW_ID_IO_ClientNodePosition,
|
||||
PW_IO_ClientNodePosition,
|
||||
m->id,
|
||||
area_size,
|
||||
sizeof(struct pw_client_node_position));
|
||||
|
|
@ -1434,7 +1434,7 @@ static int impl_mix_port_set_io(struct spa_node *node,
|
|||
if (mix == NULL)
|
||||
return -EIO;
|
||||
|
||||
if (id == SPA_ID_IO_Buffers) {
|
||||
if (id == SPA_IO_Buffers) {
|
||||
if (data && size >= sizeof(struct spa_io_buffers))
|
||||
mix->io = data;
|
||||
else
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ impl_node_add_port(struct spa_node *node, enum spa_direction direction, uint32_t
|
|||
|
||||
if ((res = spa_node_port_set_io(impl->adapter_mix,
|
||||
direction, port_id,
|
||||
SPA_ID_IO_ControlRange,
|
||||
SPA_IO_ControlRange,
|
||||
&impl->ctrl,
|
||||
sizeof(&impl->ctrl))) < 0)
|
||||
return res;
|
||||
|
|
@ -374,20 +374,20 @@ static int negotiate_format(struct impl *impl)
|
|||
state = 0;
|
||||
if ((res = spa_node_port_enum_params(impl->adapter_mix,
|
||||
SPA_DIRECTION_REVERSE(impl->direction), 0,
|
||||
SPA_ID_PARAM_EnumFormat, &state,
|
||||
SPA_PARAM_EnumFormat, &state,
|
||||
NULL, &format, &b)) <= 0) {
|
||||
debug_params(impl, impl->adapter_mix, SPA_DIRECTION_REVERSE(impl->direction), 0,
|
||||
SPA_ID_PARAM_EnumFormat, NULL);
|
||||
SPA_PARAM_EnumFormat, NULL);
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
state = 0;
|
||||
if ((res = spa_node_port_enum_params(impl->cnode,
|
||||
impl->direction, 0,
|
||||
SPA_ID_PARAM_EnumFormat, &state,
|
||||
SPA_PARAM_EnumFormat, &state,
|
||||
format, &format, &b)) <= 0) {
|
||||
debug_params(impl, impl->cnode, impl->direction, 0,
|
||||
SPA_ID_PARAM_EnumFormat, format);
|
||||
SPA_PARAM_EnumFormat, format);
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
|
|
@ -396,13 +396,13 @@ static int negotiate_format(struct impl *impl)
|
|||
|
||||
if ((res = spa_node_port_set_param(impl->adapter_mix,
|
||||
SPA_DIRECTION_REVERSE(impl->direction), 0,
|
||||
SPA_ID_PARAM_Format, 0,
|
||||
SPA_PARAM_Format, 0,
|
||||
format)) < 0)
|
||||
return res;
|
||||
|
||||
if ((res = spa_node_port_set_param(impl->cnode,
|
||||
impl->direction, 0,
|
||||
SPA_ID_PARAM_Format, 0,
|
||||
SPA_PARAM_Format, 0,
|
||||
format)) < 0)
|
||||
return res;
|
||||
|
||||
|
|
@ -433,10 +433,10 @@ static int negotiate_buffers(struct impl *impl)
|
|||
state = 0;
|
||||
if ((res = spa_node_port_enum_params(impl->adapter_mix,
|
||||
SPA_DIRECTION_REVERSE(impl->direction), 0,
|
||||
SPA_ID_PARAM_Buffers, &state,
|
||||
SPA_PARAM_Buffers, &state,
|
||||
param, ¶m, &b)) <= 0) {
|
||||
debug_params(impl, impl->adapter_mix, SPA_DIRECTION_REVERSE(impl->direction), 0,
|
||||
SPA_ID_PARAM_Buffers, param);
|
||||
SPA_PARAM_Buffers, param);
|
||||
return -ENOTSUP;
|
||||
}
|
||||
if (res == 0)
|
||||
|
|
@ -445,10 +445,10 @@ static int negotiate_buffers(struct impl *impl)
|
|||
state = 0;
|
||||
if ((res = spa_node_port_enum_params(impl->cnode,
|
||||
impl->direction, 0,
|
||||
SPA_ID_PARAM_Buffers, &state,
|
||||
SPA_PARAM_Buffers, &state,
|
||||
param, ¶m, &b)) < 0) {
|
||||
debug_params(impl, impl->cnode, impl->direction, 0,
|
||||
SPA_ID_PARAM_Buffers, param);
|
||||
SPA_PARAM_Buffers, param);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
@ -597,7 +597,7 @@ impl_node_port_set_param(struct spa_node *node,
|
|||
flags, param)) < 0)
|
||||
return res;
|
||||
|
||||
if (id == SPA_ID_PARAM_Format && impl->use_converter) {
|
||||
if (id == SPA_PARAM_Format && impl->use_converter) {
|
||||
if (param == NULL) {
|
||||
if ((res = spa_node_port_set_param(impl->adapter_mix,
|
||||
SPA_DIRECTION_REVERSE(direction), 0, id,
|
||||
|
|
@ -636,7 +636,7 @@ impl_node_port_set_io(struct spa_node *node,
|
|||
if (impl->use_converter)
|
||||
res = spa_node_port_set_io(impl->adapter_mix, direction, port_id, id, data, size);
|
||||
|
||||
if (id == SPA_ID_IO_Buffers && size >= sizeof(struct spa_io_buffers)) {
|
||||
if (id == SPA_IO_Buffers && size >= sizeof(struct spa_io_buffers)) {
|
||||
impl->io = data;
|
||||
}
|
||||
|
||||
|
|
@ -874,7 +874,7 @@ static void client_node_initialized(void *data)
|
|||
|
||||
if ((res = spa_node_port_set_io(impl->client_port->mix,
|
||||
impl->direction, 0,
|
||||
SPA_ID_IO_Buffers,
|
||||
SPA_IO_Buffers,
|
||||
impl->client_port_mix.io,
|
||||
sizeof(impl->client_port_mix.io))) < 0)
|
||||
return;
|
||||
|
|
@ -883,7 +883,7 @@ static void client_node_initialized(void *data)
|
|||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||
if ((res = spa_node_port_enum_params(impl->cnode,
|
||||
impl->direction, 0,
|
||||
SPA_ID_PARAM_EnumFormat, &state,
|
||||
SPA_PARAM_EnumFormat, &state,
|
||||
NULL, &format, &b)) <= 0) {
|
||||
pw_log_warn("client-stream %p: no format given", &impl->this);
|
||||
impl->adapter = impl->cnode;
|
||||
|
|
@ -920,7 +920,7 @@ static void client_node_initialized(void *data)
|
|||
if (impl->use_converter) {
|
||||
if ((res = spa_node_port_set_io(impl->adapter_mix,
|
||||
SPA_DIRECTION_REVERSE(impl->direction), 0,
|
||||
SPA_ID_IO_Buffers,
|
||||
SPA_IO_Buffers,
|
||||
impl->client_port_mix.io,
|
||||
sizeof(impl->client_port_mix.io))) < 0)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -662,7 +662,7 @@ static int find_port_format(struct impl *impl, struct pw_port *port,
|
|||
struct channel_data data = { impl, 0, 0 };
|
||||
|
||||
pw_port_for_each_param(port,
|
||||
SPA_ID_PARAM_EnumFormat,
|
||||
SPA_PARAM_EnumFormat,
|
||||
0, 0, NULL,
|
||||
collect_audio_format, &data);
|
||||
|
||||
|
|
|
|||
|
|
@ -26,9 +26,7 @@
|
|||
#include <spa/node/node.h>
|
||||
#include <spa/node/io.h>
|
||||
#include <spa/param/audio/format-utils.h>
|
||||
#include <spa/param/buffers.h>
|
||||
#include <spa/param/meta.h>
|
||||
#include <spa/param/io.h>
|
||||
#include <spa/param/param.h>
|
||||
#include <spa/pod/filter.h>
|
||||
|
||||
#define NAME "floatmix"
|
||||
|
|
@ -327,20 +325,20 @@ static int port_enum_formats(struct spa_node *node,
|
|||
case 0:
|
||||
if (this->have_format) {
|
||||
*param = spa_pod_builder_object(builder,
|
||||
SPA_ID_PARAM_EnumFormat, SPA_ID_OBJECT_Format,
|
||||
SPA_PARAM_EnumFormat, SPA_ID_OBJECT_Format,
|
||||
"I", SPA_MEDIA_TYPE_audio,
|
||||
"I", SPA_MEDIA_SUBTYPE_raw,
|
||||
":", SPA_FORMAT_AUDIO_format, "I", this->format.info.raw.format,
|
||||
":", SPA_FORMAT_AUDIO_layout, "i", this->format.info.raw.layout,
|
||||
":", SPA_FORMAT_AUDIO_layout, "I", this->format.info.raw.layout,
|
||||
":", SPA_FORMAT_AUDIO_rate, "i", this->format.info.raw.rate,
|
||||
":", SPA_FORMAT_AUDIO_channels, "i", this->format.info.raw.channels);
|
||||
} else {
|
||||
*param = spa_pod_builder_object(builder,
|
||||
SPA_ID_PARAM_EnumFormat, SPA_ID_OBJECT_Format,
|
||||
SPA_PARAM_EnumFormat, SPA_ID_OBJECT_Format,
|
||||
"I", SPA_MEDIA_TYPE_audio,
|
||||
"I", SPA_MEDIA_SUBTYPE_raw,
|
||||
":", SPA_FORMAT_AUDIO_format, "I", SPA_AUDIO_FORMAT_F32,
|
||||
":", SPA_FORMAT_AUDIO_layout, "i", SPA_AUDIO_LAYOUT_NON_INTERLEAVED,
|
||||
":", SPA_FORMAT_AUDIO_layout, "I", SPA_AUDIO_LAYOUT_NON_INTERLEAVED,
|
||||
":", SPA_FORMAT_AUDIO_rate, "iru", 44100,
|
||||
SPA_POD_PROP_MIN_MAX(1, INT32_MAX),
|
||||
":", SPA_FORMAT_AUDIO_channels, "iru", 1);
|
||||
|
|
@ -367,11 +365,11 @@ static int port_get_format(struct spa_node *node,
|
|||
return 0;
|
||||
|
||||
*param = spa_pod_builder_object(builder,
|
||||
SPA_ID_PARAM_Format, SPA_ID_OBJECT_Format,
|
||||
SPA_PARAM_Format, SPA_ID_OBJECT_Format,
|
||||
"I", SPA_MEDIA_TYPE_audio,
|
||||
"I", SPA_MEDIA_SUBTYPE_raw,
|
||||
":", SPA_FORMAT_AUDIO_format, "I", this->format.info.raw.format,
|
||||
":", SPA_FORMAT_AUDIO_layout, "i", this->format.info.raw.layout,
|
||||
":", SPA_FORMAT_AUDIO_layout, "I", this->format.info.raw.layout,
|
||||
":", SPA_FORMAT_AUDIO_rate, "i", this->format.info.raw.rate,
|
||||
":", SPA_FORMAT_AUDIO_channels, "i", this->format.info.raw.channels);
|
||||
|
||||
|
|
@ -407,13 +405,13 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||
|
||||
switch (id) {
|
||||
case SPA_ID_PARAM_List:
|
||||
case SPA_PARAM_List:
|
||||
{
|
||||
uint32_t list[] = { SPA_ID_PARAM_EnumFormat,
|
||||
SPA_ID_PARAM_Format,
|
||||
SPA_ID_PARAM_Buffers,
|
||||
SPA_ID_PARAM_Meta,
|
||||
SPA_ID_PARAM_IO };
|
||||
uint32_t list[] = { SPA_PARAM_EnumFormat,
|
||||
SPA_PARAM_Format,
|
||||
SPA_PARAM_Buffers,
|
||||
SPA_PARAM_Meta,
|
||||
SPA_PARAM_IO };
|
||||
|
||||
if (*index < SPA_N_ELEMENTS(list))
|
||||
param = spa_pod_builder_object(&b, id, SPA_ID_OBJECT_ParamList,
|
||||
|
|
@ -422,16 +420,16 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
return 0;
|
||||
break;
|
||||
}
|
||||
case SPA_ID_PARAM_EnumFormat:
|
||||
case SPA_PARAM_EnumFormat:
|
||||
if ((res = port_enum_formats(node, direction, port_id, index, ¶m, &b)) <= 0)
|
||||
return res;
|
||||
break;
|
||||
|
||||
case SPA_ID_PARAM_Format:
|
||||
case SPA_PARAM_Format:
|
||||
if ((res = port_get_format(node, direction, port_id, index, ¶m, &b)) <= 0)
|
||||
return res;
|
||||
break;
|
||||
case SPA_ID_PARAM_Buffers:
|
||||
case SPA_PARAM_Buffers:
|
||||
if (!port->have_format)
|
||||
return -EIO;
|
||||
if (*index > 0)
|
||||
|
|
@ -448,7 +446,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
":", SPA_PARAM_BUFFERS_align, "i", 16);
|
||||
break;
|
||||
|
||||
case SPA_ID_PARAM_Meta:
|
||||
case SPA_PARAM_Meta:
|
||||
if (!port->have_format)
|
||||
return -EIO;
|
||||
|
||||
|
|
@ -464,18 +462,18 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
}
|
||||
break;
|
||||
|
||||
case SPA_ID_PARAM_IO:
|
||||
case SPA_PARAM_IO:
|
||||
switch (*index) {
|
||||
case 0:
|
||||
param = spa_pod_builder_object(&b,
|
||||
id, SPA_ID_OBJECT_ParamIO,
|
||||
":", SPA_PARAM_IO_id, "I", SPA_ID_IO_Buffers,
|
||||
":", SPA_PARAM_IO_id, "I", SPA_IO_Buffers,
|
||||
":", SPA_PARAM_IO_size, "i", sizeof(struct spa_io_buffers));
|
||||
break;
|
||||
case 1:
|
||||
param = spa_pod_builder_object(&b,
|
||||
id, SPA_ID_OBJECT_ParamIO,
|
||||
":", SPA_PARAM_IO_id, "I", SPA_ID_IO_ControlRange,
|
||||
":", SPA_PARAM_IO_id, "I", SPA_IO_ControlRange,
|
||||
":", SPA_PARAM_IO_size, "i", sizeof(struct spa_io_control_range));
|
||||
break;
|
||||
default:
|
||||
|
|
@ -628,7 +626,7 @@ impl_node_port_set_param(struct spa_node *node,
|
|||
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
if (id == SPA_ID_PARAM_Format) {
|
||||
if (id == SPA_PARAM_Format) {
|
||||
return port_set_format(node, direction, port_id, flags, param);
|
||||
}
|
||||
else
|
||||
|
|
@ -714,9 +712,9 @@ impl_node_port_set_io(struct spa_node *node,
|
|||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
|
||||
if (id == SPA_ID_IO_Buffers)
|
||||
if (id == SPA_IO_Buffers)
|
||||
port->io = data;
|
||||
else if (id == SPA_ID_IO_ControlRange)
|
||||
else if (id == SPA_IO_ControlRange)
|
||||
port->ctrl = data;
|
||||
#if 0
|
||||
else if (id == t->io_prop_volume && direction == SPA_DIRECTION_INPUT)
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ static struct monitor_item *add_item(struct pw_spa_monitor *this,
|
|||
|
||||
if (spa_pod_object_parse(item,
|
||||
":", SPA_MONITOR_ITEM_id, "s", &id,
|
||||
":", SPA_MONITOR_ITEM_state, "i", &state,
|
||||
":", SPA_MONITOR_ITEM_state, "I", &state,
|
||||
":", SPA_MONITOR_ITEM_name, "s", &name,
|
||||
":", SPA_MONITOR_ITEM_class, "s", &klass,
|
||||
":", SPA_MONITOR_ITEM_factory, "p", &factory,
|
||||
|
|
@ -185,7 +185,7 @@ static void change_item(struct pw_spa_monitor *this, struct spa_pod *item, uint6
|
|||
|
||||
if (spa_pod_object_parse(item,
|
||||
":", SPA_MONITOR_ITEM_name, "s", &name,
|
||||
":", SPA_MONITOR_ITEM_state, "i", &state,
|
||||
":", SPA_MONITOR_ITEM_state, "I", &state,
|
||||
":", SPA_MONITOR_ITEM_id, "s", &id, NULL) < 0)
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ setup_props(struct pw_core *core, struct spa_node *spa_node, struct pw_propertie
|
|||
uint8_t buf[2048];
|
||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buf, sizeof(buf));
|
||||
|
||||
if ((res = spa_node_enum_params(spa_node, SPA_ID_PARAM_Props, &index, NULL, &props, &b)) <= 0) {
|
||||
if ((res = spa_node_enum_params(spa_node, SPA_PARAM_Props, &index, NULL, &props, &b)) <= 0) {
|
||||
pw_log_debug("spa_node_get_props failed: %d", res);
|
||||
return res;
|
||||
}
|
||||
|
|
@ -192,7 +192,7 @@ setup_props(struct pw_core *core, struct spa_node *spa_node, struct pw_propertie
|
|||
pw_properties_parse_bool(value);
|
||||
break;
|
||||
case SPA_ID_Enum:
|
||||
SPA_POD_VALUE(struct spa_pod_id, &prop->body.value) =
|
||||
SPA_POD_VALUE(struct spa_pod_enum, &prop->body.value) =
|
||||
spa_debug_type_find_id(spa_debug_types, value);
|
||||
break;
|
||||
case SPA_ID_Int:
|
||||
|
|
@ -219,7 +219,7 @@ setup_props(struct pw_core *core, struct spa_node *spa_node, struct pw_propertie
|
|||
}
|
||||
}
|
||||
|
||||
if ((res = spa_node_set_param(spa_node, SPA_ID_PARAM_Props, 0, props)) < 0) {
|
||||
if ((res = spa_node_set_param(spa_node, SPA_PARAM_Props, 0, props)) < 0) {
|
||||
pw_log_debug("spa_node_set_props failed: %d", res);
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue