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:
Wim Taymans 2018-08-25 12:08:29 +02:00
parent 93a8747a44
commit d26aecfef2
82 changed files with 869 additions and 1118 deletions

View file

@ -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 "volume"
@ -121,10 +119,10 @@ static int impl_node_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_PropInfo,
SPA_ID_PARAM_Props };
uint32_t list[] = { SPA_PARAM_PropInfo,
SPA_PARAM_Props };
if (*index < SPA_N_ELEMENTS(list))
param = spa_pod_builder_object(&b, id, SPA_ID_OBJECT_ParamList,
@ -133,7 +131,7 @@ static int impl_node_enum_params(struct spa_node *node,
return 0;
break;
}
case SPA_ID_PARAM_PropInfo:
case SPA_PARAM_PropInfo:
switch (*index) {
case 0:
param = spa_pod_builder_object(&b,
@ -154,7 +152,7 @@ static int impl_node_enum_params(struct spa_node *node,
return 0;
}
break;
case SPA_ID_PARAM_Props:
case SPA_PARAM_Props:
switch (*index) {
case 0:
param = spa_pod_builder_object(&b,
@ -188,7 +186,7 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
this = SPA_CONTAINER_OF(node, struct impl, node);
switch (id) {
case SPA_ID_PARAM_Props:
case SPA_PARAM_Props:
{
struct props *p = &this->props;
@ -329,7 +327,7 @@ static int port_enum_formats(struct spa_node *node,
switch (*index) {
case 0:
*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, "Ieu", SPA_AUDIO_FORMAT_S16,
@ -364,7 +362,7 @@ 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->current_format.info.raw.format,
@ -403,13 +401,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,
@ -418,15 +416,15 @@ 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, filter, &param, &b)) <= 0)
return res;
break;
case SPA_ID_PARAM_Format:
case SPA_PARAM_Format:
if ((res = port_get_format(node, direction, port_id, index, filter, &param, &b)) <= 0)
return res;
break;
case SPA_ID_PARAM_Buffers:
case SPA_PARAM_Buffers:
if (!port->have_format)
return -EIO;
if (*index > 0)
@ -442,7 +440,7 @@ impl_node_port_enum_params(struct spa_node *node,
":", SPA_PARAM_BUFFERS_stride, "i", 0,
":", SPA_PARAM_BUFFERS_align, "i", 16);
break;
case SPA_ID_PARAM_Meta:
case SPA_PARAM_Meta:
switch (*index) {
case 0:
param = spa_pod_builder_object(&b,
@ -454,18 +452,18 @@ impl_node_port_enum_params(struct spa_node *node,
return 0;
}
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:
@ -539,7 +537,7 @@ impl_node_port_set_param(struct spa_node *node,
spa_return_val_if_fail(CHECK_PORT(node, 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
@ -627,9 +625,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->range = data;
else
return -ENOENT;