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

@ -652,7 +652,7 @@ static const struct spa_loop_utils impl_loop_utils = {
loop_destroy_source,
};
static int impl_get_interface(struct spa_handle *handle, uint32_t interface_id, void **interface)
static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
{
struct impl *impl;
@ -661,14 +661,14 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t interface_id,
impl = (struct impl *) handle;
switch (interface_id) {
case SPA_ID_INTERFACE_Loop:
switch (type) {
case SPA_TYPE_INTERFACE_Loop:
*interface = &impl->loop;
break;
case SPA_ID_INTERFACE_LoopControl:
case SPA_TYPE_INTERFACE_LoopControl:
*interface = &impl->control;
break;
case SPA_ID_INTERFACE_LoopUtils:
case SPA_TYPE_INTERFACE_LoopUtils:
*interface = &impl->utils;
break;
default:
@ -726,7 +726,7 @@ impl_init(const struct spa_handle_factory *factory,
impl->utils = impl_loop_utils;
for (i = 0; i < n_support; i++) {
if (support[i].type == SPA_ID_INTERFACE_Log)
if (support[i].type == SPA_TYPE_INTERFACE_Log)
impl->log = support[i].data;
}
@ -749,9 +749,9 @@ impl_init(const struct spa_handle_factory *factory,
}
static const struct spa_interface_info impl_interfaces[] = {
{SPA_ID_INTERFACE_Loop,},
{SPA_ID_INTERFACE_LoopControl,},
{SPA_ID_INTERFACE_LoopUtils,},
{SPA_TYPE_INTERFACE_Loop,},
{SPA_TYPE_INTERFACE_LoopControl,},
{SPA_TYPE_INTERFACE_LoopUtils,},
};
static int