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

@ -101,7 +101,7 @@ static inline struct spa_pod_prop *spa_pod_contents_find_prop(const struct spa_p
{
const struct spa_pod *res;
SPA_POD_FOREACH(pod, size, res) {
if (res->type == SPA_ID_Prop
if (res->type == SPA_TYPE_Prop
&& ((struct spa_pod_prop *) res)->body.key == key)
return (struct spa_pod_prop *) res;
}
@ -112,9 +112,9 @@ static inline struct spa_pod_prop *spa_pod_find_prop(const struct spa_pod *pod,
{
uint32_t offset;
if (pod->type == SPA_ID_Object)
if (pod->type == SPA_TYPE_Object)
offset = sizeof(struct spa_pod_object);
else if (pod->type == SPA_ID_Struct)
else if (pod->type == SPA_TYPE_Struct)
offset = sizeof(struct spa_pod_struct);
else
return NULL;
@ -128,15 +128,15 @@ static inline int spa_pod_fixate(struct spa_pod *pod)
struct spa_pod *res;
uint32_t offset;
if (pod->type == SPA_ID_Object)
if (pod->type == SPA_TYPE_Object)
offset = sizeof(struct spa_pod_object);
else if (pod->type == SPA_ID_Struct)
else if (pod->type == SPA_TYPE_Struct)
offset = sizeof(struct spa_pod_struct);
else
return -EINVAL;
SPA_POD_CONTENTS_FOREACH(pod, offset, res) {
if (res->type == SPA_ID_Prop)
if (res->type == SPA_TYPE_Prop)
SPA_FLAG_UNSET (((struct spa_pod_prop *) res)->body.flags,
SPA_POD_PROP_FLAG_UNSET);
}