mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04: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
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include <spa/support/log.h>
|
||||
#include <spa/utils/type.h>
|
||||
#include <spa/node/node.h>
|
||||
#include <spa/utils/keys.h>
|
||||
#include <spa/utils/names.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.type = SPA_TYPE_INTERFACE_Node;
|
||||
|
||||
if (snd_pcm_info_get_stream(pcminfo) == SND_PCM_STREAM_PLAYBACK) {
|
||||
info.factory_name = SPA_NAME_API_ALSA_PCM_SINK;
|
||||
stream = "playback";
|
||||
|
|
@ -433,7 +435,7 @@ static const struct spa_device_methods impl_device = {
|
|||
.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;
|
||||
|
||||
|
|
@ -442,7 +444,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Device)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
|
||||
*interface = &this->device;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -471,7 +473,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
{
|
||||
struct impl *this;
|
||||
const char *str;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(factory != 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;
|
||||
|
||||
for (i = 0; i < n_support; i++) {
|
||||
switch (support[i].type) {
|
||||
case SPA_TYPE_INTERFACE_Log:
|
||||
this->log = support[i].data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
|
||||
this->device.iface = SPA_INTERFACE_INIT(
|
||||
SPA_TYPE_INTERFACE_Device,
|
||||
|
|
|
|||
|
|
@ -652,7 +652,7 @@ static const struct spa_node_methods impl_node = {
|
|||
.process = impl_node_process,
|
||||
};
|
||||
|
||||
static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
||||
static int impl_get_interface(struct spa_handle *handle, const char *type, void **interface)
|
||||
{
|
||||
struct state *this;
|
||||
|
||||
|
|
@ -661,7 +661,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct state *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -695,19 +695,11 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
handle->clear = impl_clear;
|
||||
|
||||
this = (struct state *) handle;
|
||||
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_DataSystem:
|
||||
this->data_system = support[i].data;
|
||||
break;
|
||||
case SPA_TYPE_INTERFACE_DataLoop:
|
||||
this->data_loop = support[i].data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
this->data_system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataSystem);
|
||||
this->data_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
|
||||
|
||||
if (this->data_loop == NULL) {
|
||||
spa_log_error(this->log, "a data loop is needed");
|
||||
return -EINVAL;
|
||||
|
|
|
|||
|
|
@ -683,7 +683,7 @@ static const struct spa_node_methods impl_node = {
|
|||
.process = impl_node_process,
|
||||
};
|
||||
|
||||
static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
||||
static int impl_get_interface(struct spa_handle *handle, const char *type, void **interface)
|
||||
{
|
||||
struct state *this;
|
||||
|
||||
|
|
@ -692,7 +692,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct state *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -730,19 +730,10 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
this = (struct state *) handle;
|
||||
|
||||
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_DataSystem:
|
||||
this->data_system = support[i].data;
|
||||
break;
|
||||
case SPA_TYPE_INTERFACE_DataLoop:
|
||||
this->data_loop = support[i].data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
this->data_system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataSystem);
|
||||
this->data_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
|
||||
|
||||
if (this->data_loop == NULL) {
|
||||
spa_log_error(this->log, NAME" %p: a data loop is needed", this);
|
||||
return -EINVAL;
|
||||
|
|
|
|||
|
|
@ -796,7 +796,7 @@ static const struct spa_node_methods impl_node = {
|
|||
.process = impl_node_process,
|
||||
};
|
||||
|
||||
static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
||||
static int impl_get_interface(struct spa_handle *handle, const char *type, void **interface)
|
||||
{
|
||||
struct 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;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -851,22 +851,11 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
this = (struct seq_state *) handle;
|
||||
|
||||
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_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;
|
||||
}
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
this->data_system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataSystem);
|
||||
this->data_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
|
||||
this->main_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Loop);
|
||||
|
||||
if (this->data_loop == NULL) {
|
||||
spa_log_error(this->log, "a data loop is needed");
|
||||
return -EINVAL;
|
||||
|
|
|
|||
|
|
@ -541,7 +541,7 @@ static const struct spa_device_methods impl_device = {
|
|||
.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;
|
||||
|
||||
|
|
@ -550,13 +550,11 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
switch (type) {
|
||||
case SPA_TYPE_INTERFACE_Device:
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
|
||||
*interface = &this->device;
|
||||
break;
|
||||
default:
|
||||
else
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -583,7 +581,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
uint32_t n_support)
|
||||
{
|
||||
struct impl *this;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(factory != 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;
|
||||
|
||||
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_Loop:
|
||||
this->main_loop = support[i].data;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
this->main_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Loop);
|
||||
|
||||
if (this->main_loop == NULL) {
|
||||
spa_log_error(this->log, "a main-loop is needed");
|
||||
return -EINVAL;
|
||||
|
|
|
|||
|
|
@ -917,7 +917,7 @@ static const struct spa_node_methods impl_node = {
|
|||
.process = impl_node_process,
|
||||
};
|
||||
|
||||
static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
||||
static int impl_get_interface(struct spa_handle *handle, const char *type, void **interface)
|
||||
{
|
||||
struct impl *this;
|
||||
|
||||
|
|
@ -926,7 +926,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -994,7 +994,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
struct impl *this;
|
||||
void *iface;
|
||||
const char *str;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(factory != 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;
|
||||
|
||||
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_CPU:
|
||||
this->cpu = support[i].data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU);
|
||||
|
||||
if (info == NULL || (str = spa_dict_lookup(info, "audio.adapt.slave")) == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
|
|
|
|||
|
|
@ -1092,7 +1092,7 @@ static const struct spa_node_methods impl_node = {
|
|||
.process = impl_node_process,
|
||||
};
|
||||
|
||||
static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
||||
static int impl_get_interface(struct spa_handle *handle, const char *type, void **interface)
|
||||
{
|
||||
struct impl *this;
|
||||
|
||||
|
|
@ -1101,7 +1101,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -1160,7 +1160,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
uint32_t n_support)
|
||||
{
|
||||
struct impl *this;
|
||||
uint32_t i;
|
||||
size_t size;
|
||||
void *iface;
|
||||
|
||||
|
|
@ -1172,16 +1171,8 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
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_CPU:
|
||||
this->cpu = support[i].data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU);
|
||||
|
||||
if (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,
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
|
|
@ -942,7 +942,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -971,7 +971,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||
|
|
@ -981,16 +980,8 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
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_CPU:
|
||||
this->cpu = support[i].data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU);
|
||||
|
||||
if (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,
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
|
|
@ -908,7 +908,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -961,7 +961,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
uint32_t n_support)
|
||||
{
|
||||
struct impl *this;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(factory != 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;
|
||||
|
||||
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_CPU:
|
||||
this->cpu = support[i].data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU);
|
||||
|
||||
if (this->cpu)
|
||||
this->cpu_flags = spa_cpu_get_flags(this->cpu);
|
||||
|
||||
this->node.iface = SPA_INTERFACE_INIT(
|
||||
SPA_TYPE_INTERFACE_Node,
|
||||
SPA_VERSION_NODE,
|
||||
&impl_node, this);
|
||||
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 = SPA_NODE_INFO_INIT();
|
||||
this->info.flags = SPA_NODE_FLAG_RT;
|
||||
|
|
|
|||
|
|
@ -1017,7 +1017,7 @@ static const struct spa_node_methods impl_node = {
|
|||
.process = impl_node_process,
|
||||
};
|
||||
|
||||
static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
||||
static int impl_get_interface(struct spa_handle *handle, const char *type, void **interface)
|
||||
{
|
||||
struct impl *this;
|
||||
|
||||
|
|
@ -1026,7 +1026,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -1055,7 +1055,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||
|
|
@ -1065,16 +1064,8 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
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_CPU:
|
||||
this->cpu = support[i].data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU);
|
||||
|
||||
if (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,
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
|
|
@ -863,7 +863,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -900,7 +900,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
uint32_t i;
|
||||
const char *str;
|
||||
|
||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||
|
|
@ -911,16 +910,8 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
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_CPU:
|
||||
this->cpu = support[i].data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU);
|
||||
|
||||
if (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,
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
|
|
@ -947,7 +947,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -976,7 +976,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||
|
|
@ -986,16 +985,9 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
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_CPU:
|
||||
this->cpu = support[i].data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU);
|
||||
|
||||
if (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,
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
|
|
@ -799,13 +799,11 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
switch (type) {
|
||||
case SPA_TYPE_INTERFACE_Node:
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
break;
|
||||
default:
|
||||
else
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -830,7 +828,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||
|
|
@ -840,13 +837,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
for (i = 0; i < n_support; i++) {
|
||||
switch (support[i].type) {
|
||||
case SPA_TYPE_INTERFACE_Log:
|
||||
this->log = support[i].data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
|
||||
spa_log_debug(this->log, NAME " %p: init", this);
|
||||
spa_hook_list_init(&this->hooks);
|
||||
|
|
|
|||
|
|
@ -826,7 +826,7 @@ static const struct spa_node_methods impl_node = {
|
|||
.process = impl_node_process,
|
||||
};
|
||||
|
||||
static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
||||
static int impl_get_interface(struct spa_handle *handle, const char *type, void **interface)
|
||||
{
|
||||
struct impl *this;
|
||||
|
||||
|
|
@ -835,7 +835,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -871,7 +871,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||
|
|
@ -881,16 +880,9 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
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_CPU:
|
||||
this->cpu = support[i].data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU);
|
||||
|
||||
if (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,
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
|
|
@ -773,7 +773,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -802,7 +802,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||
|
|
@ -812,16 +811,9 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
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_CPU:
|
||||
this->cpu = support[i].data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU);
|
||||
|
||||
if (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,
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
|
|
@ -932,7 +932,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -971,7 +971,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||
|
|
@ -981,19 +980,9 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
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);
|
||||
|
||||
spa_hook_list_init(&this->hooks);
|
||||
|
||||
|
|
|
|||
|
|
@ -1359,7 +1359,7 @@ static const struct spa_bt_transport_events transport_events = {
|
|||
.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;
|
||||
|
||||
|
|
@ -1368,7 +1368,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -1399,7 +1399,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
uint32_t i;
|
||||
const char *str;
|
||||
|
||||
spa_return_val_if_fail(factory != 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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
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);
|
||||
|
||||
if (this->data_loop == NULL) {
|
||||
spa_log_error(this->log, "a data loop is needed");
|
||||
return -EINVAL;
|
||||
|
|
@ -1465,10 +1456,9 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
port->info.n_params = 5;
|
||||
spa_list_init(&port->ready);
|
||||
|
||||
for (i = 0; info && i < info->n_items; i++) {
|
||||
if (strcmp(info->items[i].key, SPA_KEY_API_BLUEZ5_TRANSPORT) == 0)
|
||||
sscanf(info->items[i].value, "pointer:%p", &this->transport);
|
||||
}
|
||||
if (info && (str = spa_dict_lookup(info, SPA_KEY_API_BLUEZ5_TRANSPORT)))
|
||||
sscanf(str, "pointer:%p", &this->transport);
|
||||
|
||||
if (this->transport == NULL) {
|
||||
spa_log_error(this->log, "a transport is needed");
|
||||
return -EINVAL;
|
||||
|
|
|
|||
|
|
@ -1049,7 +1049,7 @@ static const struct spa_bt_transport_events transport_events = {
|
|||
.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;
|
||||
|
||||
|
|
@ -1058,7 +1058,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -1087,7 +1087,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
uint32_t i;
|
||||
const char *str;
|
||||
|
||||
spa_return_val_if_fail(factory != 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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
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);
|
||||
|
||||
if (this->data_loop == NULL) {
|
||||
spa_log_error(this->log, "a data loop is needed");
|
||||
return -EINVAL;
|
||||
|
|
@ -1160,10 +1151,9 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
spa_list_init(&port->ready);
|
||||
spa_list_init(&port->free);
|
||||
|
||||
for (i = 0; info && i < info->n_items; i++) {
|
||||
if (strcmp(info->items[i].key, SPA_KEY_API_BLUEZ5_TRANSPORT) == 0)
|
||||
sscanf(info->items[i].value, "pointer:%p", &this->transport);
|
||||
}
|
||||
if (info && (str = spa_dict_lookup(info, SPA_KEY_API_BLUEZ5_TRANSPORT)))
|
||||
sscanf(str, "pointer:%p", &this->transport);
|
||||
|
||||
if (this->transport == NULL) {
|
||||
spa_log_error(this->log, "a transport is needed");
|
||||
return -EINVAL;
|
||||
|
|
|
|||
|
|
@ -2199,7 +2199,7 @@ static const struct spa_device_methods impl_device = {
|
|||
.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;
|
||||
|
||||
|
|
@ -2208,13 +2208,11 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct spa_bt_monitor *) handle;
|
||||
|
||||
switch (type) {
|
||||
case SPA_TYPE_INTERFACE_Device:
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
|
||||
*interface = &this->device;
|
||||
break;
|
||||
default:
|
||||
else
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -2238,7 +2236,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
uint32_t n_support)
|
||||
{
|
||||
struct spa_bt_monitor *this;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(factory != 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;
|
||||
|
||||
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_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;
|
||||
}
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
this->dbus = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DBus);
|
||||
this->main_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Loop);
|
||||
this->main_system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_System);
|
||||
|
||||
if (this->dbus == NULL) {
|
||||
spa_log_error(this->log, "a dbus is needed");
|
||||
return -EINVAL;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include <spa/utils/type.h>
|
||||
#include <spa/utils/keys.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/node/node.h>
|
||||
#include <spa/support/loop.h>
|
||||
#include <spa/support/plugin.h>
|
||||
#include <spa/monitor/device.h>
|
||||
|
|
@ -183,7 +184,7 @@ static const struct spa_device_methods impl_device = {
|
|||
.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;
|
||||
|
||||
|
|
@ -192,7 +193,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Device)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
|
||||
*interface = &this->device;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -220,7 +221,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
uint32_t n_support)
|
||||
{
|
||||
struct impl *this;
|
||||
uint32_t i;
|
||||
const char *str;
|
||||
|
||||
spa_return_val_if_fail(factory != 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;
|
||||
|
||||
for (i = 0; i < n_support; i++) {
|
||||
switch (support[i].type) {
|
||||
case SPA_TYPE_INTERFACE_Log:
|
||||
this->log = support[i].data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
|
||||
if (info && (str = spa_dict_lookup(info, SPA_KEY_API_BLUEZ5_DEVICE)))
|
||||
sscanf(str, "pointer:%p", &this->bt_dev);
|
||||
|
||||
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) {
|
||||
spa_log_error(this->log, "a device is needed");
|
||||
return -EINVAL;
|
||||
|
|
|
|||
|
|
@ -1049,7 +1049,7 @@ static const struct spa_bt_transport_events transport_events = {
|
|||
.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;
|
||||
|
||||
|
|
@ -1058,7 +1058,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -1089,7 +1089,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
uint32_t i;
|
||||
const char *str;
|
||||
|
||||
spa_return_val_if_fail(factory != 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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
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);
|
||||
|
||||
if (this->data_loop == NULL) {
|
||||
spa_log_error(this->log, "a data loop is needed");
|
||||
return -EINVAL;
|
||||
|
|
@ -1155,10 +1146,9 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
port->info.n_params = 5;
|
||||
spa_list_init(&port->ready);
|
||||
|
||||
for (i = 0; info && i < info->n_items; i++) {
|
||||
if (strcmp(info->items[i].key, SPA_KEY_API_BLUEZ5_TRANSPORT) == 0)
|
||||
sscanf(info->items[i].value, "pointer:%p", &this->transport);
|
||||
}
|
||||
if (info && (str = spa_dict_lookup(info, SPA_KEY_API_BLUEZ5_TRANSPORT)))
|
||||
sscanf(str, "pointer:%p", &this->transport);
|
||||
|
||||
if (this->transport == NULL) {
|
||||
spa_log_error(this->log, "a transport is needed");
|
||||
return -EINVAL;
|
||||
|
|
|
|||
|
|
@ -957,7 +957,7 @@ static const struct spa_bt_transport_events transport_events = {
|
|||
.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;
|
||||
|
||||
|
|
@ -966,7 +966,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -995,7 +995,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
uint32_t i;
|
||||
const char *str;
|
||||
|
||||
spa_return_val_if_fail(factory != 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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
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);
|
||||
|
||||
if (this->data_loop == NULL) {
|
||||
spa_log_error(this->log, "a data loop is needed");
|
||||
return -EINVAL;
|
||||
|
|
@ -1066,10 +1057,9 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
spa_list_init(&port->ready);
|
||||
spa_list_init(&port->free);
|
||||
|
||||
for (i = 0; info && i < info->n_items; i++) {
|
||||
if (strcmp(info->items[i].key, SPA_KEY_API_BLUEZ5_TRANSPORT) == 0)
|
||||
sscanf(info->items[i].value, "pointer:%p", &this->transport);
|
||||
}
|
||||
if (info && (str = spa_dict_lookup(info, SPA_KEY_API_BLUEZ5_TRANSPORT)))
|
||||
sscanf(str, "pointer:%p", &this->transport);
|
||||
|
||||
if (this->transport == NULL) {
|
||||
spa_log_error(this->log, "a transport is needed");
|
||||
return -EINVAL;
|
||||
|
|
|
|||
|
|
@ -698,7 +698,7 @@ static const struct spa_node_methods impl_node = {
|
|||
.process = impl_node_process,
|
||||
};
|
||||
|
||||
static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
||||
static int impl_get_interface(struct spa_handle *handle, const char *type, void **interface)
|
||||
{
|
||||
struct impl *this;
|
||||
|
||||
|
|
@ -707,7 +707,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -736,7 +736,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||
|
|
@ -746,13 +745,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
for (i = 0; i < n_support; i++) {
|
||||
switch (support[i].type) {
|
||||
case SPA_TYPE_INTERFACE_Log:
|
||||
this->log = support[i].data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
|
||||
spa_hook_list_init(&this->hooks);
|
||||
|
||||
|
|
|
|||
|
|
@ -436,7 +436,7 @@ static const struct spa_node_methods impl_node = {
|
|||
};
|
||||
|
||||
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;
|
||||
|
||||
|
|
@ -445,7 +445,7 @@ impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -461,16 +461,12 @@ spa_ffmpeg_dec_init(struct spa_handle *handle,
|
|||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
uint32_t i;
|
||||
|
||||
handle->get_interface = impl_get_interface;
|
||||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
for (i = 0; i < n_support; i++) {
|
||||
if (support[i].type == SPA_TYPE_INTERFACE_Log)
|
||||
this->log = support[i].data;
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
|
||||
spa_hook_list_init(&this->hooks);
|
||||
|
||||
|
|
|
|||
|
|
@ -415,7 +415,7 @@ static const struct spa_node_methods impl_node = {
|
|||
};
|
||||
|
||||
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;
|
||||
|
||||
|
|
@ -424,7 +424,7 @@ impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -439,16 +439,12 @@ spa_ffmpeg_enc_init(struct spa_handle *handle,
|
|||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
uint32_t i;
|
||||
|
||||
handle->get_interface = impl_get_interface;
|
||||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
for (i = 0; i < n_support; i++) {
|
||||
if (support[i].type == SPA_TYPE_INTERFACE_Log)
|
||||
this->log = support[i].data;
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
|
||||
spa_hook_list_init(&this->hooks);
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include <spa/utils/keys.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/utils/result.h>
|
||||
#include <spa/node/node.h>
|
||||
#include <spa/support/loop.h>
|
||||
#include <spa/support/plugin.h>
|
||||
#include <spa/monitor/device.h>
|
||||
|
|
@ -335,7 +336,7 @@ static const struct spa_device_methods impl_device = {
|
|||
.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;
|
||||
|
||||
|
|
@ -344,13 +345,10 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
switch (type) {
|
||||
case SPA_TYPE_INTERFACE_Device:
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
|
||||
*interface = &this->device;
|
||||
break;
|
||||
default:
|
||||
else
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -383,7 +381,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
{
|
||||
struct impl *this;
|
||||
const char *str;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(factory != 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;
|
||||
|
||||
for (i = 0; i < n_support; i++) {
|
||||
switch (support[i].type) {
|
||||
case SPA_TYPE_INTERFACE_Log:
|
||||
this->log = support[i].data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
|
||||
this->device.iface = SPA_INTERFACE_INIT(
|
||||
SPA_TYPE_INTERFACE_Device,
|
||||
|
|
@ -409,10 +400,8 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
reset_props(&this->props);
|
||||
|
||||
if (info) {
|
||||
if ((str = spa_dict_lookup(info, SPA_KEY_API_JACK_SERVER)))
|
||||
snprintf(this->props.server, 64, "%s", str);
|
||||
}
|
||||
if (info && (str = spa_dict_lookup(info, SPA_KEY_API_JACK_SERVER)))
|
||||
snprintf(this->props.server, 64, "%s", str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -801,7 +801,7 @@ static const struct spa_node_methods impl_node = {
|
|||
.process = impl_node_process,
|
||||
};
|
||||
|
||||
static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
||||
static int impl_get_interface(struct spa_handle *handle, const char *type, void **interface)
|
||||
{
|
||||
struct impl *this;
|
||||
|
||||
|
|
@ -810,7 +810,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -838,7 +838,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
uint32_t n_support)
|
||||
{
|
||||
struct impl *this;
|
||||
uint32_t i;
|
||||
const char *str;
|
||||
|
||||
spa_return_val_if_fail(factory != 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;
|
||||
|
||||
for (i = 0; i < n_support; i++) {
|
||||
if (support[i].type == SPA_TYPE_INTERFACE_Log)
|
||||
this->log = support[i].data;
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
|
||||
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) {
|
||||
spa_log_error(this->log, NAME" %p: missing "SPA_KEY_API_JACK_CLIENT
|
||||
" property", this);
|
||||
|
|
|
|||
|
|
@ -823,7 +823,7 @@ static const struct spa_node_methods impl_node = {
|
|||
.process = impl_node_process,
|
||||
};
|
||||
|
||||
static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
||||
static int impl_get_interface(struct spa_handle *handle, const char *type, void **interface)
|
||||
{
|
||||
struct impl *this;
|
||||
|
||||
|
|
@ -832,7 +832,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -860,7 +860,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
uint32_t n_support)
|
||||
{
|
||||
struct impl *this;
|
||||
uint32_t i;
|
||||
const char *str;
|
||||
|
||||
spa_return_val_if_fail(factory != 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;
|
||||
|
||||
for (i = 0; i < n_support; i++) {
|
||||
if (support[i].type == SPA_TYPE_INTERFACE_Log)
|
||||
this->log = support[i].data;
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
|
||||
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) {
|
||||
spa_log_error(this->log, NAME" %p: missing "SPA_KEY_API_JACK_CLIENT
|
||||
" property", this);
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ static const struct spa_cpu_methods impl_cpu = {
|
|||
.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;
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_CPU)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_CPU) == 0)
|
||||
*interface = &this->cpu;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -160,7 +160,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
{
|
||||
struct impl *this;
|
||||
const char *str;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(factory != 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,
|
||||
&impl_cpu, this);
|
||||
|
||||
for (i = 0; i < n_support; i++) {
|
||||
switch (support[i].type) {
|
||||
case SPA_TYPE_INTERFACE_Log:
|
||||
this->log = support[i].data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
|
||||
this->flags = 0;
|
||||
this->force = SPA_CPU_FORCE_AUTODETECT;
|
||||
this->max_align = 16;
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ static const struct spa_dbus_methods impl_dbus = {
|
|||
.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;
|
||||
|
||||
|
|
@ -348,7 +348,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_DBus)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_DBus) == 0)
|
||||
*interface = &this->dbus;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -377,7 +377,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
uint32_t n_support)
|
||||
{
|
||||
struct impl *this;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(factory != 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,
|
||||
&impl_dbus, this);
|
||||
|
||||
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_LoopUtils:
|
||||
this->utils = support[i].data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
this->utils = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_LoopUtils);
|
||||
|
||||
if (this->utils == NULL) {
|
||||
spa_log_error(this->log, "a LoopUtils is needed");
|
||||
return -EINVAL;
|
||||
|
|
|
|||
|
|
@ -362,7 +362,7 @@ static const struct spa_system_methods impl_system = {
|
|||
.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;
|
||||
|
||||
|
|
@ -371,13 +371,11 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
impl = (struct impl *) handle;
|
||||
|
||||
switch (type) {
|
||||
case SPA_TYPE_INTERFACE_System:
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_System) == 0)
|
||||
*interface = &impl->system;
|
||||
break;
|
||||
default:
|
||||
else
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -402,7 +400,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
uint32_t n_support)
|
||||
{
|
||||
struct impl *impl;
|
||||
uint32_t i;
|
||||
int res;
|
||||
|
||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||
|
|
@ -417,13 +414,8 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
SPA_VERSION_SYSTEM,
|
||||
&impl_system, impl);
|
||||
|
||||
for (i = 0; i < n_support; i++) {
|
||||
switch (support[i].type) {
|
||||
case SPA_TYPE_INTERFACE_Log:
|
||||
impl->log = support[i].data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
impl->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
|
||||
impl->pid = getpid();
|
||||
|
||||
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,
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
|
|
@ -183,7 +183,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Log)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Log) == 0)
|
||||
*interface = &this->log;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -222,7 +222,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
uint32_t n_support)
|
||||
{
|
||||
struct impl *this;
|
||||
uint32_t i;
|
||||
struct spa_loop *loop = NULL;
|
||||
const char *str;
|
||||
|
||||
|
|
@ -240,16 +239,9 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
&impl_log, this);
|
||||
this->log.level = DEFAULT_LOG_LEVEL;
|
||||
|
||||
for (i = 0; i < n_support; i++) {
|
||||
switch (support[i].type) {
|
||||
case SPA_TYPE_INTERFACE_Loop:
|
||||
loop = support[i].data;
|
||||
break;
|
||||
case SPA_TYPE_INTERFACE_System:
|
||||
this->system = support[i].data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Loop);
|
||||
this->system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_System);
|
||||
|
||||
if (loop != NULL && this->system != NULL) {
|
||||
this->source.func = on_trace_event;
|
||||
this->source.data = this;
|
||||
|
|
|
|||
|
|
@ -664,7 +664,7 @@ static const struct spa_loop_utils_methods impl_loop_utils = {
|
|||
.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;
|
||||
|
||||
|
|
@ -673,19 +673,15 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
impl = (struct impl *) handle;
|
||||
|
||||
switch (type) {
|
||||
case SPA_TYPE_INTERFACE_Loop:
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Loop) == 0)
|
||||
*interface = &impl->loop;
|
||||
break;
|
||||
case SPA_TYPE_INTERFACE_LoopControl:
|
||||
else if (strcmp(type, SPA_TYPE_INTERFACE_LoopControl) == 0)
|
||||
*interface = &impl->control;
|
||||
break;
|
||||
case SPA_TYPE_INTERFACE_LoopUtils:
|
||||
else if (strcmp(type, SPA_TYPE_INTERFACE_LoopUtils) == 0)
|
||||
*interface = &impl->utils;
|
||||
break;
|
||||
default:
|
||||
else
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -724,7 +720,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
uint32_t n_support)
|
||||
{
|
||||
struct impl *impl;
|
||||
uint32_t i;
|
||||
int res;
|
||||
|
||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||
|
|
@ -747,16 +742,9 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
SPA_VERSION_LOOP_UTILS,
|
||||
&impl_loop_utils, impl);
|
||||
|
||||
for (i = 0; i < n_support; i++) {
|
||||
switch (support[i].type) {
|
||||
case SPA_TYPE_INTERFACE_Log:
|
||||
impl->log = support[i].data;
|
||||
break;
|
||||
case SPA_TYPE_INTERFACE_System:
|
||||
impl->system = support[i].data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
impl->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
impl->system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_System);
|
||||
|
||||
if (impl->system == NULL) {
|
||||
spa_log_error(impl->log, NAME " %p: a System is needed", impl);
|
||||
res = -EINVAL;
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ static const struct spa_system_methods impl_system = {
|
|||
.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;
|
||||
|
||||
|
|
@ -287,13 +287,11 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
impl = (struct impl *) handle;
|
||||
|
||||
switch (type) {
|
||||
case SPA_TYPE_INTERFACE_System:
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_System) == 0)
|
||||
*interface = &impl->system;
|
||||
break;
|
||||
default:
|
||||
else
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -318,7 +316,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
uint32_t n_support)
|
||||
{
|
||||
struct impl *impl;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(factory != 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,
|
||||
&impl_system, impl);
|
||||
|
||||
for (i = 0; i < n_support; i++) {
|
||||
switch (support[i].type) {
|
||||
case SPA_TYPE_INTERFACE_Log:
|
||||
impl->log = support[i].data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
impl->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
|
||||
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,
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
|
|
@ -688,7 +688,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -727,7 +727,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||
|
|
@ -737,19 +736,9 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
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);
|
||||
|
||||
spa_hook_list_init(&this->hooks);
|
||||
|
||||
|
|
|
|||
|
|
@ -713,7 +713,7 @@ static const struct spa_node_methods impl_node = {
|
|||
.process = impl_node_process,
|
||||
};
|
||||
|
||||
static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
||||
static int impl_get_interface(struct spa_handle *handle, const char *type, void **interface)
|
||||
{
|
||||
struct impl *this;
|
||||
|
||||
|
|
@ -722,7 +722,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -761,7 +761,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||
|
|
@ -771,19 +770,9 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
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);
|
||||
|
||||
spa_hook_list_init(&this->hooks);
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include <spa/support/loop.h>
|
||||
#include <spa/utils/keys.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/node/node.h>
|
||||
#include <spa/pod/builder.h>
|
||||
#include <spa/monitor/device.h>
|
||||
#include <spa/monitor/utils.h>
|
||||
|
|
@ -186,7 +187,7 @@ static const struct spa_device_methods impl_device = {
|
|||
.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;
|
||||
|
||||
|
|
@ -195,7 +196,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Device)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
|
||||
*interface = &this->device;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -223,7 +224,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
uint32_t n_support)
|
||||
{
|
||||
struct impl *this;
|
||||
uint32_t i;
|
||||
const char *str;
|
||||
|
||||
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->clear = impl_clear, this = (struct impl *) handle;
|
||||
|
||||
for (i = 0; i < n_support; i++) {
|
||||
switch (support[i].type) {
|
||||
case SPA_TYPE_INTERFACE_Log:
|
||||
this->log = support[i].data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
|
||||
spa_hook_list_init(&this->hooks);
|
||||
|
||||
|
|
|
|||
|
|
@ -886,7 +886,7 @@ static const struct spa_node_methods impl_node = {
|
|||
.process = impl_node_process,
|
||||
};
|
||||
|
||||
static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
||||
static int impl_get_interface(struct spa_handle *handle, const char *type, void **interface)
|
||||
{
|
||||
struct impl *this;
|
||||
|
||||
|
|
@ -895,7 +895,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -923,7 +923,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
uint32_t n_support)
|
||||
{
|
||||
struct impl *this;
|
||||
uint32_t i;
|
||||
const char *str;
|
||||
struct port *port;
|
||||
int res;
|
||||
|
|
@ -936,16 +935,9 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
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);
|
||||
|
||||
if (this->data_loop == NULL) {
|
||||
spa_log_error(this->log, "a data_loop is needed");
|
||||
return -EINVAL;
|
||||
|
|
|
|||
|
|
@ -426,7 +426,7 @@ static const struct spa_device_methods impl_device = {
|
|||
.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;
|
||||
|
||||
|
|
@ -435,13 +435,10 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
switch (type) {
|
||||
case SPA_TYPE_INTERFACE_Device:
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
|
||||
*interface = &this->device;
|
||||
break;
|
||||
default:
|
||||
else
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -469,7 +466,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
uint32_t n_support)
|
||||
{
|
||||
struct impl *this;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(factory != 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;
|
||||
|
||||
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_Loop:
|
||||
this->main_loop = support[i].data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
this->main_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Loop);
|
||||
|
||||
if (this->main_loop == NULL) {
|
||||
spa_log_error(this->log, "a main-loop is needed");
|
||||
return -EINVAL;
|
||||
|
|
|
|||
|
|
@ -801,7 +801,7 @@ static const struct spa_node_methods impl_node = {
|
|||
.process = impl_node_process,
|
||||
};
|
||||
|
||||
static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
||||
static int impl_get_interface(struct spa_handle *handle, const char *type, void **interface)
|
||||
{
|
||||
struct impl *this;
|
||||
|
||||
|
|
@ -810,7 +810,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -864,7 +864,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
void *iface;
|
||||
#endif
|
||||
const char *str;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(factory != 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;
|
||||
|
||||
for (i = 0; i < n_support; i++) {
|
||||
switch (support[i].type) {
|
||||
case SPA_TYPE_INTERFACE_Log:
|
||||
this->log = support[i].data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
|
||||
if (info == NULL || (str = spa_dict_lookup(info, "video.adapt.slave")) == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
|
|
|
|||
|
|
@ -808,7 +808,7 @@ static const struct spa_node_methods impl_node = {
|
|||
.process = impl_node_process,
|
||||
};
|
||||
|
||||
static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
||||
static int impl_get_interface(struct spa_handle *handle, const char *type, void **interface)
|
||||
{
|
||||
struct impl *this;
|
||||
|
||||
|
|
@ -817,7 +817,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -856,7 +856,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||
|
|
@ -866,19 +865,9 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
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);
|
||||
|
||||
spa_hook_list_init(&this->hooks);
|
||||
|
||||
|
|
|
|||
|
|
@ -737,7 +737,7 @@ static const struct spa_node_methods impl_node = {
|
|||
.process = impl_node_process,
|
||||
};
|
||||
|
||||
static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
||||
static int impl_get_interface(struct spa_handle *handle, const char *type, void **interface)
|
||||
{
|
||||
struct impl *this;
|
||||
|
||||
|
|
@ -746,7 +746,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -775,7 +775,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||
|
|
@ -785,10 +784,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
for (i = 0; i < n_support; i++) {
|
||||
if (support[i].type == SPA_TYPE_INTERFACE_Log)
|
||||
this->log = support[i].data;
|
||||
}
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
|
||||
spa_hook_list_init(&this->hooks);
|
||||
|
||||
|
|
|
|||
|
|
@ -824,7 +824,7 @@ static const struct spa_node_methods impl_node = {
|
|||
.process = impl_node_process,
|
||||
};
|
||||
|
||||
static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
|
||||
static int impl_get_interface(struct spa_handle *handle, const char *type, void **interface)
|
||||
{
|
||||
struct impl *this;
|
||||
|
||||
|
|
@ -833,7 +833,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (type == SPA_TYPE_INTERFACE_Node)
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -872,7 +872,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||
|
|
@ -882,19 +881,9 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
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);
|
||||
|
||||
spa_hook_list_init(&this->hooks);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue