mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-07 13:30:09 -05:00
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:
parent
9657486a81
commit
f391353c7f
123 changed files with 791 additions and 1251 deletions
|
|
@ -207,7 +207,7 @@ static int client_endpoint_create_link(void *object, const struct spa_dict *prop
|
|||
goto exit;
|
||||
}
|
||||
obj = sm_media_session_find_object(impl->session, atoi(str));
|
||||
if (obj == NULL || obj->type != PW_TYPE_INTERFACE_Endpoint) {
|
||||
if (obj == NULL || strcmp(obj->type, PW_TYPE_INTERFACE_Endpoint) != 0) {
|
||||
pw_log_warn(NAME" %p: could not find endpoint %s (%p)", impl, str, obj);
|
||||
res = -EINVAL;
|
||||
goto exit;
|
||||
|
|
@ -557,15 +557,11 @@ static void session_create(void *data, struct sm_object *object)
|
|||
struct impl *impl = data;
|
||||
int res;
|
||||
|
||||
switch (object->type) {
|
||||
case PW_TYPE_INTERFACE_Node:
|
||||
if (strcmp(object->type, PW_TYPE_INTERFACE_Node) == 0)
|
||||
res = handle_node(impl, object);
|
||||
break;
|
||||
|
||||
default:
|
||||
else
|
||||
res = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (res < 0) {
|
||||
pw_log_warn(NAME" %p: can't handle global %d: %s", impl,
|
||||
object->id, spa_strerror(res));
|
||||
|
|
@ -576,16 +572,10 @@ static void session_remove(void *data, struct sm_object *object)
|
|||
{
|
||||
struct impl *impl = data;
|
||||
|
||||
switch (object->type) {
|
||||
case PW_TYPE_INTERFACE_Node:
|
||||
{
|
||||
if (strcmp(object->type, PW_TYPE_INTERFACE_Node) == 0) {
|
||||
struct node *node;
|
||||
if ((node = sm_object_get_data(object, SESSION_KEY)) != NULL)
|
||||
destroy_node(impl, node);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue