mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-08 13:30:08 -05:00
Remove dynamic types
Do not use dynamic types anymore. The reason is that it's difficult: - to maintain a shared type database over a network. - the extra overhead when translating between processes and for maintaining the translation tables. - race conditions in translating in RT-threads, this is a problem because we want to make event streams. We now have simple enums with types and extension points for all types. This is also nicer to use in general. We don't need the mapper anymore or pass strings around as types. There is a parallel type info system to get more info about ids and enums and their hierarchy. It can also be used for debugging.
This commit is contained in:
parent
e6977fa178
commit
fca3e1d85d
162 changed files with 5200 additions and 7461 deletions
|
|
@ -180,13 +180,12 @@ static const struct pw_module_events module_events = {
|
|||
static int module_init(struct pw_module *module, struct pw_properties *properties)
|
||||
{
|
||||
struct pw_core *core = pw_module_get_core(module);
|
||||
struct pw_type *t = pw_core_get_type(core);
|
||||
struct pw_factory *factory;
|
||||
struct factory_data *data;
|
||||
|
||||
factory = pw_factory_new(core,
|
||||
"audio-dsp",
|
||||
t->node,
|
||||
PW_ID_INTERFACE_Node,
|
||||
PW_VERSION_NODE,
|
||||
NULL,
|
||||
sizeof(*data));
|
||||
|
|
|
|||
|
|
@ -46,8 +46,6 @@ struct factory_data {
|
|||
|
||||
struct pw_module *module;
|
||||
struct spa_hook module_listener;
|
||||
|
||||
uint32_t type_client_node;
|
||||
};
|
||||
|
||||
static void *create_object(void *_data,
|
||||
|
|
@ -122,16 +120,12 @@ static const struct pw_module_events module_events = {
|
|||
static int module_init(struct pw_module *module, struct pw_properties *properties)
|
||||
{
|
||||
struct pw_core *core = pw_module_get_core(module);
|
||||
struct pw_type *t = pw_core_get_type(core);
|
||||
struct pw_factory *factory;
|
||||
struct factory_data *data;
|
||||
uint32_t type_client_node;
|
||||
|
||||
type_client_node = spa_type_map_get_id(t->map, PW_TYPE_INTERFACE__ClientNode);
|
||||
|
||||
factory = pw_factory_new(core,
|
||||
"client-node",
|
||||
type_client_node,
|
||||
PW_ID_INTERFACE_ClientNode,
|
||||
PW_VERSION_CLIENT_NODE,
|
||||
NULL,
|
||||
sizeof(*data));
|
||||
|
|
@ -142,7 +136,6 @@ static int module_init(struct pw_module *module, struct pw_properties *propertie
|
|||
data->this = factory;
|
||||
data->module = module;
|
||||
data->properties = properties;
|
||||
data->type_client_node = type_client_node;
|
||||
|
||||
pw_log_debug("module %p: new", module);
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include <spa/node/node.h>
|
||||
#include <spa/pod/filter.h>
|
||||
#include <spa/debug/types.h>
|
||||
|
||||
#include "pipewire/pipewire.h"
|
||||
#include "pipewire/interfaces.h"
|
||||
|
|
@ -65,15 +66,6 @@
|
|||
|
||||
#define CHECK_PORT_BUFFER(this,b,p) (b < p->n_buffers)
|
||||
|
||||
struct type {
|
||||
uint32_t client_node_position;
|
||||
};
|
||||
|
||||
static inline void init_type(struct type *type, struct spa_type_map *map)
|
||||
{
|
||||
type->client_node_position = spa_type_map_get_id(map, PW_TYPE_CLIENT_NODE_IO__Position);
|
||||
}
|
||||
|
||||
struct mem {
|
||||
uint32_t id;
|
||||
int ref;
|
||||
|
|
@ -130,7 +122,6 @@ struct node {
|
|||
|
||||
struct impl *impl;
|
||||
|
||||
struct spa_type_map *map;
|
||||
struct spa_log *log;
|
||||
struct spa_loop *data_loop;
|
||||
|
||||
|
|
@ -158,10 +149,7 @@ struct node {
|
|||
struct impl {
|
||||
struct pw_client_node this;
|
||||
|
||||
struct type type;
|
||||
|
||||
struct pw_core *core;
|
||||
struct pw_type *t;
|
||||
|
||||
struct node node;
|
||||
|
||||
|
|
@ -315,7 +303,6 @@ static int clear_buffers(struct node *this, struct mix *mix)
|
|||
{
|
||||
uint32_t i, j;
|
||||
struct impl *impl = this->impl;
|
||||
struct pw_type *t = impl->t;
|
||||
|
||||
for (i = 0; i < mix->n_buffers; i++) {
|
||||
struct buffer *b = &mix->buffers[i];
|
||||
|
|
@ -326,8 +313,8 @@ static int clear_buffers(struct node *this, struct mix *mix)
|
|||
for (j = 0; j < b->buffer.n_datas; j++) {
|
||||
struct spa_data *d = &b->datas[j];
|
||||
|
||||
if (d->type == t->data.DmaBuf ||
|
||||
d->type == t->data.MemFd) {
|
||||
if (d->type == SPA_DATA_DmaBuf ||
|
||||
d->type == SPA_DATA_MemFd) {
|
||||
uint32_t id;
|
||||
|
||||
id = SPA_PTR_TO_UINT32(b->buffer.datas[j].data);
|
||||
|
|
@ -501,7 +488,6 @@ do_update_port(struct node *this,
|
|||
const struct spa_pod **params,
|
||||
const struct spa_port_info *info)
|
||||
{
|
||||
struct pw_type *t = this->impl->t;
|
||||
int i;
|
||||
|
||||
if (change_mask & PW_CLIENT_NODE_PORT_UPDATE_PARAMS) {
|
||||
|
|
@ -516,7 +502,7 @@ do_update_port(struct node *this,
|
|||
for (i = 0; i < port->n_params; i++) {
|
||||
port->params[i] = pw_spa_pod_copy(params[i]);
|
||||
|
||||
if (spa_pod_is_object_id(port->params[i], t->param.idFormat))
|
||||
if (spa_pod_is_object_id(port->params[i], SPA_ID_PARAM_Format))
|
||||
port->have_format = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -698,7 +684,6 @@ static int do_port_set_io(struct impl *impl,
|
|||
uint32_t id, void *data, size_t size)
|
||||
{
|
||||
struct node *this = &impl->node;
|
||||
struct pw_type *t = impl->t;
|
||||
struct pw_memblock *mem;
|
||||
struct mem *m;
|
||||
uint32_t memid, mem_offset, mem_size;
|
||||
|
|
@ -729,7 +714,7 @@ static int do_port_set_io(struct impl *impl,
|
|||
return -EINVAL;
|
||||
|
||||
mem_offset += mem->offset;
|
||||
m = ensure_mem(impl, mem->fd, t->data.MemFd, mem->flags);
|
||||
m = ensure_mem(impl, mem->fd, SPA_DATA_MemFd, mem->flags);
|
||||
memid = m->id;
|
||||
}
|
||||
else {
|
||||
|
|
@ -779,7 +764,6 @@ do_port_use_buffers(struct impl *impl,
|
|||
struct mix *mix;
|
||||
uint32_t i, j;
|
||||
struct pw_client_node_buffer *mb;
|
||||
struct pw_type *t = impl->t;
|
||||
|
||||
spa_log_debug(this->log, "client-node %p: %s port %d.%d use buffers %p %u", impl,
|
||||
direction == SPA_DIRECTION_INPUT ? "input" : "output",
|
||||
|
|
@ -836,11 +820,11 @@ do_port_use_buffers(struct impl *impl,
|
|||
for (j = 0; j < buffers[i]->n_datas; j++) {
|
||||
struct spa_data *d = buffers[i]->datas;
|
||||
data_size += sizeof(struct spa_chunk);
|
||||
if (d->type == t->data.MemPtr)
|
||||
if (d->type == SPA_DATA_MemPtr)
|
||||
data_size += d->maxsize;
|
||||
}
|
||||
|
||||
m = ensure_mem(impl, mem->fd, t->data.MemFd, mem->flags);
|
||||
m = ensure_mem(impl, mem->fd, SPA_DATA_MemFd, mem->flags);
|
||||
b->memid = m->id;
|
||||
|
||||
mb[i].buffer = &b->buffer;
|
||||
|
|
@ -858,11 +842,11 @@ do_port_use_buffers(struct impl *impl,
|
|||
|
||||
memcpy(&b->buffer.datas[j], d, sizeof(struct spa_data));
|
||||
|
||||
if (d->type == t->data.DmaBuf ||
|
||||
d->type == t->data.MemFd) {
|
||||
if (d->type == SPA_DATA_DmaBuf ||
|
||||
d->type == SPA_DATA_MemFd) {
|
||||
m = ensure_mem(impl, d->fd, d->type, d->flags);
|
||||
b->buffer.datas[j].data = SPA_UINT32_TO_PTR(m->id);
|
||||
} else if (d->type == t->data.MemPtr) {
|
||||
} else if (d->type == SPA_DATA_MemPtr) {
|
||||
b->buffer.datas[j].data = SPA_INT_TO_PTR(size);
|
||||
size += d->maxsize;
|
||||
} else {
|
||||
|
|
@ -950,8 +934,6 @@ impl_node_port_send_command(struct spa_node *node,
|
|||
uint32_t port_id, const struct spa_command *command)
|
||||
{
|
||||
struct node *this;
|
||||
struct impl *impl;
|
||||
struct pw_type *t;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(command != NULL, -EINVAL);
|
||||
|
|
@ -961,11 +943,8 @@ impl_node_port_send_command(struct spa_node *node,
|
|||
if (this->resource == NULL)
|
||||
return 0;
|
||||
|
||||
impl = this->impl;
|
||||
t = impl->t;
|
||||
|
||||
spa_log_trace(this->log, "send command %s",
|
||||
spa_type_map_get_type(t->map, SPA_COMMAND_TYPE(command)));
|
||||
spa_debug_type_find_name(spa_debug_types, SPA_COMMAND_TYPE(command)));
|
||||
|
||||
pw_client_node_resource_port_command(this->resource,
|
||||
direction, port_id,
|
||||
|
|
@ -1175,21 +1154,21 @@ node_init(struct node *this,
|
|||
uint32_t i;
|
||||
|
||||
for (i = 0; i < n_support; i++) {
|
||||
if (strcmp(support[i].type, SPA_TYPE__Log) == 0)
|
||||
switch (support[i].type) {
|
||||
case SPA_ID_INTERFACE_Log:
|
||||
this->log = support[i].data;
|
||||
else if (strcmp(support[i].type, SPA_TYPE_LOOP__DataLoop) == 0)
|
||||
break;
|
||||
case SPA_ID_INTERFACE_DataLoop:
|
||||
this->data_loop = support[i].data;
|
||||
else if (strcmp(support[i].type, SPA_TYPE__TypeMap) == 0)
|
||||
this->map = support[i].data;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (this->data_loop == NULL) {
|
||||
spa_log_error(this->log, "a data-loop is needed");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (this->map == NULL) {
|
||||
spa_log_error(this->log, "a type map is needed");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
this->node = impl_node;
|
||||
|
||||
|
|
@ -1266,7 +1245,6 @@ static void node_initialized(void *data)
|
|||
struct impl *impl = data;
|
||||
struct pw_client_node *this = &impl->this;
|
||||
struct pw_node *node = this->node;
|
||||
struct pw_type *t = impl->t;
|
||||
struct pw_global *global;
|
||||
uint32_t area_size, size;
|
||||
struct mem *m;
|
||||
|
|
@ -1297,11 +1275,11 @@ static void node_initialized(void *data)
|
|||
impl->position = SPA_MEMBER(impl->io_areas->ptr,
|
||||
area_size, struct pw_client_node_position);
|
||||
|
||||
m = ensure_mem(impl, impl->io_areas->fd, t->data.MemFd, impl->io_areas->flags);
|
||||
m = ensure_mem(impl, impl->io_areas->fd, SPA_DATA_MemFd, impl->io_areas->flags);
|
||||
pw_log_debug("client-node %p: io areas %p", node, impl->io_areas->ptr);
|
||||
|
||||
pw_client_node_resource_set_io(this->resource,
|
||||
impl->type.client_node_position,
|
||||
PW_ID_IO_ClientNodePosition,
|
||||
m->id,
|
||||
area_size,
|
||||
sizeof(struct pw_client_node_position));
|
||||
|
|
@ -1451,13 +1429,12 @@ static int impl_mix_port_set_io(struct spa_node *node,
|
|||
struct pw_port *port = p->port;
|
||||
struct impl *impl = port->owner_data;
|
||||
struct pw_port_mix *mix;
|
||||
struct pw_type *t = impl->t;
|
||||
|
||||
mix = pw_map_lookup(&port->mix_port_map, mix_id);
|
||||
if (mix == NULL)
|
||||
return -EIO;
|
||||
|
||||
if (id == t->io.Buffers) {
|
||||
if (id == SPA_ID_IO_Buffers) {
|
||||
if (data && size >= sizeof(struct spa_io_buffers))
|
||||
mix->io = data;
|
||||
else
|
||||
|
|
@ -1606,12 +1583,9 @@ struct pw_client_node *pw_client_node_new(struct pw_resource *resource,
|
|||
this = &impl->this;
|
||||
|
||||
impl->core = core;
|
||||
impl->t = pw_core_get_type(core);
|
||||
impl->fds[0] = impl->fds[1] = -1;
|
||||
pw_log_debug("client-node %p: new", impl);
|
||||
|
||||
init_type(&impl->type, impl->t->map);
|
||||
|
||||
support = pw_core_get_support(impl->core, &n_support);
|
||||
node_init(&impl->node, NULL, support, n_support);
|
||||
impl->node.impl = impl;
|
||||
|
|
|
|||
|
|
@ -47,23 +47,11 @@
|
|||
|
||||
/** \cond */
|
||||
|
||||
struct type {
|
||||
struct spa_type_media_type media_type;
|
||||
struct spa_type_media_subtype media_subtype;
|
||||
};
|
||||
|
||||
static inline void init_type(struct type *type, struct spa_type_map *map)
|
||||
{
|
||||
spa_type_media_type_map(map, &type->media_type);
|
||||
spa_type_media_subtype_map(map, &type->media_subtype);
|
||||
}
|
||||
|
||||
struct node {
|
||||
struct spa_node node;
|
||||
|
||||
struct impl *impl;
|
||||
|
||||
struct spa_type_map *map;
|
||||
struct spa_log *log;
|
||||
|
||||
const struct spa_node_callbacks *callbacks;
|
||||
|
|
@ -75,10 +63,7 @@ struct node {
|
|||
struct impl {
|
||||
struct pw_client_stream this;
|
||||
|
||||
struct type type;
|
||||
|
||||
struct pw_core *core;
|
||||
struct pw_type *t;
|
||||
|
||||
struct node node;
|
||||
|
||||
|
|
@ -253,14 +238,12 @@ impl_node_add_port(struct spa_node *node, enum spa_direction direction, uint32_t
|
|||
{
|
||||
struct node *this;
|
||||
struct impl *impl;
|
||||
struct pw_type *t;
|
||||
int res;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
t = impl->t;
|
||||
|
||||
if (direction != impl->direction)
|
||||
return -EINVAL;
|
||||
|
|
@ -270,7 +253,7 @@ impl_node_add_port(struct spa_node *node, enum spa_direction direction, uint32_t
|
|||
|
||||
if ((res = spa_node_port_set_io(impl->adapter_mix,
|
||||
direction, port_id,
|
||||
t->io.ControlRange,
|
||||
SPA_ID_IO_ControlRange,
|
||||
&impl->ctrl,
|
||||
sizeof(&impl->ctrl))) < 0)
|
||||
return res;
|
||||
|
|
@ -344,14 +327,13 @@ static int debug_params(struct impl *impl, struct spa_node *node,
|
|||
enum spa_direction direction, uint32_t port_id, uint32_t id, struct spa_pod *filter)
|
||||
{
|
||||
struct node *this = &impl->node;
|
||||
struct pw_type *t = impl->t;
|
||||
struct spa_pod_builder b = { 0 };
|
||||
uint8_t buffer[4096];
|
||||
uint32_t state;
|
||||
struct spa_pod *param;
|
||||
int res;
|
||||
|
||||
spa_log_error(this->log, "params %s:", spa_type_map_get_type(t->map, id));
|
||||
spa_log_error(this->log, "params %s:", spa_debug_type_find_name(spa_debug_types, id));
|
||||
|
||||
state = 0;
|
||||
while (true) {
|
||||
|
|
@ -365,12 +347,12 @@ static int debug_params(struct impl *impl, struct spa_node *node,
|
|||
spa_log_error(this->log, " error: %s", spa_strerror(res));
|
||||
break;
|
||||
}
|
||||
spa_debug_pod(2, t->map, param);
|
||||
spa_debug_pod(2, spa_debug_types, param);
|
||||
}
|
||||
|
||||
spa_log_error(this->log, "failed filter:");
|
||||
if (filter)
|
||||
spa_debug_pod(2, t->map, filter);
|
||||
spa_debug_pod(2, spa_debug_types, filter);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -383,7 +365,6 @@ static int negotiate_format(struct impl *impl)
|
|||
struct spa_pod *format;
|
||||
uint8_t buffer[4096];
|
||||
struct spa_pod_builder b = { 0 };
|
||||
struct pw_type *t = impl->t;
|
||||
int res;
|
||||
|
||||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||
|
|
@ -393,35 +374,35 @@ static int negotiate_format(struct impl *impl)
|
|||
state = 0;
|
||||
if ((res = spa_node_port_enum_params(impl->adapter_mix,
|
||||
SPA_DIRECTION_REVERSE(impl->direction), 0,
|
||||
t->param.idEnumFormat, &state,
|
||||
SPA_ID_PARAM_EnumFormat, &state,
|
||||
NULL, &format, &b)) <= 0) {
|
||||
debug_params(impl, impl->adapter_mix, SPA_DIRECTION_REVERSE(impl->direction), 0,
|
||||
t->param.idEnumFormat, NULL);
|
||||
SPA_ID_PARAM_EnumFormat, NULL);
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
state = 0;
|
||||
if ((res = spa_node_port_enum_params(impl->cnode,
|
||||
impl->direction, 0,
|
||||
t->param.idEnumFormat, &state,
|
||||
SPA_ID_PARAM_EnumFormat, &state,
|
||||
format, &format, &b)) <= 0) {
|
||||
debug_params(impl, impl->cnode, impl->direction, 0,
|
||||
t->param.idEnumFormat, format);
|
||||
SPA_ID_PARAM_EnumFormat, format);
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
spa_pod_fixate(format);
|
||||
spa_debug_format(0, t->map, format);
|
||||
spa_debug_format(0, NULL, format);
|
||||
|
||||
if ((res = spa_node_port_set_param(impl->adapter_mix,
|
||||
SPA_DIRECTION_REVERSE(impl->direction), 0,
|
||||
t->param.idFormat, 0,
|
||||
SPA_ID_PARAM_Format, 0,
|
||||
format)) < 0)
|
||||
return res;
|
||||
|
||||
if ((res = spa_node_port_set_param(impl->cnode,
|
||||
impl->direction, 0,
|
||||
t->param.idFormat, 0,
|
||||
SPA_ID_PARAM_Format, 0,
|
||||
format)) < 0)
|
||||
return res;
|
||||
|
||||
|
|
@ -431,7 +412,6 @@ static int negotiate_format(struct impl *impl)
|
|||
static int negotiate_buffers(struct impl *impl)
|
||||
{
|
||||
struct node *this = &impl->node;
|
||||
struct pw_type *t = impl->t;
|
||||
uint8_t buffer[4096];
|
||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
|
||||
uint32_t state;
|
||||
|
|
@ -453,10 +433,10 @@ static int negotiate_buffers(struct impl *impl)
|
|||
state = 0;
|
||||
if ((res = spa_node_port_enum_params(impl->adapter_mix,
|
||||
SPA_DIRECTION_REVERSE(impl->direction), 0,
|
||||
t->param.idBuffers, &state,
|
||||
SPA_ID_PARAM_Buffers, &state,
|
||||
param, ¶m, &b)) <= 0) {
|
||||
debug_params(impl, impl->adapter_mix, SPA_DIRECTION_REVERSE(impl->direction), 0,
|
||||
t->param.idBuffers, param);
|
||||
SPA_ID_PARAM_Buffers, param);
|
||||
return -ENOTSUP;
|
||||
}
|
||||
if (res == 0)
|
||||
|
|
@ -465,10 +445,10 @@ static int negotiate_buffers(struct impl *impl)
|
|||
state = 0;
|
||||
if ((res = spa_node_port_enum_params(impl->cnode,
|
||||
impl->direction, 0,
|
||||
t->param.idBuffers, &state,
|
||||
SPA_ID_PARAM_Buffers, &state,
|
||||
param, ¶m, &b)) < 0) {
|
||||
debug_params(impl, impl->cnode, impl->direction, 0,
|
||||
t->param.idBuffers, param);
|
||||
SPA_ID_PARAM_Buffers, param);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
@ -494,10 +474,10 @@ static int negotiate_buffers(struct impl *impl)
|
|||
}
|
||||
|
||||
if (spa_pod_object_parse(param,
|
||||
":", t->param_buffers.buffers, "i", &buffers,
|
||||
":", t->param_buffers.blocks, "i", &blocks,
|
||||
":", t->param_buffers.size, "i", &size,
|
||||
":", t->param_buffers.align, "i", &align,
|
||||
":", SPA_PARAM_BUFFERS_buffers, "i", &buffers,
|
||||
":", SPA_PARAM_BUFFERS_blocks, "i", &blocks,
|
||||
":", SPA_PARAM_BUFFERS_size, "i", &size,
|
||||
":", SPA_PARAM_BUFFERS_align, "i", &align,
|
||||
NULL) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
|
|
@ -508,7 +488,7 @@ static int negotiate_buffers(struct impl *impl)
|
|||
memset(datas, 0, sizeof(struct spa_data) * blocks);
|
||||
aligns = alloca(sizeof(uint32_t) * blocks);
|
||||
for (i = 0; i < blocks; i++) {
|
||||
datas[i].type = t->data.MemPtr;
|
||||
datas[i].type = SPA_DATA_MemPtr;
|
||||
datas[i].maxsize = size;
|
||||
aligns[i] = align;
|
||||
}
|
||||
|
|
@ -603,14 +583,12 @@ impl_node_port_set_param(struct spa_node *node,
|
|||
{
|
||||
struct node *this;
|
||||
struct impl *impl;
|
||||
struct pw_type *t;
|
||||
int res;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
t = impl->t;
|
||||
|
||||
if (direction != impl->direction)
|
||||
return -EINVAL;
|
||||
|
|
@ -619,7 +597,7 @@ impl_node_port_set_param(struct spa_node *node,
|
|||
flags, param)) < 0)
|
||||
return res;
|
||||
|
||||
if (id == t->param.idFormat && impl->use_converter) {
|
||||
if (id == SPA_ID_PARAM_Format && impl->use_converter) {
|
||||
if (param == NULL) {
|
||||
if ((res = spa_node_port_set_param(impl->adapter_mix,
|
||||
SPA_DIRECTION_REVERSE(direction), 0, id,
|
||||
|
|
@ -644,14 +622,12 @@ impl_node_port_set_io(struct spa_node *node,
|
|||
{
|
||||
struct node *this;
|
||||
struct impl *impl;
|
||||
struct pw_type *t;
|
||||
int res = 0;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
impl = this->impl;
|
||||
t = impl->t;
|
||||
|
||||
spa_log_debug(this->log, "set io %d %d %d", id, direction, impl->direction);
|
||||
if (direction != impl->direction)
|
||||
|
|
@ -660,7 +636,7 @@ impl_node_port_set_io(struct spa_node *node,
|
|||
if (impl->use_converter)
|
||||
res = spa_node_port_set_io(impl->adapter_mix, direction, port_id, id, data, size);
|
||||
|
||||
if (id == t->io.Buffers && size >= sizeof(struct spa_io_buffers)) {
|
||||
if (id == SPA_ID_IO_Buffers && size >= sizeof(struct spa_io_buffers)) {
|
||||
impl->io = data;
|
||||
}
|
||||
|
||||
|
|
@ -837,16 +813,9 @@ node_init(struct node *this,
|
|||
uint32_t i;
|
||||
|
||||
for (i = 0; i < n_support; i++) {
|
||||
if (strcmp(support[i].type, SPA_TYPE__Log) == 0)
|
||||
if (support[i].type == SPA_ID_INTERFACE_Log)
|
||||
this->log = support[i].data;
|
||||
else if (strcmp(support[i].type, SPA_TYPE__TypeMap) == 0)
|
||||
this->map = support[i].data;
|
||||
}
|
||||
if (this->map == NULL) {
|
||||
spa_log_error(this->log, "a type map is needed");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
this->node = impl_node;
|
||||
|
||||
this->seq = 1;
|
||||
|
|
@ -859,7 +828,6 @@ static void client_node_initialized(void *data)
|
|||
struct impl *impl = data;
|
||||
uint32_t n_input_ports, n_output_ports, max_input_ports, max_output_ports, state;
|
||||
uint32_t media_type, media_subtype;
|
||||
struct pw_type *t = impl->t;
|
||||
struct spa_pod *format;
|
||||
uint8_t buffer[4096];
|
||||
struct spa_pod_builder b;
|
||||
|
|
@ -906,7 +874,7 @@ static void client_node_initialized(void *data)
|
|||
|
||||
if ((res = spa_node_port_set_io(impl->client_port->mix,
|
||||
impl->direction, 0,
|
||||
t->io.Buffers,
|
||||
SPA_ID_IO_Buffers,
|
||||
impl->client_port_mix.io,
|
||||
sizeof(impl->client_port_mix.io))) < 0)
|
||||
return;
|
||||
|
|
@ -915,7 +883,7 @@ static void client_node_initialized(void *data)
|
|||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||
if ((res = spa_node_port_enum_params(impl->cnode,
|
||||
impl->direction, 0,
|
||||
t->param.idEnumFormat, &state,
|
||||
SPA_ID_PARAM_EnumFormat, &state,
|
||||
NULL, &format, &b)) <= 0) {
|
||||
pw_log_warn("client-stream %p: no format given", &impl->this);
|
||||
impl->adapter = impl->cnode;
|
||||
|
|
@ -929,15 +897,15 @@ static void client_node_initialized(void *data)
|
|||
"I", &media_subtype);
|
||||
|
||||
pw_log_debug("client-stream %p: %s/%s", &impl->this,
|
||||
spa_type_map_get_type(t->map, media_type),
|
||||
spa_type_map_get_type(t->map, media_subtype));
|
||||
spa_debug_type_find_name(spa_debug_types, media_type),
|
||||
spa_debug_type_find_name(spa_debug_types, media_subtype));
|
||||
|
||||
|
||||
if (!exclusive &&
|
||||
media_type == impl->type.media_type.audio &&
|
||||
media_subtype == impl->type.media_subtype.raw) {
|
||||
media_type == SPA_MEDIA_TYPE_audio &&
|
||||
media_subtype == SPA_MEDIA_SUBTYPE_raw) {
|
||||
if ((impl->adapter = pw_load_spa_interface("audioconvert/libspa-audioconvert",
|
||||
"audioconvert", SPA_TYPE__Node, NULL, 0, NULL)) == NULL)
|
||||
"audioconvert", SPA_ID_INTERFACE_Node, NULL, 0, NULL)) == NULL)
|
||||
return;
|
||||
|
||||
impl->adapter_mix = impl->adapter;
|
||||
|
|
@ -952,7 +920,7 @@ static void client_node_initialized(void *data)
|
|||
if (impl->use_converter) {
|
||||
if ((res = spa_node_port_set_io(impl->adapter_mix,
|
||||
SPA_DIRECTION_REVERSE(impl->direction), 0,
|
||||
t->io.Buffers,
|
||||
SPA_ID_IO_Buffers,
|
||||
impl->client_port_mix.io,
|
||||
sizeof(impl->client_port_mix.io))) < 0)
|
||||
return;
|
||||
|
|
@ -960,9 +928,9 @@ static void client_node_initialized(void *data)
|
|||
|
||||
}
|
||||
|
||||
if (media_type == impl->type.media_type.audio)
|
||||
if (media_type == SPA_MEDIA_TYPE_audio)
|
||||
type = "Audio";
|
||||
else if (media_type == impl->type.media_type.video)
|
||||
else if (media_type == SPA_MEDIA_TYPE_video)
|
||||
type = "Video";
|
||||
else
|
||||
type = "Generic";
|
||||
|
|
@ -1108,9 +1076,6 @@ struct pw_client_stream *pw_client_stream_new(struct pw_resource *resource,
|
|||
this = &impl->this;
|
||||
|
||||
impl->core = core;
|
||||
impl->t = pw_core_get_type(core);
|
||||
|
||||
init_type(&impl->type, impl->t->map);
|
||||
|
||||
pw_log_debug("client-stream %p: new", impl);
|
||||
|
||||
|
|
|
|||
|
|
@ -938,7 +938,7 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_client_node_
|
|||
};
|
||||
|
||||
static const struct pw_protocol_marshal pw_protocol_native_client_node_marshal = {
|
||||
PW_TYPE_INTERFACE__ClientNode,
|
||||
PW_ID_INTERFACE_ClientNode,
|
||||
PW_VERSION_CLIENT_NODE,
|
||||
&pw_protocol_native_client_node_method_marshal,
|
||||
&pw_protocol_native_client_node_method_demarshal,
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ static const struct spa_dict_item module_props[] = {
|
|||
|
||||
struct impl {
|
||||
struct pw_core *core;
|
||||
struct pw_type *type;
|
||||
struct pw_properties *properties;
|
||||
|
||||
struct spa_dbus_connection *conn;
|
||||
|
|
@ -211,7 +210,6 @@ static int
|
|||
set_global_permissions(void *data, struct pw_global *global)
|
||||
{
|
||||
struct client_info *cinfo = data;
|
||||
struct impl *impl = cinfo->impl;
|
||||
struct pw_client *client = cinfo->client;
|
||||
const struct pw_properties *props;
|
||||
const char *str;
|
||||
|
|
@ -222,25 +220,27 @@ set_global_permissions(void *data, struct pw_global *global)
|
|||
|
||||
props = pw_global_get_properties(global);
|
||||
|
||||
if (pw_global_get_type(global) == impl->type->core) {
|
||||
switch (pw_global_get_type(global)) {
|
||||
case PW_ID_INTERFACE_Core:
|
||||
allowed = true;
|
||||
}
|
||||
else if (pw_global_get_type(global) == impl->type->factory) {
|
||||
break;
|
||||
case PW_ID_INTERFACE_Factory:
|
||||
if (props && (str = pw_properties_get(props, "factory.name"))) {
|
||||
if (strcmp(str, "client-node") == 0)
|
||||
allowed = true;
|
||||
}
|
||||
}
|
||||
else if (pw_global_get_type(global) == impl->type->node) {
|
||||
break;
|
||||
case PW_ID_INTERFACE_Node:
|
||||
if (props && (str = pw_properties_get(props, "media.class"))) {
|
||||
if (strcmp(str, "Video/Source") == 0 && cinfo->camera_allowed)
|
||||
allowed = true;
|
||||
}
|
||||
allowed |= check_global_owner(client, global);
|
||||
}
|
||||
else
|
||||
break;
|
||||
default:
|
||||
allowed = check_global_owner(client, global);
|
||||
|
||||
break;
|
||||
}
|
||||
snprintf(perms, sizeof(perms), "%d:%c--", pw_global_get_id(global), allowed ? 'r' : '-');
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT(PW_CORE_PROXY_PERMISSIONS_GLOBAL, perms);
|
||||
pw_client_update_permissions(client, &SPA_DICT_INIT(items, n_items));
|
||||
|
|
@ -393,7 +393,7 @@ core_global_added(void *data, struct pw_global *global)
|
|||
struct client_info *cinfo;
|
||||
int res;
|
||||
|
||||
if (pw_global_get_type(global) == impl->type->client) {
|
||||
if (pw_global_get_type(global) == PW_ID_INTERFACE_Client) {
|
||||
struct pw_client *client = pw_global_get_object(global);
|
||||
|
||||
res = check_sandboxed(client);
|
||||
|
|
@ -432,7 +432,7 @@ core_global_removed(void *data, struct pw_global *global)
|
|||
{
|
||||
struct impl *impl = data;
|
||||
|
||||
if (pw_global_get_type(global) == impl->type->client) {
|
||||
if (pw_global_get_type(global) == PW_ID_INTERFACE_Client) {
|
||||
struct pw_client *client = pw_global_get_object(global);
|
||||
struct client_info *cinfo;
|
||||
|
||||
|
|
@ -483,7 +483,7 @@ static int module_init(struct pw_module *module, struct pw_properties *propertie
|
|||
|
||||
support = pw_core_get_support(core, &n_support);
|
||||
|
||||
dbus = spa_support_find(support, n_support, SPA_TYPE__DBus);
|
||||
dbus = spa_support_find(support, n_support, SPA_ID_INTERFACE_DBus);
|
||||
if (dbus == NULL)
|
||||
return -ENOTSUP;
|
||||
|
||||
|
|
@ -494,7 +494,6 @@ static int module_init(struct pw_module *module, struct pw_properties *propertie
|
|||
pw_log_debug("module %p: new", impl);
|
||||
|
||||
impl->core = core;
|
||||
impl->type = pw_core_get_type(core);
|
||||
impl->properties = properties;
|
||||
|
||||
impl->conn = spa_dbus_get_connection(dbus, SPA_DBUS_TYPE_SESSION);
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ static void *create_object(void *_data,
|
|||
struct pw_node *output_node, *input_node;
|
||||
struct pw_port *outport, *inport;
|
||||
struct pw_core *core;
|
||||
struct pw_type *t;
|
||||
struct pw_global *global;
|
||||
struct pw_link *link;
|
||||
uint32_t output_node_id, input_node_id;
|
||||
|
|
@ -87,16 +86,15 @@ static void *create_object(void *_data,
|
|||
|
||||
client = pw_resource_get_client(resource);
|
||||
core = pw_client_get_core(client);
|
||||
t = pw_core_get_type(core);
|
||||
|
||||
global = pw_core_find_global(core, output_node_id);
|
||||
if (global == NULL || pw_global_get_type(global) != t->node)
|
||||
if (global == NULL || pw_global_get_type(global) != PW_ID_INTERFACE_Node)
|
||||
goto no_output;
|
||||
|
||||
output_node = pw_global_get_object(global);
|
||||
|
||||
global = pw_core_find_global(core, input_node_id);
|
||||
if (global == NULL || pw_global_get_type(global) != t->node)
|
||||
if (global == NULL || pw_global_get_type(global) != PW_ID_INTERFACE_Node)
|
||||
goto no_input;
|
||||
|
||||
input_node = pw_global_get_object(global);
|
||||
|
|
@ -105,7 +103,7 @@ static void *create_object(void *_data,
|
|||
outport = pw_node_find_port(output_node, SPA_DIRECTION_OUTPUT, SPA_ID_INVALID);
|
||||
else {
|
||||
global = pw_core_find_global(core, output_port_id);
|
||||
if (global == NULL || pw_global_get_type(global) != t->port)
|
||||
if (global == NULL || pw_global_get_type(global) != PW_ID_INTERFACE_Port)
|
||||
goto no_output_port;
|
||||
|
||||
outport = pw_global_get_object(global);
|
||||
|
|
@ -117,7 +115,7 @@ static void *create_object(void *_data,
|
|||
inport = pw_node_find_port(input_node, SPA_DIRECTION_INPUT, SPA_ID_INVALID);
|
||||
else {
|
||||
global = pw_core_find_global(core, input_port_id);
|
||||
if (global == NULL || pw_global_get_type(global) != t->port)
|
||||
if (global == NULL || pw_global_get_type(global) != PW_ID_INTERFACE_Port)
|
||||
goto no_output_port;
|
||||
|
||||
inport = pw_global_get_object(global);
|
||||
|
|
@ -201,13 +199,12 @@ static const struct pw_module_events module_events = {
|
|||
static int module_init(struct pw_module *module, struct pw_properties *properties)
|
||||
{
|
||||
struct pw_core *core = pw_module_get_core(module);
|
||||
struct pw_type *t = pw_core_get_type(core);
|
||||
struct pw_factory *factory;
|
||||
struct factory_data *data;
|
||||
|
||||
factory = pw_factory_new(core,
|
||||
"link-factory",
|
||||
t->link,
|
||||
PW_ID_INTERFACE_Link,
|
||||
PW_VERSION_LINK,
|
||||
NULL,
|
||||
sizeof(*data));
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include <spa/utils/hook.h>
|
||||
#include <spa/param/audio/format-utils.h>
|
||||
#include <spa/debug/format.h>
|
||||
#include <spa/debug/types.h>
|
||||
|
||||
#include "pipewire/core.h"
|
||||
#include "pipewire/control.h"
|
||||
|
|
@ -52,30 +53,10 @@ static const struct spa_dict_item module_props[] = {
|
|||
#define MIN_QUANTUM_SIZE 64
|
||||
#define MAX_QUANTUM_SIZE 1024
|
||||
|
||||
struct type {
|
||||
struct spa_type_media_type media_type;
|
||||
struct spa_type_media_subtype media_subtype;
|
||||
struct spa_type_format_audio format_audio;
|
||||
struct spa_type_audio_format audio_format;
|
||||
struct spa_type_media_subtype_audio media_subtype_audio;
|
||||
};
|
||||
|
||||
static inline void init_type(struct type *type, struct spa_type_map *map)
|
||||
{
|
||||
spa_type_media_type_map(map, &type->media_type);
|
||||
spa_type_media_subtype_map(map, &type->media_subtype);
|
||||
spa_type_format_audio_map(map, &type->format_audio);
|
||||
spa_type_audio_format_map(map, &type->audio_format);
|
||||
spa_type_media_subtype_audio_map(map, &type->media_subtype_audio);
|
||||
}
|
||||
|
||||
struct impl {
|
||||
struct type type;
|
||||
|
||||
struct timespec now;
|
||||
|
||||
struct pw_core *core;
|
||||
struct pw_type *t;
|
||||
struct pw_module *module;
|
||||
struct spa_hook core_listener;
|
||||
struct spa_hook module_listener;
|
||||
|
|
@ -650,7 +631,6 @@ static int collect_audio_format(void *data, uint32_t id,
|
|||
uint32_t index, uint32_t next, struct spa_pod *param)
|
||||
{
|
||||
struct channel_data *d = data;
|
||||
struct impl *impl = d->impl;
|
||||
uint32_t media_type, media_subtype;
|
||||
struct spa_audio_info_raw info;
|
||||
|
||||
|
|
@ -658,14 +638,14 @@ static int collect_audio_format(void *data, uint32_t id,
|
|||
"I", &media_type,
|
||||
"I", &media_subtype);
|
||||
|
||||
if (media_type != impl->type.media_type.audio ||
|
||||
media_subtype != impl->type.media_subtype.raw)
|
||||
if (media_type != SPA_MEDIA_TYPE_audio ||
|
||||
media_subtype != SPA_MEDIA_SUBTYPE_raw)
|
||||
return 0;
|
||||
|
||||
spa_pod_fixate(param);
|
||||
spa_debug_format(0, impl->t->map, param);
|
||||
spa_debug_format(0, NULL, param);
|
||||
|
||||
if (spa_format_audio_raw_parse(param, &info, &impl->type.format_audio) < 0)
|
||||
if (spa_format_audio_raw_parse(param, &info) < 0)
|
||||
return 0;
|
||||
|
||||
if (info.channels > d->channels) {
|
||||
|
|
@ -679,11 +659,10 @@ static int collect_audio_format(void *data, uint32_t id,
|
|||
static int find_port_format(struct impl *impl, struct pw_port *port,
|
||||
uint32_t *channels, uint32_t *rate)
|
||||
{
|
||||
struct pw_type *t = impl->t;
|
||||
struct channel_data data = { impl, 0, 0 };
|
||||
|
||||
pw_port_for_each_param(port,
|
||||
t->param.idEnumFormat,
|
||||
SPA_ID_PARAM_EnumFormat,
|
||||
0, 0, NULL,
|
||||
collect_audio_format, &data);
|
||||
|
||||
|
|
@ -708,7 +687,7 @@ static int on_global(void *data, struct pw_global *global)
|
|||
bool need_dsp;
|
||||
uint64_t plugged;
|
||||
|
||||
if (pw_global_get_type(global) != impl->t->node)
|
||||
if (pw_global_get_type(global) != PW_ID_INTERFACE_Node)
|
||||
return 0;
|
||||
|
||||
node = pw_global_get_object(global);
|
||||
|
|
@ -846,12 +825,9 @@ static int module_init(struct pw_module *module, struct pw_properties *propertie
|
|||
pw_log_debug("module %p: new", impl);
|
||||
|
||||
impl->core = core;
|
||||
impl->t = pw_core_get_type(core);
|
||||
impl->module = module;
|
||||
impl->properties = properties;
|
||||
|
||||
init_type(&impl->type, core->type.map);
|
||||
|
||||
spa_list_init(&impl->session_list);
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &impl->now);
|
||||
|
|
|
|||
|
|
@ -66,7 +66,6 @@ struct port {
|
|||
|
||||
struct node {
|
||||
struct pw_core *core;
|
||||
struct pw_type *t;
|
||||
struct pw_node *node;
|
||||
|
||||
void *user_data;
|
||||
|
|
@ -80,14 +79,13 @@ struct node {
|
|||
|
||||
static void init_buffer(struct port *port, uint32_t id)
|
||||
{
|
||||
struct pw_type *t = port->node->t;
|
||||
struct buffer *b = &port->buffers[id];
|
||||
b->buf.id = id;
|
||||
b->buf.n_metas = 0;
|
||||
b->buf.metas = NULL;
|
||||
b->buf.n_datas = 1;
|
||||
b->buf.datas = b->datas;
|
||||
b->datas[0].type = t->data.MemPtr;
|
||||
b->datas[0].type = SPA_DATA_MemPtr;
|
||||
b->datas[0].flags = 0;
|
||||
b->datas[0].fd = -1;
|
||||
b->datas[0].mapoffset = 0;
|
||||
|
|
@ -153,7 +151,6 @@ struct pw_node *pw_audio_dsp_new(struct pw_core *core,
|
|||
{
|
||||
struct pw_node *node;
|
||||
struct pw_port *port;
|
||||
struct pw_type *t = pw_core_get_type(core);
|
||||
struct node *n;
|
||||
const char *api, *alias, *plugged, *str;
|
||||
char node_name[128];
|
||||
|
|
@ -204,7 +201,6 @@ struct pw_node *pw_audio_dsp_new(struct pw_core *core,
|
|||
|
||||
n = pw_spa_node_get_user_data(node);
|
||||
n->core = core;
|
||||
n->t = pw_core_get_type(core);
|
||||
n->node = node;
|
||||
|
||||
n->channels = channels;
|
||||
|
|
@ -258,7 +254,7 @@ struct pw_node *pw_audio_dsp_new(struct pw_core *core,
|
|||
p->spa_handle, NULL,
|
||||
support, n_support);
|
||||
|
||||
spa_handle_get_interface(p->spa_handle, t->spa_node, &iface);
|
||||
spa_handle_get_interface(p->spa_handle, SPA_ID_INTERFACE_Node, &iface);
|
||||
|
||||
p->spa_node = iface;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include <spa/support/log.h>
|
||||
#include <spa/support/type-map.h>
|
||||
#include <spa/utils/list.h>
|
||||
#include <spa/node/node.h>
|
||||
#include <spa/node/io.h>
|
||||
|
|
@ -88,55 +87,10 @@ struct port {
|
|||
size_t queued_bytes;
|
||||
};
|
||||
|
||||
struct type {
|
||||
uint32_t node;
|
||||
uint32_t format;
|
||||
uint32_t prop_volume;
|
||||
uint32_t prop_mute;
|
||||
uint32_t io_prop_volume;
|
||||
uint32_t io_prop_mute;
|
||||
struct spa_type_io io;
|
||||
struct spa_type_param param;
|
||||
struct spa_type_media_type media_type;
|
||||
struct spa_type_media_subtype media_subtype;
|
||||
struct spa_type_format_audio format_audio;
|
||||
struct spa_type_audio_format audio_format;
|
||||
struct spa_type_command_node command_node;
|
||||
struct spa_type_meta meta;
|
||||
struct spa_type_data data;
|
||||
struct spa_type_param_buffers param_buffers;
|
||||
struct spa_type_param_meta param_meta;
|
||||
struct spa_type_param_io param_io;
|
||||
};
|
||||
|
||||
static inline void init_type(struct type *type, struct spa_type_map *map)
|
||||
{
|
||||
type->node = spa_type_map_get_id(map, SPA_TYPE__Node);
|
||||
type->format = spa_type_map_get_id(map, SPA_TYPE__Format);
|
||||
type->prop_volume = spa_type_map_get_id(map, SPA_TYPE_PROPS__volume);
|
||||
type->prop_mute = spa_type_map_get_id(map, SPA_TYPE_PROPS__mute);
|
||||
type->io_prop_volume = spa_type_map_get_id(map, SPA_TYPE_IO_PROP_BASE "volume");
|
||||
type->io_prop_mute = spa_type_map_get_id(map, SPA_TYPE_IO_PROP_BASE "mute");
|
||||
spa_type_io_map(map, &type->io);
|
||||
spa_type_param_map(map, &type->param);
|
||||
spa_type_media_type_map(map, &type->media_type);
|
||||
spa_type_media_subtype_map(map, &type->media_subtype);
|
||||
spa_type_format_audio_map(map, &type->format_audio);
|
||||
spa_type_audio_format_map(map, &type->audio_format);
|
||||
spa_type_command_node_map(map, &type->command_node);
|
||||
spa_type_meta_map(map, &type->meta);
|
||||
spa_type_data_map(map, &type->data);
|
||||
spa_type_param_buffers_map(map, &type->param_buffers);
|
||||
spa_type_param_meta_map(map, &type->param_meta);
|
||||
spa_type_param_io_map(map, &type->param_io);
|
||||
}
|
||||
|
||||
struct impl {
|
||||
struct spa_handle handle;
|
||||
struct spa_node node;
|
||||
|
||||
struct type type;
|
||||
struct spa_type_map *map;
|
||||
struct spa_log *log;
|
||||
|
||||
const struct spa_node_callbacks *callbacks;
|
||||
|
|
@ -188,13 +142,16 @@ static int impl_node_send_command(struct spa_node *node, const struct spa_comman
|
|||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
if (SPA_COMMAND_TYPE(command) == this->type.command_node.Start) {
|
||||
switch (SPA_COMMAND_TYPE(command)) {
|
||||
case SPA_ID_COMMAND_NODE_Start:
|
||||
this->started = true;
|
||||
} else if (SPA_COMMAND_TYPE(command) == this->type.command_node.Pause) {
|
||||
break;
|
||||
case SPA_ID_COMMAND_NODE_Pause:
|
||||
this->started = false;
|
||||
} else
|
||||
break;
|
||||
default:
|
||||
return -ENOTSUP;
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -365,29 +322,28 @@ static int port_enum_formats(struct spa_node *node,
|
|||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
struct type *t = &this->type;
|
||||
|
||||
switch (*index) {
|
||||
case 0:
|
||||
if (this->have_format) {
|
||||
*param = spa_pod_builder_object(builder,
|
||||
t->param.idEnumFormat, t->format,
|
||||
"I", t->media_type.audio,
|
||||
"I", t->media_subtype.raw,
|
||||
":", t->format_audio.format, "I", this->format.info.raw.format,
|
||||
":", t->format_audio.layout, "i", this->format.info.raw.layout,
|
||||
":", t->format_audio.rate, "i", this->format.info.raw.rate,
|
||||
":", t->format_audio.channels, "i", this->format.info.raw.channels);
|
||||
SPA_ID_PARAM_EnumFormat, SPA_ID_OBJECT_Format,
|
||||
"I", SPA_MEDIA_TYPE_audio,
|
||||
"I", SPA_MEDIA_SUBTYPE_raw,
|
||||
":", SPA_FORMAT_AUDIO_format, "I", this->format.info.raw.format,
|
||||
":", SPA_FORMAT_AUDIO_layout, "i", this->format.info.raw.layout,
|
||||
":", SPA_FORMAT_AUDIO_rate, "i", this->format.info.raw.rate,
|
||||
":", SPA_FORMAT_AUDIO_channels, "i", this->format.info.raw.channels);
|
||||
} else {
|
||||
*param = spa_pod_builder_object(builder,
|
||||
t->param.idEnumFormat, t->format,
|
||||
"I", t->media_type.audio,
|
||||
"I", t->media_subtype.raw,
|
||||
":", t->format_audio.format, "I", t->audio_format.F32,
|
||||
":", t->format_audio.layout, "i", SPA_AUDIO_LAYOUT_NON_INTERLEAVED,
|
||||
":", t->format_audio.rate, "iru", 44100,
|
||||
SPA_ID_PARAM_EnumFormat, SPA_ID_OBJECT_Format,
|
||||
"I", SPA_MEDIA_TYPE_audio,
|
||||
"I", SPA_MEDIA_SUBTYPE_raw,
|
||||
":", SPA_FORMAT_AUDIO_format, "I", SPA_AUDIO_FORMAT_F32,
|
||||
":", SPA_FORMAT_AUDIO_layout, "i", SPA_AUDIO_LAYOUT_NON_INTERLEAVED,
|
||||
":", SPA_FORMAT_AUDIO_rate, "iru", 44100,
|
||||
SPA_POD_PROP_MIN_MAX(1, INT32_MAX),
|
||||
":", t->format_audio.channels, "iru", 1);
|
||||
":", SPA_FORMAT_AUDIO_channels, "iru", 1);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
@ -403,7 +359,6 @@ static int port_get_format(struct spa_node *node,
|
|||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
struct type *t = &this->type;
|
||||
struct port *port = GET_PORT(this, direction, port_id);
|
||||
|
||||
if (!port->have_format)
|
||||
|
|
@ -412,13 +367,13 @@ static int port_get_format(struct spa_node *node,
|
|||
return 0;
|
||||
|
||||
*param = spa_pod_builder_object(builder,
|
||||
t->param.idFormat, t->format,
|
||||
"I", t->media_type.audio,
|
||||
"I", t->media_subtype.raw,
|
||||
":", t->format_audio.format, "I", this->format.info.raw.format,
|
||||
":", t->format_audio.layout, "i", this->format.info.raw.layout,
|
||||
":", t->format_audio.rate, "i", this->format.info.raw.rate,
|
||||
":", t->format_audio.channels, "i", this->format.info.raw.channels);
|
||||
SPA_ID_PARAM_Format, SPA_ID_OBJECT_Format,
|
||||
"I", SPA_MEDIA_TYPE_audio,
|
||||
"I", SPA_MEDIA_SUBTYPE_raw,
|
||||
":", SPA_FORMAT_AUDIO_format, "I", this->format.info.raw.format,
|
||||
":", SPA_FORMAT_AUDIO_layout, "i", this->format.info.raw.layout,
|
||||
":", SPA_FORMAT_AUDIO_rate, "i", this->format.info.raw.rate,
|
||||
":", SPA_FORMAT_AUDIO_channels, "i", this->format.info.raw.channels);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -432,7 +387,6 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct impl *this;
|
||||
struct type *t;
|
||||
struct port *port;
|
||||
struct spa_pod *param;
|
||||
struct spa_pod_builder b = { 0 };
|
||||
|
|
@ -444,7 +398,6 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
spa_return_val_if_fail(builder != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
t = &this->type;
|
||||
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
|
|
@ -453,83 +406,83 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
next:
|
||||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||
|
||||
if (id == t->param.idList) {
|
||||
uint32_t list[] = { t->param.idEnumFormat,
|
||||
t->param.idFormat,
|
||||
t->param.idBuffers,
|
||||
t->param.idMeta,
|
||||
t->param_io.idBuffers,
|
||||
t->param_io.idControl,
|
||||
t->param_io.idPropsIn };
|
||||
switch (id) {
|
||||
case SPA_ID_PARAM_List:
|
||||
{
|
||||
uint32_t list[] = { SPA_ID_PARAM_EnumFormat,
|
||||
SPA_ID_PARAM_Format,
|
||||
SPA_ID_PARAM_Buffers,
|
||||
SPA_ID_PARAM_Meta,
|
||||
SPA_ID_PARAM_IO };
|
||||
|
||||
if (*index < SPA_N_ELEMENTS(list))
|
||||
param = spa_pod_builder_object(&b, id, t->param.List,
|
||||
":", t->param.listId, "I", list[*index]);
|
||||
param = spa_pod_builder_object(&b, id, SPA_ID_OBJECT_ParamList,
|
||||
":", SPA_PARAM_LIST_id, "I", list[*index]);
|
||||
else
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
else if (id == t->param.idEnumFormat) {
|
||||
case SPA_ID_PARAM_EnumFormat:
|
||||
if ((res = port_enum_formats(node, direction, port_id, index, ¶m, &b)) <= 0)
|
||||
return res;
|
||||
}
|
||||
else if (id == t->param.idFormat) {
|
||||
break;
|
||||
|
||||
case SPA_ID_PARAM_Format:
|
||||
if ((res = port_get_format(node, direction, port_id, index, ¶m, &b)) <= 0)
|
||||
return res;
|
||||
}
|
||||
else if (id == t->param.idBuffers) {
|
||||
break;
|
||||
case SPA_ID_PARAM_Buffers:
|
||||
if (!port->have_format)
|
||||
return -EIO;
|
||||
if (*index > 0)
|
||||
return 0;
|
||||
|
||||
param = spa_pod_builder_object(&b,
|
||||
id, t->param_buffers.Buffers,
|
||||
":", t->param_buffers.size, "iru", 1024 * this->stride,
|
||||
SPA_POD_PROP_MIN_MAX(16 * this->stride, INT32_MAX / this->stride),
|
||||
":", t->param_buffers.stride, "i", this->stride,
|
||||
":", t->param_buffers.buffers, "iru", 1,
|
||||
id, SPA_ID_OBJECT_ParamBuffers,
|
||||
":", SPA_PARAM_BUFFERS_buffers, "iru", 1,
|
||||
SPA_POD_PROP_MIN_MAX(1, MAX_BUFFERS),
|
||||
":", t->param_buffers.align, "i", 16);
|
||||
}
|
||||
else if (id == t->param.idMeta) {
|
||||
":", SPA_PARAM_BUFFERS_blocks, "i", 1,
|
||||
":", SPA_PARAM_BUFFERS_size, "iru", 1024 * this->stride,
|
||||
SPA_POD_PROP_MIN_MAX(16 * this->stride, INT32_MAX / this->stride),
|
||||
":", SPA_PARAM_BUFFERS_stride, "i", this->stride,
|
||||
":", SPA_PARAM_BUFFERS_align, "i", 16);
|
||||
break;
|
||||
|
||||
case SPA_ID_PARAM_Meta:
|
||||
if (!port->have_format)
|
||||
return -EIO;
|
||||
|
||||
switch (*index) {
|
||||
case 0:
|
||||
param = spa_pod_builder_object(&b,
|
||||
id, t->param_meta.Meta,
|
||||
":", t->param_meta.type, "I", t->meta.Header,
|
||||
":", t->param_meta.size, "i", sizeof(struct spa_meta_header));
|
||||
id, SPA_ID_OBJECT_ParamMeta,
|
||||
":", SPA_PARAM_META_type, "I", SPA_META_Header,
|
||||
":", SPA_PARAM_META_size, "i", sizeof(struct spa_meta_header));
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (id == t->param_io.idBuffers) {
|
||||
break;
|
||||
|
||||
case SPA_ID_PARAM_IO:
|
||||
switch (*index) {
|
||||
case 0:
|
||||
param = spa_pod_builder_object(&b,
|
||||
id, t->param_io.Buffers,
|
||||
":", t->param_io.id, "I", t->io.Buffers,
|
||||
":", t->param_io.size, "i", sizeof(struct spa_io_buffers));
|
||||
id, SPA_ID_OBJECT_ParamIO,
|
||||
":", SPA_PARAM_IO_id, "I", SPA_ID_IO_Buffers,
|
||||
":", SPA_PARAM_IO_size, "i", sizeof(struct spa_io_buffers));
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (id == t->param_io.idControl) {
|
||||
switch (*index) {
|
||||
case 0:
|
||||
case 1:
|
||||
param = spa_pod_builder_object(&b,
|
||||
id, t->param_io.Control,
|
||||
":", t->param_io.id, "I", t->io.ControlRange,
|
||||
":", t->param_io.size, "i", sizeof(struct spa_io_control_range));
|
||||
id, SPA_ID_OBJECT_ParamIO,
|
||||
":", SPA_PARAM_IO_id, "I", SPA_ID_IO_ControlRange,
|
||||
":", SPA_PARAM_IO_size, "i", sizeof(struct spa_io_control_range));
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#if 0
|
||||
else if (id == t->param_io.idPropsIn) {
|
||||
struct port_props *p = &port->props;
|
||||
|
||||
|
|
@ -558,8 +511,10 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
default:
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
(*index)++;
|
||||
|
||||
|
|
@ -612,7 +567,6 @@ static int port_set_format(struct spa_node *node,
|
|||
{
|
||||
struct impl *this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
struct port *port;
|
||||
struct type *t = &this->type;
|
||||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
|
||||
|
|
@ -630,18 +584,18 @@ static int port_set_format(struct spa_node *node,
|
|||
"I", &info.media_type,
|
||||
"I", &info.media_subtype);
|
||||
|
||||
if (info.media_type != t->media_type.audio ||
|
||||
info.media_subtype != t->media_subtype.raw)
|
||||
if (info.media_type != SPA_MEDIA_TYPE_audio ||
|
||||
info.media_subtype != SPA_MEDIA_SUBTYPE_raw)
|
||||
return -EINVAL;
|
||||
|
||||
if (spa_format_audio_raw_parse(format, &info.info.raw, &t->format_audio) < 0)
|
||||
if (spa_format_audio_raw_parse(format, &info.info.raw) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (this->have_format) {
|
||||
if (memcmp(&info, &this->format, sizeof(struct spa_audio_info)))
|
||||
return -EINVAL;
|
||||
} else {
|
||||
if (info.info.raw.format != t->audio_format.F32)
|
||||
if (info.info.raw.format != SPA_AUDIO_FORMAT_F32)
|
||||
return -EINVAL;
|
||||
|
||||
this->stride = sizeof(float);
|
||||
|
|
@ -667,16 +621,14 @@ impl_node_port_set_param(struct spa_node *node,
|
|||
const struct spa_pod *param)
|
||||
{
|
||||
struct impl *this;
|
||||
struct type *t;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
t = &this->type;
|
||||
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
if (id == t->param.idFormat) {
|
||||
if (id == SPA_ID_PARAM_Format) {
|
||||
return port_set_format(node, direction, port_id, flags, param);
|
||||
}
|
||||
else
|
||||
|
|
@ -693,12 +645,10 @@ impl_node_port_use_buffers(struct spa_node *node,
|
|||
struct impl *this;
|
||||
struct port *port;
|
||||
uint32_t i;
|
||||
struct type *t;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
t = &this->type;
|
||||
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
|
|
@ -719,11 +669,11 @@ impl_node_port_use_buffers(struct spa_node *node,
|
|||
b->buffer = buffers[i];
|
||||
b->flags = 0;
|
||||
b->id = i;
|
||||
b->h = spa_buffer_find_meta_data(buffers[i], t->meta.Header, sizeof(*b->h));
|
||||
b->h = spa_buffer_find_meta_data(buffers[i], SPA_META_Header, sizeof(*b->h));
|
||||
|
||||
if (!((d[0].type == t->data.MemPtr ||
|
||||
d[0].type == t->data.MemFd ||
|
||||
d[0].type == t->data.DmaBuf) && d[0].data != NULL)) {
|
||||
if (!((d[0].type == SPA_DATA_MemPtr ||
|
||||
d[0].type == SPA_DATA_MemFd ||
|
||||
d[0].type == SPA_DATA_DmaBuf) && d[0].data != NULL)) {
|
||||
spa_log_error(this->log, NAME " %p: invalid memory on buffer %p", this,
|
||||
buffers[i]);
|
||||
return -EINVAL;
|
||||
|
|
@ -755,21 +705,20 @@ impl_node_port_set_io(struct spa_node *node,
|
|||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
struct type *t;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
t = &this->type;
|
||||
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
|
||||
if (id == t->io.Buffers)
|
||||
if (id == SPA_ID_IO_Buffers)
|
||||
port->io = data;
|
||||
else if (id == t->io.ControlRange)
|
||||
else if (id == SPA_ID_IO_ControlRange)
|
||||
port->ctrl = data;
|
||||
#if 0
|
||||
else if (id == t->io_prop_volume && direction == SPA_DIRECTION_INPUT)
|
||||
if (data && size >= sizeof(struct spa_pod_double))
|
||||
port->io_volume = &SPA_POD_VALUE(struct spa_pod_double, data);
|
||||
|
|
@ -780,6 +729,7 @@ impl_node_port_set_io(struct spa_node *node,
|
|||
port->io_mute = &SPA_POD_VALUE(struct spa_pod_bool, data);
|
||||
else
|
||||
port->io_mute = &port->props.mute;
|
||||
#endif
|
||||
else
|
||||
return -ENOENT;
|
||||
|
||||
|
|
@ -985,7 +935,7 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t interface_id,
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (interface_id == this->type.node)
|
||||
if (interface_id == SPA_ID_INTERFACE_Node)
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -1025,16 +975,9 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
this = (struct impl *) handle;
|
||||
|
||||
for (i = 0; i < n_support; i++) {
|
||||
if (strcmp(support[i].type, SPA_TYPE__TypeMap) == 0)
|
||||
this->map = support[i].data;
|
||||
else if (strcmp(support[i].type, SPA_TYPE__Log) == 0)
|
||||
if (support[i].type == SPA_ID_INTERFACE_Log)
|
||||
this->log = support[i].data;
|
||||
}
|
||||
if (this->map == NULL) {
|
||||
spa_log_error(this->log, "an id-map is needed");
|
||||
return -EINVAL;
|
||||
}
|
||||
init_type(&this->type, this->map);
|
||||
|
||||
this->node = impl_node;
|
||||
|
||||
|
|
@ -1049,7 +992,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
}
|
||||
|
||||
static const struct spa_interface_info impl_interfaces[] = {
|
||||
{SPA_TYPE__Node,},
|
||||
{SPA_ID_INTERFACE_Node,},
|
||||
};
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include <spa/pod/iter.h>
|
||||
#include <spa/debug/pod.h>
|
||||
#include <spa/debug/types.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
|
@ -108,6 +109,7 @@ struct client_data {
|
|||
bool busy;
|
||||
};
|
||||
|
||||
#if 0
|
||||
static bool pod_remap_data(uint32_t type, void *body, uint32_t size, struct pw_map *types)
|
||||
{
|
||||
void *t;
|
||||
|
|
@ -172,6 +174,7 @@ static bool pod_remap_data(uint32_t type, void *body, uint32_t size, struct pw_m
|
|||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
process_messages(struct client_data *data)
|
||||
|
|
@ -227,13 +230,15 @@ process_messages(struct client_data *data)
|
|||
continue;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (demarshal[opcode].flags & PW_PROTOCOL_NATIVE_REMAP)
|
||||
if (!pod_remap_data(SPA_POD_TYPE_STRUCT, message, size, &client->types))
|
||||
goto invalid_message;
|
||||
#endif
|
||||
|
||||
if (debug_messages) {
|
||||
fprintf(stderr, "<<<<<<<<< in: %d %d %d\n", id, opcode, size);
|
||||
spa_debug_pod(0, core->type.map, (struct spa_pod *)message);
|
||||
spa_debug_pod(0, spa_debug_types, (struct spa_pod *)message);
|
||||
}
|
||||
if (demarshal[opcode].func(resource, message, size) < 0)
|
||||
goto invalid_message;
|
||||
|
|
@ -557,6 +562,7 @@ on_remote_data(void *data, int fd, enum spa_io mask)
|
|||
continue;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (demarshal[opcode].flags & PW_PROTOCOL_NATIVE_REMAP) {
|
||||
if (!pod_remap_data(SPA_POD_TYPE_STRUCT, message, size, &this->types)) {
|
||||
pw_log_error
|
||||
|
|
@ -565,9 +571,10 @@ on_remote_data(void *data, int fd, enum spa_io mask)
|
|||
continue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (debug_messages) {
|
||||
fprintf(stderr, "<<<<<<<<< in: %d %d %d\n", id, opcode, size);
|
||||
spa_debug_pod(0, core->type.map, (struct spa_pod *)message);
|
||||
spa_debug_pod(0, spa_debug_types, (struct spa_pod *)message);
|
||||
}
|
||||
if (demarshal[opcode].func(proxy, message, size) < 0) {
|
||||
pw_log_error ("protocol-native %p: invalid message received %u for %u", this,
|
||||
|
|
|
|||
|
|
@ -365,21 +365,6 @@ pw_protocol_native_connection_begin_resource(struct pw_protocol_native_connectio
|
|||
uint8_t opcode)
|
||||
{
|
||||
struct impl *impl = SPA_CONTAINER_OF(conn, struct impl, this);
|
||||
uint32_t diff, base, i, b;
|
||||
struct pw_client *client = resource->client;
|
||||
struct pw_core *core = client->core;
|
||||
const char **types;
|
||||
|
||||
base = client->n_types;
|
||||
diff = spa_type_map_get_size(core->type.map) - base;
|
||||
if (diff > 0) {
|
||||
types = alloca(diff * sizeof(char *));
|
||||
for (i = 0, b = base; i < diff; i++, b++)
|
||||
types[i] = spa_type_map_get_type(core->type.map, b);
|
||||
|
||||
client->n_types += diff;
|
||||
pw_core_resource_update_types(client->core_resource, base, types, diff);
|
||||
}
|
||||
|
||||
impl->dest_id = resource->id;
|
||||
impl->opcode = opcode;
|
||||
|
|
@ -394,21 +379,6 @@ pw_protocol_native_connection_begin_proxy(struct pw_protocol_native_connection *
|
|||
uint8_t opcode)
|
||||
{
|
||||
struct impl *impl = SPA_CONTAINER_OF(conn, struct impl, this);
|
||||
uint32_t diff, base, i, b;
|
||||
const char **types;
|
||||
struct pw_remote *remote = proxy->remote;
|
||||
struct pw_core *core = remote->core;
|
||||
|
||||
base = remote->n_types;
|
||||
diff = spa_type_map_get_size(core->type.map) - base;
|
||||
if (diff > 0) {
|
||||
types = alloca(diff * sizeof(char *));
|
||||
for (i = 0, b = base; i < diff; i++, b++)
|
||||
types[i] = spa_type_map_get_type(core->type.map, b);
|
||||
|
||||
remote->n_types += diff;
|
||||
pw_core_proxy_update_types(remote->core_proxy, base, types, diff);
|
||||
}
|
||||
|
||||
impl->dest_id = proxy->id;
|
||||
impl->opcode = opcode;
|
||||
|
|
@ -435,7 +405,7 @@ pw_protocol_native_connection_end(struct pw_protocol_native_connection *conn,
|
|||
|
||||
if (debug_messages) {
|
||||
fprintf(stderr, ">>>>>>>>> out: %d %d %d\n", impl->dest_id, impl->opcode, size);
|
||||
spa_debug_pod(0, impl->core->type.map, (struct spa_pod *)p);
|
||||
spa_debug_pod(0, spa_debug_types, (struct spa_pod *)p);
|
||||
}
|
||||
spa_hook_list_call(&conn->listener_list,
|
||||
struct pw_protocol_native_connection_events, need_flush, 0);
|
||||
|
|
|
|||
|
|
@ -158,28 +158,6 @@ core_marshal_destroy(void *object, uint32_t id)
|
|||
pw_protocol_native_end_proxy(proxy, b);
|
||||
}
|
||||
|
||||
static void
|
||||
core_marshal_update_types_client(void *object, uint32_t first_id, const char **types, uint32_t n_types)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_builder *b;
|
||||
uint32_t i;
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_PROXY_METHOD_UPDATE_TYPES);
|
||||
|
||||
spa_pod_builder_add(b,
|
||||
"["
|
||||
" i", first_id,
|
||||
" i", n_types, NULL);
|
||||
|
||||
for (i = 0; i < n_types; i++) {
|
||||
spa_pod_builder_add(b, "s", types[i], NULL);
|
||||
}
|
||||
spa_pod_builder_add(b, "]", NULL);
|
||||
|
||||
pw_protocol_native_end_proxy(proxy, b);
|
||||
}
|
||||
|
||||
static int core_demarshal_info(void *object, void *data, size_t size)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
|
|
@ -260,30 +238,6 @@ static int core_demarshal_remove_id(void *object, void *data, size_t size)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int core_demarshal_update_types_client(void *object, void *data, size_t size)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_parser prs;
|
||||
uint32_t first_id, n_types;
|
||||
const char **types;
|
||||
uint32_t i;
|
||||
|
||||
spa_pod_parser_init(&prs, data, size, 0);
|
||||
if (spa_pod_parser_get(&prs,
|
||||
"["
|
||||
" i", &first_id,
|
||||
" i", &n_types, NULL) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
types = alloca(n_types * sizeof(char *));
|
||||
for (i = 0; i < n_types; i++) {
|
||||
if (spa_pod_parser_get(&prs, "s", &types[i], NULL) < 0)
|
||||
return -EINVAL;
|
||||
}
|
||||
pw_proxy_notify(proxy, struct pw_core_proxy_events, update_types, 0, first_id, types, n_types);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void core_marshal_info(void *object, struct pw_core_info *info)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
|
|
@ -360,28 +314,6 @@ static void core_marshal_remove_id(void *object, uint32_t id)
|
|||
pw_protocol_native_end_resource(resource, b);
|
||||
}
|
||||
|
||||
static void
|
||||
core_marshal_update_types_server(void *object, uint32_t first_id, const char **types, uint32_t n_types)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct spa_pod_builder *b;
|
||||
uint32_t i;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_PROXY_EVENT_UPDATE_TYPES);
|
||||
|
||||
spa_pod_builder_add(b,
|
||||
"[",
|
||||
"i", first_id,
|
||||
"i", n_types, NULL);
|
||||
|
||||
for (i = 0; i < n_types; i++) {
|
||||
spa_pod_builder_add(b, "s", types[i], NULL);
|
||||
}
|
||||
spa_pod_builder_add(b, "]", NULL);
|
||||
|
||||
pw_protocol_native_end_resource(resource, b);
|
||||
}
|
||||
|
||||
static int core_demarshal_client_update(void *object, void *data, size_t size)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
|
|
@ -516,30 +448,6 @@ static int core_demarshal_destroy(void *object, void *data, size_t size)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int core_demarshal_update_types_server(void *object, void *data, size_t size)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct spa_pod_parser prs;
|
||||
uint32_t first_id, n_types;
|
||||
const char **types;
|
||||
uint32_t i;
|
||||
|
||||
spa_pod_parser_init(&prs, data, size, 0);
|
||||
if (spa_pod_parser_get(&prs,
|
||||
"["
|
||||
"i", &first_id,
|
||||
"i", &n_types, NULL) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
types = alloca(n_types * sizeof(char *));
|
||||
for (i = 0; i < n_types; i++) {
|
||||
if (spa_pod_parser_get(&prs, "s", &types[i], NULL) < 0)
|
||||
return -EINVAL;
|
||||
}
|
||||
pw_resource_do(resource, struct pw_core_proxy_methods, update_types, 0, first_id, types, n_types);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void registry_marshal_global(void *object, uint32_t id, uint32_t parent_id, uint32_t permissions,
|
||||
uint32_t type, uint32_t version, const struct spa_dict *props)
|
||||
{
|
||||
|
|
@ -1164,7 +1072,6 @@ static void registry_marshal_bind(void *object, uint32_t id,
|
|||
static const struct pw_core_proxy_methods pw_protocol_native_core_method_marshal = {
|
||||
PW_VERSION_CORE_PROXY_METHODS,
|
||||
&core_marshal_hello,
|
||||
&core_marshal_update_types_client,
|
||||
&core_marshal_sync,
|
||||
&core_marshal_get_registry,
|
||||
&core_marshal_client_update,
|
||||
|
|
@ -1175,7 +1082,6 @@ static const struct pw_core_proxy_methods pw_protocol_native_core_method_marshal
|
|||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_core_method_demarshal[PW_CORE_PROXY_METHOD_NUM] = {
|
||||
{ &core_demarshal_hello, 0, },
|
||||
{ &core_demarshal_update_types_server, 0, },
|
||||
{ &core_demarshal_sync, 0, },
|
||||
{ &core_demarshal_get_registry, 0, },
|
||||
{ &core_demarshal_client_update, 0, },
|
||||
|
|
@ -1186,7 +1092,6 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_core_method_
|
|||
|
||||
static const struct pw_core_proxy_events pw_protocol_native_core_event_marshal = {
|
||||
PW_VERSION_CORE_PROXY_EVENTS,
|
||||
&core_marshal_update_types_server,
|
||||
&core_marshal_done,
|
||||
&core_marshal_error,
|
||||
&core_marshal_remove_id,
|
||||
|
|
@ -1194,7 +1099,6 @@ static const struct pw_core_proxy_events pw_protocol_native_core_event_marshal =
|
|||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_core_event_demarshal[PW_CORE_PROXY_EVENT_NUM] = {
|
||||
{ &core_demarshal_update_types_client, 0, },
|
||||
{ &core_demarshal_done, 0, },
|
||||
{ &core_demarshal_error, 0, },
|
||||
{ &core_demarshal_remove_id, 0, },
|
||||
|
|
@ -1202,7 +1106,7 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_core_event_d
|
|||
};
|
||||
|
||||
static const struct pw_protocol_marshal pw_protocol_native_core_marshal = {
|
||||
PW_TYPE_INTERFACE__Core,
|
||||
PW_ID_INTERFACE_Core,
|
||||
PW_VERSION_CORE,
|
||||
&pw_protocol_native_core_method_marshal,
|
||||
pw_protocol_native_core_method_demarshal,
|
||||
|
|
@ -1233,7 +1137,7 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_registry_eve
|
|||
};
|
||||
|
||||
const struct pw_protocol_marshal pw_protocol_native_registry_marshal = {
|
||||
PW_TYPE_INTERFACE__Registry,
|
||||
PW_ID_INTERFACE_Registry,
|
||||
PW_VERSION_REGISTRY,
|
||||
&pw_protocol_native_registry_method_marshal,
|
||||
pw_protocol_native_registry_method_demarshal,
|
||||
|
|
@ -1253,7 +1157,7 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_module_event
|
|||
};
|
||||
|
||||
const struct pw_protocol_marshal pw_protocol_native_module_marshal = {
|
||||
PW_TYPE_INTERFACE__Module,
|
||||
PW_ID_INTERFACE_Module,
|
||||
PW_VERSION_MODULE,
|
||||
NULL, NULL, 0,
|
||||
&pw_protocol_native_module_event_marshal,
|
||||
|
|
@ -1271,7 +1175,7 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_factory_even
|
|||
};
|
||||
|
||||
const struct pw_protocol_marshal pw_protocol_native_factory_marshal = {
|
||||
PW_TYPE_INTERFACE__Factory,
|
||||
PW_ID_INTERFACE_Factory,
|
||||
PW_VERSION_FACTORY,
|
||||
NULL, NULL, 0,
|
||||
&pw_protocol_native_factory_event_marshal,
|
||||
|
|
@ -1300,7 +1204,7 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_node_event_d
|
|||
};
|
||||
|
||||
static const struct pw_protocol_marshal pw_protocol_native_node_marshal = {
|
||||
PW_TYPE_INTERFACE__Node,
|
||||
PW_ID_INTERFACE_Node,
|
||||
PW_VERSION_NODE,
|
||||
&pw_protocol_native_node_method_marshal,
|
||||
pw_protocol_native_node_method_demarshal,
|
||||
|
|
@ -1332,7 +1236,7 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_port_event_d
|
|||
};
|
||||
|
||||
static const struct pw_protocol_marshal pw_protocol_native_port_marshal = {
|
||||
PW_TYPE_INTERFACE__Port,
|
||||
PW_ID_INTERFACE_Port,
|
||||
PW_VERSION_PORT,
|
||||
&pw_protocol_native_port_method_marshal,
|
||||
pw_protocol_native_port_method_demarshal,
|
||||
|
|
@ -1352,7 +1256,7 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_client_event
|
|||
};
|
||||
|
||||
static const struct pw_protocol_marshal pw_protocol_native_client_marshal = {
|
||||
PW_TYPE_INTERFACE__Client,
|
||||
PW_ID_INTERFACE_Client,
|
||||
PW_VERSION_CLIENT,
|
||||
NULL, NULL, 0,
|
||||
&pw_protocol_native_client_event_marshal,
|
||||
|
|
@ -1370,7 +1274,7 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_link_event_d
|
|||
};
|
||||
|
||||
static const struct pw_protocol_marshal pw_protocol_native_link_marshal = {
|
||||
PW_TYPE_INTERFACE__Link,
|
||||
PW_ID_INTERFACE_Link,
|
||||
PW_VERSION_LINK,
|
||||
NULL, NULL, 0,
|
||||
&pw_protocol_native_link_event_marshal,
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ static const struct spa_dict_item module_props[] = {
|
|||
|
||||
struct impl {
|
||||
struct pw_core *core;
|
||||
struct pw_type *type;
|
||||
struct pw_properties *properties;
|
||||
|
||||
struct spa_loop *loop;
|
||||
|
|
@ -482,7 +481,7 @@ static int module_init(struct pw_module *module, struct pw_properties *propertie
|
|||
|
||||
support = pw_core_get_support(core, &n_support);
|
||||
|
||||
loop = spa_support_find(support, n_support, SPA_TYPE_LOOP__DataLoop);
|
||||
loop = spa_support_find(support, n_support, SPA_ID_INTERFACE_DataLoop);
|
||||
if (loop == NULL)
|
||||
return -ENOTSUP;
|
||||
|
||||
|
|
@ -493,7 +492,6 @@ static int module_init(struct pw_module *module, struct pw_properties *propertie
|
|||
pw_log_debug("module %p: new", impl);
|
||||
|
||||
impl->core = core;
|
||||
impl->type = pw_core_get_type(core);
|
||||
impl->properties = properties;
|
||||
impl->loop = loop;
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ static const struct spa_dict_item module_props[] = {
|
|||
|
||||
struct impl {
|
||||
struct pw_core *core;
|
||||
struct pw_type *t;
|
||||
struct pw_properties *properties;
|
||||
|
||||
struct spa_hook module_listener;
|
||||
|
|
@ -128,7 +127,7 @@ core_global_added(void *data, struct pw_global *global)
|
|||
{
|
||||
struct impl *impl = data;
|
||||
|
||||
if (pw_global_get_type(global) == impl->t->node) {
|
||||
if (pw_global_get_type(global) == PW_ID_INTERFACE_Node) {
|
||||
struct pw_node *node = pw_global_get_object(global);
|
||||
struct node_info *info;
|
||||
|
||||
|
|
@ -148,7 +147,7 @@ core_global_removed(void *data, struct pw_global *global)
|
|||
{
|
||||
struct impl *impl = data;
|
||||
|
||||
if (pw_global_get_type(global) == impl->t->node) {
|
||||
if (pw_global_get_type(global) == PW_ID_INTERFACE_Node) {
|
||||
struct pw_node *node = pw_global_get_object(global);
|
||||
struct node_info *info;
|
||||
|
||||
|
|
@ -207,7 +206,6 @@ static int module_init(struct pw_module *module, struct pw_properties *propertie
|
|||
pw_log_debug("module %p: new", impl);
|
||||
|
||||
impl->core = pw_module_get_core(module);
|
||||
impl->t = pw_core_get_type(impl->core);
|
||||
impl->properties = properties;
|
||||
|
||||
spa_list_init(&impl->node_list);
|
||||
|
|
|
|||
|
|
@ -172,13 +172,12 @@ static const struct pw_module_events module_events = {
|
|||
static int module_init(struct pw_module *module, struct pw_properties *properties)
|
||||
{
|
||||
struct pw_core *core = pw_module_get_core(module);
|
||||
struct pw_type *t = pw_core_get_type(core);
|
||||
struct pw_factory *factory;
|
||||
struct factory_data *data;
|
||||
|
||||
factory = pw_factory_new(core,
|
||||
"spa-node-factory",
|
||||
t->node,
|
||||
PW_ID_INTERFACE_Node,
|
||||
PW_VERSION_NODE,
|
||||
NULL,
|
||||
sizeof(*data));
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ struct impl {
|
|||
struct pw_spa_monitor this;
|
||||
|
||||
struct pw_core *core;
|
||||
struct pw_type *t;
|
||||
struct pw_global *parent;
|
||||
|
||||
void *hnd;
|
||||
|
|
@ -71,18 +70,17 @@ static struct monitor_item *add_item(struct pw_spa_monitor *this,
|
|||
struct spa_handle_factory *factory;
|
||||
enum spa_monitor_item_state state;
|
||||
struct spa_pod *info = NULL;
|
||||
struct pw_type *t = pw_core_get_type(impl->core);
|
||||
const struct spa_support *support;
|
||||
enum pw_spa_node_flags flags;
|
||||
uint32_t n_support;
|
||||
|
||||
if (spa_pod_object_parse(item,
|
||||
":",t->monitor.id, "s", &id,
|
||||
":",t->monitor.state, "i", &state,
|
||||
":",t->monitor.name, "s", &name,
|
||||
":",t->monitor.klass, "s", &klass,
|
||||
":",t->monitor.factory, "p", &factory,
|
||||
":",t->monitor.info, "T", &info, NULL) < 0)
|
||||
":", SPA_MONITOR_ITEM_id, "s", &id,
|
||||
":", SPA_MONITOR_ITEM_state, "i", &state,
|
||||
":", SPA_MONITOR_ITEM_name, "s", &name,
|
||||
":", SPA_MONITOR_ITEM_class, "s", &klass,
|
||||
":", SPA_MONITOR_ITEM_factory, "p", &factory,
|
||||
":", SPA_MONITOR_ITEM_info, "T", &info, NULL) < 0)
|
||||
return NULL;
|
||||
|
||||
pw_log_debug("monitor %p: add: \"%s\" (%s)", this, name, id);
|
||||
|
|
@ -120,7 +118,7 @@ static struct monitor_item *add_item(struct pw_spa_monitor *this,
|
|||
pw_log_error("can't make factory instance: %d", res);
|
||||
return NULL;
|
||||
}
|
||||
if ((res = spa_handle_get_interface(handle, t->spa_node, &node_iface)) < 0) {
|
||||
if ((res = spa_handle_get_interface(handle, SPA_ID_INTERFACE_Node, &node_iface)) < 0) {
|
||||
pw_log_error("can't get NODE interface: %d", res);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -165,14 +163,12 @@ void destroy_item(struct monitor_item *mitem)
|
|||
|
||||
static void remove_item(struct pw_spa_monitor *this, struct spa_pod *item, uint64_t now)
|
||||
{
|
||||
struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this);
|
||||
struct monitor_item *mitem;
|
||||
const char *name, *id;
|
||||
struct pw_type *t = pw_core_get_type(impl->core);
|
||||
|
||||
if (spa_pod_object_parse(item,
|
||||
":",t->monitor.name, "s", &name,
|
||||
":",t->monitor.id, "s", &id, NULL) < 0)
|
||||
":", SPA_MONITOR_ITEM_name, "s", &name,
|
||||
":", SPA_MONITOR_ITEM_id, "s", &id, NULL) < 0)
|
||||
return;
|
||||
|
||||
pw_log_debug("monitor %p: remove: \"%s\" (%s)", this, name, id);
|
||||
|
|
@ -183,16 +179,14 @@ static void remove_item(struct pw_spa_monitor *this, struct spa_pod *item, uint6
|
|||
|
||||
static void change_item(struct pw_spa_monitor *this, struct spa_pod *item, uint64_t now)
|
||||
{
|
||||
struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this);
|
||||
struct monitor_item *mitem;
|
||||
const char *name, *id;
|
||||
struct pw_type *t = pw_core_get_type(impl->core);
|
||||
enum spa_monitor_item_state state;
|
||||
|
||||
if (spa_pod_object_parse(item,
|
||||
":",t->monitor.name, "s", &name,
|
||||
":",t->monitor.state, "i", &state,
|
||||
":",t->monitor.id, "s", &id, NULL) < 0)
|
||||
":", SPA_MONITOR_ITEM_name, "s", &name,
|
||||
":", SPA_MONITOR_ITEM_state, "i", &state,
|
||||
":", SPA_MONITOR_ITEM_id, "s", &id, NULL) < 0)
|
||||
return;
|
||||
|
||||
pw_log_debug("monitor %p: change: \"%s\" (%s)", this, name, id);
|
||||
|
|
@ -217,22 +211,24 @@ static void on_monitor_event(void *data, struct spa_event *event)
|
|||
{
|
||||
struct impl *impl = data;
|
||||
struct pw_spa_monitor *this = &impl->this;
|
||||
struct pw_type *t = pw_core_get_type(impl->core);
|
||||
struct timespec now;
|
||||
uint64_t now_nsec;
|
||||
struct spa_pod *item;
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
now_nsec = now.tv_sec * SPA_NSEC_PER_SEC + now.tv_nsec;
|
||||
|
||||
if (SPA_EVENT_TYPE(event) == t->monitor.Added) {
|
||||
struct spa_pod *item = SPA_POD_CONTENTS(struct spa_event, event);
|
||||
item = SPA_POD_CONTENTS(struct spa_event, event);
|
||||
switch(SPA_EVENT_TYPE(event)) {
|
||||
case SPA_ID_EVENT_MONITOR_Added:
|
||||
add_item(this, item, now_nsec);
|
||||
} else if (SPA_EVENT_TYPE(event) == t->monitor.Removed) {
|
||||
struct spa_pod *item = SPA_POD_CONTENTS(struct spa_event, event);
|
||||
break;
|
||||
case SPA_ID_EVENT_MONITOR_Removed:
|
||||
remove_item(this, item, now_nsec);
|
||||
} else if (SPA_EVENT_TYPE(event) == t->monitor.Changed) {
|
||||
struct spa_pod *item = SPA_POD_CONTENTS(struct spa_event, event);
|
||||
break;
|
||||
case SPA_ID_EVENT_MONITOR_Changed:
|
||||
change_item(this, item, now_nsec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -287,7 +283,6 @@ struct pw_spa_monitor *pw_spa_monitor_load(struct pw_core *core,
|
|||
char *filename;
|
||||
const struct spa_support *support;
|
||||
uint32_t n_support;
|
||||
struct pw_type *t = pw_core_get_type(core);
|
||||
|
||||
asprintf(&filename, "%s/%s.so", dir, lib);
|
||||
|
||||
|
|
@ -320,14 +315,13 @@ struct pw_spa_monitor *pw_spa_monitor_load(struct pw_core *core,
|
|||
pw_log_error("can't make factory instance: %d", res);
|
||||
goto init_failed;
|
||||
}
|
||||
if ((res = spa_handle_get_interface(handle, t->spa_monitor, &iface)) < 0) {
|
||||
if ((res = spa_handle_get_interface(handle, SPA_ID_INTERFACE_Monitor, &iface)) < 0) {
|
||||
pw_log_error("can't get MONITOR interface: %d", res);
|
||||
goto interface_failed;
|
||||
}
|
||||
|
||||
impl = calloc(1, sizeof(struct impl) + user_data_size);
|
||||
impl->core = core;
|
||||
impl->t = t;
|
||||
impl->parent = parent;
|
||||
impl->hnd = hnd;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include <spa/node/node.h>
|
||||
#include <spa/param/props.h>
|
||||
#include <spa/pod/iter.h>
|
||||
#include <spa/debug/types.h>
|
||||
|
||||
#include "spa-node.h"
|
||||
#include "pipewire/node.h"
|
||||
|
|
@ -158,24 +159,25 @@ setup_props(struct pw_core *core, struct spa_node *spa_node, struct pw_propertie
|
|||
struct spa_pod *props;
|
||||
void *state = NULL;
|
||||
const char *key;
|
||||
struct pw_type *t = pw_core_get_type(core);
|
||||
uint32_t index = 0;
|
||||
uint8_t buf[2048];
|
||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buf, sizeof(buf));
|
||||
|
||||
if ((res = spa_node_enum_params(spa_node, t->param.idProps, &index, NULL, &props, &b)) <= 0) {
|
||||
if ((res = spa_node_enum_params(spa_node, SPA_ID_PARAM_Props, &index, NULL, &props, &b)) <= 0) {
|
||||
pw_log_debug("spa_node_get_props failed: %d", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
while ((key = pw_properties_iterate(pw_props, &state))) {
|
||||
struct spa_pod_prop *prop;
|
||||
uint32_t id;
|
||||
uint32_t id = 0;
|
||||
|
||||
#if 0
|
||||
if (!spa_type_is_a(key, SPA_TYPE_PROPS_BASE))
|
||||
continue;
|
||||
|
||||
id = spa_type_map_get_id(t->map, key);
|
||||
#endif
|
||||
id = spa_debug_type_find_id(spa_debug_types, key);
|
||||
if (id == SPA_ID_INVALID)
|
||||
continue;
|
||||
|
||||
|
|
@ -191,7 +193,7 @@ setup_props(struct pw_core *core, struct spa_node *spa_node, struct pw_propertie
|
|||
break;
|
||||
case SPA_POD_TYPE_ID:
|
||||
SPA_POD_VALUE(struct spa_pod_id, &prop->body.value) =
|
||||
spa_type_map_get_id(t->map, value);
|
||||
spa_debug_type_find_id(spa_debug_types, value);
|
||||
break;
|
||||
case SPA_POD_TYPE_INT:
|
||||
SPA_POD_VALUE(struct spa_pod_int, &prop->body.value) =
|
||||
|
|
@ -217,7 +219,7 @@ setup_props(struct pw_core *core, struct spa_node *spa_node, struct pw_propertie
|
|||
}
|
||||
}
|
||||
|
||||
if ((res = spa_node_set_param(spa_node, t->param.idProps, 0, props)) < 0) {
|
||||
if ((res = spa_node_set_param(spa_node, SPA_ID_PARAM_Props, 0, props)) < 0) {
|
||||
pw_log_debug("spa_node_set_props failed: %d", res);
|
||||
return res;
|
||||
}
|
||||
|
|
@ -249,7 +251,6 @@ struct pw_node *pw_spa_node_load(struct pw_core *core,
|
|||
const char *dir;
|
||||
const struct spa_support *support;
|
||||
uint32_t n_support;
|
||||
struct pw_type *t = pw_core_get_type(core);
|
||||
|
||||
if ((dir = getenv("SPA_PLUGIN_DIR")) == NULL)
|
||||
dir = PLUGINDIR;
|
||||
|
|
@ -292,7 +293,7 @@ struct pw_node *pw_spa_node_load(struct pw_core *core,
|
|||
if (SPA_RESULT_IS_ASYNC(res))
|
||||
flags |= PW_SPA_NODE_FLAG_ASYNC;
|
||||
|
||||
if ((res = spa_handle_get_interface(handle, t->spa_node, &iface)) < 0) {
|
||||
if ((res = spa_handle_get_interface(handle, SPA_ID_INTERFACE_Node, &iface)) < 0) {
|
||||
pw_log_error("can't get node interface %d", res);
|
||||
goto interface_failed;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue