mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-08 13:30:08 -05:00
types: more work on types
This commit is contained in:
parent
acedfe71c0
commit
5825c62d6d
76 changed files with 1713 additions and 1477 deletions
|
|
@ -88,7 +88,7 @@ struct _SpaProxy
|
|||
|
||||
PinosNode *pnode;
|
||||
|
||||
SpaIDMap *map;
|
||||
SpaTypeMap *map;
|
||||
SpaLog *log;
|
||||
SpaLoop *main_loop;
|
||||
SpaLoop *data_loop;
|
||||
|
|
@ -130,7 +130,7 @@ static void
|
|||
send_async_complete (SpaProxy *this, uint32_t seq, SpaResult res)
|
||||
{
|
||||
PinosCore *core = this->pnode->core;
|
||||
SpaEventNodeAsyncComplete ac = SPA_EVENT_NODE_ASYNC_COMPLETE_INIT (core->uri.event_node.AsyncComplete,
|
||||
SpaEventNodeAsyncComplete ac = SPA_EVENT_NODE_ASYNC_COMPLETE_INIT (core->type.event_node.AsyncComplete,
|
||||
seq, res);
|
||||
this->event_cb (&this->node, (SpaEvent *)&ac, this->user_data);
|
||||
}
|
||||
|
|
@ -166,7 +166,7 @@ static void
|
|||
send_need_input (SpaProxy *this)
|
||||
{
|
||||
PinosNode *pnode = this->pnode;
|
||||
SpaEvent event = SPA_EVENT_INIT (pnode->core->uri.event_node.NeedInput);
|
||||
SpaEvent event = SPA_EVENT_INIT (pnode->core->type.event_node.NeedInput);
|
||||
uint64_t cmd = 1;
|
||||
|
||||
pinos_transport_add_event (pnode->transport, &event);
|
||||
|
|
@ -177,7 +177,7 @@ static void
|
|||
send_have_output (SpaProxy *this)
|
||||
{
|
||||
PinosNode *pnode = this->pnode;
|
||||
SpaEvent event = SPA_EVENT_INIT (pnode->core->uri.event_node.HaveOutput);
|
||||
SpaEvent event = SPA_EVENT_INIT (pnode->core->type.event_node.HaveOutput);
|
||||
uint64_t cmd = 1;
|
||||
|
||||
pinos_transport_add_event (pnode->transport, &event);
|
||||
|
|
@ -202,7 +202,7 @@ spa_proxy_node_send_command (SpaNode *node,
|
|||
|
||||
core = this->pnode->core;
|
||||
|
||||
if (SPA_COMMAND_TYPE (command) == core->uri.command_node.ClockUpdate) {
|
||||
if (SPA_COMMAND_TYPE (command) == core->type.command_node.ClockUpdate) {
|
||||
pinos_client_node_notify_node_command (this->resource,
|
||||
this->seq++,
|
||||
command);
|
||||
|
|
@ -212,7 +212,7 @@ spa_proxy_node_send_command (SpaNode *node,
|
|||
pinos_client_node_notify_node_command (this->resource,
|
||||
this->seq,
|
||||
command);
|
||||
if (SPA_COMMAND_TYPE (command) == core->uri.command_node.Start)
|
||||
if (SPA_COMMAND_TYPE (command) == core->type.command_node.Start)
|
||||
send_need_input (this);
|
||||
|
||||
res = SPA_RESULT_RETURN_ASYNC (this->seq++);
|
||||
|
|
@ -770,7 +770,7 @@ spa_proxy_node_port_reuse_buffer (SpaNode *node,
|
|||
return SPA_RESULT_INVALID_PORT;
|
||||
|
||||
{
|
||||
SpaEventNodeReuseBuffer rb = SPA_EVENT_NODE_REUSE_BUFFER_INIT (pnode->core->uri.event_node.ReuseBuffer,
|
||||
SpaEventNodeReuseBuffer rb = SPA_EVENT_NODE_REUSE_BUFFER_INIT (pnode->core->type.event_node.ReuseBuffer,
|
||||
port_id, buffer_id);
|
||||
pinos_transport_add_event (pnode->transport, (SpaEvent *)&rb);
|
||||
//write (this->data_source.fd, &cmd, 8);
|
||||
|
|
@ -999,11 +999,11 @@ proxy_init (SpaProxy *this,
|
|||
uint32_t i;
|
||||
|
||||
for (i = 0; i < n_support; i++) {
|
||||
if (strcmp (support[i].uri, SPA_TYPE__Log) == 0)
|
||||
if (strcmp (support[i].type, SPA_TYPE__Log) == 0)
|
||||
this->log = support[i].data;
|
||||
else if (strcmp (support[i].uri, SPA_TYPE_LOOP__MainLoop) == 0)
|
||||
else if (strcmp (support[i].type, SPA_TYPE_LOOP__MainLoop) == 0)
|
||||
this->main_loop = support[i].data;
|
||||
else if (strcmp (support[i].uri, SPA_TYPE_LOOP__DataLoop) == 0)
|
||||
else if (strcmp (support[i].type, SPA_TYPE_LOOP__DataLoop) == 0)
|
||||
this->data_loop = support[i].data;
|
||||
}
|
||||
if (this->data_loop == NULL) {
|
||||
|
|
@ -1164,7 +1164,7 @@ pinos_client_node_new (PinosClient *client,
|
|||
|
||||
this->resource = pinos_resource_new (client,
|
||||
id,
|
||||
client->core->uri.client_node,
|
||||
client->core->type.client_node,
|
||||
this,
|
||||
(PinosDestroy) client_node_resource_destroy);
|
||||
if (this->resource == NULL)
|
||||
|
|
|
|||
|
|
@ -106,14 +106,14 @@ pinos_client_new (PinosCore *core,
|
|||
pinos_signal_init (&this->resource_removed);
|
||||
|
||||
pinos_map_init (&this->objects, 0, 32);
|
||||
pinos_map_init (&this->uris, 0, 32);
|
||||
pinos_map_init (&this->types, 0, 32);
|
||||
pinos_signal_init (&this->destroy_signal);
|
||||
|
||||
spa_list_insert (core->client_list.prev, &this->link);
|
||||
|
||||
this->global = pinos_core_add_global (core,
|
||||
this,
|
||||
core->uri.client,
|
||||
core->type.client,
|
||||
0,
|
||||
this,
|
||||
client_bind_func);
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ struct _PinosClient {
|
|||
PinosResource *core_resource;
|
||||
|
||||
PinosMap objects;
|
||||
uint32_t n_uris;
|
||||
PinosMap uris;
|
||||
uint32_t n_types;
|
||||
PinosMap types;
|
||||
|
||||
SpaList resource_list;
|
||||
PINOS_SIGNAL (resource_added, (PinosListener *listener,
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ core_get_registry (void *object,
|
|||
|
||||
registry_resource = pinos_resource_new (client,
|
||||
new_id,
|
||||
this->uri.registry,
|
||||
this->type.registry,
|
||||
this,
|
||||
destroy_registry_resource);
|
||||
if (registry_resource == NULL)
|
||||
|
|
@ -124,7 +124,7 @@ core_get_registry (void *object,
|
|||
spa_list_for_each (global, &this->global_list, link)
|
||||
pinos_registry_notify_global (registry_resource,
|
||||
global->id,
|
||||
spa_id_map_get_uri (this->uri.map, global->type));
|
||||
spa_type_map_get_type (this->type.map, global->type));
|
||||
|
||||
return;
|
||||
|
||||
|
|
@ -203,21 +203,21 @@ no_mem:
|
|||
}
|
||||
|
||||
static void
|
||||
core_update_uris (void *object,
|
||||
uint32_t first_id,
|
||||
uint32_t n_uris,
|
||||
const char **uris)
|
||||
core_update_types (void *object,
|
||||
uint32_t first_id,
|
||||
uint32_t n_types,
|
||||
const char **types)
|
||||
{
|
||||
PinosResource *resource = object;
|
||||
PinosCore *this = resource->core;
|
||||
PinosClient *client = resource->client;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n_uris; i++, first_id++) {
|
||||
uint32_t this_id = spa_id_map_get_id (this->uri.map, uris[i]);
|
||||
printf ("update %d %s -> %d\n", first_id, uris[i], this_id);
|
||||
if (!pinos_map_insert_at (&client->uris, first_id, SPA_UINT32_TO_PTR (this_id)))
|
||||
pinos_log_error ("can't add uri for client");
|
||||
for (i = 0; i < n_types; i++, first_id++) {
|
||||
uint32_t this_id = spa_type_map_get_id (this->type.map, types[i]);
|
||||
printf ("update %d %s -> %d\n", first_id, types[i], this_id);
|
||||
if (!pinos_map_insert_at (&client->types, first_id, SPA_UINT32_TO_PTR (this_id)))
|
||||
pinos_log_error ("can't add type for client");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -227,7 +227,7 @@ static PinosCoreMethods core_methods = {
|
|||
&core_get_registry,
|
||||
&core_create_node,
|
||||
&core_create_client_node,
|
||||
&core_update_uris
|
||||
&core_update_types
|
||||
};
|
||||
|
||||
static void
|
||||
|
|
@ -291,17 +291,17 @@ pinos_core_new (PinosMainLoop *main_loop,
|
|||
this->main_loop = main_loop;
|
||||
this->properties = properties;
|
||||
|
||||
pinos_uri_init (&this->uri);
|
||||
pinos_type_init (&this->type);
|
||||
pinos_access_init (&this->access);
|
||||
pinos_map_init (&this->objects, 128, 32);
|
||||
|
||||
impl->support[0].uri = SPA_TYPE__IDMap;
|
||||
impl->support[0].data = this->uri.map;
|
||||
impl->support[1].uri = SPA_TYPE__Log;
|
||||
impl->support[0].type = SPA_TYPE__TypeMap;
|
||||
impl->support[0].data = this->type.map;
|
||||
impl->support[1].type = SPA_TYPE__Log;
|
||||
impl->support[1].data = pinos_log_get ();
|
||||
impl->support[2].uri = SPA_TYPE_LOOP__DataLoop;
|
||||
impl->support[2].type = SPA_TYPE_LOOP__DataLoop;
|
||||
impl->support[2].data = this->data_loop->loop->loop;
|
||||
impl->support[3].uri = SPA_TYPE_LOOP__MainLoop;
|
||||
impl->support[3].type = SPA_TYPE_LOOP__MainLoop;
|
||||
impl->support[3].data = this->main_loop->loop->loop;
|
||||
this->support = impl->support;
|
||||
this->n_support = 4;
|
||||
|
|
@ -321,7 +321,7 @@ pinos_core_new (PinosMainLoop *main_loop,
|
|||
|
||||
this->global = pinos_core_add_global (this,
|
||||
NULL,
|
||||
this->uri.core,
|
||||
this->type.core,
|
||||
0,
|
||||
this,
|
||||
core_bind_func);
|
||||
|
|
@ -370,7 +370,7 @@ pinos_core_add_global (PinosCore *core,
|
|||
PinosGlobalImpl *impl;
|
||||
PinosGlobal *this;
|
||||
PinosResource *registry;
|
||||
const char *type_uri;
|
||||
const char *type_name;
|
||||
|
||||
impl = calloc (1, sizeof (PinosGlobalImpl));
|
||||
if (impl == NULL)
|
||||
|
|
@ -392,13 +392,13 @@ pinos_core_add_global (PinosCore *core,
|
|||
spa_list_insert (core->global_list.prev, &this->link);
|
||||
pinos_signal_emit (&core->global_added, core, this);
|
||||
|
||||
type_uri = spa_id_map_get_uri (core->uri.map, this->type);
|
||||
pinos_log_debug ("global %p: new %u %s", this, this->id, type_uri);
|
||||
type_name = spa_type_map_get_type (core->type.map, this->type);
|
||||
pinos_log_debug ("global %p: new %u %s", this, this->id, type_name);
|
||||
|
||||
spa_list_for_each (registry, &core->registry_resource_list, link)
|
||||
pinos_registry_notify_global (registry,
|
||||
this->id,
|
||||
type_uri);
|
||||
type_name);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ typedef struct _PinosGlobal PinosGlobal;
|
|||
|
||||
#include <spa/include/spa/log.h>
|
||||
|
||||
#include <pinos/client/uri.h>
|
||||
#include <pinos/client/type.h>
|
||||
|
||||
#include <pinos/server/access.h>
|
||||
#include <pinos/server/main-loop.h>
|
||||
|
|
@ -68,7 +68,7 @@ struct _PinosCore {
|
|||
|
||||
PinosProperties *properties;
|
||||
|
||||
PinosURI uri;
|
||||
PinosType type;
|
||||
PinosAccess access;
|
||||
|
||||
PinosMap objects;
|
||||
|
|
|
|||
|
|
@ -158,11 +158,11 @@ find_meta_enable (PinosCore *core, const SpaPortInfo *info, SpaMetaType type)
|
|||
uint32_t i;
|
||||
|
||||
for (i = 0; i < info->n_params; i++) {
|
||||
if (spa_pod_is_object_type (&info->params[i]->pod, core->uri.alloc_param_meta_enable.MetaEnable)) {
|
||||
if (spa_pod_is_object_type (&info->params[i]->pod, core->type.alloc_param_meta_enable.MetaEnable)) {
|
||||
uint32_t qtype;
|
||||
|
||||
if (spa_alloc_param_query (info->params[i],
|
||||
core->uri.alloc_param_meta_enable.type, SPA_POD_TYPE_INT, &qtype, 0) != 1)
|
||||
core->type.alloc_param_meta_enable.type, SPA_POD_TYPE_INT, &qtype, 0) != 1)
|
||||
continue;
|
||||
|
||||
if (qtype == type)
|
||||
|
|
@ -208,11 +208,11 @@ alloc_buffers (PinosLink *this,
|
|||
for (i = 0; i < n_params; i++) {
|
||||
SpaAllocParam *ap = params[i];
|
||||
|
||||
if (ap->pod.type == this->core->uri.alloc_param_meta_enable.MetaEnable) {
|
||||
if (ap->pod.type == this->core->type.alloc_param_meta_enable.MetaEnable) {
|
||||
uint32_t type;
|
||||
|
||||
if (spa_alloc_param_query (ap,
|
||||
this->core->uri.alloc_param_meta_enable.type, SPA_POD_TYPE_INT, &type,
|
||||
this->core->type.alloc_param_meta_enable.type, SPA_POD_TYPE_INT, &type,
|
||||
0) != 1)
|
||||
continue;
|
||||
|
||||
|
|
@ -404,43 +404,43 @@ do_allocation (PinosLink *this, SpaNodeState in_state, SpaNodeState out_state)
|
|||
max_buffers = 1;
|
||||
|
||||
if (spa_alloc_param_query (in_me,
|
||||
this->core->uri.alloc_param_meta_enable.ringbufferSize, SPA_POD_TYPE_INT, &ms1,
|
||||
this->core->uri.alloc_param_meta_enable.ringbufferStride, SPA_POD_TYPE_INT, &s1, 0) == 2 &&
|
||||
this->core->type.alloc_param_meta_enable.ringbufferSize, SPA_POD_TYPE_INT, &ms1,
|
||||
this->core->type.alloc_param_meta_enable.ringbufferStride, SPA_POD_TYPE_INT, &s1, 0) == 2 &&
|
||||
spa_alloc_param_query (in_me,
|
||||
this->core->uri.alloc_param_meta_enable.ringbufferSize, SPA_POD_TYPE_INT, &ms2,
|
||||
this->core->uri.alloc_param_meta_enable.ringbufferStride, SPA_POD_TYPE_INT, &s2, 0) == 2) {
|
||||
this->core->type.alloc_param_meta_enable.ringbufferSize, SPA_POD_TYPE_INT, &ms2,
|
||||
this->core->type.alloc_param_meta_enable.ringbufferStride, SPA_POD_TYPE_INT, &s2, 0) == 2) {
|
||||
minsize = SPA_MAX (ms1, ms2);
|
||||
stride = SPA_MAX (s1, s2);
|
||||
}
|
||||
} else {
|
||||
max_buffers = MAX_BUFFERS;
|
||||
minsize = stride = 0;
|
||||
in_alloc = find_param (iinfo, this->core->uri.alloc_param_buffers.Buffers);
|
||||
in_alloc = find_param (iinfo, this->core->type.alloc_param_buffers.Buffers);
|
||||
if (in_alloc) {
|
||||
uint32_t qmax_buffers = max_buffers,
|
||||
qminsize = minsize,
|
||||
qstride = stride;
|
||||
|
||||
spa_alloc_param_query (in_alloc,
|
||||
this->core->uri.alloc_param_buffers.size, SPA_POD_TYPE_INT, &qminsize,
|
||||
this->core->uri.alloc_param_buffers.stride, SPA_POD_TYPE_INT, &qstride,
|
||||
this->core->uri.alloc_param_buffers.buffers, SPA_POD_TYPE_INT, &qmax_buffers,
|
||||
this->core->type.alloc_param_buffers.size, SPA_POD_TYPE_INT, &qminsize,
|
||||
this->core->type.alloc_param_buffers.stride, SPA_POD_TYPE_INT, &qstride,
|
||||
this->core->type.alloc_param_buffers.buffers, SPA_POD_TYPE_INT, &qmax_buffers,
|
||||
0);
|
||||
|
||||
max_buffers = qmax_buffers == 0 ? max_buffers : SPA_MIN (qmax_buffers, max_buffers);
|
||||
minsize = SPA_MAX (minsize, qminsize);
|
||||
stride = SPA_MAX (stride, qstride);
|
||||
}
|
||||
out_alloc = find_param (oinfo, this->core->uri.alloc_param_buffers.Buffers);
|
||||
out_alloc = find_param (oinfo, this->core->type.alloc_param_buffers.Buffers);
|
||||
if (out_alloc) {
|
||||
uint32_t qmax_buffers = max_buffers,
|
||||
qminsize = minsize,
|
||||
qstride = stride;
|
||||
|
||||
spa_alloc_param_query (out_alloc,
|
||||
this->core->uri.alloc_param_buffers.size, SPA_POD_TYPE_INT, &qminsize,
|
||||
this->core->uri.alloc_param_buffers.stride, SPA_POD_TYPE_INT, &qstride,
|
||||
this->core->uri.alloc_param_buffers.buffers, SPA_POD_TYPE_INT, &qmax_buffers,
|
||||
this->core->type.alloc_param_buffers.size, SPA_POD_TYPE_INT, &qminsize,
|
||||
this->core->type.alloc_param_buffers.stride, SPA_POD_TYPE_INT, &qstride,
|
||||
this->core->type.alloc_param_buffers.buffers, SPA_POD_TYPE_INT, &qmax_buffers,
|
||||
0);
|
||||
|
||||
max_buffers = qmax_buffers == 0 ? max_buffers : SPA_MIN (qmax_buffers, max_buffers);
|
||||
|
|
@ -866,7 +866,7 @@ pinos_link_new (PinosCore *core,
|
|||
|
||||
this->global = pinos_core_add_global (core,
|
||||
NULL,
|
||||
core->uri.link,
|
||||
core->type.link,
|
||||
0,
|
||||
this,
|
||||
link_bind_func);
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ pinos_module_load (PinosCore *core,
|
|||
|
||||
this->global = pinos_core_add_global (core,
|
||||
NULL,
|
||||
core->uri.module,
|
||||
core->type.module,
|
||||
0,
|
||||
impl,
|
||||
module_bind_func);
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "spa/include/spa/node-command.h"
|
||||
|
||||
#include "pinos/client/pinos.h"
|
||||
#include "pinos/client/interfaces.h"
|
||||
|
||||
|
|
@ -169,7 +167,7 @@ pause_node (PinosNode *this)
|
|||
|
||||
pinos_log_debug ("node %p: pause node", this);
|
||||
{
|
||||
SpaCommand cmd = SPA_COMMAND_INIT (this->core->uri.command_node.Pause);
|
||||
SpaCommand cmd = SPA_COMMAND_INIT (this->core->type.command_node.Pause);
|
||||
if ((res = spa_node_send_command (this->node, &cmd)) < 0)
|
||||
pinos_log_debug ("got error %d", res);
|
||||
}
|
||||
|
|
@ -183,7 +181,7 @@ start_node (PinosNode *this)
|
|||
|
||||
pinos_log_debug ("node %p: start node", this);
|
||||
{
|
||||
SpaCommand cmd = SPA_COMMAND_INIT (this->core->uri.command_node.Start);
|
||||
SpaCommand cmd = SPA_COMMAND_INIT (this->core->type.command_node.Start);
|
||||
if ((res = spa_node_send_command (this->node, &cmd)) < 0)
|
||||
pinos_log_debug ("got error %d", res);
|
||||
}
|
||||
|
|
@ -226,7 +224,7 @@ send_clock_update (PinosNode *this)
|
|||
SpaResult res;
|
||||
SpaCommandNodeClockUpdate cu =
|
||||
SPA_COMMAND_NODE_CLOCK_UPDATE_INIT(
|
||||
this->core->uri.command_node.ClockUpdate,
|
||||
this->core->type.command_node.ClockUpdate,
|
||||
SPA_COMMAND_NODE_CLOCK_UPDATE_TIME |
|
||||
SPA_COMMAND_NODE_CLOCK_UPDATE_SCALE |
|
||||
SPA_COMMAND_NODE_CLOCK_UPDATE_STATE |
|
||||
|
|
@ -258,7 +256,7 @@ on_node_event (SpaNode *node, SpaEvent *event, void *user_data)
|
|||
PinosNode *this = user_data;
|
||||
PinosNodeImpl *impl = SPA_CONTAINER_OF (this, PinosNodeImpl, this);
|
||||
|
||||
if (SPA_EVENT_TYPE (event) == this->core->uri.event_node.AsyncComplete) {
|
||||
if (SPA_EVENT_TYPE (event) == this->core->type.event_node.AsyncComplete) {
|
||||
SpaEventNodeAsyncComplete *ac = (SpaEventNodeAsyncComplete *) event;
|
||||
|
||||
pinos_log_debug ("node %p: async complete event %d %d", this, ac->body.seq.value, ac->body.res.value);
|
||||
|
|
@ -266,7 +264,7 @@ on_node_event (SpaNode *node, SpaEvent *event, void *user_data)
|
|||
pinos_signal_emit (&this->async_complete, this, ac->body.seq.value, ac->body.res.value);
|
||||
}
|
||||
}
|
||||
else if (SPA_EVENT_TYPE (event) == this->core->uri.event_node.NeedInput) {
|
||||
else if (SPA_EVENT_TYPE (event) == this->core->type.event_node.NeedInput) {
|
||||
SpaResult res;
|
||||
int i;
|
||||
bool processed = false;
|
||||
|
|
@ -310,7 +308,7 @@ on_node_event (SpaNode *node, SpaEvent *event, void *user_data)
|
|||
pinos_log_warn ("node %p: got process input %d", this, res);
|
||||
}
|
||||
}
|
||||
else if (SPA_EVENT_TYPE (event) == this->core->uri.event_node.HaveOutput) {
|
||||
else if (SPA_EVENT_TYPE (event) == this->core->type.event_node.HaveOutput) {
|
||||
SpaResult res;
|
||||
int i;
|
||||
bool processed = false;
|
||||
|
|
@ -353,7 +351,7 @@ on_node_event (SpaNode *node, SpaEvent *event, void *user_data)
|
|||
pinos_log_warn ("node %p: got process output %d", this, res);
|
||||
}
|
||||
}
|
||||
else if (SPA_EVENT_TYPE (event) == this->core->uri.event_node.RequestClockUpdate) {
|
||||
else if (SPA_EVENT_TYPE (event) == this->core->type.event_node.RequestClockUpdate) {
|
||||
send_clock_update (this);
|
||||
}
|
||||
}
|
||||
|
|
@ -455,7 +453,7 @@ init_complete (PinosNode *this)
|
|||
spa_list_insert (this->core->node_list.prev, &this->link);
|
||||
this->global = pinos_core_add_global (this->core,
|
||||
NULL,
|
||||
this->core->uri.node,
|
||||
this->core->type.node,
|
||||
0,
|
||||
this,
|
||||
node_bind_func);
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ no_mem:
|
|||
static SpaResult
|
||||
pinos_port_pause (PinosPort *port)
|
||||
{
|
||||
SpaCommand cmd = SPA_COMMAND_INIT (port->node->core->uri.command_node.Pause);
|
||||
SpaCommand cmd = SPA_COMMAND_INIT (port->node->core->type.command_node.Pause);
|
||||
return spa_node_port_send_command (port->node->node,
|
||||
port->direction,
|
||||
port->port_id,
|
||||
|
|
|
|||
|
|
@ -50,22 +50,22 @@ core_update_map (PinosClient *client)
|
|||
{
|
||||
uint32_t diff, base, i;
|
||||
PinosCore *core = client->core;
|
||||
const char **uris;
|
||||
const char **types;
|
||||
|
||||
base = client->n_uris;
|
||||
diff = spa_id_map_get_size (core->uri.map) - base;
|
||||
base = client->n_types;
|
||||
diff = spa_type_map_get_size (core->type.map) - base;
|
||||
if (diff == 0)
|
||||
return;
|
||||
|
||||
uris = alloca (diff * sizeof (char *));
|
||||
types = alloca (diff * sizeof (char *));
|
||||
for (i = 0; i < diff; i++, base++)
|
||||
uris[i] = spa_id_map_get_uri (core->uri.map, base);
|
||||
types[i] = spa_type_map_get_type (core->type.map, base);
|
||||
|
||||
pinos_core_notify_update_uris (client->core_resource,
|
||||
client->n_uris,
|
||||
pinos_core_notify_update_types (client->core_resource,
|
||||
client->n_types,
|
||||
diff,
|
||||
uris);
|
||||
client->n_uris += diff;
|
||||
types);
|
||||
client->n_types += diff;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -166,10 +166,10 @@ core_marshal_remove_id (void *object,
|
|||
}
|
||||
|
||||
static void
|
||||
core_marshal_update_uris (void *object,
|
||||
uint32_t first_id,
|
||||
uint32_t n_uris,
|
||||
const char **uris)
|
||||
core_marshal_update_types (void *object,
|
||||
uint32_t first_id,
|
||||
uint32_t n_types,
|
||||
const char **types)
|
||||
{
|
||||
PinosResource *resource = object;
|
||||
PinosConnection *connection = resource->client->protocol_private;
|
||||
|
|
@ -180,11 +180,11 @@ core_marshal_update_uris (void *object,
|
|||
spa_pod_builder_add (&b.b,
|
||||
SPA_POD_TYPE_STRUCT, &f,
|
||||
SPA_POD_TYPE_INT, first_id,
|
||||
SPA_POD_TYPE_INT, n_uris, 0);
|
||||
SPA_POD_TYPE_INT, n_types, 0);
|
||||
|
||||
for (i = 0; i < n_uris; i++) {
|
||||
for (i = 0; i < n_types; i++) {
|
||||
spa_pod_builder_add (&b.b,
|
||||
SPA_POD_TYPE_STRING, uris[i], 0);
|
||||
SPA_POD_TYPE_STRING, types[i], 0);
|
||||
}
|
||||
spa_pod_builder_add (&b.b,
|
||||
-SPA_POD_TYPE_STRUCT, &f, 0);
|
||||
|
|
@ -333,29 +333,29 @@ core_demarshal_create_client_node (void *object,
|
|||
}
|
||||
|
||||
static bool
|
||||
core_demarshal_update_uris (void *object,
|
||||
void *data,
|
||||
size_t size)
|
||||
core_demarshal_update_types (void *object,
|
||||
void *data,
|
||||
size_t size)
|
||||
{
|
||||
PinosResource *resource = object;
|
||||
SpaPODIter it;
|
||||
uint32_t first_id, n_uris;
|
||||
const char **uris;
|
||||
uint32_t first_id, n_types;
|
||||
const char **types;
|
||||
int i;
|
||||
|
||||
if (!spa_pod_iter_struct (&it, data, size) ||
|
||||
!spa_pod_iter_get (&it,
|
||||
SPA_POD_TYPE_INT, &first_id,
|
||||
SPA_POD_TYPE_INT, &n_uris,
|
||||
SPA_POD_TYPE_INT, &n_types,
|
||||
0))
|
||||
return false;
|
||||
|
||||
uris = alloca (n_uris * sizeof (char *));
|
||||
for (i = 0; i < n_uris; i++) {
|
||||
if (!spa_pod_iter_get (&it, SPA_POD_TYPE_STRING, &uris[i], 0))
|
||||
types = alloca (n_types * sizeof (char *));
|
||||
for (i = 0; i < n_types; i++) {
|
||||
if (!spa_pod_iter_get (&it, SPA_POD_TYPE_STRING, &types[i], 0))
|
||||
return false;
|
||||
}
|
||||
((PinosCoreMethods*)resource->implementation)->update_uris (resource, first_id, n_uris, uris);
|
||||
((PinosCoreMethods*)resource->implementation)->update_types (resource, first_id, n_types, types);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -975,7 +975,7 @@ static const PinosDemarshalFunc pinos_protocol_native_server_core_demarshal[] =
|
|||
&core_demarshal_get_registry,
|
||||
&core_demarshal_create_node,
|
||||
&core_demarshal_create_client_node,
|
||||
&core_demarshal_update_uris
|
||||
&core_demarshal_update_types
|
||||
};
|
||||
|
||||
static const PinosCoreEvents pinos_protocol_native_server_core_events = {
|
||||
|
|
@ -983,7 +983,7 @@ static const PinosCoreEvents pinos_protocol_native_server_core_events = {
|
|||
&core_marshal_done,
|
||||
&core_marshal_error,
|
||||
&core_marshal_remove_id,
|
||||
&core_marshal_update_uris
|
||||
&core_marshal_update_types
|
||||
};
|
||||
|
||||
const PinosInterface pinos_protocol_native_server_core_interface = {
|
||||
|
|
@ -1072,25 +1072,25 @@ bool
|
|||
pinos_protocol_native_server_setup (PinosResource *resource)
|
||||
{
|
||||
const PinosInterface *iface;
|
||||
if (resource->type == resource->core->uri.core) {
|
||||
if (resource->type == resource->core->type.core) {
|
||||
iface = &pinos_protocol_native_server_core_interface;
|
||||
}
|
||||
else if (resource->type == resource->core->uri.registry) {
|
||||
else if (resource->type == resource->core->type.registry) {
|
||||
iface = &pinos_protocol_native_server_registry_interface;
|
||||
}
|
||||
else if (resource->type == resource->core->uri.module) {
|
||||
else if (resource->type == resource->core->type.module) {
|
||||
iface = &pinos_protocol_native_server_module_interface;
|
||||
}
|
||||
else if (resource->type == resource->core->uri.node) {
|
||||
else if (resource->type == resource->core->type.node) {
|
||||
iface = &pinos_protocol_native_server_node_interface;
|
||||
}
|
||||
else if (resource->type == resource->core->uri.client) {
|
||||
else if (resource->type == resource->core->type.client) {
|
||||
iface = &pinos_protocol_native_server_client_interface;
|
||||
}
|
||||
else if (resource->type == resource->core->uri.client_node) {
|
||||
else if (resource->type == resource->core->type.client_node) {
|
||||
iface = &pinos_protocol_native_server_client_node_interface;
|
||||
}
|
||||
else if (resource->type == resource->core->uri.link) {
|
||||
else if (resource->type == resource->core->type.link) {
|
||||
iface = &pinos_protocol_native_server_link_interface;
|
||||
} else
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue