Make interface types a string

This is more in line with wayland and it allows us to create new
interfaces in modules without having to add anything to the type
enum. It also removes some lookups to map type_id to readable
name in debug.
This commit is contained in:
Wim Taymans 2019-12-19 13:15:10 +01:00
parent 9657486a81
commit f391353c7f
123 changed files with 791 additions and 1251 deletions

View file

@ -737,7 +737,7 @@ static const struct spa_node_methods impl_node = {
.process = impl_node_process,
};
static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
static int impl_get_interface(struct spa_handle *handle, const char *type, void **interface)
{
struct impl *this;
@ -746,7 +746,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
this = (struct impl *) handle;
if (type == SPA_TYPE_INTERFACE_Node)
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
*interface = &this->node;
else
return -ENOENT;
@ -775,7 +775,6 @@ impl_init(const struct spa_handle_factory *factory,
{
struct impl *this;
struct port *port;
uint32_t i;
spa_return_val_if_fail(factory != NULL, -EINVAL);
spa_return_val_if_fail(handle != NULL, -EINVAL);
@ -785,10 +784,7 @@ impl_init(const struct spa_handle_factory *factory,
this = (struct impl *) handle;
for (i = 0; i < n_support; i++) {
if (support[i].type == SPA_TYPE_INTERFACE_Log)
this->log = support[i].data;
}
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
spa_hook_list_init(&this->hooks);