mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -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
|
|
@ -113,11 +113,11 @@ int main(int argc, char *argv[])
|
|||
data.remote = pw_stream_get_remote(data.stream);
|
||||
|
||||
params[0] = spa_pod_builder_object(&b,
|
||||
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_INTERLEAVED,
|
||||
":", SPA_FORMAT_AUDIO_layout, "I", SPA_AUDIO_LAYOUT_INTERLEAVED,
|
||||
":", SPA_FORMAT_AUDIO_channels, "i", DEFAULT_CHANNELS,
|
||||
":", SPA_FORMAT_AUDIO_rate, "i", DEFAULT_RATE);
|
||||
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ static int impl_port_set_io(struct spa_node *node,
|
|||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
|
||||
if (id == SPA_ID_IO_Buffers)
|
||||
if (id == SPA_IO_Buffers)
|
||||
d->io = data;
|
||||
#if 0
|
||||
else if (id == d->type.io_prop_param) {
|
||||
|
|
@ -218,7 +218,7 @@ static int port_get_format(struct spa_node *node,
|
|||
return 0;
|
||||
|
||||
*result = spa_pod_builder_object(builder,
|
||||
SPA_ID_PARAM_Format, SPA_ID_OBJECT_Format,
|
||||
SPA_PARAM_Format, SPA_ID_OBJECT_Format,
|
||||
"I", SPA_MEDIA_TYPE_video,
|
||||
"I", SPA_MEDIA_SUBTYPE_raw,
|
||||
":", SPA_FORMAT_VIDEO_format, "I", d->format.format,
|
||||
|
|
@ -241,13 +241,13 @@ static int impl_port_enum_params(struct spa_node *node,
|
|||
struct spa_pod *param;
|
||||
|
||||
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(builder,
|
||||
|
|
@ -257,13 +257,13 @@ static int impl_port_enum_params(struct spa_node *node,
|
|||
return 0;
|
||||
break;
|
||||
}
|
||||
case SPA_ID_PARAM_EnumFormat:
|
||||
case SPA_PARAM_EnumFormat:
|
||||
return port_enum_formats(node, direction, port_id, index, filter, result, builder);
|
||||
|
||||
case SPA_ID_PARAM_Format:
|
||||
case SPA_PARAM_Format:
|
||||
return port_get_format(node, direction, port_id, index, filter, result, builder);
|
||||
|
||||
case SPA_ID_PARAM_Buffers:
|
||||
case SPA_PARAM_Buffers:
|
||||
if (*index != 0)
|
||||
return 0;
|
||||
|
||||
|
|
@ -277,7 +277,7 @@ static int impl_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(builder,
|
||||
|
|
@ -360,7 +360,7 @@ static int impl_port_set_param(struct spa_node *node,
|
|||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
if (id == SPA_ID_PARAM_Format) {
|
||||
if (id == SPA_PARAM_Format) {
|
||||
return port_set_format(node, direction, port_id, flags, param);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ static int impl_port_set_io(struct spa_node *node, enum spa_direction direction,
|
|||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
|
||||
if (id == SPA_ID_IO_Buffers)
|
||||
if (id == SPA_IO_Buffers)
|
||||
d->io = data;
|
||||
#if 0
|
||||
else if (id == type.io_prop_volume) {
|
||||
|
|
@ -181,13 +181,13 @@ static int port_enum_formats(struct spa_node *node,
|
|||
return 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,
|
||||
SPA_POD_PROP_ENUM(2, SPA_AUDIO_FORMAT_S16,
|
||||
SPA_AUDIO_FORMAT_F32),
|
||||
":", SPA_FORMAT_AUDIO_layout, "ieu", SPA_AUDIO_LAYOUT_INTERLEAVED,
|
||||
":", SPA_FORMAT_AUDIO_layout, "Ieu", SPA_AUDIO_LAYOUT_INTERLEAVED,
|
||||
SPA_POD_PROP_ENUM(2, SPA_AUDIO_LAYOUT_INTERLEAVED,
|
||||
SPA_AUDIO_LAYOUT_NON_INTERLEAVED),
|
||||
":", SPA_FORMAT_AUDIO_channels, "iru", 2,
|
||||
|
|
@ -216,11 +216,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", d->format.format,
|
||||
":", SPA_FORMAT_AUDIO_layout, "i", d->format.layout,
|
||||
":", SPA_FORMAT_AUDIO_layout, "I", d->format.layout,
|
||||
":", SPA_FORMAT_AUDIO_channels, "i", d->format.channels,
|
||||
":", SPA_FORMAT_AUDIO_rate, "i", d->format.rate);
|
||||
|
||||
|
|
@ -239,13 +239,13 @@ static int impl_port_enum_params(struct spa_node *node,
|
|||
struct spa_pod *param;
|
||||
|
||||
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(builder,
|
||||
|
|
@ -255,13 +255,13 @@ static int impl_port_enum_params(struct spa_node *node,
|
|||
return 0;
|
||||
break;
|
||||
}
|
||||
case SPA_ID_PARAM_EnumFormat:
|
||||
case SPA_PARAM_EnumFormat:
|
||||
return port_enum_formats(node, direction, port_id, index, filter, result, builder);
|
||||
|
||||
case SPA_ID_PARAM_Format:
|
||||
case SPA_PARAM_Format:
|
||||
return port_get_format(node, direction, port_id, index, filter, result, builder);
|
||||
|
||||
case SPA_ID_PARAM_Buffers:
|
||||
case SPA_PARAM_Buffers:
|
||||
if (*index > 0)
|
||||
return 0;
|
||||
|
||||
|
|
@ -275,7 +275,7 @@ static int impl_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(builder,
|
||||
|
|
@ -287,12 +287,12 @@ static int impl_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(builder,
|
||||
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;
|
||||
default:
|
||||
|
|
@ -356,7 +356,7 @@ static int impl_port_set_param(struct spa_node *node,
|
|||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
if (id == SPA_ID_PARAM_Format) {
|
||||
if (id == SPA_PARAM_Format) {
|
||||
return port_set_format(node, direction, port_id, flags, param);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ static int impl_port_set_io(struct spa_node *node, enum spa_direction direction,
|
|||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
|
||||
if (id == SPA_ID_IO_Buffers)
|
||||
if (id == SPA_IO_Buffers)
|
||||
d->io = data;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -225,9 +225,9 @@ static int port_enum_formats(struct spa_node *node,
|
|||
|
||||
SDL_GetRendererInfo(d->renderer, &info);
|
||||
|
||||
spa_pod_builder_push_object(builder, SPA_ID_PARAM_EnumFormat, SPA_ID_OBJECT_Format);
|
||||
spa_pod_builder_id(builder, SPA_MEDIA_TYPE_video);
|
||||
spa_pod_builder_id(builder, SPA_MEDIA_SUBTYPE_raw);
|
||||
spa_pod_builder_push_object(builder, SPA_PARAM_EnumFormat, SPA_ID_OBJECT_Format);
|
||||
spa_pod_builder_enum(builder, SPA_MEDIA_TYPE_video);
|
||||
spa_pod_builder_enum(builder, SPA_MEDIA_SUBTYPE_raw);
|
||||
|
||||
spa_pod_builder_push_prop(builder, SPA_FORMAT_VIDEO_format,
|
||||
SPA_POD_PROP_FLAG_UNSET |
|
||||
|
|
@ -237,13 +237,13 @@ static int port_enum_formats(struct spa_node *node,
|
|||
if (id == 0)
|
||||
continue;
|
||||
if (c++ == 0)
|
||||
spa_pod_builder_id(builder, id);
|
||||
spa_pod_builder_id(builder, id);
|
||||
spa_pod_builder_enum(builder, id);
|
||||
spa_pod_builder_enum(builder, id);
|
||||
}
|
||||
for (i = 0; i < SPA_N_ELEMENTS(video_formats); i++) {
|
||||
uint32_t id = video_formats[i].id;
|
||||
if (id != SPA_VIDEO_FORMAT_UNKNOWN)
|
||||
spa_pod_builder_id(builder, id);
|
||||
spa_pod_builder_enum(builder, id);
|
||||
}
|
||||
spa_pod_builder_pop(builder);
|
||||
|
||||
|
|
@ -273,10 +273,10 @@ static int impl_port_enum_params(struct spa_node *node,
|
|||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
|
||||
switch (id) {
|
||||
case SPA_ID_PARAM_EnumFormat:
|
||||
case SPA_PARAM_EnumFormat:
|
||||
return port_enum_formats(node, direction, port_id, index, filter, result, builder);
|
||||
|
||||
case SPA_ID_PARAM_Buffers:
|
||||
case SPA_PARAM_Buffers:
|
||||
if (*index > 0)
|
||||
return 0;
|
||||
|
||||
|
|
@ -290,7 +290,7 @@ static int impl_port_enum_params(struct spa_node *node,
|
|||
":", SPA_PARAM_BUFFERS_align, "i", 16);
|
||||
break;
|
||||
|
||||
case SPA_ID_PARAM_Meta:
|
||||
case SPA_PARAM_Meta:
|
||||
if (*index > 0)
|
||||
return 0;
|
||||
|
||||
|
|
@ -342,7 +342,7 @@ static int impl_port_set_param(struct spa_node *node,
|
|||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
if (id == SPA_ID_PARAM_Format) {
|
||||
if (id == SPA_PARAM_Format) {
|
||||
return port_set_format(node, direction, port_id, flags, param);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -97,9 +97,9 @@ static struct spa_pod *sdl_build_formats(SDL_RendererInfo *info, struct spa_pod_
|
|||
{
|
||||
int i, c;
|
||||
|
||||
spa_pod_builder_push_object(b, SPA_ID_PARAM_EnumFormat, SPA_ID_OBJECT_Format);
|
||||
spa_pod_builder_id(b, SPA_MEDIA_TYPE_video);
|
||||
spa_pod_builder_id(b, SPA_MEDIA_SUBTYPE_raw);
|
||||
spa_pod_builder_push_object(b, SPA_PARAM_EnumFormat, SPA_ID_OBJECT_Format);
|
||||
spa_pod_builder_enum(b, SPA_MEDIA_TYPE_video);
|
||||
spa_pod_builder_enum(b, SPA_MEDIA_SUBTYPE_raw);
|
||||
|
||||
spa_pod_builder_push_prop(b, SPA_FORMAT_VIDEO_format,
|
||||
SPA_POD_PROP_FLAG_UNSET |
|
||||
|
|
@ -109,13 +109,13 @@ static struct spa_pod *sdl_build_formats(SDL_RendererInfo *info, struct spa_pod_
|
|||
if (id == 0)
|
||||
continue;
|
||||
if (c++ == 0)
|
||||
spa_pod_builder_id(b, id);
|
||||
spa_pod_builder_id(b, id);
|
||||
spa_pod_builder_enum(b, id);
|
||||
spa_pod_builder_enum(b, id);
|
||||
}
|
||||
for (i = 0; i < SPA_N_ELEMENTS(sdl_video_formats); i++) {
|
||||
uint32_t id = sdl_video_formats[i].id;
|
||||
if (id != SPA_VIDEO_FORMAT_UNKNOWN)
|
||||
spa_pod_builder_id(b, id);
|
||||
spa_pod_builder_enum(b, id);
|
||||
}
|
||||
spa_pod_builder_pop(b);
|
||||
spa_pod_builder_add(b,
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ on_stream_format_changed(void *_data, const struct spa_pod *format)
|
|||
SDL_UnlockTexture(data->texture);
|
||||
|
||||
params[0] = spa_pod_builder_object(&b,
|
||||
SPA_ID_PARAM_Buffers, SPA_ID_OBJECT_ParamBuffers,
|
||||
SPA_PARAM_Buffers, SPA_ID_OBJECT_ParamBuffers,
|
||||
":", SPA_PARAM_BUFFERS_buffers, "iru", 8,
|
||||
SPA_POD_PROP_MIN_MAX(2, 16),
|
||||
":", SPA_PARAM_BUFFERS_blocks, "i", 1,
|
||||
|
|
@ -178,7 +178,7 @@ on_stream_format_changed(void *_data, const struct spa_pod *format)
|
|||
":", SPA_PARAM_BUFFERS_align, "i", 16);
|
||||
|
||||
params[1] = spa_pod_builder_object(&b,
|
||||
SPA_ID_PARAM_Meta, SPA_ID_OBJECT_ParamMeta,
|
||||
SPA_PARAM_Meta, SPA_ID_OBJECT_ParamMeta,
|
||||
":", SPA_PARAM_META_type, "I", SPA_META_Header,
|
||||
":", SPA_PARAM_META_size, "i", sizeof(struct spa_meta_header));
|
||||
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ on_stream_format_changed(void *_data, const struct spa_pod *format)
|
|||
data->stride = SPA_ROUND_UP_N(data->format.size.width * BPP, 4);
|
||||
|
||||
params[0] = spa_pod_builder_object(&b,
|
||||
SPA_ID_PARAM_Buffers, SPA_ID_OBJECT_ParamBuffers,
|
||||
SPA_PARAM_Buffers, SPA_ID_OBJECT_ParamBuffers,
|
||||
":", SPA_PARAM_BUFFERS_buffers, "iru", 2,
|
||||
SPA_POD_PROP_MIN_MAX(1, 32),
|
||||
":", SPA_PARAM_BUFFERS_blocks, "i", 1,
|
||||
|
|
@ -177,12 +177,12 @@ on_stream_format_changed(void *_data, const struct spa_pod *format)
|
|||
":", SPA_PARAM_BUFFERS_align, "i", 16);
|
||||
|
||||
params[1] = spa_pod_builder_object(&b,
|
||||
SPA_ID_PARAM_Meta, SPA_ID_OBJECT_ParamMeta,
|
||||
SPA_PARAM_Meta, SPA_ID_OBJECT_ParamMeta,
|
||||
":", SPA_PARAM_META_type, "I", SPA_META_Header,
|
||||
":", SPA_PARAM_META_size, "i", sizeof(struct spa_meta_header));
|
||||
|
||||
params[2] = spa_pod_builder_object(&b,
|
||||
SPA_ID_PARAM_Meta, SPA_ID_OBJECT_ParamMeta,
|
||||
SPA_PARAM_Meta, SPA_ID_OBJECT_ParamMeta,
|
||||
":", SPA_PARAM_META_type, "I", SPA_META_VideoDamage,
|
||||
":", SPA_PARAM_META_size, "iru", sizeof(struct spa_meta_region) * 16,
|
||||
SPA_POD_PROP_MIN_MAX(sizeof(struct spa_meta_region) * 1,
|
||||
|
|
@ -223,7 +223,7 @@ static void on_state_changed(void *_data, enum pw_remote_state old, enum pw_remo
|
|||
NULL));
|
||||
|
||||
params[0] = spa_pod_builder_object(&b,
|
||||
SPA_ID_PARAM_EnumFormat, SPA_ID_OBJECT_Format,
|
||||
SPA_PARAM_EnumFormat, SPA_ID_OBJECT_Format,
|
||||
"I", SPA_MEDIA_TYPE_video,
|
||||
"I", SPA_MEDIA_SUBTYPE_raw,
|
||||
":", SPA_FORMAT_VIDEO_format, "I", SPA_VIDEO_FORMAT_RGB,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue