More type cleanups

SPA_ID_* -> SPA_TYPE_*. We use 'type' for all registered types.
ID refers to either a registered type or an enum.
Improve introspection of object ids. Make 0 an invalid enum and
use it to look up the object id type.
Move some type-info files together.
Swap type and id of the object, we first specify the type and then
the id because the meaning of the id depends on the object type.
This commit is contained in:
Wim Taymans 2018-08-27 15:03:11 +02:00
parent 281b65934e
commit 90c1a95eef
117 changed files with 1198 additions and 1272 deletions

View file

@ -144,7 +144,7 @@ static int make_node(struct data *data, struct spa_node **node, const char *lib,
printf("can't make factory instance: %d\n", res);
return res;
}
if ((res = spa_handle_get_interface(handle, SPA_ID_INTERFACE_Node, &iface)) < 0) {
if ((res = spa_handle_get_interface(handle, SPA_TYPE_INTERFACE_Node, &iface)) < 0) {
printf("can't get interface %d\n", res);
return res;
}
@ -236,7 +236,7 @@ static int make_nodes(struct data *data, const char *device)
spa_pod_builder_init(&b, buffer, sizeof(buffer));
props = spa_pod_builder_object(&b,
0, SPA_ID_OBJECT_Props,
SPA_TYPE_OBJECT_Props, 0,
":", SPA_PROP_device, "s", device ? device : "hw:0",
":", SPA_PROP_minLatency, "i", 64);
@ -252,7 +252,7 @@ static int make_nodes(struct data *data, const char *device)
spa_pod_builder_init(&b, buffer, sizeof(buffer));
props = spa_pod_builder_object(&b,
0, SPA_ID_OBJECT_Props,
SPA_TYPE_OBJECT_Props, 0,
":", SPA_PROP_live, "b", false);
if ((res = spa_node_set_param(data->source, SPA_PARAM_Props, 0, props)) < 0)
@ -271,7 +271,7 @@ static int negotiate_formats(struct data *data)
spa_pod_builder_init(&b, buffer, sizeof(buffer));
filter = spa_pod_builder_object(&b,
0, SPA_ID_OBJECT_Format,
SPA_TYPE_OBJECT_Format, 0,
"I", SPA_MEDIA_TYPE_audio,
"I", SPA_MEDIA_SUBTYPE_raw,
":", SPA_FORMAT_AUDIO_format, "I", SPA_AUDIO_FORMAT_S16,
@ -428,9 +428,9 @@ int main(int argc, char *argv[])
if ((str = getenv("SPA_DEBUG")))
data.log->level = atoi(str);
data.support[0] = SPA_SUPPORT_INIT(SPA_ID_INTERFACE_Log, data.log);
data.support[1] = SPA_SUPPORT_INIT(SPA_ID_INTERFACE_MainLoop, &data.data_loop);
data.support[2] = SPA_SUPPORT_INIT(SPA_ID_INTERFACE_DataLoop, &data.data_loop);
data.support[0] = SPA_SUPPORT_INIT(SPA_TYPE_INTERFACE_Log, data.log);
data.support[1] = SPA_SUPPORT_INIT(SPA_TYPE_INTERFACE_MainLoop, &data.data_loop);
data.support[2] = SPA_SUPPORT_INIT(SPA_TYPE_INTERFACE_DataLoop, &data.data_loop);
data.n_support = 3;
if ((res = make_nodes(&data, argc > 1 ? argv[1] : NULL)) < 0) {