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

@ -100,8 +100,8 @@ static void fill_item(struct impl *this, struct item *item, struct udev_device *
spa_pod_builder_add(builder,
"<", 0, SPA_ID_OBJECT_MonitorItem,
":", SPA_MONITOR_ITEM_id, "s", udev_device_get_syspath(item->udevice),
":", SPA_MONITOR_ITEM_flags, "i", SPA_MONITOR_ITEM_FLAG_NONE,
":", SPA_MONITOR_ITEM_state, "i", SPA_MONITOR_ITEM_STATE_AVAILABLE,
":", SPA_MONITOR_ITEM_flags, "I", SPA_MONITOR_ITEM_FLAG_NONE,
":", SPA_MONITOR_ITEM_state, "I", SPA_MONITOR_ITEM_STATE_AVAILABLE,
":", SPA_MONITOR_ITEM_name, "s", name,
":", SPA_MONITOR_ITEM_class, "s", "Video/Source",
":", SPA_MONITOR_ITEM_factory, "p", SPA_ID_INTERFACE_HandleFactory, &spa_v4l2_source_factory,

View file

@ -30,9 +30,7 @@
#include <spa/node/node.h>
#include <spa/node/io.h>
#include <spa/param/video/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 "v4l2-source"
@ -158,10 +156,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,
@ -170,7 +168,7 @@ static int impl_node_enum_params(struct spa_node *node,
return 0;
break;
}
case SPA_ID_PARAM_PropInfo:
case SPA_PARAM_PropInfo:
{
struct props *p = &this->props;
@ -201,7 +199,7 @@ static int impl_node_enum_params(struct spa_node *node,
}
break;
}
case SPA_ID_PARAM_Props:
case SPA_PARAM_Props:
{
struct props *p = &this->props;
@ -241,7 +239,7 @@ static int impl_node_set_param(struct spa_node *node,
this = SPA_CONTAINER_OF(node, struct impl, node);
switch (id) {
case SPA_ID_PARAM_Props:
case SPA_PARAM_Props:
{
struct props *p = &this->props;
@ -394,7 +392,7 @@ static int port_get_format(struct spa_node *node,
if (*index > 0)
return 0;
spa_pod_builder_push_object(builder, SPA_ID_PARAM_Format, SPA_ID_OBJECT_Format);
spa_pod_builder_push_object(builder, SPA_PARAM_Format, SPA_ID_OBJECT_Format);
spa_pod_builder_add(builder,
"I", port->current_format.media_type,
@ -457,14 +455,14 @@ static int 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_PropInfo,
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_PropInfo,
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,
@ -473,17 +471,17 @@ static int impl_node_port_enum_params(struct spa_node *node,
return 0;
break;
}
case SPA_ID_PARAM_PropInfo:
case SPA_PARAM_PropInfo:
return spa_v4l2_enum_controls(this, index, filter, result, builder);
case SPA_ID_PARAM_EnumFormat:
case SPA_PARAM_EnumFormat:
return spa_v4l2_enum_format(this, index, filter, result, builder);
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)
@ -499,7 +497,7 @@ static int 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:
switch (*index) {
case 0:
param = spa_pod_builder_object(&b,
@ -516,18 +514,18 @@ static int impl_node_port_enum_params(struct spa_node *node,
return spa_v4l2_enum_controls(this, index, filter, result, builder);
}
#endif
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_Clock,
":", SPA_PARAM_IO_id, "I", SPA_IO_Clock,
":", SPA_PARAM_IO_size, "i", sizeof(struct spa_io_clock));
break;
default:
@ -635,7 +633,7 @@ static int 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
@ -734,10 +732,10 @@ static int 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_Clock) {
else if (id == SPA_IO_Clock) {
port->clock = data;
}
else if ((control = find_control(port, id))) {

View file

@ -675,7 +675,7 @@ spa_v4l2_enum_format(struct impl *this,
}
}
spa_pod_builder_push_object(builder, SPA_ID_PARAM_EnumFormat, SPA_ID_OBJECT_Format);
spa_pod_builder_push_object(builder, SPA_PARAM_EnumFormat, SPA_ID_OBJECT_Format);
spa_pod_builder_add(builder,
"I", info->media_type,
"I", info->media_subtype, 0);
@ -1052,7 +1052,7 @@ spa_v4l2_enum_controls(struct impl *this,
switch (queryctrl.type) {
case V4L2_CTRL_TYPE_INTEGER:
param = spa_pod_builder_object(&b,
SPA_ID_PARAM_PropInfo, SPA_ID_OBJECT_PropInfo,
SPA_PARAM_PropInfo, SPA_ID_OBJECT_PropInfo,
":", SPA_PROP_INFO_id, "I", prop_id,
":", SPA_PROP_INFO_type, "isu", queryctrl.default_value,
SPA_POD_PROP_STEP(queryctrl.minimum,
@ -1062,7 +1062,7 @@ spa_v4l2_enum_controls(struct impl *this,
break;
case V4L2_CTRL_TYPE_BOOLEAN:
param = spa_pod_builder_object(&b,
SPA_ID_PARAM_PropInfo, SPA_ID_OBJECT_PropInfo,
SPA_PARAM_PropInfo, SPA_ID_OBJECT_PropInfo,
":", SPA_PROP_INFO_id, "I", prop_id,
":", SPA_PROP_INFO_type, "b-u", queryctrl.default_value,
":", SPA_PROP_INFO_name, "s", queryctrl.name);
@ -1071,7 +1071,7 @@ spa_v4l2_enum_controls(struct impl *this,
{
struct v4l2_querymenu querymenu;
spa_pod_builder_push_object(&b, SPA_ID_PARAM_PropInfo, SPA_ID_OBJECT_PropInfo);
spa_pod_builder_push_object(&b, SPA_PARAM_PropInfo, SPA_ID_OBJECT_PropInfo);
spa_pod_builder_add(&b,
":", SPA_PROP_INFO_id, "I", prop_id,
":", SPA_PROP_INFO_type, "i-u", queryctrl.default_value,