mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-16 08:56:45 -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
|
|
@ -96,6 +96,9 @@ struct object {
|
||||||
|
|
||||||
struct client *client;
|
struct client *client;
|
||||||
|
|
||||||
|
#define INTERFACE_Port 0
|
||||||
|
#define INTERFACE_Node 1
|
||||||
|
#define INTERFACE_Link 2
|
||||||
uint32_t type;
|
uint32_t type;
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
|
|
||||||
|
|
@ -410,7 +413,7 @@ static struct port * alloc_port(struct client *c, enum spa_direction direction)
|
||||||
spa_list_remove(&p->link);
|
spa_list_remove(&p->link);
|
||||||
|
|
||||||
o = alloc_object(c);
|
o = alloc_object(c);
|
||||||
o->type = PW_TYPE_INTERFACE_Port;
|
o->type = INTERFACE_Port;
|
||||||
o->id = SPA_ID_INVALID;
|
o->id = SPA_ID_INVALID;
|
||||||
o->port.node_id = c->node_id;
|
o->port.node_id = c->node_id;
|
||||||
o->port.port_id = p->id;
|
o->port.port_id = p->id;
|
||||||
|
|
@ -1838,20 +1841,21 @@ static const struct pw_metadata_events metadata_events = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static void registry_event_global(void *data, uint32_t id,
|
static void registry_event_global(void *data, uint32_t id,
|
||||||
uint32_t permissions, uint32_t type, uint32_t version,
|
uint32_t permissions, const char *type, uint32_t version,
|
||||||
const struct spa_dict *props)
|
const struct spa_dict *props)
|
||||||
{
|
{
|
||||||
struct client *c = (struct client *) data;
|
struct client *c = (struct client *) data;
|
||||||
struct object *o, *ot;
|
struct object *o, *ot;
|
||||||
const char *str;
|
const char *str;
|
||||||
|
uint32_t object_type;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
if (props == NULL)
|
if (props == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (type) {
|
if (strcmp(type, PW_TYPE_INTERFACE_Node) == 0) {
|
||||||
case PW_TYPE_INTERFACE_Node:
|
|
||||||
o = alloc_object(c);
|
o = alloc_object(c);
|
||||||
|
object_type = INTERFACE_Node;
|
||||||
|
|
||||||
if ((str = spa_dict_lookup(props, PW_KEY_NODE_DESCRIPTION)) == NULL &&
|
if ((str = spa_dict_lookup(props, PW_KEY_NODE_DESCRIPTION)) == NULL &&
|
||||||
(str = spa_dict_lookup(props, PW_KEY_NODE_NICK)) == NULL &&
|
(str = spa_dict_lookup(props, PW_KEY_NODE_NICK)) == NULL &&
|
||||||
|
|
@ -1865,16 +1869,15 @@ static void registry_event_global(void *data, uint32_t id,
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: add node %d", c, id);
|
pw_log_debug(NAME" %p: add node %d", c, id);
|
||||||
spa_list_append(&c->context.nodes, &o->link);
|
spa_list_append(&c->context.nodes, &o->link);
|
||||||
break;
|
}
|
||||||
|
else if (strcmp(type, PW_TYPE_INTERFACE_Port) == 0) {
|
||||||
case PW_TYPE_INTERFACE_Port:
|
|
||||||
{
|
|
||||||
const struct spa_dict_item *item;
|
const struct spa_dict_item *item;
|
||||||
unsigned long flags = 0;
|
unsigned long flags = 0;
|
||||||
jack_port_type_id_t type_id;
|
jack_port_type_id_t type_id;
|
||||||
uint32_t node_id;
|
uint32_t node_id;
|
||||||
char full_name[1024];
|
char full_name[1024];
|
||||||
|
|
||||||
|
object_type = INTERFACE_Port;
|
||||||
if ((str = spa_dict_lookup(props, PW_KEY_FORMAT_DSP)) == NULL)
|
if ((str = spa_dict_lookup(props, PW_KEY_FORMAT_DSP)) == NULL)
|
||||||
str = "other";
|
str = "other";
|
||||||
if ((type_id = string_to_type(str)) == SPA_ID_INVALID)
|
if ((type_id = string_to_type(str)) == SPA_ID_INVALID)
|
||||||
|
|
@ -1923,7 +1926,7 @@ static void registry_event_global(void *data, uint32_t id,
|
||||||
|
|
||||||
spa_list_append(&c->context.ports, &o->link);
|
spa_list_append(&c->context.ports, &o->link);
|
||||||
ot = pw_map_lookup(&c->context.globals, node_id);
|
ot = pw_map_lookup(&c->context.globals, node_id);
|
||||||
if (ot == NULL || ot->type != PW_TYPE_INTERFACE_Node)
|
if (ot == NULL || ot->type != INTERFACE_Node)
|
||||||
goto exit_free;
|
goto exit_free;
|
||||||
|
|
||||||
snprintf(o->port.name, sizeof(o->port.name), "%s:%s", ot->node.name, str);
|
snprintf(o->port.name, sizeof(o->port.name), "%s:%s", ot->node.name, str);
|
||||||
|
|
@ -1954,10 +1957,11 @@ static void registry_event_global(void *data, uint32_t id,
|
||||||
}
|
}
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: add port %d %s %d", c, id, o->port.name, type_id);
|
pw_log_debug(NAME" %p: add port %d %s %d", c, id, o->port.name, type_id);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case PW_TYPE_INTERFACE_Link:
|
else if (strcmp(type, PW_TYPE_INTERFACE_Link) == 0) {
|
||||||
o = alloc_object(c);
|
o = alloc_object(c);
|
||||||
|
object_type = INTERFACE_Link;
|
||||||
|
|
||||||
spa_list_append(&c->context.links, &o->link);
|
spa_list_append(&c->context.links, &o->link);
|
||||||
|
|
||||||
if ((str = spa_dict_lookup(props, PW_KEY_LINK_OUTPUT_PORT)) == NULL)
|
if ((str = spa_dict_lookup(props, PW_KEY_LINK_OUTPUT_PORT)) == NULL)
|
||||||
|
|
@ -1970,10 +1974,8 @@ static void registry_event_global(void *data, uint32_t id,
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: add link %d %d->%d", c, id,
|
pw_log_debug(NAME" %p: add link %d %d->%d", c, id,
|
||||||
o->port_link.src, o->port_link.dst);
|
o->port_link.src, o->port_link.dst);
|
||||||
break;
|
}
|
||||||
|
else if (strcmp(type, PW_TYPE_INTERFACE_Metadata) == 0) {
|
||||||
case PW_TYPE_INTERFACE_Metadata:
|
|
||||||
{
|
|
||||||
struct pw_proxy *proxy;
|
struct pw_proxy *proxy;
|
||||||
|
|
||||||
if (c->metadata)
|
if (c->metadata)
|
||||||
|
|
@ -1990,11 +1992,11 @@ static void registry_event_global(void *data, uint32_t id,
|
||||||
&metadata_events, c);
|
&metadata_events, c);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
default:
|
else {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
o->type = type;
|
o->type = object_type;
|
||||||
o->id = id;
|
o->id = id;
|
||||||
|
|
||||||
size = pw_map_get_size(&c->context.globals);
|
size = pw_map_get_size(&c->context.globals);
|
||||||
|
|
@ -2004,18 +2006,18 @@ static void registry_event_global(void *data, uint32_t id,
|
||||||
|
|
||||||
pw_thread_loop_unlock(c->context.loop);
|
pw_thread_loop_unlock(c->context.loop);
|
||||||
|
|
||||||
switch (type) {
|
switch (o->type) {
|
||||||
case PW_TYPE_INTERFACE_Node:
|
case INTERFACE_Node:
|
||||||
if (c->registration_callback)
|
if (c->registration_callback)
|
||||||
c->registration_callback(o->node.name, 1, c->registration_arg);
|
c->registration_callback(o->node.name, 1, c->registration_arg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PW_TYPE_INTERFACE_Port:
|
case INTERFACE_Port:
|
||||||
if (c->portregistration_callback)
|
if (c->portregistration_callback)
|
||||||
c->portregistration_callback(o->id, 1, c->portregistration_arg);
|
c->portregistration_callback(o->id, 1, c->portregistration_arg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PW_TYPE_INTERFACE_Link:
|
case INTERFACE_Link:
|
||||||
if (c->connect_callback)
|
if (c->connect_callback)
|
||||||
c->connect_callback(o->port_link.src, o->port_link.dst, 1, c->connect_arg);
|
c->connect_callback(o->port_link.src, o->port_link.dst, 1, c->connect_arg);
|
||||||
break;
|
break;
|
||||||
|
|
@ -2043,15 +2045,15 @@ static void registry_event_global_remove(void *object, uint32_t id)
|
||||||
pw_thread_loop_unlock(c->context.loop);
|
pw_thread_loop_unlock(c->context.loop);
|
||||||
|
|
||||||
switch (o->type) {
|
switch (o->type) {
|
||||||
case PW_TYPE_INTERFACE_Node:
|
case INTERFACE_Node:
|
||||||
if (c->registration_callback)
|
if (c->registration_callback)
|
||||||
c->registration_callback(o->node.name, 0, c->registration_arg);
|
c->registration_callback(o->node.name, 0, c->registration_arg);
|
||||||
break;
|
break;
|
||||||
case PW_TYPE_INTERFACE_Port:
|
case INTERFACE_Port:
|
||||||
if (c->portregistration_callback)
|
if (c->portregistration_callback)
|
||||||
c->portregistration_callback(o->id, 0, c->portregistration_arg);
|
c->portregistration_callback(o->id, 0, c->portregistration_arg);
|
||||||
break;
|
break;
|
||||||
case PW_TYPE_INTERFACE_Link:
|
case INTERFACE_Link:
|
||||||
if (c->connect_callback)
|
if (c->connect_callback)
|
||||||
c->connect_callback(o->port_link.src, o->port_link.dst, 0, c->connect_arg);
|
c->connect_callback(o->port_link.src, o->port_link.dst, 0, c->connect_arg);
|
||||||
break;
|
break;
|
||||||
|
|
@ -2846,7 +2848,7 @@ int jack_port_unregister (jack_client_t *client, jack_port_t *port)
|
||||||
struct port *p;
|
struct port *p;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
if (o->type != PW_TYPE_INTERFACE_Port || o->port.port_id == SPA_ID_INVALID) {
|
if (o->type != INTERFACE_Port || o->port.port_id == SPA_ID_INVALID) {
|
||||||
pw_log_error(NAME" %p: invalid port %p", client, port);
|
pw_log_error(NAME" %p: invalid port %p", client, port);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
@ -2963,7 +2965,7 @@ void * jack_port_get_buffer (jack_port_t *port, jack_nframes_t frames)
|
||||||
|
|
||||||
c = o->client;
|
c = o->client;
|
||||||
|
|
||||||
if (o->type != PW_TYPE_INTERFACE_Port || o->port.port_id == SPA_ID_INVALID) {
|
if (o->type != INTERFACE_Port || o->port.port_id == SPA_ID_INVALID) {
|
||||||
pw_log_error(NAME" %p: invalid port %p", c, port);
|
pw_log_error(NAME" %p: invalid port %p", c, port);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -3052,7 +3054,7 @@ SPA_EXPORT
|
||||||
int jack_port_is_mine (const jack_client_t *client, const jack_port_t *port)
|
int jack_port_is_mine (const jack_client_t *client, const jack_port_t *port)
|
||||||
{
|
{
|
||||||
struct object *o = (struct object *) port;
|
struct object *o = (struct object *) port;
|
||||||
return o->type == PW_TYPE_INTERFACE_Port && o->port.port_id != SPA_ID_INVALID;
|
return o->type == INTERFACE_Port && o->port.port_id != SPA_ID_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
|
|
@ -3714,7 +3716,7 @@ jack_port_t * jack_port_by_id (jack_client_t *client,
|
||||||
o = pw_map_lookup(&c->context.globals, port_id);
|
o = pw_map_lookup(&c->context.globals, port_id);
|
||||||
pw_log_debug(NAME" %p: port %d -> %p", c, port_id, o);
|
pw_log_debug(NAME" %p: port %d -> %p", c, port_id, o);
|
||||||
|
|
||||||
if (o == NULL || o->type != PW_TYPE_INTERFACE_Port)
|
if (o == NULL || o->type != INTERFACE_Port)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
res = o;
|
res = o;
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ static void global_free(pa_context *c, struct global *g)
|
||||||
}
|
}
|
||||||
if (g->props)
|
if (g->props)
|
||||||
pw_properties_free(g->props);
|
pw_properties_free(g->props);
|
||||||
|
free(g->type);
|
||||||
free(g);
|
free(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -152,7 +153,7 @@ struct global *pa_context_find_linked(pa_context *c, uint32_t idx)
|
||||||
struct global *g, *f;
|
struct global *g, *f;
|
||||||
|
|
||||||
spa_list_for_each(g, &c->globals, link) {
|
spa_list_for_each(g, &c->globals, link) {
|
||||||
if (g->type != PW_TYPE_INTERFACE_EndpointLink)
|
if (strcmp(g->type, PW_TYPE_INTERFACE_EndpointLink) != 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pw_log_debug("context %p: %p %d %d:%d %d:%d", c, g, idx,
|
pw_log_debug("context %p: %p %d %d:%d %d:%d", c, g, idx,
|
||||||
|
|
@ -577,8 +578,7 @@ static int set_mask(pa_context *c, struct global *g)
|
||||||
pw_destroy_t destroy;
|
pw_destroy_t destroy;
|
||||||
uint32_t client_version;
|
uint32_t client_version;
|
||||||
|
|
||||||
switch (g->type) {
|
if (strcmp(g->type, PW_TYPE_INTERFACE_Device) == 0) {
|
||||||
case PW_TYPE_INTERFACE_Device:
|
|
||||||
if (g->props == NULL)
|
if (g->props == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
if ((str = pw_properties_get(g->props, PW_KEY_MEDIA_CLASS)) == NULL)
|
if ((str = pw_properties_get(g->props, PW_KEY_MEDIA_CLASS)) == NULL)
|
||||||
|
|
@ -595,9 +595,7 @@ static int set_mask(pa_context *c, struct global *g)
|
||||||
client_version = PW_VERSION_DEVICE;
|
client_version = PW_VERSION_DEVICE;
|
||||||
destroy = device_destroy;
|
destroy = device_destroy;
|
||||||
spa_list_init(&g->card_info.profiles);
|
spa_list_init(&g->card_info.profiles);
|
||||||
break;
|
} else if (strcmp(g->type, PW_TYPE_INTERFACE_Endpoint) == 0) {
|
||||||
|
|
||||||
case PW_TYPE_INTERFACE_Endpoint:
|
|
||||||
if (g->props == NULL)
|
if (g->props == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
@ -660,9 +658,7 @@ static int set_mask(pa_context *c, struct global *g)
|
||||||
destroy = endpoint_destroy;
|
destroy = endpoint_destroy;
|
||||||
g->endpoint_info.volume = 1.0;
|
g->endpoint_info.volume = 1.0;
|
||||||
g->endpoint_info.mute = false;
|
g->endpoint_info.mute = false;
|
||||||
break;
|
} else if (strcmp(g->type, PW_TYPE_INTERFACE_EndpointStream) == 0) {
|
||||||
|
|
||||||
case PW_TYPE_INTERFACE_EndpointStream:
|
|
||||||
if (g->props == NULL)
|
if (g->props == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
@ -672,27 +668,21 @@ static int set_mask(pa_context *c, struct global *g)
|
||||||
}
|
}
|
||||||
/* streams get transformed into profiles on the device */
|
/* streams get transformed into profiles on the device */
|
||||||
pw_log_debug("found endpoint stream %d", g->id);
|
pw_log_debug("found endpoint stream %d", g->id);
|
||||||
break;
|
} else if (strcmp(g->type, PW_TYPE_INTERFACE_Module) == 0) {
|
||||||
|
|
||||||
case PW_TYPE_INTERFACE_Module:
|
|
||||||
pw_log_debug("found module %d", g->id);
|
pw_log_debug("found module %d", g->id);
|
||||||
g->mask = PA_SUBSCRIPTION_MASK_MODULE;
|
g->mask = PA_SUBSCRIPTION_MASK_MODULE;
|
||||||
g->event = PA_SUBSCRIPTION_EVENT_MODULE;
|
g->event = PA_SUBSCRIPTION_EVENT_MODULE;
|
||||||
events = &module_events;
|
events = &module_events;
|
||||||
client_version = PW_VERSION_MODULE;
|
client_version = PW_VERSION_MODULE;
|
||||||
destroy = module_destroy;
|
destroy = module_destroy;
|
||||||
break;
|
} else if (strcmp(g->type, PW_TYPE_INTERFACE_Client) == 0) {
|
||||||
|
|
||||||
case PW_TYPE_INTERFACE_Client:
|
|
||||||
pw_log_debug("found client %d", g->id);
|
pw_log_debug("found client %d", g->id);
|
||||||
g->mask = PA_SUBSCRIPTION_MASK_CLIENT;
|
g->mask = PA_SUBSCRIPTION_MASK_CLIENT;
|
||||||
g->event = PA_SUBSCRIPTION_EVENT_CLIENT;
|
g->event = PA_SUBSCRIPTION_EVENT_CLIENT;
|
||||||
events = &client_events;
|
events = &client_events;
|
||||||
client_version = PW_VERSION_CLIENT;
|
client_version = PW_VERSION_CLIENT;
|
||||||
destroy = client_destroy;
|
destroy = client_destroy;
|
||||||
break;
|
} else if (strcmp(g->type, PW_TYPE_INTERFACE_EndpointLink) == 0) {
|
||||||
|
|
||||||
case PW_TYPE_INTERFACE_EndpointLink:
|
|
||||||
if ((str = pw_properties_get(g->props, PW_KEY_ENDPOINT_LINK_OUTPUT_ENDPOINT)) == NULL)
|
if ((str = pw_properties_get(g->props, PW_KEY_ENDPOINT_LINK_OUTPUT_ENDPOINT)) == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
g->link_info.output = pa_context_find_global(c, pw_properties_parse_int(str));
|
g->link_info.output = pa_context_find_global(c, pw_properties_parse_int(str));
|
||||||
|
|
@ -710,9 +700,7 @@ static int set_mask(pa_context *c, struct global *g)
|
||||||
if (!g->link_info.input->init)
|
if (!g->link_info.input->init)
|
||||||
emit_event(c, g->link_info.input, PA_SUBSCRIPTION_EVENT_CHANGE);
|
emit_event(c, g->link_info.input, PA_SUBSCRIPTION_EVENT_CHANGE);
|
||||||
|
|
||||||
break;
|
} else {
|
||||||
|
|
||||||
default:
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -749,7 +737,7 @@ static inline void insert_global(pa_context *c, struct global *global)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void registry_event_global(void *data, uint32_t id,
|
static void registry_event_global(void *data, uint32_t id,
|
||||||
uint32_t permissions, uint32_t type, uint32_t version,
|
uint32_t permissions, const char *type, uint32_t version,
|
||||||
const struct spa_dict *props)
|
const struct spa_dict *props)
|
||||||
{
|
{
|
||||||
pa_context *c = data;
|
pa_context *c = data;
|
||||||
|
|
@ -757,10 +745,10 @@ static void registry_event_global(void *data, uint32_t id,
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
g = calloc(1, sizeof(struct global));
|
g = calloc(1, sizeof(struct global));
|
||||||
pw_log_debug("context %p: global %d %u %p", c, id, type, g);
|
pw_log_debug("context %p: global %d %s %p", c, id, type, g);
|
||||||
g->context = c;
|
g->context = c;
|
||||||
g->id = id;
|
g->id = id;
|
||||||
g->type = type;
|
g->type = strdup(type);
|
||||||
g->init = true;
|
g->init = true;
|
||||||
g->props = props ? pw_properties_new_dict(props) : NULL;
|
g->props = props ? pw_properties_new_dict(props) : NULL;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -219,7 +219,7 @@ struct param {
|
||||||
struct global {
|
struct global {
|
||||||
struct spa_list link;
|
struct spa_list link;
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
uint32_t type;
|
char *type;
|
||||||
struct pw_properties *props;
|
struct pw_properties *props;
|
||||||
|
|
||||||
pa_context *context;
|
pa_context *context;
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,9 @@ extern "C" {
|
||||||
* Devices or Nodes.
|
* Devices or Nodes.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#define SPA_VERSION_DEVICE 0
|
#define SPA_TYPE_INTERFACE_Device SPA_TYPE_INFO_INTERFACE_BASE "Device"
|
||||||
|
|
||||||
|
#define SPA_VERSION_DEVICE 0
|
||||||
struct spa_device { struct spa_interface iface; };
|
struct spa_device { struct spa_interface iface; };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -75,7 +77,7 @@ struct spa_device_object_info {
|
||||||
#define SPA_VERSION_DEVICE_OBJECT_INFO 0
|
#define SPA_VERSION_DEVICE_OBJECT_INFO 0
|
||||||
uint32_t version;
|
uint32_t version;
|
||||||
|
|
||||||
uint32_t type; /**< the object type managed by this device */
|
const char *type; /**< the object type managed by this device */
|
||||||
const char *factory_name; /**< a factory name that implements the object */
|
const char *factory_name; /**< a factory name that implements the object */
|
||||||
|
|
||||||
#define SPA_DEVICE_OBJECT_CHANGE_MASK_FLAGS (1u<<0)
|
#define SPA_DEVICE_OBJECT_CHANGE_MASK_FLAGS (1u<<0)
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,9 @@ extern "C" {
|
||||||
/**
|
/**
|
||||||
* A spa_node is a component that can consume and produce buffers.
|
* A spa_node is a component that can consume and produce buffers.
|
||||||
*/
|
*/
|
||||||
#define SPA_VERSION_NODE 0
|
#define SPA_TYPE_INTERFACE_Node SPA_TYPE_INFO_INTERFACE_BASE "Node"
|
||||||
|
|
||||||
|
#define SPA_VERSION_NODE 0
|
||||||
struct spa_node { struct spa_interface iface; };
|
struct spa_node { struct spa_interface iface; };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,9 @@ extern "C" {
|
||||||
/**
|
/**
|
||||||
* The CPU features interface
|
* The CPU features interface
|
||||||
*/
|
*/
|
||||||
#define SPA_VERSION_CPU 0
|
#define SPA_TYPE_INTERFACE_CPU SPA_TYPE_INFO_INTERFACE_BASE "CPU"
|
||||||
|
|
||||||
|
#define SPA_VERSION_CPU 0
|
||||||
struct spa_cpu { struct spa_interface iface; };
|
struct spa_cpu { struct spa_interface iface; };
|
||||||
|
|
||||||
/* x86 specific */
|
/* x86 specific */
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,9 @@ extern "C" {
|
||||||
|
|
||||||
#include <spa/support/loop.h>
|
#include <spa/support/loop.h>
|
||||||
|
|
||||||
#define SPA_VERSION_DBUS 0
|
#define SPA_TYPE_INTERFACE_DBus SPA_TYPE_INFO_INTERFACE_BASE "DBus"
|
||||||
|
|
||||||
|
#define SPA_VERSION_DBUS 0
|
||||||
struct spa_dbus { struct spa_interface iface; };
|
struct spa_dbus { struct spa_interface iface; };
|
||||||
|
|
||||||
enum spa_dbus_type {
|
enum spa_dbus_type {
|
||||||
|
|
|
||||||
|
|
@ -46,10 +46,13 @@ enum spa_log_level {
|
||||||
/**
|
/**
|
||||||
* The Log interface
|
* The Log interface
|
||||||
*/
|
*/
|
||||||
|
#define SPA_TYPE_INTERFACE_Log SPA_TYPE_INFO_INTERFACE_BASE "Log"
|
||||||
|
|
||||||
|
#define SPA_VERSION_LOG 0
|
||||||
|
|
||||||
struct spa_log {
|
struct spa_log {
|
||||||
/** the version of this log. This can be used to expand this
|
/** the version of this log. This can be used to expand this
|
||||||
* structure in the future */
|
* structure in the future */
|
||||||
#define SPA_VERSION_LOG 0
|
|
||||||
struct spa_interface iface;
|
struct spa_interface iface;
|
||||||
/**
|
/**
|
||||||
* Logging level, everything above this level is not logged
|
* Logging level, everything above this level is not logged
|
||||||
|
|
|
||||||
|
|
@ -33,12 +33,19 @@ extern "C" {
|
||||||
#include <spa/utils/hook.h>
|
#include <spa/utils/hook.h>
|
||||||
#include <spa/support/system.h>
|
#include <spa/support/system.h>
|
||||||
|
|
||||||
|
#define SPA_TYPE_INTERFACE_Loop SPA_TYPE_INFO_INTERFACE_BASE "Loop"
|
||||||
|
#define SPA_TYPE_INTERFACE_DataLoop SPA_TYPE_INFO_INTERFACE_BASE "DataLoop"
|
||||||
#define SPA_VERSION_LOOP 0
|
#define SPA_VERSION_LOOP 0
|
||||||
struct spa_loop { struct spa_interface iface; };
|
struct spa_loop { struct spa_interface iface; };
|
||||||
|
|
||||||
|
#define SPA_TYPE_INTERFACE_LoopControl SPA_TYPE_INFO_INTERFACE_BASE "LoopControl"
|
||||||
#define SPA_VERSION_LOOP_CONTROL 0
|
#define SPA_VERSION_LOOP_CONTROL 0
|
||||||
struct spa_loop_control { struct spa_interface iface; };
|
struct spa_loop_control { struct spa_interface iface; };
|
||||||
|
|
||||||
|
#define SPA_TYPE_INTERFACE_LoopUtils SPA_TYPE_INFO_INTERFACE_BASE "LoopUtils"
|
||||||
#define SPA_VERSION_LOOP_UTILS 0
|
#define SPA_VERSION_LOOP_UTILS 0
|
||||||
struct spa_loop_utils { struct spa_interface iface; };
|
struct spa_loop_utils { struct spa_interface iface; };
|
||||||
|
|
||||||
struct spa_source;
|
struct spa_source;
|
||||||
|
|
||||||
typedef void (*spa_source_func_t) (struct spa_source *source);
|
typedef void (*spa_source_func_t) (struct spa_source *source);
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ struct spa_handle {
|
||||||
* -ENOTSUP when there are no interfaces
|
* -ENOTSUP when there are no interfaces
|
||||||
* -EINVAL when handle or info is NULL
|
* -EINVAL when handle or info is NULL
|
||||||
*/
|
*/
|
||||||
int (*get_interface) (struct spa_handle *handle, uint32_t type, void **interface);
|
int (*get_interface) (struct spa_handle *handle, const char *type, void **interface);
|
||||||
/**
|
/**
|
||||||
* Clean up the memory of \a handle. After this, \a handle should not be used
|
* Clean up the memory of \a handle. After this, \a handle should not be used
|
||||||
* anymore.
|
* anymore.
|
||||||
|
|
@ -69,8 +69,8 @@ struct spa_handle {
|
||||||
* handles.
|
* handles.
|
||||||
*/
|
*/
|
||||||
struct spa_interface_info {
|
struct spa_interface_info {
|
||||||
uint32_t type; /*< the type of the interface, can be
|
const char *type; /*< the type of the interface, can be
|
||||||
* used to get the interface */
|
* used to get the interface */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -78,18 +78,18 @@ struct spa_interface_info {
|
||||||
* a factory. It can be extra information or interfaces such as logging.
|
* a factory. It can be extra information or interfaces such as logging.
|
||||||
*/
|
*/
|
||||||
struct spa_support {
|
struct spa_support {
|
||||||
uint32_t type; /*< the type of the support item */
|
const char *type; /*< the type of the support item */
|
||||||
void *data; /*< specific data for the item */
|
void *data; /*< specific data for the item */
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Find a support item of the given type */
|
/** Find a support item of the given type */
|
||||||
static inline void *spa_support_find(const struct spa_support *support,
|
static inline void *spa_support_find(const struct spa_support *support,
|
||||||
uint32_t n_support,
|
uint32_t n_support,
|
||||||
uint32_t type)
|
const char *type)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
for (i = 0; i < n_support; i++) {
|
for (i = 0; i < n_support; i++) {
|
||||||
if (support[i].type == type)
|
if (strcmp(support[i].type, type) == 0)
|
||||||
return support[i].data;
|
return support[i].data;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,9 @@ extern "C" {
|
||||||
/**
|
/**
|
||||||
* a collection of core system functions
|
* a collection of core system functions
|
||||||
*/
|
*/
|
||||||
|
#define SPA_TYPE_INTERFACE_System SPA_TYPE_INFO_INTERFACE_BASE "System"
|
||||||
|
#define SPA_TYPE_INTERFACE_DataSystem SPA_TYPE_INFO_INTERFACE_BASE "DataSystem"
|
||||||
|
|
||||||
#define SPA_VERSION_SYSTEM 0
|
#define SPA_VERSION_SYSTEM 0
|
||||||
struct spa_system { struct spa_interface iface; };
|
struct spa_system { struct spa_interface iface; };
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ struct spa_callbacks {
|
||||||
#define SPA_CALLBACKS_INIT(_funcs,_data) (struct spa_callbacks){ _funcs, _data, }
|
#define SPA_CALLBACKS_INIT(_funcs,_data) (struct spa_callbacks){ _funcs, _data, }
|
||||||
|
|
||||||
struct spa_interface {
|
struct spa_interface {
|
||||||
uint32_t type;
|
const char *type;
|
||||||
uint32_t version;
|
uint32_t version;
|
||||||
struct spa_callbacks cb;
|
struct spa_callbacks cb;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -98,21 +98,6 @@ static const struct spa_type_info spa_types[] = {
|
||||||
{ SPA_TYPE_POINTER_Meta, SPA_TYPE_Pointer, SPA_TYPE_INFO_POINTER_BASE "Meta", NULL },
|
{ SPA_TYPE_POINTER_Meta, SPA_TYPE_Pointer, SPA_TYPE_INFO_POINTER_BASE "Meta", NULL },
|
||||||
{ SPA_TYPE_POINTER_Dict, SPA_TYPE_Pointer, SPA_TYPE_INFO_POINTER_BASE "Dict", NULL },
|
{ SPA_TYPE_POINTER_Dict, SPA_TYPE_Pointer, SPA_TYPE_INFO_POINTER_BASE "Dict", NULL },
|
||||||
|
|
||||||
{ SPA_TYPE_INTERFACE_START, SPA_TYPE_Pointer, SPA_TYPE_INFO_Interface, NULL },
|
|
||||||
{ SPA_TYPE_INTERFACE_Handle, SPA_TYPE_Pointer, SPA_TYPE_INFO_INTERFACE_BASE "Handle", NULL },
|
|
||||||
{ SPA_TYPE_INTERFACE_HandleFactory, SPA_TYPE_Pointer, SPA_TYPE_INFO_INTERFACE_BASE "HandleFactory", NULL },
|
|
||||||
{ SPA_TYPE_INTERFACE_Log, SPA_TYPE_Pointer, SPA_TYPE_INFO_INTERFACE_BASE "Log", NULL },
|
|
||||||
{ SPA_TYPE_INTERFACE_System, SPA_TYPE_Pointer, SPA_TYPE_INFO_INTERFACE_BASE "System", NULL },
|
|
||||||
{ SPA_TYPE_INTERFACE_Loop, SPA_TYPE_Pointer, SPA_TYPE_INFO_INTERFACE_BASE "Loop", NULL },
|
|
||||||
{ SPA_TYPE_INTERFACE_LoopControl, SPA_TYPE_Pointer, SPA_TYPE_INFO_INTERFACE_BASE "LoopControl", NULL },
|
|
||||||
{ SPA_TYPE_INTERFACE_LoopUtils, SPA_TYPE_Pointer, SPA_TYPE_INFO_INTERFACE_BASE "LoopUtils", NULL },
|
|
||||||
{ SPA_TYPE_INTERFACE_DataSystem, SPA_TYPE_Pointer, SPA_TYPE_INFO_INTERFACE_BASE "DataSystem", NULL },
|
|
||||||
{ SPA_TYPE_INTERFACE_DataLoop, SPA_TYPE_Pointer, SPA_TYPE_INFO_INTERFACE_BASE "DataLoop", NULL },
|
|
||||||
{ SPA_TYPE_INTERFACE_DBus, SPA_TYPE_Pointer, SPA_TYPE_INFO_INTERFACE_BASE "DBus", NULL },
|
|
||||||
{ SPA_TYPE_INTERFACE_Node, SPA_TYPE_Pointer, SPA_TYPE_INFO_INTERFACE_BASE "Node", NULL },
|
|
||||||
{ SPA_TYPE_INTERFACE_Device, SPA_TYPE_Pointer, SPA_TYPE_INFO_INTERFACE_BASE "Device", NULL },
|
|
||||||
{ SPA_TYPE_INTERFACE_CPU, SPA_TYPE_Pointer, SPA_TYPE_INFO_INTERFACE_BASE "CPU", NULL },
|
|
||||||
|
|
||||||
{ SPA_TYPE_EVENT_START, SPA_TYPE_Object, SPA_TYPE_INFO_Event, NULL },
|
{ SPA_TYPE_EVENT_START, SPA_TYPE_Object, SPA_TYPE_INFO_Event, NULL },
|
||||||
{ SPA_TYPE_EVENT_Device, SPA_TYPE_Object, SPA_TYPE_INFO_EVENT_BASE "Device", NULL },
|
{ SPA_TYPE_EVENT_Device, SPA_TYPE_Object, SPA_TYPE_INFO_EVENT_BASE "Device", NULL },
|
||||||
{ SPA_TYPE_EVENT_Node, SPA_TYPE_Object, SPA_TYPE_INFO_EVENT_BASE "Node", spa_type_node_event },
|
{ SPA_TYPE_EVENT_Node, SPA_TYPE_Object, SPA_TYPE_INFO_EVENT_BASE "Node", spa_type_node_event },
|
||||||
|
|
|
||||||
|
|
@ -63,37 +63,20 @@ enum {
|
||||||
SPA_TYPE_POINTER_Dict,
|
SPA_TYPE_POINTER_Dict,
|
||||||
SPA_TYPE_POINTER_LAST, /**< not part of ABI */
|
SPA_TYPE_POINTER_LAST, /**< not part of ABI */
|
||||||
|
|
||||||
/* Interfaces */
|
|
||||||
SPA_TYPE_INTERFACE_START = 0x20000,
|
|
||||||
SPA_TYPE_INTERFACE_Handle, /**< object handle */
|
|
||||||
SPA_TYPE_INTERFACE_HandleFactory, /**< factory for object handles */
|
|
||||||
SPA_TYPE_INTERFACE_Log, /**< log interface */
|
|
||||||
SPA_TYPE_INTERFACE_System, /**< System functions */
|
|
||||||
SPA_TYPE_INTERFACE_Loop, /**< main loop support */
|
|
||||||
SPA_TYPE_INTERFACE_LoopControl, /**< control of loops */
|
|
||||||
SPA_TYPE_INTERFACE_LoopUtils, /**< loop utilities */
|
|
||||||
SPA_TYPE_INTERFACE_DataSystem, /**< System functions for data loop */
|
|
||||||
SPA_TYPE_INTERFACE_DataLoop, /**< a data loop */
|
|
||||||
SPA_TYPE_INTERFACE_DBus, /**< dbus connection */
|
|
||||||
SPA_TYPE_INTERFACE_Node, /**< nodes for data processing */
|
|
||||||
SPA_TYPE_INTERFACE_Device, /**< device managing nodes */
|
|
||||||
SPA_TYPE_INTERFACE_CPU, /**< CPU functions */
|
|
||||||
SPA_TYPE_INTERFACE_LAST, /**< not part of ABI */
|
|
||||||
|
|
||||||
/* Events */
|
/* Events */
|
||||||
SPA_TYPE_EVENT_START = 0x30000,
|
SPA_TYPE_EVENT_START = 0x20000,
|
||||||
SPA_TYPE_EVENT_Device,
|
SPA_TYPE_EVENT_Device,
|
||||||
SPA_TYPE_EVENT_Node,
|
SPA_TYPE_EVENT_Node,
|
||||||
SPA_TYPE_EVENT_LAST, /**< not part of ABI */
|
SPA_TYPE_EVENT_LAST, /**< not part of ABI */
|
||||||
|
|
||||||
/* Commands */
|
/* Commands */
|
||||||
SPA_TYPE_COMMAND_START = 0x40000,
|
SPA_TYPE_COMMAND_START = 0x30000,
|
||||||
SPA_TYPE_COMMAND_Device,
|
SPA_TYPE_COMMAND_Device,
|
||||||
SPA_TYPE_COMMAND_Node,
|
SPA_TYPE_COMMAND_Node,
|
||||||
SPA_TYPE_COMMAND_LAST, /**< not part of ABI */
|
SPA_TYPE_COMMAND_LAST, /**< not part of ABI */
|
||||||
|
|
||||||
/* Objects */
|
/* Objects */
|
||||||
SPA_TYPE_OBJECT_START = 0x50000,
|
SPA_TYPE_OBJECT_START = 0x40000,
|
||||||
SPA_TYPE_OBJECT_PropInfo,
|
SPA_TYPE_OBJECT_PropInfo,
|
||||||
SPA_TYPE_OBJECT_Props,
|
SPA_TYPE_OBJECT_Props,
|
||||||
SPA_TYPE_OBJECT_Format,
|
SPA_TYPE_OBJECT_Format,
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
#include <spa/support/log.h>
|
#include <spa/support/log.h>
|
||||||
#include <spa/utils/type.h>
|
#include <spa/utils/type.h>
|
||||||
|
#include <spa/node/node.h>
|
||||||
#include <spa/utils/keys.h>
|
#include <spa/utils/keys.h>
|
||||||
#include <spa/utils/names.h>
|
#include <spa/utils/names.h>
|
||||||
#include <spa/support/loop.h>
|
#include <spa/support/loop.h>
|
||||||
|
|
@ -124,6 +125,7 @@ static int emit_node(struct impl *this, snd_pcm_info_t *pcminfo, uint32_t id)
|
||||||
|
|
||||||
info = SPA_DEVICE_OBJECT_INFO_INIT();
|
info = SPA_DEVICE_OBJECT_INFO_INIT();
|
||||||
info.type = SPA_TYPE_INTERFACE_Node;
|
info.type = SPA_TYPE_INTERFACE_Node;
|
||||||
|
|
||||||
if (snd_pcm_info_get_stream(pcminfo) == SND_PCM_STREAM_PLAYBACK) {
|
if (snd_pcm_info_get_stream(pcminfo) == SND_PCM_STREAM_PLAYBACK) {
|
||||||
info.factory_name = SPA_NAME_API_ALSA_PCM_SINK;
|
info.factory_name = SPA_NAME_API_ALSA_PCM_SINK;
|
||||||
stream = "playback";
|
stream = "playback";
|
||||||
|
|
@ -433,7 +435,7 @@ static const struct spa_device_methods impl_device = {
|
||||||
.set_param = impl_set_param,
|
.set_param = impl_set_param,
|
||||||
};
|
};
|
||||||
|
|
||||||
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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -442,7 +444,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Device)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
|
||||||
*interface = &this->device;
|
*interface = &this->device;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -471,7 +473,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
const char *str;
|
const char *str;
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -481,13 +482,7 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this->device.iface = SPA_INTERFACE_INIT(
|
this->device.iface = SPA_INTERFACE_INIT(
|
||||||
SPA_TYPE_INTERFACE_Device,
|
SPA_TYPE_INTERFACE_Device,
|
||||||
|
|
|
||||||
|
|
@ -652,7 +652,7 @@ static const struct spa_node_methods impl_node = {
|
||||||
.process = impl_node_process,
|
.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 state *this;
|
struct state *this;
|
||||||
|
|
||||||
|
|
@ -661,7 +661,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct state *) handle;
|
this = (struct state *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -695,19 +695,11 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
handle->clear = impl_clear;
|
handle->clear = impl_clear;
|
||||||
|
|
||||||
this = (struct state *) handle;
|
this = (struct state *) handle;
|
||||||
for (i = 0; i < n_support; i++) {
|
|
||||||
switch (support[i].type) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
this->data_system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataSystem);
|
||||||
this->log = support[i].data;
|
this->data_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataSystem:
|
|
||||||
this->data_system = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataLoop:
|
|
||||||
this->data_loop = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this->data_loop == NULL) {
|
if (this->data_loop == NULL) {
|
||||||
spa_log_error(this->log, "a data loop is needed");
|
spa_log_error(this->log, "a data loop is needed");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
||||||
|
|
@ -683,7 +683,7 @@ static const struct spa_node_methods impl_node = {
|
||||||
.process = impl_node_process,
|
.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 state *this;
|
struct state *this;
|
||||||
|
|
||||||
|
|
@ -692,7 +692,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct state *) handle;
|
this = (struct state *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -730,19 +730,10 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct state *) handle;
|
this = (struct state *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
this->data_system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataSystem);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
this->data_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataSystem:
|
|
||||||
this->data_system = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataLoop:
|
|
||||||
this->data_loop = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this->data_loop == NULL) {
|
if (this->data_loop == NULL) {
|
||||||
spa_log_error(this->log, NAME" %p: a data loop is needed", this);
|
spa_log_error(this->log, NAME" %p: a data loop is needed", this);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
||||||
|
|
@ -796,7 +796,7 @@ static const struct spa_node_methods impl_node = {
|
||||||
.process = impl_node_process,
|
.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 seq_state *this;
|
struct seq_state *this;
|
||||||
|
|
||||||
|
|
@ -805,7 +805,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct seq_state *) handle;
|
this = (struct seq_state *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -851,22 +851,11 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct seq_state *) handle;
|
this = (struct seq_state *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
this->data_system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataSystem);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
this->data_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
|
||||||
this->log = support[i].data;
|
this->main_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Loop);
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataSystem:
|
|
||||||
this->data_system = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataLoop:
|
|
||||||
this->data_loop = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_Loop:
|
|
||||||
this->main_loop = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this->data_loop == NULL) {
|
if (this->data_loop == NULL) {
|
||||||
spa_log_error(this->log, "a data loop is needed");
|
spa_log_error(this->log, "a data loop is needed");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
||||||
|
|
@ -541,7 +541,7 @@ static const struct spa_device_methods impl_device = {
|
||||||
.add_listener = impl_device_add_listener,
|
.add_listener = impl_device_add_listener,
|
||||||
};
|
};
|
||||||
|
|
||||||
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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -550,13 +550,11 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
switch (type) {
|
if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
|
||||||
case SPA_TYPE_INTERFACE_Device:
|
|
||||||
*interface = &this->device;
|
*interface = &this->device;
|
||||||
break;
|
else
|
||||||
default:
|
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -583,7 +581,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
uint32_t n_support)
|
uint32_t n_support)
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -593,18 +590,9 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
this->main_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Loop);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_Loop:
|
|
||||||
this->main_loop = support[i].data;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this->main_loop == NULL) {
|
if (this->main_loop == NULL) {
|
||||||
spa_log_error(this->log, "a main-loop is needed");
|
spa_log_error(this->log, "a main-loop is needed");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
||||||
|
|
@ -917,7 +917,7 @@ static const struct spa_node_methods impl_node = {
|
||||||
.process = impl_node_process,
|
.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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -926,7 +926,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -994,7 +994,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
void *iface;
|
void *iface;
|
||||||
const char *str;
|
const char *str;
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -1004,16 +1003,9 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_CPU:
|
|
||||||
this->cpu = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (info == NULL || (str = spa_dict_lookup(info, "audio.adapt.slave")) == NULL)
|
if (info == NULL || (str = spa_dict_lookup(info, "audio.adapt.slave")) == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1092,7 +1092,7 @@ static const struct spa_node_methods impl_node = {
|
||||||
.process = impl_node_process,
|
.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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -1101,7 +1101,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -1160,7 +1160,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
uint32_t n_support)
|
uint32_t n_support)
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
uint32_t i;
|
|
||||||
size_t size;
|
size_t size;
|
||||||
void *iface;
|
void *iface;
|
||||||
|
|
||||||
|
|
@ -1172,16 +1171,8 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_CPU:
|
|
||||||
this->cpu = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->cpu)
|
if (this->cpu)
|
||||||
this->max_align = spa_cpu_get_max_align(this->cpu);
|
this->max_align = spa_cpu_get_max_align(this->cpu);
|
||||||
|
|
|
||||||
|
|
@ -933,7 +933,7 @@ static const struct spa_node_methods impl_node = {
|
||||||
.process = impl_node_process,
|
.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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -942,7 +942,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -971,7 +971,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
struct port *port;
|
struct port *port;
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -981,16 +980,8 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_CPU:
|
|
||||||
this->cpu = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->cpu)
|
if (this->cpu)
|
||||||
this->cpu_flags = spa_cpu_get_flags(this->cpu);
|
this->cpu_flags = spa_cpu_get_flags(this->cpu);
|
||||||
|
|
|
||||||
|
|
@ -899,7 +899,7 @@ static const struct spa_node_methods impl_node = {
|
||||||
.process = impl_node_process,
|
.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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -908,7 +908,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -961,7 +961,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
uint32_t n_support)
|
uint32_t n_support)
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -971,25 +970,18 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
|
||||||
this->log = support[i].data;
|
if (this->cpu)
|
||||||
break;
|
this->cpu_flags = spa_cpu_get_flags(this->cpu);
|
||||||
case SPA_TYPE_INTERFACE_CPU:
|
|
||||||
this->cpu = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this->node.iface = SPA_INTERFACE_INIT(
|
this->node.iface = SPA_INTERFACE_INIT(
|
||||||
SPA_TYPE_INTERFACE_Node,
|
SPA_TYPE_INTERFACE_Node,
|
||||||
SPA_VERSION_NODE,
|
SPA_VERSION_NODE,
|
||||||
&impl_node, this);
|
&impl_node, this);
|
||||||
spa_hook_list_init(&this->hooks);
|
spa_hook_list_init(&this->hooks);
|
||||||
|
|
||||||
if (this->cpu)
|
|
||||||
this->cpu_flags = spa_cpu_get_flags(this->cpu);
|
|
||||||
|
|
||||||
this->info_all = SPA_PORT_CHANGE_MASK_FLAGS;
|
this->info_all = SPA_PORT_CHANGE_MASK_FLAGS;
|
||||||
this->info = SPA_NODE_INFO_INIT();
|
this->info = SPA_NODE_INFO_INIT();
|
||||||
this->info.flags = SPA_NODE_FLAG_RT;
|
this->info.flags = SPA_NODE_FLAG_RT;
|
||||||
|
|
|
||||||
|
|
@ -1017,7 +1017,7 @@ static const struct spa_node_methods impl_node = {
|
||||||
.process = impl_node_process,
|
.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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -1026,7 +1026,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -1055,7 +1055,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
struct port *port;
|
struct port *port;
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -1065,16 +1064,8 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_CPU:
|
|
||||||
this->cpu = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->cpu)
|
if (this->cpu)
|
||||||
this->cpu_flags = spa_cpu_get_flags(this->cpu);
|
this->cpu_flags = spa_cpu_get_flags(this->cpu);
|
||||||
|
|
|
||||||
|
|
@ -854,7 +854,7 @@ static const struct spa_node_methods impl_node = {
|
||||||
.process = impl_node_process,
|
.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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -863,7 +863,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -900,7 +900,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
struct port *port;
|
struct port *port;
|
||||||
uint32_t i;
|
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
|
|
@ -911,16 +910,8 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_CPU:
|
|
||||||
this->cpu = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->cpu)
|
if (this->cpu)
|
||||||
this->resample.cpu_flags = spa_cpu_get_flags(this->cpu);
|
this->resample.cpu_flags = spa_cpu_get_flags(this->cpu);
|
||||||
|
|
|
||||||
|
|
@ -938,7 +938,7 @@ static const struct spa_node_methods impl_node = {
|
||||||
.process = impl_node_process,
|
.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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -947,7 +947,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -976,7 +976,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
struct port *port;
|
struct port *port;
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -986,16 +985,9 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_CPU:
|
|
||||||
this->cpu = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this->cpu)
|
if (this->cpu)
|
||||||
this->cpu_flags = spa_cpu_get_flags(this->cpu);
|
this->cpu_flags = spa_cpu_get_flags(this->cpu);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -790,7 +790,7 @@ static const struct spa_node_methods impl_node = {
|
||||||
.process = impl_node_process,
|
.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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -799,13 +799,11 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
switch (type) {
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
case SPA_TYPE_INTERFACE_Node:
|
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
break;
|
else
|
||||||
default:
|
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -830,7 +828,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
struct port *port;
|
struct port *port;
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -840,13 +837,7 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
spa_log_debug(this->log, NAME " %p: init", this);
|
spa_log_debug(this->log, NAME " %p: init", this);
|
||||||
spa_hook_list_init(&this->hooks);
|
spa_hook_list_init(&this->hooks);
|
||||||
|
|
|
||||||
|
|
@ -826,7 +826,7 @@ static const struct spa_node_methods impl_node = {
|
||||||
.process = impl_node_process,
|
.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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -835,7 +835,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -871,7 +871,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
struct port *port;
|
struct port *port;
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -881,16 +880,9 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_CPU:
|
|
||||||
this->cpu = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this->cpu)
|
if (this->cpu)
|
||||||
this->cpu_flags = spa_cpu_get_flags(this->cpu);
|
this->cpu_flags = spa_cpu_get_flags(this->cpu);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -764,7 +764,7 @@ static const struct spa_node_methods impl_node = {
|
||||||
.process = impl_node_process,
|
.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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -773,7 +773,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -802,7 +802,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
struct port *port;
|
struct port *port;
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -812,16 +811,9 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_CPU:
|
|
||||||
this->cpu = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this->cpu)
|
if (this->cpu)
|
||||||
this->cpu_flags = spa_cpu_get_flags(this->cpu);
|
this->cpu_flags = spa_cpu_get_flags(this->cpu);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -923,7 +923,7 @@ static const struct spa_node_methods impl_node = {
|
||||||
.process = impl_node_process,
|
.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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -932,7 +932,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -971,7 +971,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
struct port *port;
|
struct port *port;
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -981,19 +980,9 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
this->data_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
this->data_system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataSystem);
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataLoop:
|
|
||||||
this->data_loop = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataSystem:
|
|
||||||
this->data_system = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
spa_hook_list_init(&this->hooks);
|
spa_hook_list_init(&this->hooks);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1359,7 +1359,7 @@ static const struct spa_bt_transport_events transport_events = {
|
||||||
.destroy = transport_destroy,
|
.destroy = transport_destroy,
|
||||||
};
|
};
|
||||||
|
|
||||||
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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -1368,7 +1368,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -1399,7 +1399,7 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
struct port *port;
|
struct port *port;
|
||||||
uint32_t i;
|
const char *str;
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -1409,19 +1409,10 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
this->data_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
this->data_system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataSystem);
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataLoop:
|
|
||||||
this->data_loop = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataSystem:
|
|
||||||
this->data_system = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this->data_loop == NULL) {
|
if (this->data_loop == NULL) {
|
||||||
spa_log_error(this->log, "a data loop is needed");
|
spa_log_error(this->log, "a data loop is needed");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
@ -1465,10 +1456,9 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
port->info.n_params = 5;
|
port->info.n_params = 5;
|
||||||
spa_list_init(&port->ready);
|
spa_list_init(&port->ready);
|
||||||
|
|
||||||
for (i = 0; info && i < info->n_items; i++) {
|
if (info && (str = spa_dict_lookup(info, SPA_KEY_API_BLUEZ5_TRANSPORT)))
|
||||||
if (strcmp(info->items[i].key, SPA_KEY_API_BLUEZ5_TRANSPORT) == 0)
|
sscanf(str, "pointer:%p", &this->transport);
|
||||||
sscanf(info->items[i].value, "pointer:%p", &this->transport);
|
|
||||||
}
|
|
||||||
if (this->transport == NULL) {
|
if (this->transport == NULL) {
|
||||||
spa_log_error(this->log, "a transport is needed");
|
spa_log_error(this->log, "a transport is needed");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
||||||
|
|
@ -1049,7 +1049,7 @@ static const struct spa_bt_transport_events transport_events = {
|
||||||
.state_changed = transport_state_changed,
|
.state_changed = transport_state_changed,
|
||||||
};
|
};
|
||||||
|
|
||||||
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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -1058,7 +1058,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -1087,7 +1087,7 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
struct port *port;
|
struct port *port;
|
||||||
uint32_t i;
|
const char *str;
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -1097,19 +1097,10 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
this->data_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
this->data_system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataSystem);
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataLoop:
|
|
||||||
this->data_loop = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataSystem:
|
|
||||||
this->data_system = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this->data_loop == NULL) {
|
if (this->data_loop == NULL) {
|
||||||
spa_log_error(this->log, "a data loop is needed");
|
spa_log_error(this->log, "a data loop is needed");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
@ -1160,10 +1151,9 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
spa_list_init(&port->ready);
|
spa_list_init(&port->ready);
|
||||||
spa_list_init(&port->free);
|
spa_list_init(&port->free);
|
||||||
|
|
||||||
for (i = 0; info && i < info->n_items; i++) {
|
if (info && (str = spa_dict_lookup(info, SPA_KEY_API_BLUEZ5_TRANSPORT)))
|
||||||
if (strcmp(info->items[i].key, SPA_KEY_API_BLUEZ5_TRANSPORT) == 0)
|
sscanf(str, "pointer:%p", &this->transport);
|
||||||
sscanf(info->items[i].value, "pointer:%p", &this->transport);
|
|
||||||
}
|
|
||||||
if (this->transport == NULL) {
|
if (this->transport == NULL) {
|
||||||
spa_log_error(this->log, "a transport is needed");
|
spa_log_error(this->log, "a transport is needed");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
||||||
|
|
@ -2199,7 +2199,7 @@ static const struct spa_device_methods impl_device = {
|
||||||
.add_listener = impl_device_add_listener,
|
.add_listener = impl_device_add_listener,
|
||||||
};
|
};
|
||||||
|
|
||||||
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 spa_bt_monitor *this;
|
struct spa_bt_monitor *this;
|
||||||
|
|
||||||
|
|
@ -2208,13 +2208,11 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct spa_bt_monitor *) handle;
|
this = (struct spa_bt_monitor *) handle;
|
||||||
|
|
||||||
switch (type) {
|
if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
|
||||||
case SPA_TYPE_INTERFACE_Device:
|
|
||||||
*interface = &this->device;
|
*interface = &this->device;
|
||||||
break;
|
else
|
||||||
default:
|
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2238,7 +2236,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
uint32_t n_support)
|
uint32_t n_support)
|
||||||
{
|
{
|
||||||
struct spa_bt_monitor *this;
|
struct spa_bt_monitor *this;
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -2248,22 +2245,11 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct spa_bt_monitor *) handle;
|
this = (struct spa_bt_monitor *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
this->dbus = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DBus);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
this->main_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Loop);
|
||||||
this->log = support[i].data;
|
this->main_system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_System);
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DBus:
|
|
||||||
this->dbus = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_Loop:
|
|
||||||
this->main_loop = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_System:
|
|
||||||
this->main_system = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this->dbus == NULL) {
|
if (this->dbus == NULL) {
|
||||||
spa_log_error(this->log, "a dbus is needed");
|
spa_log_error(this->log, "a dbus is needed");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
#include <spa/utils/type.h>
|
#include <spa/utils/type.h>
|
||||||
#include <spa/utils/keys.h>
|
#include <spa/utils/keys.h>
|
||||||
#include <spa/utils/names.h>
|
#include <spa/utils/names.h>
|
||||||
|
#include <spa/node/node.h>
|
||||||
#include <spa/support/loop.h>
|
#include <spa/support/loop.h>
|
||||||
#include <spa/support/plugin.h>
|
#include <spa/support/plugin.h>
|
||||||
#include <spa/monitor/device.h>
|
#include <spa/monitor/device.h>
|
||||||
|
|
@ -183,7 +184,7 @@ static const struct spa_device_methods impl_device = {
|
||||||
.set_param = impl_set_param,
|
.set_param = impl_set_param,
|
||||||
};
|
};
|
||||||
|
|
||||||
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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -192,7 +193,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Device)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
|
||||||
*interface = &this->device;
|
*interface = &this->device;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -220,7 +221,7 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
uint32_t n_support)
|
uint32_t n_support)
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
uint32_t i;
|
const char *str;
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -230,18 +231,11 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
if (info && (str = spa_dict_lookup(info, SPA_KEY_API_BLUEZ5_DEVICE)))
|
||||||
this->log = support[i].data;
|
sscanf(str, "pointer:%p", &this->bt_dev);
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; info && i < info->n_items; i++) {
|
|
||||||
if (strcmp(info->items[i].key, SPA_KEY_API_BLUEZ5_DEVICE) == 0)
|
|
||||||
sscanf(info->items[i].value, "pointer:%p", &this->bt_dev);
|
|
||||||
}
|
|
||||||
if (this->bt_dev == NULL) {
|
if (this->bt_dev == NULL) {
|
||||||
spa_log_error(this->log, "a device is needed");
|
spa_log_error(this->log, "a device is needed");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
||||||
|
|
@ -1049,7 +1049,7 @@ static const struct spa_bt_transport_events transport_events = {
|
||||||
.destroy = transport_destroy,
|
.destroy = transport_destroy,
|
||||||
};
|
};
|
||||||
|
|
||||||
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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -1058,7 +1058,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -1089,7 +1089,7 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
struct port *port;
|
struct port *port;
|
||||||
uint32_t i;
|
const char *str;
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -1099,19 +1099,10 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
this->data_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
this->data_system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataSystem);
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataLoop:
|
|
||||||
this->data_loop = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataSystem:
|
|
||||||
this->data_system = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this->data_loop == NULL) {
|
if (this->data_loop == NULL) {
|
||||||
spa_log_error(this->log, "a data loop is needed");
|
spa_log_error(this->log, "a data loop is needed");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
@ -1155,10 +1146,9 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
port->info.n_params = 5;
|
port->info.n_params = 5;
|
||||||
spa_list_init(&port->ready);
|
spa_list_init(&port->ready);
|
||||||
|
|
||||||
for (i = 0; info && i < info->n_items; i++) {
|
if (info && (str = spa_dict_lookup(info, SPA_KEY_API_BLUEZ5_TRANSPORT)))
|
||||||
if (strcmp(info->items[i].key, SPA_KEY_API_BLUEZ5_TRANSPORT) == 0)
|
sscanf(str, "pointer:%p", &this->transport);
|
||||||
sscanf(info->items[i].value, "pointer:%p", &this->transport);
|
|
||||||
}
|
|
||||||
if (this->transport == NULL) {
|
if (this->transport == NULL) {
|
||||||
spa_log_error(this->log, "a transport is needed");
|
spa_log_error(this->log, "a transport is needed");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
||||||
|
|
@ -957,7 +957,7 @@ static const struct spa_bt_transport_events transport_events = {
|
||||||
.destroy = transport_destroy,
|
.destroy = transport_destroy,
|
||||||
};
|
};
|
||||||
|
|
||||||
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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -966,7 +966,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -995,7 +995,7 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
struct port *port;
|
struct port *port;
|
||||||
uint32_t i;
|
const char *str;
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -1005,19 +1005,10 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
this->data_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
this->data_system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataSystem);
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataLoop:
|
|
||||||
this->data_loop = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataSystem:
|
|
||||||
this->data_system = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this->data_loop == NULL) {
|
if (this->data_loop == NULL) {
|
||||||
spa_log_error(this->log, "a data loop is needed");
|
spa_log_error(this->log, "a data loop is needed");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
@ -1066,10 +1057,9 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
spa_list_init(&port->ready);
|
spa_list_init(&port->ready);
|
||||||
spa_list_init(&port->free);
|
spa_list_init(&port->free);
|
||||||
|
|
||||||
for (i = 0; info && i < info->n_items; i++) {
|
if (info && (str = spa_dict_lookup(info, SPA_KEY_API_BLUEZ5_TRANSPORT)))
|
||||||
if (strcmp(info->items[i].key, SPA_KEY_API_BLUEZ5_TRANSPORT) == 0)
|
sscanf(str, "pointer:%p", &this->transport);
|
||||||
sscanf(info->items[i].value, "pointer:%p", &this->transport);
|
|
||||||
}
|
|
||||||
if (this->transport == NULL) {
|
if (this->transport == NULL) {
|
||||||
spa_log_error(this->log, "a transport is needed");
|
spa_log_error(this->log, "a transport is needed");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
||||||
|
|
@ -698,7 +698,7 @@ static const struct spa_node_methods impl_node = {
|
||||||
.process = impl_node_process,
|
.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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -707,7 +707,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -736,7 +736,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
struct port *port;
|
struct port *port;
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -746,13 +745,7 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
spa_hook_list_init(&this->hooks);
|
spa_hook_list_init(&this->hooks);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -436,7 +436,7 @@ static const struct spa_node_methods impl_node = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
impl_get_interface(struct spa_handle *handle, const char *type, void **interface)
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -445,7 +445,7 @@ impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -461,16 +461,12 @@ spa_ffmpeg_dec_init(struct spa_handle *handle,
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
struct port *port;
|
struct port *port;
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
handle->get_interface = impl_get_interface;
|
handle->get_interface = impl_get_interface;
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
if (support[i].type == SPA_TYPE_INTERFACE_Log)
|
|
||||||
this->log = support[i].data;
|
|
||||||
}
|
|
||||||
|
|
||||||
spa_hook_list_init(&this->hooks);
|
spa_hook_list_init(&this->hooks);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -415,7 +415,7 @@ static const struct spa_node_methods impl_node = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
impl_get_interface(struct spa_handle *handle, const char *type, void **interface)
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -424,7 +424,7 @@ impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -439,16 +439,12 @@ spa_ffmpeg_enc_init(struct spa_handle *handle,
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
struct port *port;
|
struct port *port;
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
handle->get_interface = impl_get_interface;
|
handle->get_interface = impl_get_interface;
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
if (support[i].type == SPA_TYPE_INTERFACE_Log)
|
|
||||||
this->log = support[i].data;
|
|
||||||
}
|
|
||||||
|
|
||||||
spa_hook_list_init(&this->hooks);
|
spa_hook_list_init(&this->hooks);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
#include <spa/utils/keys.h>
|
#include <spa/utils/keys.h>
|
||||||
#include <spa/utils/names.h>
|
#include <spa/utils/names.h>
|
||||||
#include <spa/utils/result.h>
|
#include <spa/utils/result.h>
|
||||||
|
#include <spa/node/node.h>
|
||||||
#include <spa/support/loop.h>
|
#include <spa/support/loop.h>
|
||||||
#include <spa/support/plugin.h>
|
#include <spa/support/plugin.h>
|
||||||
#include <spa/monitor/device.h>
|
#include <spa/monitor/device.h>
|
||||||
|
|
@ -335,7 +336,7 @@ static const struct spa_device_methods impl_device = {
|
||||||
.set_param = impl_set_param,
|
.set_param = impl_set_param,
|
||||||
};
|
};
|
||||||
|
|
||||||
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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -344,13 +345,10 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
switch (type) {
|
if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
|
||||||
case SPA_TYPE_INTERFACE_Device:
|
|
||||||
*interface = &this->device;
|
*interface = &this->device;
|
||||||
break;
|
else
|
||||||
default:
|
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -383,7 +381,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
const char *str;
|
const char *str;
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -393,13 +390,7 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this->device.iface = SPA_INTERFACE_INIT(
|
this->device.iface = SPA_INTERFACE_INIT(
|
||||||
SPA_TYPE_INTERFACE_Device,
|
SPA_TYPE_INTERFACE_Device,
|
||||||
|
|
@ -409,10 +400,8 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
reset_props(&this->props);
|
reset_props(&this->props);
|
||||||
|
|
||||||
if (info) {
|
if (info && (str = spa_dict_lookup(info, SPA_KEY_API_JACK_SERVER)))
|
||||||
if ((str = spa_dict_lookup(info, SPA_KEY_API_JACK_SERVER)))
|
snprintf(this->props.server, 64, "%s", str);
|
||||||
snprintf(this->props.server, 64, "%s", str);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -801,7 +801,7 @@ static const struct spa_node_methods impl_node = {
|
||||||
.process = impl_node_process,
|
.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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -810,7 +810,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -838,7 +838,7 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
uint32_t n_support)
|
uint32_t n_support)
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
uint32_t i;
|
const char *str;
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -848,15 +848,11 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
if (support[i].type == SPA_TYPE_INTERFACE_Log)
|
|
||||||
this->log = support[i].data;
|
if (info && (str = spa_dict_lookup(info, SPA_KEY_API_JACK_CLIENT)))
|
||||||
}
|
sscanf(str, "pointer:%p", &this->client);
|
||||||
|
|
||||||
for (i = 0; info && i < info->n_items; i++) {
|
|
||||||
if (strcmp(info->items[i].key, SPA_KEY_API_JACK_CLIENT) == 0)
|
|
||||||
sscanf(info->items[i].value, "pointer:%p", &this->client);
|
|
||||||
}
|
|
||||||
if (this->client == NULL) {
|
if (this->client == NULL) {
|
||||||
spa_log_error(this->log, NAME" %p: missing "SPA_KEY_API_JACK_CLIENT
|
spa_log_error(this->log, NAME" %p: missing "SPA_KEY_API_JACK_CLIENT
|
||||||
" property", this);
|
" property", this);
|
||||||
|
|
|
||||||
|
|
@ -823,7 +823,7 @@ static const struct spa_node_methods impl_node = {
|
||||||
.process = impl_node_process,
|
.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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -832,7 +832,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -860,7 +860,7 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
uint32_t n_support)
|
uint32_t n_support)
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
uint32_t i;
|
const char *str;
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -870,15 +870,11 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
if (support[i].type == SPA_TYPE_INTERFACE_Log)
|
|
||||||
this->log = support[i].data;
|
if (info && (str = spa_dict_lookup(info, SPA_KEY_API_JACK_CLIENT)))
|
||||||
}
|
sscanf(str, "pointer:%p", &this->client);
|
||||||
|
|
||||||
for (i = 0; info && i < info->n_items; i++) {
|
|
||||||
if (strcmp(info->items[i].key, SPA_KEY_API_JACK_CLIENT) == 0)
|
|
||||||
sscanf(info->items[i].value, "pointer:%p", &this->client);
|
|
||||||
}
|
|
||||||
if (this->client == NULL) {
|
if (this->client == NULL) {
|
||||||
spa_log_error(this->log, NAME" %p: missing "SPA_KEY_API_JACK_CLIENT
|
spa_log_error(this->log, NAME" %p: missing "SPA_KEY_API_JACK_CLIENT
|
||||||
" property", this);
|
" property", this);
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ static const struct spa_cpu_methods impl_cpu = {
|
||||||
.get_max_align = impl_cpu_get_max_align,
|
.get_max_align = impl_cpu_get_max_align,
|
||||||
};
|
};
|
||||||
|
|
||||||
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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -131,7 +131,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_CPU)
|
if (strcmp(type, SPA_TYPE_INTERFACE_CPU) == 0)
|
||||||
*interface = &this->cpu;
|
*interface = &this->cpu;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -160,7 +160,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
const char *str;
|
const char *str;
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -175,13 +174,8 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
SPA_VERSION_CPU,
|
SPA_VERSION_CPU,
|
||||||
&impl_cpu, this);
|
&impl_cpu, this);
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this->flags = 0;
|
this->flags = 0;
|
||||||
this->force = SPA_CPU_FORCE_AUTODETECT;
|
this->force = SPA_CPU_FORCE_AUTODETECT;
|
||||||
this->max_align = 16;
|
this->max_align = 16;
|
||||||
|
|
|
||||||
|
|
@ -339,7 +339,7 @@ static const struct spa_dbus_methods impl_dbus = {
|
||||||
.get_connection = impl_get_connection,
|
.get_connection = impl_get_connection,
|
||||||
};
|
};
|
||||||
|
|
||||||
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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -348,7 +348,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_DBus)
|
if (strcmp(type, SPA_TYPE_INTERFACE_DBus) == 0)
|
||||||
*interface = &this->dbus;
|
*interface = &this->dbus;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -377,7 +377,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
uint32_t n_support)
|
uint32_t n_support)
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -393,16 +392,9 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
SPA_VERSION_DBUS,
|
SPA_VERSION_DBUS,
|
||||||
&impl_dbus, this);
|
&impl_dbus, this);
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
this->utils = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_LoopUtils);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_LoopUtils:
|
|
||||||
this->utils = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this->utils == NULL) {
|
if (this->utils == NULL) {
|
||||||
spa_log_error(this->log, "a LoopUtils is needed");
|
spa_log_error(this->log, "a LoopUtils is needed");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
||||||
|
|
@ -362,7 +362,7 @@ static const struct spa_system_methods impl_system = {
|
||||||
.signalfd_read = impl_signalfd_read,
|
.signalfd_read = impl_signalfd_read,
|
||||||
};
|
};
|
||||||
|
|
||||||
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 *impl;
|
struct impl *impl;
|
||||||
|
|
||||||
|
|
@ -371,13 +371,11 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
impl = (struct impl *) handle;
|
impl = (struct impl *) handle;
|
||||||
|
|
||||||
switch (type) {
|
if (strcmp(type, SPA_TYPE_INTERFACE_System) == 0)
|
||||||
case SPA_TYPE_INTERFACE_System:
|
|
||||||
*interface = &impl->system;
|
*interface = &impl->system;
|
||||||
break;
|
else
|
||||||
default:
|
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -402,7 +400,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
uint32_t n_support)
|
uint32_t n_support)
|
||||||
{
|
{
|
||||||
struct impl *impl;
|
struct impl *impl;
|
||||||
uint32_t i;
|
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
|
|
@ -417,13 +414,8 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
SPA_VERSION_SYSTEM,
|
SPA_VERSION_SYSTEM,
|
||||||
&impl_system, impl);
|
&impl_system, impl);
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
impl->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
|
||||||
impl->log = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl->pid = getpid();
|
impl->pid = getpid();
|
||||||
|
|
||||||
if ((res = evl_attach_self("evl-system-%d-%p", impl->pid, impl)) < 0) {
|
if ((res = evl_attach_self("evl-system-%d-%p", impl->pid, impl)) < 0) {
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ static const struct spa_log_methods impl_log = {
|
||||||
.logv = impl_log_logv,
|
.logv = impl_log_logv,
|
||||||
};
|
};
|
||||||
|
|
||||||
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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -183,7 +183,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Log)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Log) == 0)
|
||||||
*interface = &this->log;
|
*interface = &this->log;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -222,7 +222,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
uint32_t n_support)
|
uint32_t n_support)
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
uint32_t i;
|
|
||||||
struct spa_loop *loop = NULL;
|
struct spa_loop *loop = NULL;
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
|
|
@ -240,16 +239,9 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
&impl_log, this);
|
&impl_log, this);
|
||||||
this->log.level = DEFAULT_LOG_LEVEL;
|
this->log.level = DEFAULT_LOG_LEVEL;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Loop);
|
||||||
switch (support[i].type) {
|
this->system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_System);
|
||||||
case SPA_TYPE_INTERFACE_Loop:
|
|
||||||
loop = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_System:
|
|
||||||
this->system = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (loop != NULL && this->system != NULL) {
|
if (loop != NULL && this->system != NULL) {
|
||||||
this->source.func = on_trace_event;
|
this->source.func = on_trace_event;
|
||||||
this->source.data = this;
|
this->source.data = this;
|
||||||
|
|
|
||||||
|
|
@ -664,7 +664,7 @@ static const struct spa_loop_utils_methods impl_loop_utils = {
|
||||||
.destroy_source = loop_destroy_source,
|
.destroy_source = loop_destroy_source,
|
||||||
};
|
};
|
||||||
|
|
||||||
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 *impl;
|
struct impl *impl;
|
||||||
|
|
||||||
|
|
@ -673,19 +673,15 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
impl = (struct impl *) handle;
|
impl = (struct impl *) handle;
|
||||||
|
|
||||||
switch (type) {
|
if (strcmp(type, SPA_TYPE_INTERFACE_Loop) == 0)
|
||||||
case SPA_TYPE_INTERFACE_Loop:
|
|
||||||
*interface = &impl->loop;
|
*interface = &impl->loop;
|
||||||
break;
|
else if (strcmp(type, SPA_TYPE_INTERFACE_LoopControl) == 0)
|
||||||
case SPA_TYPE_INTERFACE_LoopControl:
|
|
||||||
*interface = &impl->control;
|
*interface = &impl->control;
|
||||||
break;
|
else if (strcmp(type, SPA_TYPE_INTERFACE_LoopUtils) == 0)
|
||||||
case SPA_TYPE_INTERFACE_LoopUtils:
|
|
||||||
*interface = &impl->utils;
|
*interface = &impl->utils;
|
||||||
break;
|
else
|
||||||
default:
|
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -724,7 +720,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
uint32_t n_support)
|
uint32_t n_support)
|
||||||
{
|
{
|
||||||
struct impl *impl;
|
struct impl *impl;
|
||||||
uint32_t i;
|
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
|
|
@ -747,16 +742,9 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
SPA_VERSION_LOOP_UTILS,
|
SPA_VERSION_LOOP_UTILS,
|
||||||
&impl_loop_utils, impl);
|
&impl_loop_utils, impl);
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
impl->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
impl->system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_System);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
|
||||||
impl->log = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_System:
|
|
||||||
impl->system = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (impl->system == NULL) {
|
if (impl->system == NULL) {
|
||||||
spa_log_error(impl->log, NAME " %p: a System is needed", impl);
|
spa_log_error(impl->log, NAME " %p: a System is needed", impl);
|
||||||
res = -EINVAL;
|
res = -EINVAL;
|
||||||
|
|
|
||||||
|
|
@ -278,7 +278,7 @@ static const struct spa_system_methods impl_system = {
|
||||||
.signalfd_read = impl_signalfd_read,
|
.signalfd_read = impl_signalfd_read,
|
||||||
};
|
};
|
||||||
|
|
||||||
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 *impl;
|
struct impl *impl;
|
||||||
|
|
||||||
|
|
@ -287,13 +287,11 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
impl = (struct impl *) handle;
|
impl = (struct impl *) handle;
|
||||||
|
|
||||||
switch (type) {
|
if (strcmp(type, SPA_TYPE_INTERFACE_System) == 0)
|
||||||
case SPA_TYPE_INTERFACE_System:
|
|
||||||
*interface = &impl->system;
|
*interface = &impl->system;
|
||||||
break;
|
else
|
||||||
default:
|
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -318,7 +316,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
uint32_t n_support)
|
uint32_t n_support)
|
||||||
{
|
{
|
||||||
struct impl *impl;
|
struct impl *impl;
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -332,13 +329,7 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
SPA_VERSION_SYSTEM,
|
SPA_VERSION_SYSTEM,
|
||||||
&impl_system, impl);
|
&impl_system, impl);
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
impl->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
|
||||||
impl->log = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
spa_log_debug(impl->log, NAME " %p: initialized", impl);
|
spa_log_debug(impl->log, NAME " %p: initialized", impl);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -679,7 +679,7 @@ static const struct spa_node_methods impl_node = {
|
||||||
.process = impl_node_process,
|
.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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -688,7 +688,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -727,7 +727,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
struct port *port;
|
struct port *port;
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -737,19 +736,9 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
this->data_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
this->data_system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataSystem);
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataLoop:
|
|
||||||
this->data_loop = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataSystem:
|
|
||||||
this->data_system = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
spa_hook_list_init(&this->hooks);
|
spa_hook_list_init(&this->hooks);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -713,7 +713,7 @@ static const struct spa_node_methods impl_node = {
|
||||||
.process = impl_node_process,
|
.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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -722,7 +722,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -761,7 +761,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
struct port *port;
|
struct port *port;
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -771,19 +770,9 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
this->data_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
this->data_system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataSystem);
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataLoop:
|
|
||||||
this->data_loop = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataSystem:
|
|
||||||
this->data_system = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
spa_hook_list_init(&this->hooks);
|
spa_hook_list_init(&this->hooks);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
#include <spa/support/loop.h>
|
#include <spa/support/loop.h>
|
||||||
#include <spa/utils/keys.h>
|
#include <spa/utils/keys.h>
|
||||||
#include <spa/utils/names.h>
|
#include <spa/utils/names.h>
|
||||||
|
#include <spa/node/node.h>
|
||||||
#include <spa/pod/builder.h>
|
#include <spa/pod/builder.h>
|
||||||
#include <spa/monitor/device.h>
|
#include <spa/monitor/device.h>
|
||||||
#include <spa/monitor/utils.h>
|
#include <spa/monitor/utils.h>
|
||||||
|
|
@ -186,7 +187,7 @@ static const struct spa_device_methods impl_device = {
|
||||||
.set_param = impl_set_param,
|
.set_param = impl_set_param,
|
||||||
};
|
};
|
||||||
|
|
||||||
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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -195,7 +196,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Device)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
|
||||||
*interface = &this->device;
|
*interface = &this->device;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -223,7 +224,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
uint32_t n_support)
|
uint32_t n_support)
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
uint32_t i;
|
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
|
|
@ -232,13 +232,7 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
handle->get_interface = impl_get_interface;
|
handle->get_interface = impl_get_interface;
|
||||||
handle->clear = impl_clear, this = (struct impl *) handle;
|
handle->clear = impl_clear, this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
spa_hook_list_init(&this->hooks);
|
spa_hook_list_init(&this->hooks);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -886,7 +886,7 @@ static const struct spa_node_methods impl_node = {
|
||||||
.process = impl_node_process,
|
.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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -895,7 +895,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -923,7 +923,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
uint32_t n_support)
|
uint32_t n_support)
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
uint32_t i;
|
|
||||||
const char *str;
|
const char *str;
|
||||||
struct port *port;
|
struct port *port;
|
||||||
int res;
|
int res;
|
||||||
|
|
@ -936,16 +935,9 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
this->data_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataLoop:
|
|
||||||
this->data_loop = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this->data_loop == NULL) {
|
if (this->data_loop == NULL) {
|
||||||
spa_log_error(this->log, "a data_loop is needed");
|
spa_log_error(this->log, "a data_loop is needed");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
||||||
|
|
@ -426,7 +426,7 @@ static const struct spa_device_methods impl_device = {
|
||||||
.add_listener = impl_device_add_listener,
|
.add_listener = impl_device_add_listener,
|
||||||
};
|
};
|
||||||
|
|
||||||
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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -435,13 +435,10 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
switch (type) {
|
if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
|
||||||
case SPA_TYPE_INTERFACE_Device:
|
|
||||||
*interface = &this->device;
|
*interface = &this->device;
|
||||||
break;
|
else
|
||||||
default:
|
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -469,7 +466,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
uint32_t n_support)
|
uint32_t n_support)
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -479,16 +475,9 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
this->main_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Loop);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_Loop:
|
|
||||||
this->main_loop = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this->main_loop == NULL) {
|
if (this->main_loop == NULL) {
|
||||||
spa_log_error(this->log, "a main-loop is needed");
|
spa_log_error(this->log, "a main-loop is needed");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
||||||
|
|
@ -801,7 +801,7 @@ static const struct spa_node_methods impl_node = {
|
||||||
.process = impl_node_process,
|
.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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -810,7 +810,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -864,7 +864,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
void *iface;
|
void *iface;
|
||||||
#endif
|
#endif
|
||||||
const char *str;
|
const char *str;
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -874,13 +873,8 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (info == NULL || (str = spa_dict_lookup(info, "video.adapt.slave")) == NULL)
|
if (info == NULL || (str = spa_dict_lookup(info, "video.adapt.slave")) == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -808,7 +808,7 @@ static const struct spa_node_methods impl_node = {
|
||||||
.process = impl_node_process,
|
.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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -817,7 +817,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -856,7 +856,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
struct port *port;
|
struct port *port;
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -866,19 +865,9 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
this->data_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
this->data_system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataSystem);
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataLoop:
|
|
||||||
this->data_loop = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataSystem:
|
|
||||||
this->data_system = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
spa_hook_list_init(&this->hooks);
|
spa_hook_list_init(&this->hooks);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -737,7 +737,7 @@ static const struct spa_node_methods impl_node = {
|
||||||
.process = impl_node_process,
|
.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;
|
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;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -775,7 +775,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
struct port *port;
|
struct port *port;
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != 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;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
if (support[i].type == SPA_TYPE_INTERFACE_Log)
|
|
||||||
this->log = support[i].data;
|
|
||||||
}
|
|
||||||
|
|
||||||
spa_hook_list_init(&this->hooks);
|
spa_hook_list_init(&this->hooks);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -824,7 +824,7 @@ static const struct spa_node_methods impl_node = {
|
||||||
.process = impl_node_process,
|
.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;
|
struct impl *this;
|
||||||
|
|
||||||
|
|
@ -833,7 +833,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
*interface = &this->node;
|
*interface = &this->node;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -872,7 +872,6 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
struct port *port;
|
struct port *port;
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -882,19 +881,9 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
switch (support[i].type) {
|
this->data_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
this->data_system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataSystem);
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataLoop:
|
|
||||||
this->data_loop = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataSystem:
|
|
||||||
this->data_system = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
spa_hook_list_init(&this->hooks);
|
spa_hook_list_init(&this->hooks);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -101,27 +101,27 @@ static void test_abi(void)
|
||||||
spa_assert(SPA_TYPE_Pod == 20);
|
spa_assert(SPA_TYPE_Pod == 20);
|
||||||
spa_assert(SPA_TYPE_LAST == 21);
|
spa_assert(SPA_TYPE_LAST == 21);
|
||||||
|
|
||||||
spa_assert(SPA_TYPE_EVENT_START == 0x30000);
|
spa_assert(SPA_TYPE_EVENT_START == 0x20000);
|
||||||
spa_assert(SPA_TYPE_EVENT_Device == 0x30001);
|
spa_assert(SPA_TYPE_EVENT_Device == 0x20001);
|
||||||
spa_assert(SPA_TYPE_EVENT_Node == 0x30002);
|
spa_assert(SPA_TYPE_EVENT_Node == 0x20002);
|
||||||
spa_assert(SPA_TYPE_EVENT_LAST == 0x30003);
|
spa_assert(SPA_TYPE_EVENT_LAST == 0x20003);
|
||||||
|
|
||||||
spa_assert(SPA_TYPE_COMMAND_START == 0x40000);
|
spa_assert(SPA_TYPE_COMMAND_START == 0x30000);
|
||||||
spa_assert(SPA_TYPE_COMMAND_Device == 0x40001);
|
spa_assert(SPA_TYPE_COMMAND_Device == 0x30001);
|
||||||
spa_assert(SPA_TYPE_COMMAND_Node == 0x40002);
|
spa_assert(SPA_TYPE_COMMAND_Node == 0x30002);
|
||||||
spa_assert(SPA_TYPE_COMMAND_LAST == 0x40003);
|
spa_assert(SPA_TYPE_COMMAND_LAST == 0x30003);
|
||||||
|
|
||||||
spa_assert(SPA_TYPE_OBJECT_START == 0x50000);
|
spa_assert(SPA_TYPE_OBJECT_START == 0x40000);
|
||||||
spa_assert(SPA_TYPE_OBJECT_PropInfo == 0x50001);
|
spa_assert(SPA_TYPE_OBJECT_PropInfo == 0x40001);
|
||||||
spa_assert(SPA_TYPE_OBJECT_Props == 0x50002);
|
spa_assert(SPA_TYPE_OBJECT_Props == 0x40002);
|
||||||
spa_assert(SPA_TYPE_OBJECT_Format == 0x50003);
|
spa_assert(SPA_TYPE_OBJECT_Format == 0x40003);
|
||||||
spa_assert(SPA_TYPE_OBJECT_ParamBuffers == 0x50004);
|
spa_assert(SPA_TYPE_OBJECT_ParamBuffers == 0x40004);
|
||||||
spa_assert(SPA_TYPE_OBJECT_ParamMeta == 0x50005);
|
spa_assert(SPA_TYPE_OBJECT_ParamMeta == 0x40005);
|
||||||
spa_assert(SPA_TYPE_OBJECT_ParamIO == 0x50006);
|
spa_assert(SPA_TYPE_OBJECT_ParamIO == 0x40006);
|
||||||
spa_assert(SPA_TYPE_OBJECT_ParamProfile == 0x50007);
|
spa_assert(SPA_TYPE_OBJECT_ParamProfile == 0x40007);
|
||||||
spa_assert(SPA_TYPE_OBJECT_ParamPortConfig == 0x50008);
|
spa_assert(SPA_TYPE_OBJECT_ParamPortConfig == 0x40008);
|
||||||
spa_assert(SPA_TYPE_OBJECT_ParamRoute == 0x50009);
|
spa_assert(SPA_TYPE_OBJECT_ParamRoute == 0x40009);
|
||||||
spa_assert(SPA_TYPE_OBJECT_LAST == 0x5000a);
|
spa_assert(SPA_TYPE_OBJECT_LAST == 0x4000a);
|
||||||
|
|
||||||
spa_assert(SPA_TYPE_VENDOR_PipeWire == 0x02000000);
|
spa_assert(SPA_TYPE_VENDOR_PipeWire == 0x02000000);
|
||||||
spa_assert(SPA_TYPE_VENDOR_Other == 0x7f000000);
|
spa_assert(SPA_TYPE_VENDOR_Other == 0x7f000000);
|
||||||
|
|
|
||||||
|
|
@ -218,7 +218,7 @@ static void inspect_factory(struct data *data, const struct spa_handle_factory *
|
||||||
spa_strerror(res));
|
spa_strerror(res));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
printf(" interface: '%d'\n", info->type);
|
printf(" interface: '%s'\n", info->type);
|
||||||
}
|
}
|
||||||
|
|
||||||
handle = calloc(1, spa_handle_factory_get_size(factory, NULL));
|
handle = calloc(1, spa_handle_factory_get_size(factory, NULL));
|
||||||
|
|
@ -237,14 +237,14 @@ static void inspect_factory(struct data *data, const struct spa_handle_factory *
|
||||||
spa_strerror(res));
|
spa_strerror(res));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
printf(" interface: '%d'\n", info->type);
|
printf(" interface: '%s'\n", info->type);
|
||||||
|
|
||||||
if ((res = spa_handle_get_interface(handle, info->type, &interface)) < 0) {
|
if ((res = spa_handle_get_interface(handle, info->type, &interface)) < 0) {
|
||||||
printf("can't get interface: %d %d\n", info->type, res);
|
printf("can't get interface: %s: %d\n", info->type, res);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->type == SPA_TYPE_INTERFACE_Node)
|
if (strcmp(info->type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||||
inspect_node(data, interface);
|
inspect_node(data, interface);
|
||||||
else
|
else
|
||||||
printf("skipping unknown interface\n");
|
printf("skipping unknown interface\n");
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,7 @@ int main(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->type == SPA_TYPE_INTERFACE_Device) {
|
if (strcmp(info->type, SPA_TYPE_INTERFACE_Device) == 0) {
|
||||||
struct spa_handle *handle;
|
struct spa_handle *handle;
|
||||||
void *interface;
|
void *interface;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
#include <spa/node/node.h>
|
#include <spa/node/node.h>
|
||||||
#include <spa/utils/hook.h>
|
#include <spa/utils/hook.h>
|
||||||
#include <spa/utils/names.h>
|
#include <spa/utils/names.h>
|
||||||
|
#include <spa/utils/result.h>
|
||||||
#include <spa/param/audio/format-utils.h>
|
#include <spa/param/audio/format-utils.h>
|
||||||
#include <spa/param/props.h>
|
#include <spa/param/props.h>
|
||||||
#include <spa/debug/dict.h>
|
#include <spa/debug/dict.h>
|
||||||
|
|
@ -116,7 +117,7 @@ static struct node *create_node(struct object *obj, uint32_t id,
|
||||||
|
|
||||||
pw_log_debug("new node %u", id);
|
pw_log_debug("new node %u", id);
|
||||||
|
|
||||||
if (info->type != SPA_TYPE_INTERFACE_Node)
|
if (strcmp(info->type, SPA_TYPE_INTERFACE_Node) != 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
handle = pw_context_load_spa_handle(context,
|
handle = pw_context_load_spa_handle(context,
|
||||||
|
|
@ -128,7 +129,7 @@ static struct node *create_node(struct object *obj, uint32_t id,
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((res = spa_handle_get_interface(handle, info->type, &iface)) < 0) {
|
if ((res = spa_handle_get_interface(handle, info->type, &iface)) < 0) {
|
||||||
pw_log_error("can't get %d interface: %d", info->type, res);
|
pw_log_error("can't get %s interface: %s", info->type, spa_strerror(res));
|
||||||
goto unload_handle;
|
goto unload_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -225,7 +226,7 @@ static struct object *create_object(struct impl *impl, uint32_t id,
|
||||||
|
|
||||||
pw_log_debug("new object %u", id);
|
pw_log_debug("new object %u", id);
|
||||||
|
|
||||||
if (info->type != SPA_TYPE_INTERFACE_Device)
|
if (strcmp(info->type, SPA_TYPE_INTERFACE_Device) != 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
handle = pw_context_load_spa_handle(context,
|
handle = pw_context_load_spa_handle(context,
|
||||||
|
|
@ -237,7 +238,7 @@ static struct object *create_object(struct impl *impl, uint32_t id,
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((res = spa_handle_get_interface(handle, info->type, &iface)) < 0) {
|
if ((res = spa_handle_get_interface(handle, info->type, &iface)) < 0) {
|
||||||
pw_log_error("can't get %d interface: %d", info->type, res);
|
pw_log_error("can't get %s interface: %s", info->type, spa_strerror(res));
|
||||||
goto unload_handle;
|
goto unload_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -195,7 +195,7 @@ static int client_endpoint_create_link(void *object, const struct spa_dict *prop
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
obj = sm_media_session_find_object(impl->session, atoi(str));
|
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);
|
pw_log_warn(NAME" %p: could not find endpoint %s (%p)", impl, str, obj);
|
||||||
res = -EINVAL;
|
res = -EINVAL;
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
@ -707,15 +707,11 @@ static void session_create(void *data, struct sm_object *object)
|
||||||
struct impl *impl = data;
|
struct impl *impl = data;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
switch (object->type) {
|
if (strcmp(object->type, PW_TYPE_INTERFACE_Device) == 0)
|
||||||
case PW_TYPE_INTERFACE_Device:
|
|
||||||
res = handle_device(impl, object);
|
res = handle_device(impl, object);
|
||||||
break;
|
else
|
||||||
|
|
||||||
default:
|
|
||||||
res = 0;
|
res = 0;
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
pw_log_warn(NAME" %p: can't handle global %d: %s", impl,
|
pw_log_warn(NAME" %p: can't handle global %d: %s", impl,
|
||||||
object->id, spa_strerror(res));
|
object->id, spa_strerror(res));
|
||||||
|
|
@ -726,16 +722,10 @@ static void session_remove(void *data, struct sm_object *object)
|
||||||
{
|
{
|
||||||
struct impl *impl = data;
|
struct impl *impl = data;
|
||||||
|
|
||||||
switch (object->type) {
|
if (strcmp(object->type, PW_TYPE_INTERFACE_Device) == 0) {
|
||||||
case PW_TYPE_INTERFACE_Device:
|
|
||||||
{
|
|
||||||
struct device *device;
|
struct device *device;
|
||||||
if ((device = sm_object_get_data(object, SESSION_KEY)) != NULL)
|
if ((device = sm_object_get_data(object, SESSION_KEY)) != NULL)
|
||||||
destroy_device(impl, device);
|
destroy_device(impl, device);
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@
|
||||||
#include <spa/monitor/device.h>
|
#include <spa/monitor/device.h>
|
||||||
#include <spa/node/node.h>
|
#include <spa/node/node.h>
|
||||||
#include <spa/node/keys.h>
|
#include <spa/node/keys.h>
|
||||||
|
#include <spa/utils/result.h>
|
||||||
#include <spa/utils/hook.h>
|
#include <spa/utils/hook.h>
|
||||||
#include <spa/utils/names.h>
|
#include <spa/utils/names.h>
|
||||||
#include <spa/utils/keys.h>
|
#include <spa/utils/keys.h>
|
||||||
|
|
@ -147,7 +148,7 @@ static struct node *alsa_create_node(struct device *device, uint32_t id,
|
||||||
|
|
||||||
pw_log_debug("new node %u", id);
|
pw_log_debug("new node %u", id);
|
||||||
|
|
||||||
if (info->type != SPA_TYPE_INTERFACE_Node) {
|
if (strcmp(info->type, SPA_TYPE_INTERFACE_Node) != 0) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -570,7 +571,7 @@ static struct device *alsa_create_device(struct impl *impl, uint32_t id,
|
||||||
|
|
||||||
pw_log_debug("new device %u", id);
|
pw_log_debug("new device %u", id);
|
||||||
|
|
||||||
if (info->type != SPA_TYPE_INTERFACE_Device) {
|
if (strcmp(info->type, SPA_TYPE_INTERFACE_Device) != 0) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -585,7 +586,7 @@ static struct device *alsa_create_device(struct impl *impl, uint32_t id,
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((res = spa_handle_get_interface(handle, info->type, &iface)) < 0) {
|
if ((res = spa_handle_get_interface(handle, info->type, &iface)) < 0) {
|
||||||
pw_log_error("can't get %d interface: %d", info->type, res);
|
pw_log_error("can't get %s interface: %s", info->type, spa_strerror(res));
|
||||||
goto unload_handle;
|
goto unload_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@
|
||||||
#include <spa/utils/hook.h>
|
#include <spa/utils/hook.h>
|
||||||
#include <spa/utils/result.h>
|
#include <spa/utils/result.h>
|
||||||
#include <spa/utils/names.h>
|
#include <spa/utils/names.h>
|
||||||
|
#include <spa/utils/result.h>
|
||||||
#include <spa/param/audio/format-utils.h>
|
#include <spa/param/audio/format-utils.h>
|
||||||
#include <spa/param/props.h>
|
#include <spa/param/props.h>
|
||||||
#include <spa/debug/dict.h>
|
#include <spa/debug/dict.h>
|
||||||
|
|
@ -115,7 +116,7 @@ static struct bluez5_node *bluez5_create_node(struct bluez5_object *obj, uint32_
|
||||||
|
|
||||||
pw_log_debug("new node %u", id);
|
pw_log_debug("new node %u", id);
|
||||||
|
|
||||||
if (info->type != SPA_TYPE_INTERFACE_Node) {
|
if (strcmp(info->type, SPA_TYPE_INTERFACE_Node) != 0) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -247,7 +248,7 @@ static struct bluez5_object *bluez5_create_object(struct impl *impl, uint32_t id
|
||||||
|
|
||||||
pw_log_debug("new object %u", id);
|
pw_log_debug("new object %u", id);
|
||||||
|
|
||||||
if (info->type != SPA_TYPE_INTERFACE_Device) {
|
if (strcmp(info->type, SPA_TYPE_INTERFACE_Device) != 0) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -262,7 +263,7 @@ static struct bluez5_object *bluez5_create_object(struct impl *impl, uint32_t id
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((res = spa_handle_get_interface(handle, info->type, &iface)) < 0) {
|
if ((res = spa_handle_get_interface(handle, info->type, &iface)) < 0) {
|
||||||
pw_log_error("can't get %d interface: %d", info->type, res);
|
pw_log_error("can't get %s interface: %s", info->type, spa_strerror(res));
|
||||||
goto unload_handle;
|
goto unload_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ struct link {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct object_info {
|
struct object_info {
|
||||||
uint32_t type;
|
const char *type;
|
||||||
uint32_t version;
|
uint32_t version;
|
||||||
const void *events;
|
const void *events;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
@ -387,6 +387,7 @@ static void device_destroy(void *object)
|
||||||
|
|
||||||
if (device->info)
|
if (device->info)
|
||||||
pw_device_info_free(device->info);
|
pw_device_info_free(device->info);
|
||||||
|
device->info = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct object_info device_info = {
|
static const struct object_info device_info = {
|
||||||
|
|
@ -920,7 +921,10 @@ destroy_proxy(void *data)
|
||||||
if (obj->destroy)
|
if (obj->destroy)
|
||||||
obj->destroy(obj);
|
obj->destroy(obj);
|
||||||
|
|
||||||
pw_properties_free(obj->props);
|
if (obj->props)
|
||||||
|
pw_properties_free(obj->props);
|
||||||
|
obj->props = NULL;
|
||||||
|
|
||||||
spa_list_consume(d, &obj->data, link) {
|
spa_list_consume(d, &obj->data, link) {
|
||||||
spa_list_remove(&d->link);
|
spa_list_remove(&d->link);
|
||||||
free(d);
|
free(d);
|
||||||
|
|
@ -967,41 +971,31 @@ int sm_object_sync_update(struct sm_object *obj)
|
||||||
return obj->pending;
|
return obj->pending;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct object_info *get_object_info(struct impl *impl, uint32_t type)
|
static const struct object_info *get_object_info(struct impl *impl, const char *type)
|
||||||
{
|
{
|
||||||
const struct object_info *info;
|
const struct object_info *info;
|
||||||
switch (type) {
|
|
||||||
case PW_TYPE_INTERFACE_Client:
|
if (strcmp(type, PW_TYPE_INTERFACE_Client) == 0)
|
||||||
info = &client_info;
|
info = &client_info;
|
||||||
break;
|
else if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
|
||||||
case SPA_TYPE_INTERFACE_Device:
|
|
||||||
info = &spa_device_info;
|
info = &spa_device_info;
|
||||||
break;
|
else if (strcmp(type, PW_TYPE_INTERFACE_Device) == 0)
|
||||||
case PW_TYPE_INTERFACE_Device:
|
|
||||||
info = &device_info;
|
info = &device_info;
|
||||||
break;
|
else if (strcmp(type, PW_TYPE_INTERFACE_Node) == 0)
|
||||||
case PW_TYPE_INTERFACE_Node:
|
|
||||||
info = &node_info;
|
info = &node_info;
|
||||||
break;
|
else if (strcmp(type, PW_TYPE_INTERFACE_Port) == 0)
|
||||||
case PW_TYPE_INTERFACE_Port:
|
|
||||||
info = &port_info;
|
info = &port_info;
|
||||||
break;
|
else if (strcmp(type, PW_TYPE_INTERFACE_Session) == 0)
|
||||||
case PW_TYPE_INTERFACE_Session:
|
|
||||||
info = &session_info;
|
info = &session_info;
|
||||||
break;
|
else if (strcmp(type, PW_TYPE_INTERFACE_Endpoint) == 0)
|
||||||
case PW_TYPE_INTERFACE_Endpoint:
|
|
||||||
info = &endpoint_info;
|
info = &endpoint_info;
|
||||||
break;
|
else if (strcmp(type, PW_TYPE_INTERFACE_EndpointStream) == 0)
|
||||||
case PW_TYPE_INTERFACE_EndpointStream:
|
|
||||||
info = &endpoint_stream_info;
|
info = &endpoint_stream_info;
|
||||||
break;
|
else if (strcmp(type, PW_TYPE_INTERFACE_EndpointLink) == 0)
|
||||||
case PW_TYPE_INTERFACE_EndpointLink:
|
|
||||||
info = &endpoint_link_info;
|
info = &endpoint_link_info;
|
||||||
break;
|
else
|
||||||
default:
|
|
||||||
info = NULL;
|
info = NULL;
|
||||||
break;
|
|
||||||
}
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1041,7 +1035,7 @@ static struct sm_object *
|
||||||
create_object(struct impl *impl, struct pw_proxy *proxy,
|
create_object(struct impl *impl, struct pw_proxy *proxy,
|
||||||
const struct spa_dict *props)
|
const struct spa_dict *props)
|
||||||
{
|
{
|
||||||
uint32_t type;
|
const char *type;
|
||||||
const struct object_info *info;
|
const struct object_info *info;
|
||||||
struct sm_object *obj;
|
struct sm_object *obj;
|
||||||
|
|
||||||
|
|
@ -1049,7 +1043,7 @@ create_object(struct impl *impl, struct pw_proxy *proxy,
|
||||||
|
|
||||||
info = get_object_info(impl, type);
|
info = get_object_info(impl, type);
|
||||||
if (info == NULL) {
|
if (info == NULL) {
|
||||||
pw_log_error(NAME" %p: unknown object type %d", impl, type);
|
pw_log_error(NAME" %p: unknown object type %s", impl, type);
|
||||||
errno = ENOTSUP;
|
errno = ENOTSUP;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -1062,7 +1056,7 @@ create_object(struct impl *impl, struct pw_proxy *proxy,
|
||||||
|
|
||||||
static struct sm_object *
|
static struct sm_object *
|
||||||
bind_object(struct impl *impl, const struct object_info *info, uint32_t id,
|
bind_object(struct impl *impl, const struct object_info *info, uint32_t id,
|
||||||
uint32_t permissions, uint32_t type, uint32_t version,
|
uint32_t permissions, const char *type, uint32_t version,
|
||||||
const struct spa_dict *props)
|
const struct spa_dict *props)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
|
@ -1090,15 +1084,15 @@ error:
|
||||||
static int
|
static int
|
||||||
update_object(struct impl *impl, const struct object_info *info,
|
update_object(struct impl *impl, const struct object_info *info,
|
||||||
struct sm_object *obj, uint32_t id,
|
struct sm_object *obj, uint32_t id,
|
||||||
uint32_t permissions, uint32_t type, uint32_t version,
|
uint32_t permissions, const char *type, uint32_t version,
|
||||||
const struct spa_dict *props)
|
const struct spa_dict *props)
|
||||||
{
|
{
|
||||||
pw_properties_update(obj->props, props);
|
pw_properties_update(obj->props, props);
|
||||||
|
|
||||||
if (obj->type == type)
|
if (strcmp(obj->type, type) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: update type:%d -> type:%d", impl, obj->type, type);
|
pw_log_debug(NAME" %p: update type:%s -> type:%s", impl, obj->type, type);
|
||||||
obj->handle = obj->proxy;
|
obj->handle = obj->proxy;
|
||||||
spa_hook_remove(&obj->proxy_listener);
|
spa_hook_remove(&obj->proxy_listener);
|
||||||
pw_proxy_add_listener(obj->handle, &obj->handle_listener, &proxy_events, obj);
|
pw_proxy_add_listener(obj->handle, &obj->handle_listener, &proxy_events, obj);
|
||||||
|
|
@ -1108,7 +1102,7 @@ update_object(struct impl *impl, const struct object_info *info,
|
||||||
|
|
||||||
obj->proxy = pw_registry_bind(impl->registry,
|
obj->proxy = pw_registry_bind(impl->registry,
|
||||||
id, info->type, info->version, 0);
|
id, info->type, info->version, 0);
|
||||||
obj->type = type;
|
obj->type = info->type;
|
||||||
|
|
||||||
pw_proxy_add_listener(obj->proxy, &obj->proxy_listener, &proxy_events, obj);
|
pw_proxy_add_listener(obj->proxy, &obj->proxy_listener, &proxy_events, obj);
|
||||||
if (info->events)
|
if (info->events)
|
||||||
|
|
@ -1123,15 +1117,14 @@ update_object(struct impl *impl, const struct object_info *info,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
registry_global(void *data, uint32_t id,
|
registry_global(void *data, uint32_t id,
|
||||||
uint32_t permissions, uint32_t type, uint32_t version,
|
uint32_t permissions, const char *type, uint32_t version,
|
||||||
const struct spa_dict *props)
|
const struct spa_dict *props)
|
||||||
{
|
{
|
||||||
struct impl *impl = data;
|
struct impl *impl = data;
|
||||||
struct sm_object *obj;
|
struct sm_object *obj;
|
||||||
const struct object_info *info;
|
const struct object_info *info;
|
||||||
|
|
||||||
pw_log_debug(NAME " %p: new global '%d' %s/%d", impl, id,
|
pw_log_debug(NAME " %p: new global '%d' %s/%d", impl, id, type, version);
|
||||||
spa_debug_type_find_name(pw_type_info(), type), version);
|
|
||||||
|
|
||||||
info = get_object_info(impl, type);
|
info = get_object_info(impl, type);
|
||||||
if (info == NULL)
|
if (info == NULL)
|
||||||
|
|
@ -1141,7 +1134,7 @@ registry_global(void *data, uint32_t id,
|
||||||
if (obj == NULL) {
|
if (obj == NULL) {
|
||||||
bind_object(impl, info, id, permissions, type, version, props);
|
bind_object(impl, info, id, permissions, type, version, props);
|
||||||
} else {
|
} else {
|
||||||
pw_log_debug(NAME " %p: our object %d appeared %d/%d",
|
pw_log_debug(NAME " %p: our object %d appeared %s/%s",
|
||||||
impl, id, obj->type, type);
|
impl, id, obj->type, type);
|
||||||
update_object(impl, info, obj, id, permissions, type, version, props);
|
update_object(impl, info, obj, id, permissions, type, version, props);
|
||||||
}
|
}
|
||||||
|
|
@ -1259,7 +1252,7 @@ static const struct pw_registry_events registry_events = {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pw_proxy *sm_media_session_export(struct sm_media_session *sess,
|
struct pw_proxy *sm_media_session_export(struct sm_media_session *sess,
|
||||||
uint32_t type, const struct spa_dict *props,
|
const char *type, const struct spa_dict *props,
|
||||||
void *object, size_t user_data_size)
|
void *object, size_t user_data_size)
|
||||||
{
|
{
|
||||||
struct impl *impl = SPA_CONTAINER_OF(sess, struct impl, this);
|
struct impl *impl = SPA_CONTAINER_OF(sess, struct impl, this);
|
||||||
|
|
@ -1285,7 +1278,7 @@ struct sm_device *sm_media_session_export_device(struct sm_media_session *sess,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct pw_proxy *sm_media_session_create_object(struct sm_media_session *sess,
|
struct pw_proxy *sm_media_session_create_object(struct sm_media_session *sess,
|
||||||
const char *factory_name, uint32_t type, uint32_t version,
|
const char *factory_name, const char *type, uint32_t version,
|
||||||
const struct spa_dict *props, size_t user_data_size)
|
const struct spa_dict *props, size_t user_data_size)
|
||||||
{
|
{
|
||||||
struct impl *impl = SPA_CONTAINER_OF(sess, struct impl, this);
|
struct impl *impl = SPA_CONTAINER_OF(sess, struct impl, this);
|
||||||
|
|
@ -1431,36 +1424,36 @@ int sm_media_session_create_links(struct sm_media_session *sess,
|
||||||
/* find output node */
|
/* find output node */
|
||||||
if ((str = spa_dict_lookup(dict, PW_KEY_LINK_OUTPUT_NODE)) != NULL &&
|
if ((str = spa_dict_lookup(dict, PW_KEY_LINK_OUTPUT_NODE)) != NULL &&
|
||||||
(obj = find_object(impl, atoi(str))) != NULL &&
|
(obj = find_object(impl, atoi(str))) != NULL &&
|
||||||
obj->type == PW_TYPE_INTERFACE_Node) {
|
strcmp(obj->type, PW_TYPE_INTERFACE_Node) == 0) {
|
||||||
outnode = (struct sm_node*)obj;
|
outnode = (struct sm_node*)obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find input node */
|
/* find input node */
|
||||||
if ((str = spa_dict_lookup(dict, PW_KEY_LINK_INPUT_NODE)) != NULL &&
|
if ((str = spa_dict_lookup(dict, PW_KEY_LINK_INPUT_NODE)) != NULL &&
|
||||||
(obj = find_object(impl, atoi(str))) != NULL &&
|
(obj = find_object(impl, atoi(str))) != NULL &&
|
||||||
obj->type == PW_TYPE_INTERFACE_Node) {
|
strcmp(obj->type, PW_TYPE_INTERFACE_Node) == 0) {
|
||||||
innode = (struct sm_node*)obj;
|
innode = (struct sm_node*)obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find endpoints and streams */
|
/* find endpoints and streams */
|
||||||
if ((str = spa_dict_lookup(dict, PW_KEY_ENDPOINT_LINK_OUTPUT_ENDPOINT)) != NULL &&
|
if ((str = spa_dict_lookup(dict, PW_KEY_ENDPOINT_LINK_OUTPUT_ENDPOINT)) != NULL &&
|
||||||
(obj = find_object(impl, atoi(str))) != NULL &&
|
(obj = find_object(impl, atoi(str))) != NULL &&
|
||||||
obj->type == PW_TYPE_INTERFACE_Endpoint) {
|
strcmp(obj->type, PW_TYPE_INTERFACE_Endpoint) == 0) {
|
||||||
outendpoint = (struct sm_endpoint*)obj;
|
outendpoint = (struct sm_endpoint*)obj;
|
||||||
}
|
}
|
||||||
if ((str = spa_dict_lookup(dict, PW_KEY_ENDPOINT_LINK_OUTPUT_STREAM)) != NULL &&
|
if ((str = spa_dict_lookup(dict, PW_KEY_ENDPOINT_LINK_OUTPUT_STREAM)) != NULL &&
|
||||||
(obj = find_object(impl, atoi(str))) != NULL &&
|
(obj = find_object(impl, atoi(str))) != NULL &&
|
||||||
obj->type == PW_TYPE_INTERFACE_EndpointStream) {
|
strcmp(obj->type, PW_TYPE_INTERFACE_EndpointStream) == 0) {
|
||||||
outstream = (struct sm_endpoint_stream*)obj;
|
outstream = (struct sm_endpoint_stream*)obj;
|
||||||
}
|
}
|
||||||
if ((str = spa_dict_lookup(dict, PW_KEY_ENDPOINT_LINK_INPUT_ENDPOINT)) != NULL &&
|
if ((str = spa_dict_lookup(dict, PW_KEY_ENDPOINT_LINK_INPUT_ENDPOINT)) != NULL &&
|
||||||
(obj = find_object(impl, atoi(str))) != NULL &&
|
(obj = find_object(impl, atoi(str))) != NULL &&
|
||||||
obj->type == PW_TYPE_INTERFACE_Endpoint) {
|
strcmp(obj->type, PW_TYPE_INTERFACE_Endpoint) == 0) {
|
||||||
inendpoint = (struct sm_endpoint*)obj;
|
inendpoint = (struct sm_endpoint*)obj;
|
||||||
}
|
}
|
||||||
if ((str = spa_dict_lookup(dict, PW_KEY_ENDPOINT_LINK_INPUT_STREAM)) != NULL &&
|
if ((str = spa_dict_lookup(dict, PW_KEY_ENDPOINT_LINK_INPUT_STREAM)) != NULL &&
|
||||||
(obj = find_object(impl, atoi(str))) != NULL &&
|
(obj = find_object(impl, atoi(str))) != NULL &&
|
||||||
obj->type == PW_TYPE_INTERFACE_EndpointStream) {
|
strcmp(obj->type, PW_TYPE_INTERFACE_EndpointStream) == 0) {
|
||||||
instream = (struct sm_endpoint_stream*)obj;
|
instream = (struct sm_endpoint_stream*)obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ struct sm_object_events {
|
||||||
|
|
||||||
struct sm_object {
|
struct sm_object {
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
uint32_t type;
|
const char *type;
|
||||||
|
|
||||||
struct spa_list link;
|
struct spa_list link;
|
||||||
struct sm_media_session *session;
|
struct sm_media_session *session;
|
||||||
|
|
@ -226,14 +226,14 @@ struct sm_object *sm_media_session_find_object(struct sm_media_session *sess, ui
|
||||||
int sm_media_session_schedule_rescan(struct sm_media_session *sess);
|
int sm_media_session_schedule_rescan(struct sm_media_session *sess);
|
||||||
|
|
||||||
struct pw_proxy *sm_media_session_export(struct sm_media_session *sess,
|
struct pw_proxy *sm_media_session_export(struct sm_media_session *sess,
|
||||||
uint32_t type, const struct spa_dict *props,
|
const char *type, const struct spa_dict *props,
|
||||||
void *object, size_t user_data_size);
|
void *object, size_t user_data_size);
|
||||||
|
|
||||||
struct sm_device *sm_media_session_export_device(struct sm_media_session *sess,
|
struct sm_device *sm_media_session_export_device(struct sm_media_session *sess,
|
||||||
const struct spa_dict *props, struct spa_device *device);
|
const struct spa_dict *props, struct spa_device *device);
|
||||||
|
|
||||||
struct pw_proxy *sm_media_session_create_object(struct sm_media_session *sess,
|
struct pw_proxy *sm_media_session_create_object(struct sm_media_session *sess,
|
||||||
const char *factory_name, uint32_t type, uint32_t version,
|
const char *factory_name, const char *type, uint32_t version,
|
||||||
const struct spa_dict *props, size_t user_data_size);
|
const struct spa_dict *props, size_t user_data_size);
|
||||||
|
|
||||||
struct sm_node *sm_media_session_create_node(struct sm_media_session *sess,
|
struct sm_node *sm_media_session_create_node(struct sm_media_session *sess,
|
||||||
|
|
|
||||||
|
|
@ -219,19 +219,13 @@ static void session_create(void *data, struct sm_object *object)
|
||||||
struct impl *impl = data;
|
struct impl *impl = data;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
switch (object->type) {
|
if (strcmp(object->type, PW_TYPE_INTERFACE_Endpoint) == 0)
|
||||||
case PW_TYPE_INTERFACE_Endpoint:
|
|
||||||
res = handle_endpoint(impl, object);
|
res = handle_endpoint(impl, object);
|
||||||
break;
|
else if (strcmp(object->type, PW_TYPE_INTERFACE_EndpointStream) == 0)
|
||||||
|
|
||||||
case PW_TYPE_INTERFACE_EndpointStream:
|
|
||||||
res = handle_stream(impl, object);
|
res = handle_stream(impl, object);
|
||||||
break;
|
else
|
||||||
|
|
||||||
default:
|
|
||||||
res = 0;
|
res = 0;
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
pw_log_warn(NAME" %p: can't handle global %d", impl, object->id);
|
pw_log_warn(NAME" %p: can't handle global %d", impl, object->id);
|
||||||
}
|
}
|
||||||
|
|
@ -244,23 +238,15 @@ static void session_remove(void *data, struct sm_object *object)
|
||||||
struct impl *impl = data;
|
struct impl *impl = data;
|
||||||
pw_log_debug(NAME " %p: remove global '%d'", impl, object->id);
|
pw_log_debug(NAME " %p: remove global '%d'", impl, object->id);
|
||||||
|
|
||||||
switch (object->type) {
|
if (strcmp(object->type, PW_TYPE_INTERFACE_Endpoint) == 0) {
|
||||||
case PW_TYPE_INTERFACE_Endpoint:
|
|
||||||
{
|
|
||||||
struct endpoint *ep;
|
struct endpoint *ep;
|
||||||
if ((ep = sm_object_get_data(object, SESSION_KEY)) != NULL)
|
if ((ep = sm_object_get_data(object, SESSION_KEY)) != NULL)
|
||||||
destroy_endpoint(impl, ep);
|
destroy_endpoint(impl, ep);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case PW_TYPE_INTERFACE_EndpointStream:
|
else if (strcmp(object->type, PW_TYPE_INTERFACE_EndpointStream) == 0) {
|
||||||
{
|
|
||||||
struct stream *s;
|
struct stream *s;
|
||||||
if ((s = sm_object_get_data(object, SESSION_KEY)) != NULL)
|
if ((s = sm_object_get_data(object, SESSION_KEY)) != NULL)
|
||||||
destroy_stream(impl, s);
|
destroy_stream(impl, s);
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sm_media_session_schedule_rescan(impl->session);
|
sm_media_session_schedule_rescan(impl->session);
|
||||||
|
|
@ -444,11 +430,11 @@ static int rescan_endpoint(struct impl *impl, struct endpoint *ep)
|
||||||
pw_log_info(NAME " %p: target:%d", impl, path_id);
|
pw_log_info(NAME " %p: target:%d", impl, path_id);
|
||||||
|
|
||||||
if ((obj = sm_media_session_find_object(impl->session, path_id)) != NULL) {
|
if ((obj = sm_media_session_find_object(impl->session, path_id)) != NULL) {
|
||||||
switch (obj->type) {
|
if (strcmp(obj->type, PW_TYPE_INTERFACE_Endpoint) == 0) {
|
||||||
case PW_TYPE_INTERFACE_Endpoint:
|
|
||||||
peer = sm_object_get_data(obj, SESSION_KEY);
|
peer = sm_object_get_data(obj, SESSION_KEY);
|
||||||
goto do_link;
|
goto do_link;
|
||||||
case PW_TYPE_INTERFACE_Node:
|
}
|
||||||
|
else if (strcmp(obj->type, PW_TYPE_INTERFACE_Node) == 0) {
|
||||||
node = (struct sm_node*)obj;
|
node = (struct sm_node*)obj;
|
||||||
goto do_link_node;
|
goto do_link_node;
|
||||||
}
|
}
|
||||||
|
|
@ -469,7 +455,7 @@ static int rescan_endpoint(struct impl *impl, struct endpoint *ep)
|
||||||
}
|
}
|
||||||
|
|
||||||
obj = sm_media_session_find_object(impl->session, ep->client_id);
|
obj = sm_media_session_find_object(impl->session, ep->client_id);
|
||||||
if (obj && obj->type == PW_TYPE_INTERFACE_Client) {
|
if (obj && strcmp(obj->type, PW_TYPE_INTERFACE_Client) == 0) {
|
||||||
pw_client_error((struct pw_client*)obj->proxy,
|
pw_client_error((struct pw_client*)obj->proxy,
|
||||||
ep->id, -ENOENT, "no endpoint available");
|
ep->id, -ENOENT, "no endpoint available");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,7 @@ static int client_endpoint_create_link(void *object, const struct spa_dict *prop
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
obj = sm_media_session_find_object(impl->session, atoi(str));
|
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);
|
pw_log_warn(NAME" %p: could not find endpoint %s (%p)", impl, str, obj);
|
||||||
res = -EINVAL;
|
res = -EINVAL;
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
@ -557,15 +557,11 @@ static void session_create(void *data, struct sm_object *object)
|
||||||
struct impl *impl = data;
|
struct impl *impl = data;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
switch (object->type) {
|
if (strcmp(object->type, PW_TYPE_INTERFACE_Node) == 0)
|
||||||
case PW_TYPE_INTERFACE_Node:
|
|
||||||
res = handle_node(impl, object);
|
res = handle_node(impl, object);
|
||||||
break;
|
else
|
||||||
|
|
||||||
default:
|
|
||||||
res = 0;
|
res = 0;
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
pw_log_warn(NAME" %p: can't handle global %d: %s", impl,
|
pw_log_warn(NAME" %p: can't handle global %d: %s", impl,
|
||||||
object->id, spa_strerror(res));
|
object->id, spa_strerror(res));
|
||||||
|
|
@ -576,16 +572,10 @@ static void session_remove(void *data, struct sm_object *object)
|
||||||
{
|
{
|
||||||
struct impl *impl = data;
|
struct impl *impl = data;
|
||||||
|
|
||||||
switch (object->type) {
|
if (strcmp(object->type, PW_TYPE_INTERFACE_Node) == 0) {
|
||||||
case PW_TYPE_INTERFACE_Node:
|
|
||||||
{
|
|
||||||
struct node *node;
|
struct node *node;
|
||||||
if ((node = sm_object_get_data(object, SESSION_KEY)) != NULL)
|
if ((node = sm_object_get_data(object, SESSION_KEY)) != NULL)
|
||||||
destroy_node(impl, node);
|
destroy_node(impl, node);
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ static int client_endpoint_create_link(void *object, const struct spa_dict *prop
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
obj = sm_media_session_find_object(impl->session, atoi(str));
|
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);
|
pw_log_warn(NAME" %p: could not find endpoint %s (%p)", impl, str, obj);
|
||||||
res = -EINVAL;
|
res = -EINVAL;
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
@ -591,15 +591,11 @@ static void session_create(void *data, struct sm_object *object)
|
||||||
struct impl *impl = data;
|
struct impl *impl = data;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
switch (object->type) {
|
if (strcmp(object->type, PW_TYPE_INTERFACE_Device) == 0)
|
||||||
case PW_TYPE_INTERFACE_Device:
|
|
||||||
res = handle_device(impl, object);
|
res = handle_device(impl, object);
|
||||||
break;
|
else
|
||||||
|
|
||||||
default:
|
|
||||||
res = 0;
|
res = 0;
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
pw_log_warn(NAME" %p: can't handle global %d: %s", impl,
|
pw_log_warn(NAME" %p: can't handle global %d: %s", impl,
|
||||||
object->id, spa_strerror(res));
|
object->id, spa_strerror(res));
|
||||||
|
|
@ -610,16 +606,10 @@ static void session_remove(void *data, struct sm_object *object)
|
||||||
{
|
{
|
||||||
struct impl *impl = data;
|
struct impl *impl = data;
|
||||||
|
|
||||||
switch (object->type) {
|
if (strcmp(object->type, PW_TYPE_INTERFACE_Device) == 0) {
|
||||||
case PW_TYPE_INTERFACE_Device:
|
|
||||||
{
|
|
||||||
struct device *device;
|
struct device *device;
|
||||||
if ((device = sm_object_get_data(object, SESSION_KEY)) != NULL)
|
if ((device = sm_object_get_data(object, SESSION_KEY)) != NULL)
|
||||||
destroy_device(impl, device);
|
destroy_device(impl, device);
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
#include <spa/node/node.h>
|
#include <spa/node/node.h>
|
||||||
#include <spa/utils/hook.h>
|
#include <spa/utils/hook.h>
|
||||||
#include <spa/utils/names.h>
|
#include <spa/utils/names.h>
|
||||||
|
#include <spa/utils/result.h>
|
||||||
#include <spa/param/props.h>
|
#include <spa/param/props.h>
|
||||||
#include <spa/debug/dict.h>
|
#include <spa/debug/dict.h>
|
||||||
#include <spa/pod/builder.h>
|
#include <spa/pod/builder.h>
|
||||||
|
|
@ -121,7 +122,7 @@ static struct node *v4l2_create_node(struct device *dev, uint32_t id,
|
||||||
|
|
||||||
pw_log_debug("new node %u", id);
|
pw_log_debug("new node %u", id);
|
||||||
|
|
||||||
if (info->type != SPA_TYPE_INTERFACE_Node) {
|
if (strcmp(info->type, SPA_TYPE_INTERFACE_Node) != 0) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -337,7 +338,7 @@ static struct device *v4l2_create_device(struct impl *impl, uint32_t id,
|
||||||
|
|
||||||
pw_log_debug("new device %u", id);
|
pw_log_debug("new device %u", id);
|
||||||
|
|
||||||
if (info->type != SPA_TYPE_INTERFACE_Device) {
|
if (strcmp(info->type, SPA_TYPE_INTERFACE_Device) != 0) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -352,7 +353,7 @@ static struct device *v4l2_create_device(struct impl *impl, uint32_t id,
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((res = spa_handle_get_interface(handle, info->type, &iface)) < 0) {
|
if ((res = spa_handle_get_interface(handle, info->type, &iface)) < 0) {
|
||||||
pw_log_error("can't get %d interface: %d", info->type, res);
|
pw_log_error("can't get %s interface: %s", info->type, spa_strerror(res));
|
||||||
goto unload_handle;
|
goto unload_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,10 @@ extern "C" {
|
||||||
#include <spa/utils/defs.h>
|
#include <spa/utils/defs.h>
|
||||||
#include <spa/param/param.h>
|
#include <spa/param/param.h>
|
||||||
|
|
||||||
struct pw_client_node;
|
#define PW_TYPE_INTERFACE_ClientNode PW_TYPE_INFO_INTERFACE_BASE "ClientNode"
|
||||||
|
|
||||||
#define PW_VERSION_CLIENT_NODE 3
|
#define PW_VERSION_CLIENT_NODE 3
|
||||||
|
struct pw_client_node;
|
||||||
|
|
||||||
#define PW_EXTENSION_MODULE_CLIENT_NODE PIPEWIRE_MODULE_PREFIX "module-client-node"
|
#define PW_EXTENSION_MODULE_CLIENT_NODE PIPEWIRE_MODULE_PREFIX "module-client-node"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,10 @@ extern "C" {
|
||||||
|
|
||||||
#include <spa/utils/defs.h>
|
#include <spa/utils/defs.h>
|
||||||
|
|
||||||
struct pw_metadata;
|
#define PW_TYPE_INTERFACE_Metadata PW_TYPE_INFO_INTERFACE_BASE "Metadata"
|
||||||
|
|
||||||
#define PW_VERSION_METADATA 3
|
#define PW_VERSION_METADATA 3
|
||||||
|
struct pw_metadata;
|
||||||
|
|
||||||
#define PW_EXTENSION_MODULE_METADATA PIPEWIRE_MODULE_PREFIX "module-metadata"
|
#define PW_EXTENSION_MODULE_METADATA PIPEWIRE_MODULE_PREFIX "module-metadata"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,9 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PW_VERSION_CLIENT_ENDPOINT 0
|
#define PW_TYPE_INTERFACE_ClientEndpoint PW_TYPE_INFO_INTERFACE_BASE "ClientEndpoint"
|
||||||
|
|
||||||
|
#define PW_VERSION_CLIENT_ENDPOINT 0
|
||||||
struct pw_client_endpoint;
|
struct pw_client_endpoint;
|
||||||
|
|
||||||
#define PW_CLIENT_ENDPOINT_EVENT_SET_SESSION_ID 0
|
#define PW_CLIENT_ENDPOINT_EVENT_SET_SESSION_ID 0
|
||||||
|
|
@ -166,6 +168,7 @@ struct pw_client_endpoint_methods {
|
||||||
#define pw_client_endpoint_update(o,...) pw_client_endpoint_method(o,update,0,__VA_ARGS__)
|
#define pw_client_endpoint_update(o,...) pw_client_endpoint_method(o,update,0,__VA_ARGS__)
|
||||||
#define pw_client_endpoint_stream_update(o,...) pw_client_endpoint_method(o,stream_update,0,__VA_ARGS__)
|
#define pw_client_endpoint_stream_update(o,...) pw_client_endpoint_method(o,stream_update,0,__VA_ARGS__)
|
||||||
|
|
||||||
|
#define PW_TYPE_INTERFACE_ClientSession PW_TYPE_INFO_INTERFACE_BASE "ClientSession"
|
||||||
|
|
||||||
#define PW_VERSION_CLIENT_SESSION 0
|
#define PW_VERSION_CLIENT_SESSION 0
|
||||||
struct pw_client_session;
|
struct pw_client_session;
|
||||||
|
|
|
||||||
|
|
@ -35,12 +35,19 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PW_VERSION_SESSION 0
|
#define PW_TYPE_INTERFACE_Session PW_TYPE_INFO_INTERFACE_BASE "Session"
|
||||||
|
#define PW_VERSION_SESSION 0
|
||||||
struct pw_session;
|
struct pw_session;
|
||||||
#define PW_VERSION_ENDPOINT 0
|
|
||||||
|
#define PW_TYPE_INTERFACE_Endpoint PW_TYPE_INFO_INTERFACE_BASE "Endpoint"
|
||||||
|
#define PW_VERSION_ENDPOINT 0
|
||||||
struct pw_endpoint;
|
struct pw_endpoint;
|
||||||
#define PW_VERSION_ENDPOINT_STREAM 0
|
|
||||||
|
#define PW_TYPE_INTERFACE_EndpointStream PW_TYPE_INFO_INTERFACE_BASE "EndpointStream"
|
||||||
|
#define PW_VERSION_ENDPOINT_STREAM 0
|
||||||
struct pw_endpoint_stream;
|
struct pw_endpoint_stream;
|
||||||
|
|
||||||
|
#define PW_TYPE_INTERFACE_EndpointLink PW_TYPE_INFO_INTERFACE_BASE "EndpointLink"
|
||||||
#define PW_VERSION_ENDPOINT_LINK 0
|
#define PW_VERSION_ENDPOINT_LINK 0
|
||||||
struct pw_endpoint_link;
|
struct pw_endpoint_link;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -447,19 +447,18 @@ static const struct pw_proxy_events proxy_port_events = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static void registry_event_global(void *data, uint32_t id, uint32_t permissions,
|
static void registry_event_global(void *data, uint32_t id, uint32_t permissions,
|
||||||
uint32_t type, uint32_t version,
|
const char *type, uint32_t version,
|
||||||
const struct spa_dict *props)
|
const struct spa_dict *props)
|
||||||
{
|
{
|
||||||
struct core_data *rd = data;
|
struct core_data *rd = data;
|
||||||
GstPipeWireDeviceProvider *self = rd->self;
|
GstPipeWireDeviceProvider *self = rd->self;
|
||||||
struct node_data *nd;
|
struct node_data *nd;
|
||||||
|
|
||||||
if (type == PW_TYPE_INTERFACE_Node) {
|
if (strcmp(type, PW_TYPE_INTERFACE_Node) == 0) {
|
||||||
struct pw_node *node;
|
struct pw_node *node;
|
||||||
|
|
||||||
node = pw_registry_bind(rd->registry,
|
node = pw_registry_bind(rd->registry,
|
||||||
id, PW_TYPE_INTERFACE_Node,
|
id, type, PW_VERSION_NODE, sizeof(*nd));
|
||||||
PW_VERSION_NODE, sizeof(*nd));
|
|
||||||
if (node == NULL)
|
if (node == NULL)
|
||||||
goto no_mem;
|
goto no_mem;
|
||||||
|
|
||||||
|
|
@ -473,7 +472,7 @@ static void registry_event_global(void *data, uint32_t id, uint32_t permissions,
|
||||||
pw_proxy_add_listener((struct pw_proxy*)node, &nd->proxy_listener, &proxy_node_events, nd);
|
pw_proxy_add_listener((struct pw_proxy*)node, &nd->proxy_listener, &proxy_node_events, nd);
|
||||||
add_pending(self, &nd->pending, NULL, NULL);
|
add_pending(self, &nd->pending, NULL, NULL);
|
||||||
}
|
}
|
||||||
else if (type == PW_TYPE_INTERFACE_Port) {
|
else if (strcmp(type, PW_TYPE_INTERFACE_Port) == 0) {
|
||||||
struct pw_port *port;
|
struct pw_port *port;
|
||||||
struct port_data *pd;
|
struct port_data *pd;
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
@ -485,8 +484,7 @@ static void registry_event_global(void *data, uint32_t id, uint32_t permissions,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
port = pw_registry_bind(rd->registry,
|
port = pw_registry_bind(rd->registry,
|
||||||
id, PW_TYPE_INTERFACE_Port,
|
id, type, PW_VERSION_PORT, sizeof(*pd));
|
||||||
PW_VERSION_PORT, sizeof(*pd));
|
|
||||||
if (port == NULL)
|
if (port == NULL)
|
||||||
goto no_mem;
|
goto no_mem;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ static const struct pw_impl_node_events node_events = {
|
||||||
|
|
||||||
static void *create_object(void *_data,
|
static void *create_object(void *_data,
|
||||||
struct pw_resource *resource,
|
struct pw_resource *resource,
|
||||||
uint32_t type,
|
const char *type,
|
||||||
uint32_t version,
|
uint32_t version,
|
||||||
struct pw_properties *properties,
|
struct pw_properties *properties,
|
||||||
uint32_t new_id)
|
uint32_t new_id)
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ static const struct spa_dict_item module_props[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pw_proxy *pw_core_spa_device_export(struct pw_core *core,
|
struct pw_proxy *pw_core_spa_device_export(struct pw_core *core,
|
||||||
uint32_t type, const struct spa_dict *props, void *object,
|
const char *type, const struct spa_dict *props, void *object,
|
||||||
size_t user_data_size);
|
size_t user_data_size);
|
||||||
|
|
||||||
struct pw_protocol *pw_protocol_native_ext_client_device_init(struct pw_context *context);
|
struct pw_protocol *pw_protocol_native_ext_client_device_init(struct pw_context *context);
|
||||||
|
|
@ -60,7 +60,7 @@ struct factory_data {
|
||||||
|
|
||||||
static void *create_object(void *_data,
|
static void *create_object(void *_data,
|
||||||
struct pw_resource *resource,
|
struct pw_resource *resource,
|
||||||
uint32_t type,
|
const char *type,
|
||||||
uint32_t version,
|
uint32_t version,
|
||||||
struct pw_properties *properties,
|
struct pw_properties *properties,
|
||||||
uint32_t new_id)
|
uint32_t new_id)
|
||||||
|
|
|
||||||
|
|
@ -425,7 +425,7 @@ static void device_marshal_object_info(void *object, uint32_t id,
|
||||||
|
|
||||||
spa_pod_builder_push_struct(b, &f[1]);
|
spa_pod_builder_push_struct(b, &f[1]);
|
||||||
spa_pod_builder_add(b,
|
spa_pod_builder_add(b,
|
||||||
SPA_POD_Id(info->type),
|
SPA_POD_String(info->type),
|
||||||
SPA_POD_Long(change_mask),
|
SPA_POD_Long(change_mask),
|
||||||
SPA_POD_Long(info->flags),
|
SPA_POD_Long(info->flags),
|
||||||
SPA_POD_Int(n_items), NULL);
|
SPA_POD_Int(n_items), NULL);
|
||||||
|
|
@ -465,7 +465,7 @@ static int device_demarshal_object_info(void *object,
|
||||||
spa_pod_parser_pod(&p2, ipod);
|
spa_pod_parser_pod(&p2, ipod);
|
||||||
if (spa_pod_parser_push_struct(&p2, &f2) < 0 ||
|
if (spa_pod_parser_push_struct(&p2, &f2) < 0 ||
|
||||||
spa_pod_parser_get(&p2,
|
spa_pod_parser_get(&p2,
|
||||||
SPA_POD_Id(&info.type),
|
SPA_POD_String(&info.type),
|
||||||
SPA_POD_Long(&info.change_mask),
|
SPA_POD_Long(&info.change_mask),
|
||||||
SPA_POD_Long(&info.flags),
|
SPA_POD_Long(&info.flags),
|
||||||
SPA_POD_Int(&props.n_items), NULL) < 0)
|
SPA_POD_Int(&props.n_items), NULL) < 0)
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,9 @@ static const struct spa_dict_item module_props[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pw_proxy *pw_core_node_export(struct pw_core *core,
|
struct pw_proxy *pw_core_node_export(struct pw_core *core,
|
||||||
uint32_t type, const struct spa_dict *props, void *object, size_t user_data_size);
|
const char *type, const struct spa_dict *props, void *object, size_t user_data_size);
|
||||||
struct pw_proxy *pw_core_spa_node_export(struct pw_core *core,
|
struct pw_proxy *pw_core_spa_node_export(struct pw_core *core,
|
||||||
uint32_t type, const struct spa_dict *props, void *object, size_t user_data_size);
|
const char *type, const struct spa_dict *props, void *object, size_t user_data_size);
|
||||||
|
|
||||||
struct pw_protocol *pw_protocol_native_ext_client_node_init(struct pw_context *context);
|
struct pw_protocol *pw_protocol_native_ext_client_node_init(struct pw_context *context);
|
||||||
struct pw_protocol *pw_protocol_native_ext_client_node0_init(struct pw_context *context);
|
struct pw_protocol *pw_protocol_native_ext_client_node0_init(struct pw_context *context);
|
||||||
|
|
@ -64,7 +64,7 @@ struct factory_data {
|
||||||
|
|
||||||
static void *create_object(void *_data,
|
static void *create_object(void *_data,
|
||||||
struct pw_resource *resource,
|
struct pw_resource *resource,
|
||||||
uint32_t type,
|
const char *type,
|
||||||
uint32_t version,
|
uint32_t version,
|
||||||
struct pw_properties *properties,
|
struct pw_properties *properties,
|
||||||
uint32_t new_id)
|
uint32_t new_id)
|
||||||
|
|
|
||||||
|
|
@ -1090,21 +1090,10 @@ node_init(struct node *this,
|
||||||
const struct spa_support *support,
|
const struct spa_support *support,
|
||||||
uint32_t n_support)
|
uint32_t n_support)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
|
this->data_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
|
||||||
|
this->data_system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataSystem);
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
|
||||||
switch (support[i].type) {
|
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataLoop:
|
|
||||||
this->data_loop = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataSystem:
|
|
||||||
this->data_system = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this->data_loop == NULL) {
|
if (this->data_loop == NULL) {
|
||||||
spa_log_error(this->log, "a data-loop is needed");
|
spa_log_error(this->log, "a data-loop is needed");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
||||||
|
|
@ -1078,21 +1078,10 @@ node_init(struct node *this,
|
||||||
const struct spa_support *support,
|
const struct spa_support *support,
|
||||||
uint32_t n_support)
|
uint32_t n_support)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||||
|
this->data_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
|
||||||
|
this->data_system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataSystem);
|
||||||
|
|
||||||
for (i = 0; i < n_support; i++) {
|
|
||||||
switch (support[i].type) {
|
|
||||||
case SPA_TYPE_INTERFACE_Log:
|
|
||||||
this->log = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataLoop:
|
|
||||||
this->data_loop = support[i].data;
|
|
||||||
break;
|
|
||||||
case SPA_TYPE_INTERFACE_DataSystem:
|
|
||||||
this->data_system = support[i].data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this->data_loop == NULL) {
|
if (this->data_loop == NULL) {
|
||||||
spa_log_error(this->log, "a data-loop is needed");
|
spa_log_error(this->log, "a data-loop is needed");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@ extern "C" {
|
||||||
|
|
||||||
#include <pipewire/proxy.h>
|
#include <pipewire/proxy.h>
|
||||||
|
|
||||||
|
#define PW_TYPE_INTERFACE_ClientNode PW_TYPE_INFO_INTERFACE_BASE "ClientNode"
|
||||||
|
|
||||||
#define PW_VERSION_CLIENT_NODE0 0
|
#define PW_VERSION_CLIENT_NODE0 0
|
||||||
|
|
||||||
struct pw_client_node0_message;
|
struct pw_client_node0_message;
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@ static struct pw_impl_port *get_port(struct pw_impl_node *node, enum spa_directi
|
||||||
|
|
||||||
static void *create_object(void *_data,
|
static void *create_object(void *_data,
|
||||||
struct pw_resource *resource,
|
struct pw_resource *resource,
|
||||||
uint32_t type,
|
const char *type,
|
||||||
uint32_t version,
|
uint32_t version,
|
||||||
struct pw_properties *properties,
|
struct pw_properties *properties,
|
||||||
uint32_t new_id)
|
uint32_t new_id)
|
||||||
|
|
@ -214,13 +214,13 @@ static void *create_object(void *_data,
|
||||||
input_port_id = str ? pw_properties_parse_int(str) : -1;
|
input_port_id = str ? pw_properties_parse_int(str) : -1;
|
||||||
|
|
||||||
global = pw_context_find_global(context, output_node_id);
|
global = pw_context_find_global(context, output_node_id);
|
||||||
if (global == NULL || pw_global_get_type(global) != PW_TYPE_INTERFACE_Node)
|
if (global == NULL || !pw_global_is_type(global, PW_TYPE_INTERFACE_Node))
|
||||||
goto error_output;
|
goto error_output;
|
||||||
|
|
||||||
output_node = pw_global_get_object(global);
|
output_node = pw_global_get_object(global);
|
||||||
|
|
||||||
global = pw_context_find_global(context, input_node_id);
|
global = pw_context_find_global(context, input_node_id);
|
||||||
if (global == NULL || pw_global_get_type(global) != PW_TYPE_INTERFACE_Node)
|
if (global == NULL || !pw_global_is_type(global, PW_TYPE_INTERFACE_Node))
|
||||||
goto error_input;
|
goto error_input;
|
||||||
|
|
||||||
input_node = pw_global_get_object(global);
|
input_node = pw_global_get_object(global);
|
||||||
|
|
@ -230,7 +230,7 @@ static void *create_object(void *_data,
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
global = pw_context_find_global(context, output_port_id);
|
global = pw_context_find_global(context, output_port_id);
|
||||||
if (global == NULL || pw_global_get_type(global) != PW_TYPE_INTERFACE_Port)
|
if (global == NULL || !pw_global_is_type(global, PW_TYPE_INTERFACE_Port))
|
||||||
goto error_output_port;
|
goto error_output_port;
|
||||||
|
|
||||||
outport = pw_global_get_object(global);
|
outport = pw_global_get_object(global);
|
||||||
|
|
@ -242,7 +242,7 @@ static void *create_object(void *_data,
|
||||||
inport = get_port(input_node, SPA_DIRECTION_INPUT);
|
inport = get_port(input_node, SPA_DIRECTION_INPUT);
|
||||||
else {
|
else {
|
||||||
global = pw_context_find_global(context, input_port_id);
|
global = pw_context_find_global(context, input_port_id);
|
||||||
if (global == NULL || pw_global_get_type(global) != PW_TYPE_INTERFACE_Port)
|
if (global == NULL || !pw_global_is_type(global, PW_TYPE_INTERFACE_Port))
|
||||||
goto error_input_port;
|
goto error_input_port;
|
||||||
|
|
||||||
inport = pw_global_get_object(global);
|
inport = pw_global_get_object(global);
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ void * pw_metadata_new(struct pw_context *context, struct pw_resource *resource,
|
||||||
struct pw_properties *properties);
|
struct pw_properties *properties);
|
||||||
|
|
||||||
struct pw_proxy *pw_core_metadata_export(struct pw_core *core,
|
struct pw_proxy *pw_core_metadata_export(struct pw_core *core,
|
||||||
uint32_t type, const struct spa_dict *props, void *object, size_t user_data_size);
|
const char *type, const struct spa_dict *props, void *object, size_t user_data_size);
|
||||||
|
|
||||||
int pw_protocol_native_ext_metadata_init(struct pw_context *context);
|
int pw_protocol_native_ext_metadata_init(struct pw_context *context);
|
||||||
|
|
||||||
|
|
@ -62,7 +62,7 @@ struct factory_data {
|
||||||
|
|
||||||
static void *create_object(void *_data,
|
static void *create_object(void *_data,
|
||||||
struct pw_resource *resource,
|
struct pw_resource *resource,
|
||||||
uint32_t type,
|
const char *type,
|
||||||
uint32_t version,
|
uint32_t version,
|
||||||
struct pw_properties *properties,
|
struct pw_properties *properties,
|
||||||
uint32_t new_id)
|
uint32_t new_id)
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,7 @@ static void push_params(struct spa_pod_builder *b, uint32_t n_params,
|
||||||
static void *
|
static void *
|
||||||
core_method_marshal_create_object(void *object,
|
core_method_marshal_create_object(void *object,
|
||||||
const char *factory_name,
|
const char *factory_name,
|
||||||
uint32_t type, uint32_t version,
|
const char *type, uint32_t version,
|
||||||
const struct spa_dict *props, size_t user_data_size)
|
const struct spa_dict *props, size_t user_data_size)
|
||||||
{
|
{
|
||||||
struct pw_proxy *proxy = object;
|
struct pw_proxy *proxy = object;
|
||||||
|
|
@ -213,7 +213,7 @@ core_method_marshal_create_object(void *object,
|
||||||
spa_pod_builder_push_struct(b, &f);
|
spa_pod_builder_push_struct(b, &f);
|
||||||
spa_pod_builder_add(b,
|
spa_pod_builder_add(b,
|
||||||
SPA_POD_String(factory_name),
|
SPA_POD_String(factory_name),
|
||||||
SPA_POD_Id(type),
|
SPA_POD_String(type),
|
||||||
SPA_POD_Int(version),
|
SPA_POD_Int(version),
|
||||||
NULL);
|
NULL);
|
||||||
push_dict(b, props);
|
push_dict(b, props);
|
||||||
|
|
@ -595,15 +595,15 @@ static int core_method_demarshal_create_object(void *object, const struct pw_pro
|
||||||
struct pw_resource *resource = object;
|
struct pw_resource *resource = object;
|
||||||
struct spa_pod_parser prs;
|
struct spa_pod_parser prs;
|
||||||
struct spa_pod_frame f[2];
|
struct spa_pod_frame f[2];
|
||||||
uint32_t version, type, new_id;
|
uint32_t version, new_id;
|
||||||
const char *factory_name;
|
const char *factory_name, *type;
|
||||||
struct spa_dict props = SPA_DICT_INIT(NULL, 0);
|
struct spa_dict props = SPA_DICT_INIT(NULL, 0);
|
||||||
|
|
||||||
spa_pod_parser_init(&prs, msg->data, msg->size);
|
spa_pod_parser_init(&prs, msg->data, msg->size);
|
||||||
if (spa_pod_parser_push_struct(&prs, &f[0]) < 0 ||
|
if (spa_pod_parser_push_struct(&prs, &f[0]) < 0 ||
|
||||||
spa_pod_parser_get(&prs,
|
spa_pod_parser_get(&prs,
|
||||||
SPA_POD_String(&factory_name),
|
SPA_POD_String(&factory_name),
|
||||||
SPA_POD_Id(&type),
|
SPA_POD_String(&type),
|
||||||
SPA_POD_Int(&version),
|
SPA_POD_Int(&version),
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
@ -664,7 +664,7 @@ static int registry_method_marshal_add_listener(void *object,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void registry_marshal_global(void *object, uint32_t id, uint32_t permissions,
|
static void registry_marshal_global(void *object, uint32_t id, uint32_t permissions,
|
||||||
uint32_t type, uint32_t version, const struct spa_dict *props)
|
const char *type, uint32_t version, const struct spa_dict *props)
|
||||||
{
|
{
|
||||||
struct pw_resource *resource = object;
|
struct pw_resource *resource = object;
|
||||||
struct spa_pod_builder *b;
|
struct spa_pod_builder *b;
|
||||||
|
|
@ -676,7 +676,7 @@ static void registry_marshal_global(void *object, uint32_t id, uint32_t permissi
|
||||||
spa_pod_builder_add(b,
|
spa_pod_builder_add(b,
|
||||||
SPA_POD_Int(id),
|
SPA_POD_Int(id),
|
||||||
SPA_POD_Int(permissions),
|
SPA_POD_Int(permissions),
|
||||||
SPA_POD_Id(type),
|
SPA_POD_String(type),
|
||||||
SPA_POD_Int(version),
|
SPA_POD_Int(version),
|
||||||
NULL);
|
NULL);
|
||||||
push_dict(b, props);
|
push_dict(b, props);
|
||||||
|
|
@ -701,12 +701,13 @@ static int registry_demarshal_bind(void *object, const struct pw_protocol_native
|
||||||
{
|
{
|
||||||
struct pw_resource *resource = object;
|
struct pw_resource *resource = object;
|
||||||
struct spa_pod_parser prs;
|
struct spa_pod_parser prs;
|
||||||
uint32_t id, version, type, new_id;
|
uint32_t id, version, new_id;
|
||||||
|
char *type;
|
||||||
|
|
||||||
spa_pod_parser_init(&prs, msg->data, msg->size);
|
spa_pod_parser_init(&prs, msg->data, msg->size);
|
||||||
if (spa_pod_parser_get_struct(&prs,
|
if (spa_pod_parser_get_struct(&prs,
|
||||||
SPA_POD_Int(&id),
|
SPA_POD_Int(&id),
|
||||||
SPA_POD_Id(&type),
|
SPA_POD_String(&type),
|
||||||
SPA_POD_Int(&version),
|
SPA_POD_Int(&version),
|
||||||
SPA_POD_Int(&new_id)) < 0)
|
SPA_POD_Int(&new_id)) < 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
@ -998,7 +999,7 @@ static void factory_marshal_info(void *object, const struct pw_factory_info *inf
|
||||||
spa_pod_builder_add(b,
|
spa_pod_builder_add(b,
|
||||||
SPA_POD_Int(info->id),
|
SPA_POD_Int(info->id),
|
||||||
SPA_POD_String(info->name),
|
SPA_POD_String(info->name),
|
||||||
SPA_POD_Id(info->type),
|
SPA_POD_String(info->type),
|
||||||
SPA_POD_Int(info->version),
|
SPA_POD_Int(info->version),
|
||||||
SPA_POD_Long(info->change_mask),
|
SPA_POD_Long(info->change_mask),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
@ -1021,7 +1022,7 @@ static int factory_demarshal_info(void *object, const struct pw_protocol_native_
|
||||||
spa_pod_parser_get(&prs,
|
spa_pod_parser_get(&prs,
|
||||||
SPA_POD_Int(&info.id),
|
SPA_POD_Int(&info.id),
|
||||||
SPA_POD_String(&info.name),
|
SPA_POD_String(&info.name),
|
||||||
SPA_POD_Id(&info.type),
|
SPA_POD_String(&info.type),
|
||||||
SPA_POD_Int(&info.version),
|
SPA_POD_Int(&info.version),
|
||||||
SPA_POD_Long(&info.change_mask), NULL) < 0)
|
SPA_POD_Long(&info.change_mask), NULL) < 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
@ -1815,7 +1816,8 @@ static int registry_demarshal_global(void *object, const struct pw_protocol_nati
|
||||||
struct pw_proxy *proxy = object;
|
struct pw_proxy *proxy = object;
|
||||||
struct spa_pod_parser prs;
|
struct spa_pod_parser prs;
|
||||||
struct spa_pod_frame f[2];
|
struct spa_pod_frame f[2];
|
||||||
uint32_t id, permissions, type, version;
|
uint32_t id, permissions, version;
|
||||||
|
char *type;
|
||||||
struct spa_dict props = SPA_DICT_INIT(NULL, 0);
|
struct spa_dict props = SPA_DICT_INIT(NULL, 0);
|
||||||
|
|
||||||
spa_pod_parser_init(&prs, msg->data, msg->size);
|
spa_pod_parser_init(&prs, msg->data, msg->size);
|
||||||
|
|
@ -1823,7 +1825,7 @@ static int registry_demarshal_global(void *object, const struct pw_protocol_nati
|
||||||
spa_pod_parser_get(&prs,
|
spa_pod_parser_get(&prs,
|
||||||
SPA_POD_Int(&id),
|
SPA_POD_Int(&id),
|
||||||
SPA_POD_Int(&permissions),
|
SPA_POD_Int(&permissions),
|
||||||
SPA_POD_Id(&type),
|
SPA_POD_String(&type),
|
||||||
SPA_POD_Int(&version), NULL) < 0)
|
SPA_POD_Int(&version), NULL) < 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
|
@ -1856,7 +1858,7 @@ static int registry_demarshal_global_remove(void *object, const struct pw_protoc
|
||||||
}
|
}
|
||||||
|
|
||||||
static void * registry_marshal_bind(void *object, uint32_t id,
|
static void * registry_marshal_bind(void *object, uint32_t id,
|
||||||
uint32_t type, uint32_t version, size_t user_data_size)
|
const char *type, uint32_t version, size_t user_data_size)
|
||||||
{
|
{
|
||||||
struct pw_proxy *proxy = object;
|
struct pw_proxy *proxy = object;
|
||||||
struct spa_pod_builder *b;
|
struct spa_pod_builder *b;
|
||||||
|
|
@ -1873,7 +1875,7 @@ static void * registry_marshal_bind(void *object, uint32_t id,
|
||||||
|
|
||||||
spa_pod_builder_add_struct(b,
|
spa_pod_builder_add_struct(b,
|
||||||
SPA_POD_Int(id),
|
SPA_POD_Int(id),
|
||||||
SPA_POD_Id(type),
|
SPA_POD_String(type),
|
||||||
SPA_POD_Int(version),
|
SPA_POD_Int(version),
|
||||||
SPA_POD_Int(new_id));
|
SPA_POD_Int(new_id));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,9 @@
|
||||||
#include "pipewire/protocol.h"
|
#include "pipewire/protocol.h"
|
||||||
#include "pipewire/resource.h"
|
#include "pipewire/resource.h"
|
||||||
#include "extensions/protocol-native.h"
|
#include "extensions/protocol-native.h"
|
||||||
|
#include "extensions/metadata.h"
|
||||||
|
#include "extensions/session-manager.h"
|
||||||
|
#include "extensions/client-node.h"
|
||||||
|
|
||||||
#include "interfaces.h"
|
#include "interfaces.h"
|
||||||
#include "typemap.h"
|
#include "typemap.h"
|
||||||
|
|
@ -275,6 +278,23 @@ uint32_t pw_protocol_native0_type_from_v2(struct pw_impl_client *client, uint32_
|
||||||
return type_map[index].id;
|
return type_map[index].id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SPA_EXPORT
|
||||||
|
const char * pw_protocol_native0_name_from_v2(struct pw_impl_client *client, uint32_t type)
|
||||||
|
{
|
||||||
|
void *t;
|
||||||
|
uint32_t index;
|
||||||
|
struct protocol_compat_v2 *compat_v2 = client->compat_v2;
|
||||||
|
|
||||||
|
if ((t = pw_map_lookup(&compat_v2->types, type)) == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
index = PW_MAP_PTR_TO_ID(t);
|
||||||
|
if (index >= SPA_N_ELEMENTS(type_map))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return type_map[index].name;
|
||||||
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
uint32_t pw_protocol_native0_type_to_v2(struct pw_impl_client *client,
|
uint32_t pw_protocol_native0_type_to_v2(struct pw_impl_client *client,
|
||||||
const struct spa_type_info *info, uint32_t type)
|
const struct spa_type_info *info, uint32_t type)
|
||||||
|
|
@ -614,7 +634,7 @@ static int core_demarshal_create_object(void *object, const struct pw_protocol_n
|
||||||
struct spa_pod_parser prs;
|
struct spa_pod_parser prs;
|
||||||
struct spa_pod_frame f;
|
struct spa_pod_frame f;
|
||||||
uint32_t version, type, new_id, i;
|
uint32_t version, type, new_id, i;
|
||||||
const char *factory_name;
|
const char *factory_name, *type_name;
|
||||||
struct spa_dict props;
|
struct spa_dict props;
|
||||||
|
|
||||||
spa_pod_parser_init(&prs, msg->data, msg->size);
|
spa_pod_parser_init(&prs, msg->data, msg->size);
|
||||||
|
|
@ -636,10 +656,12 @@ static int core_demarshal_create_object(void *object, const struct pw_protocol_n
|
||||||
if (spa_pod_parser_get(&prs, "i", &new_id, NULL) < 0)
|
if (spa_pod_parser_get(&prs, "i", &new_id, NULL) < 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
type = pw_protocol_native0_type_from_v2(client, type);
|
type_name = pw_protocol_native0_name_from_v2(client, type);
|
||||||
|
if (type_name == NULL)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
return pw_resource_notify(resource, struct pw_core_methods, create_object, 0, factory_name,
|
return pw_resource_notify(resource, struct pw_core_methods, create_object, 0, factory_name,
|
||||||
type, version,
|
type_name, version,
|
||||||
&props, new_id);
|
&props, new_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -702,19 +724,20 @@ static int core_demarshal_update_types_server(void *object, const struct pw_prot
|
||||||
}
|
}
|
||||||
|
|
||||||
static void registry_marshal_global(void *object, uint32_t id, uint32_t permissions,
|
static void registry_marshal_global(void *object, uint32_t id, uint32_t permissions,
|
||||||
uint32_t type, uint32_t version, const struct spa_dict *props)
|
const char *type, uint32_t version, const struct spa_dict *props)
|
||||||
{
|
{
|
||||||
struct pw_resource *resource = object;
|
struct pw_resource *resource = object;
|
||||||
struct pw_impl_client *client = resource->client;
|
struct pw_impl_client *client = resource->client;
|
||||||
struct spa_pod_builder *b;
|
struct spa_pod_builder *b;
|
||||||
struct spa_pod_frame f;
|
struct spa_pod_frame f;
|
||||||
uint32_t i, n_items, parent_id;
|
uint32_t i, n_items, parent_id;
|
||||||
|
uint32_t type_id;
|
||||||
|
|
||||||
b = pw_protocol_native_begin_resource(resource, PW_REGISTRY_V0_EVENT_GLOBAL, NULL);
|
b = pw_protocol_native_begin_resource(resource, PW_REGISTRY_V0_EVENT_GLOBAL, NULL);
|
||||||
|
|
||||||
n_items = props ? props->n_items : 0;
|
n_items = props ? props->n_items : 0;
|
||||||
|
|
||||||
type = pw_protocol_native0_type_to_v2(client, pw_type_info(), type);
|
type_id = pw_protocol_native0_find_type(client, type);
|
||||||
parent_id = 0;
|
parent_id = 0;
|
||||||
version = 0;
|
version = 0;
|
||||||
|
|
||||||
|
|
@ -723,7 +746,7 @@ static void registry_marshal_global(void *object, uint32_t id, uint32_t permissi
|
||||||
"i", id,
|
"i", id,
|
||||||
"i", parent_id,
|
"i", parent_id,
|
||||||
"i", permissions,
|
"i", permissions,
|
||||||
"I", type,
|
"I", type_id,
|
||||||
"i", version,
|
"i", version,
|
||||||
"i", n_items, NULL);
|
"i", n_items, NULL);
|
||||||
|
|
||||||
|
|
@ -754,6 +777,7 @@ static int registry_demarshal_bind(void *object, const struct pw_protocol_native
|
||||||
struct pw_resource *resource = object;
|
struct pw_resource *resource = object;
|
||||||
struct spa_pod_parser prs;
|
struct spa_pod_parser prs;
|
||||||
uint32_t id, version, type, new_id;
|
uint32_t id, version, type, new_id;
|
||||||
|
const char *type_name;
|
||||||
|
|
||||||
spa_pod_parser_init(&prs, msg->data, msg->size);
|
spa_pod_parser_init(&prs, msg->data, msg->size);
|
||||||
if (spa_pod_parser_get_struct(&prs,
|
if (spa_pod_parser_get_struct(&prs,
|
||||||
|
|
@ -763,9 +787,11 @@ static int registry_demarshal_bind(void *object, const struct pw_protocol_native
|
||||||
"i", &new_id) < 0)
|
"i", &new_id) < 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
type = pw_protocol_native0_type_from_v2(resource->client, type);
|
type_name = pw_protocol_native0_name_from_v2(resource->client, type);
|
||||||
|
if (type_name == NULL)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
return pw_resource_notify(resource, struct pw_registry_methods, bind, 0, id, type, version, new_id);
|
return pw_resource_notify(resource, struct pw_registry_methods, bind, 0, id, type_name, version, new_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void module_marshal_info(void *object, const struct pw_module_info *info)
|
static void module_marshal_info(void *object, const struct pw_module_info *info)
|
||||||
|
|
@ -810,7 +836,7 @@ static void factory_marshal_info(void *object, const struct pw_factory_info *inf
|
||||||
|
|
||||||
n_items = info->props ? info->props->n_items : 0;
|
n_items = info->props ? info->props->n_items : 0;
|
||||||
|
|
||||||
type = pw_protocol_native0_type_to_v2(client, pw_type_info(), info->type);
|
type = pw_protocol_native0_find_type(client, info->type);
|
||||||
version = 0;
|
version = 0;
|
||||||
|
|
||||||
spa_pod_builder_push_struct(b, &f);
|
spa_pod_builder_push_struct(b, &f);
|
||||||
|
|
|
||||||
|
|
@ -5,34 +5,34 @@ const struct type_info {
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
} type_map[] = {
|
} type_map[] = {
|
||||||
{ "Spa:Interface:TypeMap", SPA_TYPE_INFO_INTERFACE_BASE, 0, },
|
{ "Spa:Interface:TypeMap", SPA_TYPE_INFO_INTERFACE_BASE, 0, },
|
||||||
{ "Spa:Interface:Log", SPA_TYPE_INFO_INTERFACE_BASE "Log", SPA_TYPE_INTERFACE_Log, },
|
{ "Spa:Interface:Log", SPA_TYPE_INTERFACE_Log, 0, },
|
||||||
{ "Spa:Interface:Loop", SPA_TYPE_INFO_INTERFACE_BASE "Loop", SPA_TYPE_INTERFACE_Loop, },
|
{ "Spa:Interface:Loop", SPA_TYPE_INTERFACE_Loop, 0, },
|
||||||
{ "Spa:Interface:LoopControl", SPA_TYPE_INFO_INTERFACE_BASE "LoopControl", SPA_TYPE_INTERFACE_LoopControl, },
|
{ "Spa:Interface:LoopControl", SPA_TYPE_INTERFACE_LoopControl, 0, },
|
||||||
{ "Spa:Interface:LoopUtils", SPA_TYPE_INFO_INTERFACE_BASE "LoopUtils", SPA_TYPE_INTERFACE_LoopUtils, },
|
{ "Spa:Interface:LoopUtils", SPA_TYPE_INTERFACE_LoopUtils, 0, },
|
||||||
{ "PipeWire:Interface:Core", PW_TYPE_INFO_INTERFACE_BASE "Core", PW_TYPE_INTERFACE_Core, },
|
{ "PipeWire:Interface:Core", PW_TYPE_INTERFACE_Core, 0, },
|
||||||
{ "PipeWire:Interface:Registry", PW_TYPE_INFO_INTERFACE_BASE "Registry", PW_TYPE_INTERFACE_Registry, },
|
{ "PipeWire:Interface:Registry", PW_TYPE_INTERFACE_Registry, 0, },
|
||||||
{ "PipeWire:Interface:Node", PW_TYPE_INFO_INTERFACE_BASE "Node", PW_TYPE_INTERFACE_Node, },
|
{ "PipeWire:Interface:Node", PW_TYPE_INTERFACE_Node, 0, },
|
||||||
{ "PipeWire:Interface:Port", PW_TYPE_INFO_INTERFACE_BASE "Port", PW_TYPE_INTERFACE_Port,},
|
{ "PipeWire:Interface:Port", PW_TYPE_INTERFACE_Port,0, },
|
||||||
{ "PipeWire:Interface:Factory", PW_TYPE_INFO_INTERFACE_BASE "Factory", PW_TYPE_INTERFACE_Factory, },
|
{ "PipeWire:Interface:Factory", PW_TYPE_INTERFACE_Factory, 0, },
|
||||||
{ "PipeWire:Interface:Link", PW_TYPE_INFO_INTERFACE_BASE "Link", PW_TYPE_INTERFACE_Link, },
|
{ "PipeWire:Interface:Link", PW_TYPE_INTERFACE_Link, 0, },
|
||||||
{ "PipeWire:Interface:Client", PW_TYPE_INFO_INTERFACE_BASE "Client", PW_TYPE_INTERFACE_Client, },
|
{ "PipeWire:Interface:Client", PW_TYPE_INTERFACE_Client, 0, },
|
||||||
{ "PipeWire:Interface:Module", PW_TYPE_INFO_INTERFACE_BASE "Module", PW_TYPE_INTERFACE_Module, },
|
{ "PipeWire:Interface:Module", PW_TYPE_INTERFACE_Module, 0, },
|
||||||
{ "PipeWire:Interface:Device", PW_TYPE_INFO_INTERFACE_BASE "Device", PW_TYPE_INTERFACE_Device, },
|
{ "PipeWire:Interface:Device", PW_TYPE_INTERFACE_Device, 0, },
|
||||||
|
|
||||||
{ "PipeWire:Interface:Metadata", PW_TYPE_INFO_INTERFACE_BASE "Metadata", PW_TYPE_INTERFACE_Metadata, },
|
{ "PipeWire:Interface:Metadata", PW_TYPE_INTERFACE_Metadata, 0, },
|
||||||
{ "PipeWire:Interface:Session", PW_TYPE_INFO_INTERFACE_BASE "Session", PW_TYPE_INTERFACE_Session, },
|
{ "PipeWire:Interface:Session", PW_TYPE_INTERFACE_Session, 0, },
|
||||||
{ "PipeWire:Interface:Endpoint", PW_TYPE_INFO_INTERFACE_BASE "Endpoint", PW_TYPE_INTERFACE_Endpoint, },
|
{ "PipeWire:Interface:Endpoint", PW_TYPE_INTERFACE_Endpoint, 0, },
|
||||||
{ "PipeWire:Interface:EndpointStream", PW_TYPE_INFO_INTERFACE_BASE "EndpointStream", PW_TYPE_INTERFACE_EndpointStream, },
|
{ "PipeWire:Interface:EndpointStream", PW_TYPE_INTERFACE_EndpointStream, 0, },
|
||||||
{ "PipeWire:Interface:EndpointLink", PW_TYPE_INFO_INTERFACE_BASE "EndpointLink", PW_TYPE_INTERFACE_EndpointLink, },
|
{ "PipeWire:Interface:EndpointLink", PW_TYPE_INTERFACE_EndpointLink, 0, },
|
||||||
|
|
||||||
{ "PipeWire:Interface:ClientNode", PW_TYPE_INFO_INTERFACE_BASE "ClientNode", PW_TYPE_INTERFACE_ClientNode, },
|
{ "PipeWire:Interface:ClientNode", PW_TYPE_INTERFACE_ClientNode, 0, },
|
||||||
{ "PipeWire:Interface:ClientSession", PW_TYPE_INFO_INTERFACE_BASE "ClientSession", PW_TYPE_INTERFACE_ClientSession, },
|
{ "PipeWire:Interface:ClientSession", PW_TYPE_INTERFACE_ClientSession, 0, },
|
||||||
{ "PipeWire:Interface:ClientEndpoint", PW_TYPE_INFO_INTERFACE_BASE "ClientEndpoint", PW_TYPE_INTERFACE_ClientEndpoint, },
|
{ "PipeWire:Interface:ClientEndpoint", PW_TYPE_INTERFACE_ClientEndpoint, 0, },
|
||||||
|
|
||||||
{ "Spa:Interface:Node", SPA_TYPE_INFO_INTERFACE_BASE "Node", SPA_TYPE_INTERFACE_Node, },
|
{ "Spa:Interface:Node", SPA_TYPE_INTERFACE_Node, 0, },
|
||||||
{ "Spa:Interface:Clock", },
|
{ "Spa:Interface:Clock", },
|
||||||
{ "Spa:Interface:Monitor", },
|
{ "Spa:Interface:Monitor", },
|
||||||
{ "Spa:Interface:Device", SPA_TYPE_INFO_INTERFACE_BASE "Device", SPA_TYPE_INTERFACE_Device, },
|
{ "Spa:Interface:Device", SPA_TYPE_INTERFACE_Device, 0, },
|
||||||
{ "Spa:POD:Object:Param:Format", SPA_TYPE_INFO_Format, SPA_TYPE_OBJECT_Format, },
|
{ "Spa:POD:Object:Param:Format", SPA_TYPE_INFO_Format, SPA_TYPE_OBJECT_Format, },
|
||||||
{ "Spa:POD:Object:Param:Props", SPA_TYPE_INFO_Props, SPA_TYPE_OBJECT_Props, },
|
{ "Spa:POD:Object:Param:Props", SPA_TYPE_INFO_Props, SPA_TYPE_OBJECT_Props, },
|
||||||
{ "Spa:Pointer:IO:Buffers", },
|
{ "Spa:Pointer:IO:Buffers", },
|
||||||
|
|
@ -102,7 +102,7 @@ const struct type_info {
|
||||||
{ "Spa:Enum:ParamId:IO:Props:In", },
|
{ "Spa:Enum:ParamId:IO:Props:In", },
|
||||||
{ "Spa:Enum:ParamId:IO:Props:Out", },
|
{ "Spa:Enum:ParamId:IO:Props:Out", },
|
||||||
{ "Spa:POD:Object:Param:IO:Prop", },
|
{ "Spa:POD:Object:Param:IO:Prop", },
|
||||||
{ "Spa:Interface:DBus", SPA_TYPE_INFO_INTERFACE_BASE "DBus", SPA_TYPE_INTERFACE_DBus, },
|
{ "Spa:Interface:DBus", SPA_TYPE_INFO_INTERFACE_BASE "DBus", 0, },
|
||||||
{ "Spa:Enum:MediaType:audio", SPA_TYPE_INFO_MEDIA_TYPE_BASE "audio", SPA_MEDIA_TYPE_audio, },
|
{ "Spa:Enum:MediaType:audio", SPA_TYPE_INFO_MEDIA_TYPE_BASE "audio", SPA_MEDIA_TYPE_audio, },
|
||||||
{ "Spa:Enum:MediaType:video", SPA_TYPE_INFO_MEDIA_TYPE_BASE "video", SPA_MEDIA_TYPE_video, },
|
{ "Spa:Enum:MediaType:video", SPA_TYPE_INFO_MEDIA_TYPE_BASE "video", SPA_MEDIA_TYPE_video, },
|
||||||
{ "Spa:Enum:MediaType:image", SPA_TYPE_INFO_MEDIA_TYPE_BASE "image", SPA_MEDIA_TYPE_image, },
|
{ "Spa:Enum:MediaType:image", SPA_TYPE_INFO_MEDIA_TYPE_BASE "image", SPA_MEDIA_TYPE_image, },
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ static const struct pw_resource_events resource_events = {
|
||||||
|
|
||||||
static void *create_object(void *data,
|
static void *create_object(void *data,
|
||||||
struct pw_resource *owner_resource,
|
struct pw_resource *owner_resource,
|
||||||
uint32_t type,
|
const char *type,
|
||||||
uint32_t version,
|
uint32_t version,
|
||||||
struct pw_properties *properties,
|
struct pw_properties *properties,
|
||||||
uint32_t new_id)
|
uint32_t new_id)
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ static const struct pw_resource_events resource_events = {
|
||||||
|
|
||||||
static void *create_object(void *data,
|
static void *create_object(void *data,
|
||||||
struct pw_resource *owner_resource,
|
struct pw_resource *owner_resource,
|
||||||
uint32_t type,
|
const char *type,
|
||||||
uint32_t version,
|
uint32_t version,
|
||||||
struct pw_properties *properties,
|
struct pw_properties *properties,
|
||||||
uint32_t new_id)
|
uint32_t new_id)
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ static const struct pw_impl_device_events device_events = {
|
||||||
|
|
||||||
static void *create_object(void *_data,
|
static void *create_object(void *_data,
|
||||||
struct pw_resource *resource,
|
struct pw_resource *resource,
|
||||||
uint32_t type,
|
const char *type,
|
||||||
uint32_t version,
|
uint32_t version,
|
||||||
struct pw_properties *properties,
|
struct pw_properties *properties,
|
||||||
uint32_t new_id)
|
uint32_t new_id)
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ static const struct pw_impl_node_events node_events = {
|
||||||
|
|
||||||
static void *create_object(void *_data,
|
static void *create_object(void *_data,
|
||||||
struct pw_resource *resource,
|
struct pw_resource *resource,
|
||||||
uint32_t type,
|
const char *type,
|
||||||
uint32_t version,
|
uint32_t version,
|
||||||
struct pw_properties *properties,
|
struct pw_properties *properties,
|
||||||
uint32_t new_id)
|
uint32_t new_id)
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,11 @@ extern "C" {
|
||||||
#include <pipewire/proxy.h>
|
#include <pipewire/proxy.h>
|
||||||
#include <pipewire/permission.h>
|
#include <pipewire/permission.h>
|
||||||
|
|
||||||
|
#define PW_TYPE_INTERFACE_Client PW_TYPE_INFO_INTERFACE_BASE "Client"
|
||||||
|
|
||||||
|
#define PW_VERSION_CLIENT 3
|
||||||
|
struct pw_client;
|
||||||
|
|
||||||
/** The client information. Extra information can be added in later versions \memberof pw_introspect */
|
/** The client information. Extra information can be added in later versions \memberof pw_introspect */
|
||||||
struct pw_client_info {
|
struct pw_client_info {
|
||||||
uint32_t id; /**< id of the global */
|
uint32_t id; /**< id of the global */
|
||||||
|
|
@ -53,9 +58,6 @@ pw_client_info_update(struct pw_client_info *info,
|
||||||
void pw_client_info_free(struct pw_client_info *info);
|
void pw_client_info_free(struct pw_client_info *info);
|
||||||
|
|
||||||
|
|
||||||
#define PW_VERSION_CLIENT 3
|
|
||||||
struct pw_client;
|
|
||||||
|
|
||||||
#define PW_CLIENT_EVENT_INFO 0
|
#define PW_CLIENT_EVENT_INFO 0
|
||||||
#define PW_CLIENT_EVENT_PERMISSIONS 1
|
#define PW_CLIENT_EVENT_PERMISSIONS 1
|
||||||
#define PW_CLIENT_EVENT_NUM 2
|
#define PW_CLIENT_EVENT_NUM 2
|
||||||
|
|
|
||||||
|
|
@ -876,18 +876,17 @@ struct spa_handle *pw_context_load_spa_handle(struct pw_context *context,
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
int pw_context_register_export_type(struct pw_context *context, struct pw_export_type *type)
|
int pw_context_register_export_type(struct pw_context *context, struct pw_export_type *type)
|
||||||
{
|
{
|
||||||
pw_log_debug("context %p: Add export type %d/%s to context", context, type->type,
|
pw_log_debug("context %p: Add export type %s to context", context, type->type);
|
||||||
spa_debug_type_find_name(pw_type_info(), type->type));
|
|
||||||
spa_list_append(&context->export_list, &type->link);
|
spa_list_append(&context->export_list, &type->link);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
const struct pw_export_type *pw_context_find_export_type(struct pw_context *context, uint32_t type)
|
const struct pw_export_type *pw_context_find_export_type(struct pw_context *context, const char *type)
|
||||||
{
|
{
|
||||||
const struct pw_export_type *t;
|
const struct pw_export_type *t;
|
||||||
spa_list_for_each(t, &context->export_list, link) {
|
spa_list_for_each(t, &context->export_list, link) {
|
||||||
if (t->type == type)
|
if (strcmp(t->type, type) == 0)
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
|
|
@ -148,9 +148,9 @@ struct spa_handle *pw_context_load_spa_handle(struct pw_context *context,
|
||||||
/** data for registering export functions */
|
/** data for registering export functions */
|
||||||
struct pw_export_type {
|
struct pw_export_type {
|
||||||
struct spa_list link;
|
struct spa_list link;
|
||||||
uint32_t type;
|
const char *type;
|
||||||
struct pw_proxy * (*func) (struct pw_core *core,
|
struct pw_proxy * (*func) (struct pw_core *core,
|
||||||
uint32_t type, const struct spa_dict *props, void *object,
|
const char *type, const struct spa_dict *props, void *object,
|
||||||
size_t user_data_size);
|
size_t user_data_size);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -158,7 +158,7 @@ struct pw_export_type {
|
||||||
* extension modules */
|
* extension modules */
|
||||||
int pw_context_register_export_type(struct pw_context *context, struct pw_export_type *type);
|
int pw_context_register_export_type(struct pw_context *context, struct pw_export_type *type);
|
||||||
/** find information about registered export type */
|
/** find information about registered export type */
|
||||||
const struct pw_export_type *pw_context_find_export_type(struct pw_context *context, uint32_t type);
|
const struct pw_export_type *pw_context_find_export_type(struct pw_context *context, const char *type);
|
||||||
|
|
||||||
/** add an object to the context */
|
/** add an object to the context */
|
||||||
int pw_context_set_object(struct pw_context *context, const char *type, void *value);
|
int pw_context_set_object(struct pw_context *context, const char *type, void *value);
|
||||||
|
|
|
||||||
|
|
@ -237,7 +237,7 @@ struct pw_proxy *pw_core_find_proxy(struct pw_core *core, uint32_t id)
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
struct pw_proxy *pw_core_export(struct pw_core *core,
|
struct pw_proxy *pw_core_export(struct pw_core *core,
|
||||||
uint32_t type, const struct spa_dict *props, void *object,
|
const char *type, const struct spa_dict *props, void *object,
|
||||||
size_t user_data_size)
|
size_t user_data_size)
|
||||||
{
|
{
|
||||||
struct pw_proxy *proxy;
|
struct pw_proxy *proxy;
|
||||||
|
|
@ -258,7 +258,7 @@ struct pw_proxy *pw_core_export(struct pw_core *core,
|
||||||
return proxy;
|
return proxy;
|
||||||
|
|
||||||
error_export_type:
|
error_export_type:
|
||||||
pw_log_error(NAME" %p: can't export type %d: %s", core, type, spa_strerror(res));
|
pw_log_error(NAME" %p: can't export type %s: %s", core, type, spa_strerror(res));
|
||||||
goto exit;
|
goto exit;
|
||||||
error_proxy_failed:
|
error_proxy_failed:
|
||||||
pw_log_error(NAME" %p: failed to create proxy: %s", core, spa_strerror(res));
|
pw_log_error(NAME" %p: failed to create proxy: %s", core, spa_strerror(res));
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,9 @@ extern "C" {
|
||||||
|
|
||||||
#include <spa/utils/hook.h>
|
#include <spa/utils/hook.h>
|
||||||
|
|
||||||
|
#define PW_TYPE_INTERFACE_Core PW_TYPE_INFO_INTERFACE_BASE "Core"
|
||||||
|
#define PW_TYPE_INTERFACE_Registry PW_TYPE_INFO_INTERFACE_BASE "Registry"
|
||||||
|
|
||||||
#define PW_VERSION_CORE 3
|
#define PW_VERSION_CORE 3
|
||||||
struct pw_core;
|
struct pw_core;
|
||||||
#define PW_VERSION_REGISTRY 3
|
#define PW_VERSION_REGISTRY 3
|
||||||
|
|
@ -278,7 +281,7 @@ struct pw_core_methods {
|
||||||
*/
|
*/
|
||||||
void * (*create_object) (void *object,
|
void * (*create_object) (void *object,
|
||||||
const char *factory_name,
|
const char *factory_name,
|
||||||
uint32_t type,
|
const char *type,
|
||||||
uint32_t version,
|
uint32_t version,
|
||||||
const struct spa_dict *props,
|
const struct spa_dict *props,
|
||||||
size_t user_data_size);
|
size_t user_data_size);
|
||||||
|
|
@ -342,7 +345,7 @@ pw_core_get_registry(struct pw_core *core, uint32_t version, size_t user_data_si
|
||||||
static inline void *
|
static inline void *
|
||||||
pw_core_create_object(struct pw_core *core,
|
pw_core_create_object(struct pw_core *core,
|
||||||
const char *factory_name,
|
const char *factory_name,
|
||||||
uint32_t type,
|
const char *type,
|
||||||
uint32_t version,
|
uint32_t version,
|
||||||
const struct spa_dict *props,
|
const struct spa_dict *props,
|
||||||
size_t user_data_size)
|
size_t user_data_size)
|
||||||
|
|
@ -410,7 +413,7 @@ struct pw_registry_events {
|
||||||
* \param props extra properties of the global
|
* \param props extra properties of the global
|
||||||
*/
|
*/
|
||||||
void (*global) (void *object, uint32_t id,
|
void (*global) (void *object, uint32_t id,
|
||||||
uint32_t permissions, uint32_t type, uint32_t version,
|
uint32_t permissions, const char *type, uint32_t version,
|
||||||
const struct spa_dict *props);
|
const struct spa_dict *props);
|
||||||
/**
|
/**
|
||||||
* Notify of a global object removal
|
* Notify of a global object removal
|
||||||
|
|
@ -450,7 +453,7 @@ struct pw_registry_methods {
|
||||||
* \param version the interface version to use
|
* \param version the interface version to use
|
||||||
* \returns the new object
|
* \returns the new object
|
||||||
*/
|
*/
|
||||||
void * (*bind) (void *object, uint32_t id, uint32_t type, uint32_t version,
|
void * (*bind) (void *object, uint32_t id, const char *type, uint32_t version,
|
||||||
size_t use_data_size);
|
size_t use_data_size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -477,7 +480,7 @@ struct pw_registry_methods {
|
||||||
|
|
||||||
static inline void *
|
static inline void *
|
||||||
pw_registry_bind(struct pw_registry *registry,
|
pw_registry_bind(struct pw_registry *registry,
|
||||||
uint32_t id, uint32_t type, uint32_t version,
|
uint32_t id, const char *type, uint32_t version,
|
||||||
size_t user_data_size)
|
size_t user_data_size)
|
||||||
{
|
{
|
||||||
void *res = NULL;
|
void *res = NULL;
|
||||||
|
|
@ -550,7 +553,7 @@ struct pw_proxy *pw_core_find_proxy(struct pw_core *core, uint32_t id);
|
||||||
|
|
||||||
/** Export an object into the PipeWire instance associated with core */
|
/** Export an object into the PipeWire instance associated with core */
|
||||||
struct pw_proxy *pw_core_export(struct pw_core *core, /**< the core */
|
struct pw_proxy *pw_core_export(struct pw_core *core, /**< the core */
|
||||||
uint32_t type, /**< the type of object */
|
const char *type, /**< the type of object */
|
||||||
const struct spa_dict *props, /**< extra properties */
|
const struct spa_dict *props, /**< extra properties */
|
||||||
void *object, /**< object to export */
|
void *object, /**< object to export */
|
||||||
size_t user_data_size /**< extra user data */);
|
size_t user_data_size /**< extra user data */);
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,8 @@ extern "C" {
|
||||||
|
|
||||||
#include <pipewire/proxy.h>
|
#include <pipewire/proxy.h>
|
||||||
|
|
||||||
|
#define PW_TYPE_INTERFACE_Device PW_TYPE_INFO_INTERFACE_BASE "Device"
|
||||||
|
|
||||||
#define PW_VERSION_DEVICE 3
|
#define PW_VERSION_DEVICE 3
|
||||||
struct pw_device;
|
struct pw_device;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,14 +37,16 @@ extern "C" {
|
||||||
|
|
||||||
#include <pipewire/proxy.h>
|
#include <pipewire/proxy.h>
|
||||||
|
|
||||||
#define PW_VERSION_FACTORY 3
|
#define PW_TYPE_INTERFACE_Factory PW_TYPE_INFO_INTERFACE_BASE "Factory"
|
||||||
|
|
||||||
|
#define PW_VERSION_FACTORY 3
|
||||||
struct pw_factory;
|
struct pw_factory;
|
||||||
|
|
||||||
/** The factory information. Extra information can be added in later versions \memberof pw_introspect */
|
/** The factory information. Extra information can be added in later versions \memberof pw_introspect */
|
||||||
struct pw_factory_info {
|
struct pw_factory_info {
|
||||||
uint32_t id; /**< id of the global */
|
uint32_t id; /**< id of the global */
|
||||||
const char *name; /**< name the factory */
|
const char *name; /**< name the factory */
|
||||||
uint32_t type; /**< type of the objects created by this factory */
|
const char *type; /**< type of the objects created by this factory */
|
||||||
uint32_t version; /**< version of the objects */
|
uint32_t version; /**< version of the objects */
|
||||||
#define PW_FACTORY_CHANGE_MASK_PROPS (1 << 0)
|
#define PW_FACTORY_CHANGE_MASK_PROPS (1 << 0)
|
||||||
#define PW_FACTORY_CHANGE_MASK_ALL ((1 << 1)-1)
|
#define PW_FACTORY_CHANGE_MASK_ALL ((1 << 1)-1)
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ uint32_t pw_global_get_permissions(struct pw_global *global, struct pw_impl_clie
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
struct pw_global *
|
struct pw_global *
|
||||||
pw_global_new(struct pw_context *context,
|
pw_global_new(struct pw_context *context,
|
||||||
uint32_t type,
|
const char *type,
|
||||||
uint32_t version,
|
uint32_t version,
|
||||||
struct pw_properties *properties,
|
struct pw_properties *properties,
|
||||||
pw_global_bind_func_t func,
|
pw_global_bind_func_t func,
|
||||||
|
|
@ -104,9 +104,7 @@ pw_global_new(struct pw_context *context,
|
||||||
spa_list_init(&this->resource_list);
|
spa_list_init(&this->resource_list);
|
||||||
spa_hook_list_init(&this->listener_list);
|
spa_hook_list_init(&this->listener_list);
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: new %s %d", this,
|
pw_log_debug(NAME" %p: new %s %d", this, this->type, this->id);
|
||||||
spa_debug_type_find_name(pw_type_info(), this->type),
|
|
||||||
this->id);
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
|
|
@ -190,11 +188,17 @@ struct pw_context *pw_global_get_context(struct pw_global *global)
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
uint32_t pw_global_get_type(struct pw_global *global)
|
const char * pw_global_get_type(struct pw_global *global)
|
||||||
{
|
{
|
||||||
return global->type;
|
return global->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SPA_EXPORT
|
||||||
|
bool pw_global_is_type(struct pw_global *global, const char *type)
|
||||||
|
{
|
||||||
|
return strcmp(global->type, type) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
uint32_t pw_global_get_version(struct pw_global *global)
|
uint32_t pw_global_get_version(struct pw_global *global)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -79,8 +79,8 @@ struct pw_global_events {
|
||||||
|
|
||||||
/** Create a new global object */
|
/** Create a new global object */
|
||||||
struct pw_global *
|
struct pw_global *
|
||||||
pw_global_new(struct pw_context *context, /**< the context */
|
pw_global_new(struct pw_context *context, /**< the context */
|
||||||
uint32_t type, /**< the interface type of the global */
|
const char *type, /**< the interface type of the global */
|
||||||
uint32_t version, /**< the interface version of the global */
|
uint32_t version, /**< the interface version of the global */
|
||||||
struct pw_properties *properties, /**< extra properties */
|
struct pw_properties *properties, /**< extra properties */
|
||||||
pw_global_bind_func_t func, /**< function to bind */
|
pw_global_bind_func_t func, /**< function to bind */
|
||||||
|
|
@ -102,7 +102,10 @@ uint32_t pw_global_get_permissions(struct pw_global *global, struct pw_impl_clie
|
||||||
struct pw_context *pw_global_get_context(struct pw_global *global);
|
struct pw_context *pw_global_get_context(struct pw_global *global);
|
||||||
|
|
||||||
/** Get the global type */
|
/** Get the global type */
|
||||||
uint32_t pw_global_get_type(struct pw_global *global);
|
const char *pw_global_get_type(struct pw_global *global);
|
||||||
|
|
||||||
|
/** Check a global type */
|
||||||
|
bool pw_global_is_type(struct pw_global *global, const char *type);
|
||||||
|
|
||||||
/** Get the global version */
|
/** Get the global version */
|
||||||
uint32_t pw_global_get_version(struct pw_global *global);
|
uint32_t pw_global_get_version(struct pw_global *global);
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue