types: more work on types

This commit is contained in:
Wim Taymans 2017-03-24 11:40:58 +01:00
parent acedfe71c0
commit 5825c62d6d
76 changed files with 1713 additions and 1477 deletions

View file

@ -169,9 +169,9 @@ core_event_update_uris (void *object,
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]);
SpaType this_id = spa_type_map_get_id (this->type.map, uris[i]);
printf ("update %d %s -> %d\n", first_id, uris[i], this_id);
if (!pinos_map_insert_at (&this->uris, first_id, SPA_UINT32_TO_PTR (this_id)))
if (!pinos_map_insert_at (&this->types, first_id, SPA_UINT32_TO_PTR (this_id)))
pinos_log_error ("can't add uri for client");
}
}
@ -310,7 +310,7 @@ registry_event_global (void *object,
if (!strcmp (type, PINOS_TYPE__Node)) {
proxy = pinos_proxy_new (this,
SPA_ID_INVALID,
this->uri.node);
this->type.node);
if (proxy == NULL)
goto no_mem;
@ -318,7 +318,7 @@ registry_event_global (void *object,
} else if (!strcmp (type, PINOS_TYPE__Module)) {
proxy = pinos_proxy_new (this,
SPA_ID_INVALID,
this->uri.module);
this->type.module);
if (proxy == NULL)
goto no_mem;
@ -326,7 +326,7 @@ registry_event_global (void *object,
} else if (!strcmp (type, PINOS_TYPE__Client)) {
proxy = pinos_proxy_new (this,
SPA_ID_INVALID,
this->uri.client);
this->type.client);
if (proxy == NULL)
goto no_mem;
@ -334,7 +334,7 @@ registry_event_global (void *object,
} else if (!strcmp (type, PINOS_TYPE__Link)) {
proxy = pinos_proxy_new (this,
SPA_ID_INVALID,
this->uri.link);
this->type.link);
if (proxy == NULL)
goto no_mem;
@ -478,7 +478,7 @@ pinos_context_new (PinosLoop *loop,
pinos_fill_context_properties (properties);
this->properties = properties;
pinos_uri_init (&this->uri);
pinos_type_init (&this->type);
this->loop = loop;
@ -487,7 +487,7 @@ pinos_context_new (PinosLoop *loop,
this->state = PINOS_CONTEXT_STATE_UNCONNECTED;
pinos_map_init (&this->objects, 64, 32);
pinos_map_init (&this->uris, 64, 32);
pinos_map_init (&this->types, 64, 32);
spa_list_init (&this->stream_list);
spa_list_init (&this->global_list);
@ -630,7 +630,7 @@ pinos_context_connect_fd (PinosContext *context,
context->core_proxy = pinos_proxy_new (context,
0,
context->uri.core);
context->type.core);
if (context->core_proxy == NULL)
goto no_proxy;
@ -641,7 +641,7 @@ pinos_context_connect_fd (PinosContext *context,
context->registry_proxy = pinos_proxy_new (context,
SPA_ID_INVALID,
context->uri.registry);
context->type.registry);
if (context->registry_proxy == NULL)
goto no_registry;
@ -710,7 +710,7 @@ pinos_context_get_core_info (PinosContext *context,
proxy = pinos_map_lookup (&context->objects, 0);
if (proxy == NULL) {
cb (context, SPA_RESULT_INVALID_OBJECT_ID, NULL, user_data);
} else if (proxy->type == context->uri.core && proxy->user_data) {
} else if (proxy->type == context->type.core && proxy->user_data) {
PinosCoreInfo *info = proxy->user_data;
cb (context, SPA_RESULT_OK, info, user_data);
info->change_mask = 0;
@ -750,7 +750,7 @@ pinos_context_list_module_info (PinosContext *context,
PinosModuleInfoCallback cb,
void *user_data)
{
do_list (context, context->uri.module, (ListFunc) cb, user_data);
do_list (context, context->type.module, (ListFunc) cb, user_data);
}
void
@ -764,7 +764,7 @@ pinos_context_get_module_info_by_id (PinosContext *context,
proxy = pinos_map_lookup (&context->objects, id);
if (proxy == NULL) {
cb (context, SPA_RESULT_INVALID_OBJECT_ID, NULL, user_data);
} else if (proxy->type == context->uri.module && proxy->user_data) {
} else if (proxy->type == context->type.module && proxy->user_data) {
PinosModuleInfo *info = proxy->user_data;
cb (context, SPA_RESULT_OK, info, user_data);
info->change_mask = 0;
@ -777,7 +777,7 @@ pinos_context_list_client_info (PinosContext *context,
PinosClientInfoCallback cb,
void *user_data)
{
do_list (context, context->uri.client, (ListFunc) cb, user_data);
do_list (context, context->type.client, (ListFunc) cb, user_data);
}
void
@ -791,7 +791,7 @@ pinos_context_get_client_info_by_id (PinosContext *context,
proxy = pinos_map_lookup (&context->objects, id);
if (proxy == NULL) {
cb (context, SPA_RESULT_INVALID_OBJECT_ID, NULL, user_data);
} else if (proxy->type == context->uri.client && proxy->user_data) {
} else if (proxy->type == context->type.client && proxy->user_data) {
PinosClientInfo *info = proxy->user_data;
cb (context, SPA_RESULT_OK, info, user_data);
info->change_mask = 0;
@ -804,7 +804,7 @@ pinos_context_list_node_info (PinosContext *context,
PinosNodeInfoCallback cb,
void *user_data)
{
do_list (context, context->uri.node, (ListFunc) cb, user_data);
do_list (context, context->type.node, (ListFunc) cb, user_data);
}
void
@ -818,7 +818,7 @@ pinos_context_get_node_info_by_id (PinosContext *context,
proxy = pinos_map_lookup (&context->objects, id);
if (proxy == NULL) {
cb (context, SPA_RESULT_INVALID_OBJECT_ID, NULL, user_data);
} else if (proxy->type == context->uri.node && proxy->user_data) {
} else if (proxy->type == context->type.node && proxy->user_data) {
PinosNodeInfo *info = proxy->user_data;
cb (context, SPA_RESULT_OK, info, user_data);
info->change_mask = 0;
@ -831,7 +831,7 @@ pinos_context_list_link_info (PinosContext *context,
PinosLinkInfoCallback cb,
void *user_data)
{
do_list (context, context->uri.link, (ListFunc) cb, user_data);
do_list (context, context->type.link, (ListFunc) cb, user_data);
}
void
@ -845,7 +845,7 @@ pinos_context_get_link_info_by_id (PinosContext *context,
proxy = pinos_map_lookup (&context->objects, id);
if (proxy == NULL) {
cb (context, SPA_RESULT_INVALID_OBJECT_ID, NULL, user_data);
} else if (proxy->type == context->uri.link && proxy->user_data) {
} else if (proxy->type == context->type.link && proxy->user_data) {
PinosLinkInfo *info = proxy->user_data;
cb (context, SPA_RESULT_OK, info, user_data);
info->change_mask = 0;

View file

@ -31,7 +31,7 @@ typedef struct _PinosContext PinosContext;
#include <pinos/client/properties.h>
#include <pinos/client/subscribe.h>
#include <pinos/client/proxy.h>
#include <pinos/client/uri.h>
#include <pinos/client/type.h>
/**
* PinosContextState:
@ -60,7 +60,7 @@ struct _PinosContext {
char *name;
PinosProperties *properties;
PinosURI uri;
PinosType type;
PinosLoop *loop;
@ -68,8 +68,8 @@ struct _PinosContext {
PinosProxy *registry_proxy;
PinosMap objects;
uint32_t n_uris;
PinosMap uris;
uint32_t n_types;
PinosMap types;
SpaList global_list;
SpaList stream_list;

View file

@ -58,10 +58,10 @@ typedef struct {
const char *name,
const SpaDict *props,
uint32_t new_id);
void (*update_uris) (void *object,
void (*update_types) (void *object,
uint32_t first_id,
uint32_t n_uris,
const char **uris);
uint32_t n_types,
const char **types);
} PinosCoreMethods;
#define pinos_core_do_client_update(r,...) ((PinosCoreMethods*)r->iface->methods)->client_update(r,__VA_ARGS__)
@ -69,7 +69,7 @@ typedef struct {
#define pinos_core_do_get_registry(r,...) ((PinosCoreMethods*)r->iface->methods)->get_registry(r,__VA_ARGS__)
#define pinos_core_do_create_node(r,...) ((PinosCoreMethods*)r->iface->methods)->create_node(r,__VA_ARGS__)
#define pinos_core_do_create_client_node(r,...) ((PinosCoreMethods*)r->iface->methods)->create_client_node(r,__VA_ARGS__)
#define pinos_core_do_update_uris(r,...) ((PinosCoreMethods*)r->iface->methods)->update_uris(r,__VA_ARGS__)
#define pinos_core_do_update_types(r,...) ((PinosCoreMethods*)r->iface->methods)->update_types(r,__VA_ARGS__)
typedef struct {
void (*info) (void *object,
@ -82,17 +82,17 @@ typedef struct {
const char *error, ...);
void (*remove_id) (void *object,
uint32_t id);
void (*update_uris) (void *object,
void (*update_types) (void *object,
uint32_t first_id,
uint32_t n_uris,
const char **uris);
uint32_t n_types,
const char **types);
} PinosCoreEvents;
#define pinos_core_notify_info(r,...) ((PinosCoreEvents*)r->iface->events)->info(r,__VA_ARGS__)
#define pinos_core_notify_done(r,...) ((PinosCoreEvents*)r->iface->events)->done(r,__VA_ARGS__)
#define pinos_core_notify_error(r,...) ((PinosCoreEvents*)r->iface->events)->error(r,__VA_ARGS__)
#define pinos_core_notify_remove_id(r,...) ((PinosCoreEvents*)r->iface->events)->remove_id(r,__VA_ARGS__)
#define pinos_core_notify_update_uris(r,...) ((PinosCoreEvents*)r->iface->events)->update_uris(r,__VA_ARGS__)
#define pinos_core_notify_info(r,...) ((PinosCoreEvents*)r->iface->events)->info(r,__VA_ARGS__)
#define pinos_core_notify_done(r,...) ((PinosCoreEvents*)r->iface->events)->done(r,__VA_ARGS__)
#define pinos_core_notify_error(r,...) ((PinosCoreEvents*)r->iface->events)->error(r,__VA_ARGS__)
#define pinos_core_notify_remove_id(r,...) ((PinosCoreEvents*)r->iface->events)->remove_id(r,__VA_ARGS__)
#define pinos_core_notify_update_types(r,...) ((PinosCoreEvents*)r->iface->events)->update_types(r,__VA_ARGS__)
typedef struct {
void (*bind) (void *object,

View file

@ -22,76 +22,76 @@
#include <stdio.h>
#include <string.h>
#include <spa/id-map.h>
#include <spa/type-map.h>
#include <spa/lib/mapper.h>
#include <pinos/client/map.h>
typedef struct {
SpaIDMap map;
PinosMap uris;
SpaTypeMap map;
PinosMap types;
PinosArray strings;
} IDMap;
} TypeMap;
static uint32_t
id_map_get_id (SpaIDMap *map, const char *uri)
type_map_get_id (SpaTypeMap *map, const char *type)
{
IDMap *this = SPA_CONTAINER_OF (map, IDMap, map);
TypeMap *this = SPA_CONTAINER_OF (map, TypeMap, map);
uint32_t i = 0, len;
void *p;
off_t o;
if (uri != NULL) {
for (i = 0; i < pinos_map_get_size (&this->uris); i++) {
o = (off_t) pinos_map_lookup_unchecked (&this->uris, i);
if (strcmp (SPA_MEMBER (this->strings.data, o, char), uri) == 0)
if (type != NULL) {
for (i = 0; i < pinos_map_get_size (&this->types); i++) {
o = (off_t) pinos_map_lookup_unchecked (&this->types, i);
if (strcmp (SPA_MEMBER (this->strings.data, o, char), type) == 0)
return i;
}
len = strlen (uri);
len = strlen (type);
p = pinos_array_add (&this->strings, SPA_ROUND_UP_N (len+1, 2));
memcpy (p, uri, len+1);
memcpy (p, type, len+1);
o = (p - this->strings.data);
i = pinos_map_insert_new (&this->uris, (void *)o);
i = pinos_map_insert_new (&this->types, (void *)o);
}
return i;
}
static const char *
id_map_get_uri (SpaIDMap *map, uint32_t id)
type_map_get_type (SpaTypeMap *map, uint32_t id)
{
IDMap *this = SPA_CONTAINER_OF (map, IDMap, map);
TypeMap *this = SPA_CONTAINER_OF (map, TypeMap, map);
if (id == SPA_ID_INVALID)
return NULL;
if (SPA_LIKELY (pinos_map_check_id (&this->uris, id))) {
off_t o = (off_t) pinos_map_lookup_unchecked (&this->uris, id);
if (SPA_LIKELY (pinos_map_check_id (&this->types, id))) {
off_t o = (off_t) pinos_map_lookup_unchecked (&this->types, id);
return SPA_MEMBER (this->strings.data, o, char);
}
return NULL;
}
static uint32_t
id_map_get_size (SpaIDMap *map)
static size_t
type_map_get_size (SpaTypeMap *map)
{
IDMap *this = SPA_CONTAINER_OF (map, IDMap, map);
return pinos_map_get_size (&this->uris);
TypeMap *this = SPA_CONTAINER_OF (map, TypeMap, map);
return pinos_map_get_size (&this->types);
}
static IDMap default_id_map = {
{ sizeof (SpaIDMap),
static TypeMap default_type_map = {
{ sizeof (SpaTypeMap),
NULL,
id_map_get_id,
id_map_get_uri,
id_map_get_size,
type_map_get_id,
type_map_get_type,
type_map_get_size,
},
PINOS_MAP_INIT(128),
PINOS_ARRAY_INIT (4096)
};
SpaIDMap *
pinos_id_map_get_default (void)
SpaTypeMap *
pinos_type_map_get_default (void)
{
spa_id_map_set_default (&default_id_map.map);
return &default_id_map.map;
spa_type_map_set_default (&default_type_map.map);
return &default_type_map.map;
}

View file

@ -15,7 +15,7 @@ pinos_headers = [
'subscribe.h',
'thread-mainloop.h',
'transport.h',
'uri.h',
'type.h',
'utils.h',
]
@ -35,7 +35,7 @@ pinos_sources = [
'rtkit.c',
'thread-mainloop.c',
'transport.c',
'uri.c',
'type.c',
'utils.c',
]

View file

@ -35,7 +35,7 @@ extern "C" {
#include <pinos/client/subscribe.h>
#include <pinos/client/utils.h>
#include <spa/include/spa/id-map.h>
#include <spa/include/spa/type-map.h>
void pinos_init (int *argc, char **argv[]);
@ -51,7 +51,7 @@ void pinos_fill_stream_properties (PinosProperties *properties);
PinosDirection pinos_direction_reverse (PinosDirection direction);
SpaIDMap * pinos_id_map_get_default (void);
SpaTypeMap * pinos_type_map_get_default (void);
#ifdef __cplusplus
}

View file

@ -51,22 +51,22 @@ static void
core_update_map (PinosContext *context)
{
uint32_t diff, base, i;
const char **uris;
const char **types;
base = context->n_uris;
diff = spa_id_map_get_size (context->uri.map) - base;
base = context->n_types;
diff = spa_type_map_get_size (context->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 (context->uri.map, base);
types[i] = spa_type_map_get_type (context->type.map, base);
pinos_core_do_update_uris (context->core_proxy,
context->n_uris,
diff,
uris);
context->n_uris += diff;
pinos_core_do_update_types (context->core_proxy,
context->n_types,
diff,
types);
context->n_types += diff;
}
static void
@ -203,10 +203,10 @@ core_marshal_create_client_node (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)
{
PinosProxy *proxy = object;
PinosConnection *connection = proxy->context->protocol_private;
@ -217,11 +217,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);
@ -327,29 +327,29 @@ core_demarshal_remove_id (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)
{
PinosProxy *proxy = 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;
}
((PinosCoreEvents*)proxy->implementation)->update_uris (proxy, first_id, n_uris, uris);
((PinosCoreEvents*)proxy->implementation)->update_types (proxy, first_id, n_types, types);
return true;
}
@ -1009,7 +1009,7 @@ static const PinosCoreMethods pinos_protocol_native_client_core_methods = {
&core_marshal_get_registry,
&core_marshal_create_node,
&core_marshal_create_client_node,
&core_marshal_update_uris,
&core_marshal_update_types,
};
static const PinosDemarshalFunc pinos_protocol_native_client_core_demarshal[] = {
@ -1017,7 +1017,7 @@ static const PinosDemarshalFunc pinos_protocol_native_client_core_demarshal[] =
&core_demarshal_done,
&core_demarshal_error,
&core_demarshal_remove_id,
&core_demarshal_update_uris,
&core_demarshal_update_types,
};
static const PinosInterface pinos_protocol_native_client_core_interface = {
@ -1107,25 +1107,25 @@ pinos_protocol_native_client_setup (PinosProxy *proxy)
{
const PinosInterface *iface;
if (proxy->type == proxy->context->uri.core) {
if (proxy->type == proxy->context->type.core) {
iface = &pinos_protocol_native_client_core_interface;
}
else if (proxy->type == proxy->context->uri.registry) {
else if (proxy->type == proxy->context->type.registry) {
iface = &pinos_protocol_native_client_registry_interface;
}
else if (proxy->type == proxy->context->uri.module) {
else if (proxy->type == proxy->context->type.module) {
iface = &pinos_protocol_native_client_module_interface;
}
else if (proxy->type == proxy->context->uri.node) {
else if (proxy->type == proxy->context->type.node) {
iface = &pinos_protocol_native_client_node_interface;
}
else if (proxy->type == proxy->context->uri.client_node) {
else if (proxy->type == proxy->context->type.client_node) {
iface = &pinos_protocol_native_client_client_node_interface;
}
else if (proxy->type == proxy->context->uri.client) {
else if (proxy->type == proxy->context->type.client) {
iface = &pinos_protocol_native_client_client_interface;
}
else if (proxy->type == proxy->context->uri.link) {
else if (proxy->type == proxy->context->type.link) {
iface = &pinos_protocol_native_client_link_interface;
} else
return false;

View file

@ -388,7 +388,7 @@ add_request_clock_update (PinosStream *stream, bool flush)
{
PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this);
SpaEventNodeRequestClockUpdate rcu =
SPA_EVENT_NODE_REQUEST_CLOCK_UPDATE_INIT (stream->context->uri.event_node.RequestClockUpdate,
SPA_EVENT_NODE_REQUEST_CLOCK_UPDATE_INIT (stream->context->type.event_node.RequestClockUpdate,
SPA_EVENT_NODE_REQUEST_CLOCK_UPDATE_TIME, 0, 0);
pinos_client_node_do_event (impl->node_proxy, (SpaEvent*)&rcu);
@ -402,7 +402,7 @@ add_async_complete (PinosStream *stream,
{
PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this);
SpaEventNodeAsyncComplete ac =
SPA_EVENT_NODE_ASYNC_COMPLETE_INIT (stream->context->uri.event_node.AsyncComplete,
SPA_EVENT_NODE_ASYNC_COMPLETE_INIT (stream->context->type.event_node.AsyncComplete,
seq, res);
pinos_client_node_do_event (impl->node_proxy, (SpaEvent*)&ac);
}
@ -470,7 +470,7 @@ handle_rtnode_event (PinosStream *stream,
PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this);
PinosContext *context = impl->this.context;
if (SPA_EVENT_TYPE (event) == context->uri.event_node.HaveOutput) {
if (SPA_EVENT_TYPE (event) == context->type.event_node.HaveOutput) {
int i;
//pinos_log_debug ("stream %p: have output", stream);
@ -486,11 +486,11 @@ handle_rtnode_event (PinosStream *stream,
}
send_need_input (stream);
}
else if (SPA_EVENT_TYPE (event) == context->uri.event_node.NeedInput) {
else if (SPA_EVENT_TYPE (event) == context->type.event_node.NeedInput) {
//pinos_log_debug ("stream %p: need input", stream);
pinos_signal_emit (&stream->need_buffer, stream);
}
else if (SPA_EVENT_TYPE (event) == context->uri.event_node.ReuseBuffer) {
else if (SPA_EVENT_TYPE (event) == context->type.event_node.ReuseBuffer) {
SpaEventNodeReuseBuffer *p = (SpaEventNodeReuseBuffer *) event;
BufferId *bid;
@ -580,14 +580,14 @@ handle_node_command (PinosStream *stream,
PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this);
PinosContext *context = stream->context;
if (SPA_COMMAND_TYPE (command) == context->uri.command_node.Pause) {
if (SPA_COMMAND_TYPE (command) == context->type.command_node.Pause) {
pinos_log_debug ("stream %p: pause %d", stream, seq);
add_state_change (stream, SPA_NODE_STATE_PAUSED, false);
add_async_complete (stream, seq, SPA_RESULT_OK, true);
stream_set_state (stream, PINOS_STREAM_STATE_PAUSED, NULL);
}
else if (SPA_COMMAND_TYPE (command) == context->uri.command_node.Start) {
else if (SPA_COMMAND_TYPE (command) == context->type.command_node.Start) {
pinos_log_debug ("stream %p: start %d", stream, seq);
add_state_change (stream, SPA_NODE_STATE_STREAMING, false);
add_async_complete (stream, seq, SPA_RESULT_OK, true);
@ -597,7 +597,7 @@ handle_node_command (PinosStream *stream,
stream_set_state (stream, PINOS_STREAM_STATE_STREAMING, NULL);
}
else if (SPA_COMMAND_TYPE (command) == context->uri.command_node.ClockUpdate) {
else if (SPA_COMMAND_TYPE (command) == context->type.command_node.ClockUpdate) {
SpaCommandNodeClockUpdate *cu = (SpaCommandNodeClockUpdate *) command;
if (cu->body.flags.value & SPA_COMMAND_NODE_CLOCK_UPDATE_FLAG_LIVE) {
pinos_properties_set (stream->properties,
@ -955,7 +955,7 @@ pinos_stream_connect (PinosStream *stream,
impl->node_proxy = pinos_proxy_new (stream->context,
SPA_ID_INVALID,
stream->context->uri.client_node);
stream->context->type.client_node);
if (impl->node_proxy == NULL)
return false;
@ -1125,7 +1125,7 @@ pinos_stream_recycle_buffer (PinosStream *stream,
uint32_t id)
{
PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this);
SpaEventNodeReuseBuffer rb = SPA_EVENT_NODE_REUSE_BUFFER_INIT (stream->context->uri.event_node.ReuseBuffer,
SpaEventNodeReuseBuffer rb = SPA_EVENT_NODE_REUSE_BUFFER_INIT (stream->context->type.event_node.ReuseBuffer,
impl->port_id, id);
uint64_t cmd = 1;

58
pinos/client/type.c Normal file
View file

@ -0,0 +1,58 @@
/* Pinos
* Copyright (C) 2015 Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include <string.h>
#include "pinos/client/pinos.h"
#include "pinos/client/type.h"
#include "pinos/server/core.h"
#include "pinos/server/node.h"
#include "pinos/server/node-factory.h"
#include "pinos/server/client.h"
#include "pinos/server/client-node.h"
#include "pinos/server/module.h"
#include "spa/include/spa/monitor.h"
void
pinos_type_init (PinosType *type)
{
type->map = pinos_type_map_get_default();
type->core = spa_type_map_get_id (type->map, PINOS_TYPE__Core);
type->registry = spa_type_map_get_id (type->map, PINOS_TYPE__Registry);
type->node = spa_type_map_get_id (type->map, PINOS_TYPE__Node);
type->node_factory = spa_type_map_get_id (type->map, PINOS_TYPE__NodeFactory);
type->link = spa_type_map_get_id (type->map, PINOS_TYPE__Link);
type->client = spa_type_map_get_id (type->map, PINOS_TYPE__Client);
type->client_node = spa_type_map_get_id (type->map, PINOS_TYPE__ClientNode);
type->module = spa_type_map_get_id (type->map, PINOS_TYPE__Module);
type->spa_node = spa_type_map_get_id (type->map, SPA_TYPE__Node);
type->spa_clock = spa_type_map_get_id (type->map, SPA_TYPE__Clock);
type->spa_monitor = spa_type_map_get_id (type->map, SPA_TYPE__Monitor);
spa_type_event_node_map (type->map, &type->event_node);
spa_type_command_node_map (type->map, &type->command_node);
spa_type_monitor_map (type->map, &type->monitor);
spa_type_alloc_param_buffers_map (type->map, &type->alloc_param_buffers);
spa_type_alloc_param_meta_enable_map (type->map, &type->alloc_param_meta_enable);
spa_type_alloc_param_video_padding_map (type->map, &type->alloc_param_video_padding);
}

View file

@ -17,56 +17,55 @@
* Boston, MA 02110-1301, USA.
*/
#ifndef __PINOS_URI_H__
#define __PINOS_URI_H__
#ifndef __PINOS_TYPE_H__
#define __PINOS_TYPE_H__
#ifdef __cplusplus
extern "C" {
#endif
#define PINOS_TYPE__Uri "Pinos:Object:Uri"
#define PINOS_TYPE_URI_BASE PINOS_TYPE__Uri ":"
#include <pinos/client/map.h>
#include <spa/include/spa/id-map.h>
#include <spa/include/spa/node-event.h>
#include <spa/include/spa/type-map.h>
#include <spa/include/spa/event-node.h>
#include <spa/include/spa/command-node.h>
#include <spa/include/spa/monitor.h>
#include <spa/include/spa/alloc-param.h>
typedef struct _PinosURI PinosURI;
typedef struct _PinosType PinosType;
/**
* PinosURI:
* PinosType:
*
* Pinos URI support struct.
* Pinos Type support struct.
*/
struct _PinosURI {
SpaIDMap *map;
struct _PinosType {
SpaTypeMap *map;
uint32_t core;
uint32_t registry;
uint32_t node;
uint32_t node_factory;
uint32_t link;
uint32_t client;
uint32_t client_node;
uint32_t module;
SpaType core;
SpaType registry;
SpaType node;
SpaType node_factory;
SpaType link;
SpaType client;
SpaType client_node;
SpaType module;
uint32_t spa_node;
uint32_t spa_clock;
uint32_t spa_monitor;
SpaType spa_node;
SpaType spa_clock;
SpaType spa_monitor;
SpaEventNode event_node;
SpaCommandNode command_node;
SpaMonitorTypes monitor_types;
SpaAllocParamBuffers alloc_param_buffers;
SpaAllocParamMetaEnable alloc_param_meta_enable;
SpaAllocParamVideoPadding alloc_param_video_padding;
SpaTypeEventNode event_node;
SpaTypeCommandNode command_node;
SpaTypeMonitor monitor;
SpaTypeAllocParamBuffers alloc_param_buffers;
SpaTypeAllocParamMetaEnable alloc_param_meta_enable;
SpaTypeAllocParamVideoPadding alloc_param_video_padding;
};
void pinos_uri_init (PinosURI *uri);
void pinos_type_init (PinosType *type);
#ifdef __cplusplus
}
#endif
#endif /* __PINOS_URI_H__ */
#endif /* __PINOS_TYPE_H__ */

View file

@ -1,58 +0,0 @@
/* Pinos
* Copyright (C) 2015 Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include <string.h>
#include "pinos/client/pinos.h"
#include "pinos/client/uri.h"
#include "pinos/server/core.h"
#include "pinos/server/node.h"
#include "pinos/server/node-factory.h"
#include "pinos/server/client.h"
#include "pinos/server/client-node.h"
#include "pinos/server/module.h"
#include "spa/include/spa/monitor.h"
void
pinos_uri_init (PinosURI *uri)
{
uri->map = pinos_id_map_get_default();
uri->core = spa_id_map_get_id (uri->map, PINOS_TYPE__Core);
uri->registry = spa_id_map_get_id (uri->map, PINOS_TYPE__Registry);
uri->node = spa_id_map_get_id (uri->map, PINOS_TYPE__Node);
uri->node_factory = spa_id_map_get_id (uri->map, PINOS_TYPE__NodeFactory);
uri->link = spa_id_map_get_id (uri->map, PINOS_TYPE__Link);
uri->client = spa_id_map_get_id (uri->map, PINOS_TYPE__Client);
uri->client_node = spa_id_map_get_id (uri->map, PINOS_TYPE__ClientNode);
uri->module = spa_id_map_get_id (uri->map, PINOS_TYPE__Module);
uri->spa_node = spa_id_map_get_id (uri->map, SPA_TYPE__Node);
uri->spa_clock = spa_id_map_get_id (uri->map, SPA_TYPE__Clock);
uri->spa_monitor = spa_id_map_get_id (uri->map, SPA_TYPE__Monitor);
spa_event_node_map (uri->map, &uri->event_node);
spa_command_node_map (uri->map, &uri->command_node);
spa_monitor_types_map (uri->map, &uri->monitor_types);
spa_alloc_param_buffers_map (uri->map, &uri->alloc_param_buffers);
spa_alloc_param_meta_enable_map (uri->map, &uri->alloc_param_meta_enable);
spa_alloc_param_video_padding_map (uri->map, &uri->alloc_param_video_padding);
}

View file

@ -284,7 +284,7 @@ on_context_subscription (PinosListener *listener,
GstDeviceProvider *provider = GST_DEVICE_PROVIDER (self);
GstPinosDevice *dev;
if (type != context->uri.node)
if (type != context->type.node)
return;
dev = find_device (provider, id);

View file

@ -37,121 +37,123 @@ typedef struct {
uint32_t *media_subtype;
} MediaType;
static uint32_t format_type;
static SpaMediaTypes media_types = { 0, };
static SpaMediaSubtypes media_subtypes = { 0, };
static SpaMediaSubtypesVideo media_subtypes_video = { 0, };
static SpaMediaSubtypesAudio media_subtypes_audio = { 0, };
static SpaPropVideo prop_video = { 0, };
static SpaPropAudio prop_audio = { 0, };
static SpaVideoFormats video_formats = { 0, };
static SpaAudioFormats audio_formats = { 0, };
static struct {
uint32_t format;
SpaTypeMediaType media_type;
SpaTypeMediaSubtype media_subtype;
SpaTypeMediaSubtypeVideo media_subtype_video;
SpaTypeMediaSubtypeAudio media_subtype_audio;
SpaTypePropVideo prop_video;
SpaTypePropAudio prop_audio;
SpaTypeVideoFormat video_format;
SpaTypeAudioFormat audio_format;
} type = { 0, };
static void
ensure_types (void)
{
SpaIDMap *map = spa_id_map_get_default ();
SpaTypeMap *map = spa_type_map_get_default ();
format_type = spa_id_map_get_id (map, SPA_TYPE__Format);
spa_media_types_fill (&media_types, map);
spa_media_subtypes_map (map, &media_subtypes);
spa_media_subtypes_video_map (map, &media_subtypes_video);
spa_media_subtypes_audio_map (map, &media_subtypes_audio);
spa_prop_video_map (map, &prop_video);
spa_prop_audio_map (map, &prop_audio);
spa_video_formats_map (map, &video_formats);
spa_audio_formats_map (map, &audio_formats);
type.format = spa_type_map_get_id (map, SPA_TYPE__Format);
spa_type_media_type_map (map, &type.media_type);
spa_type_media_subtype_map (map, &type.media_subtype);
spa_type_media_subtype_video_map (map, &type.media_subtype_video);
spa_type_media_subtype_audio_map (map, &type.media_subtype_audio);
spa_type_prop_video_map (map, &type.prop_video);
spa_type_prop_audio_map (map, &type.prop_audio);
spa_type_video_format_map (map, &type.video_format);
spa_type_audio_format_map (map, &type.audio_format);
}
static const MediaType media_type_map[] = {
{ "video/x-raw", &media_types.video, &media_subtypes.raw },
{ "audio/x-raw", &media_types.audio, &media_subtypes.raw },
{ "image/jpeg", &media_types.video, &media_subtypes_video.mjpg },
{ "video/x-h264", &media_types.video, &media_subtypes_video.h264 },
{ "video/x-raw", &type.media_type.video, &type.media_subtype.raw },
{ "audio/x-raw", &type.media_type.audio, &type.media_subtype.raw },
{ "image/jpeg", &type.media_type.video, &type.media_subtype_video.mjpg },
{ "video/x-h264", &type.media_type.video, &type.media_subtype_video.h264 },
{ NULL, }
};
static const uint32_t *video_format_map[] = {
&video_formats.UNKNOWN,
&video_formats.ENCODED,
&video_formats.I420,
&video_formats.YV12,
&video_formats.YUY2,
&video_formats.UYVY,
&video_formats.AYUV,
&video_formats.RGBx,
&video_formats.BGRx,
&video_formats.xRGB,
&video_formats.xBGR,
&video_formats.RGBA,
&video_formats.BGRA,
&video_formats.ARGB,
&video_formats.ABGR,
&video_formats.RGB,
&video_formats.BGR,
&video_formats.Y41B,
&video_formats.Y42B,
&video_formats.YVYU,
&video_formats.Y444,
&video_formats.v210,
&video_formats.v216,
&video_formats.NV12,
&video_formats.NV21,
&video_formats.GRAY8,
&video_formats.GRAY16_BE,
&video_formats.GRAY16_LE,
&video_formats.v308,
&video_formats.RGB16,
&video_formats.BGR16,
&video_formats.RGB15,
&video_formats.BGR15,
&video_formats.UYVP,
&video_formats.A420,
&video_formats.RGB8P,
&video_formats.YUV9,
&video_formats.YVU9,
&video_formats.IYU1,
&video_formats.ARGB64,
&video_formats.AYUV64,
&video_formats.r210,
&video_formats.I420_10BE,
&video_formats.I420_10LE,
&video_formats.I422_10BE,
&video_formats.I422_10LE,
&video_formats.Y444_10BE,
&video_formats.Y444_10LE,
&video_formats.GBR,
&video_formats.GBR_10BE,
&video_formats.GBR_10LE,
&video_formats.NV16,
&video_formats.NV24,
&video_formats.NV12_64Z32,
&video_formats.A420_10BE,
&video_formats.A420_10LE,
&video_formats.A422_10BE,
&video_formats.A422_10LE,
&video_formats.A444_10BE,
&video_formats.A444_10LE,
&video_formats.NV61,
&video_formats.P010_10BE,
&video_formats.P010_10LE,
&video_formats.IYU2,
&video_formats.VYUY,
&type.video_format.UNKNOWN,
&type.video_format.ENCODED,
&type.video_format.I420,
&type.video_format.YV12,
&type.video_format.YUY2,
&type.video_format.UYVY,
&type.video_format.AYUV,
&type.video_format.RGBx,
&type.video_format.BGRx,
&type.video_format.xRGB,
&type.video_format.xBGR,
&type.video_format.RGBA,
&type.video_format.BGRA,
&type.video_format.ARGB,
&type.video_format.ABGR,
&type.video_format.RGB,
&type.video_format.BGR,
&type.video_format.Y41B,
&type.video_format.Y42B,
&type.video_format.YVYU,
&type.video_format.Y444,
&type.video_format.v210,
&type.video_format.v216,
&type.video_format.NV12,
&type.video_format.NV21,
&type.video_format.GRAY8,
&type.video_format.GRAY16_BE,
&type.video_format.GRAY16_LE,
&type.video_format.v308,
&type.video_format.RGB16,
&type.video_format.BGR16,
&type.video_format.RGB15,
&type.video_format.BGR15,
&type.video_format.UYVP,
&type.video_format.A420,
&type.video_format.RGB8P,
&type.video_format.YUV9,
&type.video_format.YVU9,
&type.video_format.IYU1,
&type.video_format.ARGB64,
&type.video_format.AYUV64,
&type.video_format.r210,
&type.video_format.I420_10BE,
&type.video_format.I420_10LE,
&type.video_format.I422_10BE,
&type.video_format.I422_10LE,
&type.video_format.Y444_10BE,
&type.video_format.Y444_10LE,
&type.video_format.GBR,
&type.video_format.GBR_10BE,
&type.video_format.GBR_10LE,
&type.video_format.NV16,
&type.video_format.NV24,
&type.video_format.NV12_64Z32,
&type.video_format.A420_10BE,
&type.video_format.A420_10LE,
&type.video_format.A422_10BE,
&type.video_format.A422_10LE,
&type.video_format.A444_10BE,
&type.video_format.A444_10LE,
&type.video_format.NV61,
&type.video_format.P010_10BE,
&type.video_format.P010_10LE,
&type.video_format.IYU2,
&type.video_format.VYUY,
};
#if __BYTE_ORDER == __BIG_ENDIAN
#define _FORMAT_LE(fmt) &audio_formats. fmt ## _OE
#define _FORMAT_BE(fmt) &audio_formats. fmt
#define _FORMAT_LE(fmt) &type.audio_format. fmt ## _OE
#define _FORMAT_BE(fmt) &type.audio_format. fmt
#elif __BYTE_ORDER == __LITTLE_ENDIAN
#define _FORMAT_LE(fmt) &audio_formats. fmt
#define _FORMAT_BE(fmt) &audio_formats. fmt ## _OE
#define _FORMAT_LE(fmt) &type.audio_format. fmt
#define _FORMAT_BE(fmt) &type.audio_format. fmt ## _OE
#endif
static const uint32_t *audio_format_map[] = {
&audio_formats.UNKNOWN,
&audio_formats.ENCODED,
&audio_formats.S8,
&audio_formats.U8,
&type.audio_format.UNKNOWN,
&type.audio_format.ENCODED,
&type.audio_format.S8,
&type.audio_format.U8,
_FORMAT_LE (S16),
_FORMAT_BE (S16),
_FORMAT_LE (U16),
@ -367,7 +369,7 @@ handle_video_fields (ConvertData *d)
for (i = 0; (v = get_nth_string (value, i)); i++) {
if (i == 0)
spa_pod_builder_push_prop (&d->b, &f,
prop_video.format,
type.prop_video.format,
get_range_type (value) | SPA_POD_PROP_FLAG_READWRITE);
spa_pod_builder_uri (&d->b, *video_format_map[gst_video_format_from_string (v)]);
@ -383,7 +385,7 @@ handle_video_fields (ConvertData *d)
for (i = 0; get_nth_rectangle (value, value2, i, &v); i++) {
if (i == 0)
spa_pod_builder_push_prop (&d->b, &f,
prop_video.size,
type.prop_video.size,
get_range_type2 (value, value2) | SPA_POD_PROP_FLAG_READWRITE);
spa_pod_builder_rectangle (&d->b, v.width, v.height);
@ -399,7 +401,7 @@ handle_video_fields (ConvertData *d)
for (i = 0; get_nth_fraction (value, i, &v); i++) {
if (i == 0)
spa_pod_builder_push_prop (&d->b, &f,
prop_video.framerate,
type.prop_video.framerate,
get_range_type (value) | SPA_POD_PROP_FLAG_READWRITE);
spa_pod_builder_fraction (&d->b, v.num, v.denom);
@ -424,7 +426,7 @@ handle_audio_fields (ConvertData *d)
for (i = 0; (v = get_nth_string (value, i)); i++) {
if (i == 0)
spa_pod_builder_push_prop (&d->b, &f,
prop_audio.format,
type.prop_audio.format,
get_range_type (value) | SPA_POD_PROP_FLAG_READWRITE);
spa_pod_builder_uri (&d->b, *audio_format_map[gst_audio_format_from_string (v)]);
@ -449,7 +451,7 @@ handle_audio_fields (ConvertData *d)
if (i == 0)
spa_pod_builder_push_prop (&d->b, &f,
prop_audio.layout,
type.prop_audio.layout,
get_range_type (value) | SPA_POD_PROP_FLAG_READWRITE);
spa_pod_builder_int (&d->b, layout);
@ -464,7 +466,7 @@ handle_audio_fields (ConvertData *d)
for (i = 0; get_nth_int (value, i, &v); i++) {
if (i == 0)
spa_pod_builder_push_prop (&d->b, &f,
prop_audio.rate,
type.prop_audio.rate,
get_range_type (value) | SPA_POD_PROP_FLAG_READWRITE);
spa_pod_builder_int (&d->b, v);
@ -479,7 +481,7 @@ handle_audio_fields (ConvertData *d)
for (i = 0; get_nth_int (value, i, &v); i++) {
if (i == 0)
spa_pod_builder_push_prop (&d->b, &f,
prop_audio.channels,
type.prop_audio.channels,
get_range_type (value) | SPA_POD_PROP_FLAG_READWRITE);
spa_pod_builder_int (&d->b, v);
@ -520,13 +522,13 @@ convert_1 (GstCapsFeatures *cf, GstStructure *cs)
d.b.write = write_pod;
spa_pod_builder_push_format (&d.b, &f, format_type,
spa_pod_builder_push_format (&d.b, &f, type.format,
*d.type->media_type,
*d.type->media_subtype);
if (*d.type->media_type == media_types.video)
if (*d.type->media_type == type.media_type.video)
handle_video_fields (&d);
else if (*d.type->media_type == media_types.audio)
else if (*d.type->media_type == type.media_type.audio)
handle_audio_fields (&d);
spa_pod_builder_pop (&d.b, &f);
@ -592,14 +594,14 @@ gst_caps_from_format (const SpaFormat *format)
media_type = format->body.media_type.value;
media_subtype = format->body.media_subtype.value;
if (media_type == media_types.video) {
if (media_type == type.media_type.video) {
SpaVideoInfo f;
if (spa_format_video_parse (format, &f) < 0)
return NULL;
if (media_subtype == media_subtypes.raw) {
const char * str = spa_id_map_get_uri (spa_id_map_get_default (), f.info.raw.format);
if (media_subtype == type.media_subtype.raw) {
const char * str = spa_type_map_get_type (spa_type_map_get_default (), f.info.raw.format);
res = gst_caps_new_simple ("video/x-raw",
"format", G_TYPE_STRING, rindex (str, ':') + 1,
@ -608,14 +610,14 @@ gst_caps_from_format (const SpaFormat *format)
"framerate", GST_TYPE_FRACTION, f.info.raw.framerate.num, f.info.raw.framerate.denom,
NULL);
}
else if (media_subtype == media_subtypes_video.mjpg) {
else if (media_subtype == type.media_subtype_video.mjpg) {
res = gst_caps_new_simple ("image/jpeg",
"width", G_TYPE_INT, f.info.mjpg.size.width,
"height", G_TYPE_INT, f.info.mjpg.size.height,
"framerate", GST_TYPE_FRACTION, f.info.mjpg.framerate.num, f.info.mjpg.framerate.denom,
NULL);
}
else if (media_subtype == media_subtypes_video.h264) {
else if (media_subtype == type.media_subtype_video.h264) {
res = gst_caps_new_simple ("video/x-h264",
"width", G_TYPE_INT, f.info.h264.size.width,
"height", G_TYPE_INT, f.info.h264.size.height,
@ -624,14 +626,14 @@ gst_caps_from_format (const SpaFormat *format)
"alignment", G_TYPE_STRING, "au",
NULL);
}
} else if (media_type == media_types.audio) {
} else if (media_type == type.media_type.audio) {
SpaAudioInfo f;
if (spa_format_audio_parse (format, &f) < 0)
return NULL;
if (media_subtype == media_subtypes.raw) {
const char * str = spa_id_map_get_uri (spa_id_map_get_default (), f.info.raw.format);
if (media_subtype == type.media_subtype.raw) {
const char * str = spa_type_map_get_type (spa_type_map_get_default (), f.info.raw.format);
res = gst_caps_new_simple ("audio/x-raw",
"format", G_TYPE_STRING, rindex (str, ':') + 1,

View file

@ -134,25 +134,25 @@ do_start (GstBufferPool * pool)
gst_buffer_pool_config_get_params (config, &caps, &size, &min_buffers, &max_buffers);
spa_pod_builder_init (&b, buffer, sizeof (buffer));
spa_pod_builder_object (&b, &f[0], 0, ctx->uri.alloc_param_buffers.Buffers,
PROP (&f[1], ctx->uri.alloc_param_buffers.size, SPA_POD_TYPE_INT, size),
PROP (&f[1], ctx->uri.alloc_param_buffers.stride, SPA_POD_TYPE_INT, 0),
PROP_MM (&f[1], ctx->uri.alloc_param_buffers.buffers, SPA_POD_TYPE_INT, min_buffers, min_buffers, max_buffers),
PROP (&f[1], ctx->uri.alloc_param_buffers.align, SPA_POD_TYPE_INT, 16));
spa_pod_builder_object (&b, &f[0], 0, ctx->type.alloc_param_buffers.Buffers,
PROP (&f[1], ctx->type.alloc_param_buffers.size, SPA_POD_TYPE_INT, size),
PROP (&f[1], ctx->type.alloc_param_buffers.stride, SPA_POD_TYPE_INT, 0),
PROP_MM (&f[1], ctx->type.alloc_param_buffers.buffers, SPA_POD_TYPE_INT, min_buffers, min_buffers, max_buffers),
PROP (&f[1], ctx->type.alloc_param_buffers.align, SPA_POD_TYPE_INT, 16));
port_params[0] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
spa_pod_builder_object (&b, &f[0], 0, ctx->uri.alloc_param_meta_enable.MetaEnable,
PROP (&f[1], ctx->uri.alloc_param_meta_enable.type, SPA_POD_TYPE_INT, SPA_META_TYPE_HEADER));
spa_pod_builder_object (&b, &f[0], 0, ctx->type.alloc_param_meta_enable.MetaEnable,
PROP (&f[1], ctx->type.alloc_param_meta_enable.type, SPA_POD_TYPE_INT, SPA_META_TYPE_HEADER));
port_params[1] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
spa_pod_builder_object (&b, &f[0], 0, ctx->uri.alloc_param_meta_enable.MetaEnable,
PROP (&f[1], ctx->uri.alloc_param_meta_enable.type, SPA_POD_TYPE_INT, SPA_META_TYPE_RINGBUFFER),
PROP (&f[1], ctx->uri.alloc_param_meta_enable.ringbufferSize, SPA_POD_TYPE_INT,
spa_pod_builder_object (&b, &f[0], 0, ctx->type.alloc_param_meta_enable.MetaEnable,
PROP (&f[1], ctx->type.alloc_param_meta_enable.type, SPA_POD_TYPE_INT, SPA_META_TYPE_RINGBUFFER),
PROP (&f[1], ctx->type.alloc_param_meta_enable.ringbufferSize, SPA_POD_TYPE_INT,
size * SPA_MAX (4,
SPA_MAX (min_buffers, max_buffers))),
PROP (&f[1], ctx->uri.alloc_param_meta_enable.ringbufferStride, SPA_POD_TYPE_INT, 0),
PROP (&f[1], ctx->uri.alloc_param_meta_enable.ringbufferBlocks, SPA_POD_TYPE_INT, 1),
PROP (&f[1], ctx->uri.alloc_param_meta_enable.ringbufferAlign, SPA_POD_TYPE_INT, 16));
PROP (&f[1], ctx->type.alloc_param_meta_enable.ringbufferStride, SPA_POD_TYPE_INT, 0),
PROP (&f[1], ctx->type.alloc_param_meta_enable.ringbufferBlocks, SPA_POD_TYPE_INT, 1),
PROP (&f[1], ctx->type.alloc_param_meta_enable.ringbufferAlign, SPA_POD_TYPE_INT, 16));
port_params[2] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
pinos_stream_finish_format (p->stream, SPA_RESULT_OK, port_params, 2);

View file

@ -789,8 +789,8 @@ on_format_changed (PinosListener *listener,
SpaPODFrame f[2];
spa_pod_builder_init (&b, buffer, sizeof (buffer));
spa_pod_builder_object (&b, &f[0], 0, ctx->uri.alloc_param_meta_enable.MetaEnable,
PROP (&f[1], ctx->uri.alloc_param_meta_enable.type, SPA_POD_TYPE_INT, SPA_META_TYPE_HEADER));
spa_pod_builder_object (&b, &f[0], 0, ctx->type.alloc_param_meta_enable.MetaEnable,
PROP (&f[1], ctx->type.alloc_param_meta_enable.type, SPA_POD_TYPE_INT, SPA_META_TYPE_HEADER));
params[0] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
GST_DEBUG_OBJECT (pinossrc, "doing finish format");

View file

@ -64,7 +64,7 @@ do_check_send (PinosListener *listener,
PinosClient *client = data->client;
PinosCore *core = client->core;
if (data->resource->type == core->uri.registry) {
if (data->resource->type == core->type.registry) {
#if 0
switch (data->opcode) {
case 0:
@ -107,7 +107,7 @@ do_check_dispatch (PinosListener *listener,
PinosClient *client = data->client;
PinosCore *core = client->core;
if (data->resource->type == core->uri.registry) {
if (data->resource->type == core->type.registry) {
#if 0
if (data->opcode == 0) {
PinosMessageBind *m = data->message;

View file

@ -307,7 +307,7 @@ on_resource_added (PinosListener *listener,
ClientInfo *cinfo = SPA_CONTAINER_OF (listener, ClientInfo, resource_added);
ModuleImpl *impl = cinfo->impl;
if (resource->type == impl->core->uri.client_node) {
if (resource->type == impl->core->type.client_node) {
PinosClientNode *cnode = resource->object;
on_node_added (impl, cnode->node, resource, cinfo);
}
@ -321,7 +321,7 @@ on_resource_removed (PinosListener *listener,
ClientInfo *cinfo = SPA_CONTAINER_OF (listener, ClientInfo, resource_removed);
ModuleImpl *impl = cinfo->impl;
if (resource->type == impl->core->uri.client_node) {
if (resource->type == impl->core->type.client_node) {
PinosClientNode *cnode = resource->object;
NodeInfo *ninfo;
@ -339,7 +339,7 @@ on_global_added (PinosListener *listener,
{
ModuleImpl *impl = SPA_CONTAINER_OF (listener, ModuleImpl, global_added);
if (global->type == impl->core->uri.client) {
if (global->type == impl->core->type.client) {
PinosClient *client = global->object;
ClientInfo *cinfo;
@ -362,7 +362,7 @@ on_global_removed (PinosListener *listener,
{
ModuleImpl *impl = SPA_CONTAINER_OF (listener, ModuleImpl, global_removed);
if (global->type == impl->core->uri.client) {
if (global->type == impl->core->type.client) {
PinosClient *client = global->object;
ClientInfo *cinfo;

View file

@ -330,7 +330,7 @@ handle_create_node (PinosDaemon1 *interface,
pinos_resource_new (client,
SPA_ID_INVALID,
impl->core->uri.node,
impl->core->type.node,
node,
(PinosDestroy) pinos_node_destroy);
@ -519,7 +519,7 @@ on_global_added (PinosListener *listener,
PinosProtocolDBus *impl = SPA_CONTAINER_OF (listener, PinosProtocolDBus, global_added);
PinosObjectSkeleton *skel;
if (global->type == impl->core->uri.client) {
if (global->type == impl->core->type.client) {
PinosClient1 *iface;
PinosClient *client = global->object;
PinosProperties *props = client->properties;
@ -541,7 +541,7 @@ on_global_added (PinosListener *listener,
false,
(PinosDestroy) client_destroy);
} else if (global->type == impl->core->uri.node) {
} else if (global->type == impl->core->type.node) {
PinosNode1 *iface;
PinosNode *node = global->object;
PinosProperties *props = node->properties;
@ -610,7 +610,7 @@ on_global_added (PinosListener *listener,
name_lost_handler,
proto,
NULL);
} else if (global->type == impl->core->uri.link) {
} else if (global->type == impl->core->type.link) {
PinosLink1 *iface;
PinosLink *link = global->object;
PinosProtocolDBusObject *obj;

View file

@ -131,7 +131,7 @@ on_global_added (PinosListener *listener,
{
ModuleImpl *impl = SPA_CONTAINER_OF (listener, ModuleImpl, global_added);
if (global->type == impl->core->uri.node) {
if (global->type == impl->core->type.node) {
PinosNode *node = global->object;
NodeInfo *info;
@ -153,7 +153,7 @@ on_global_removed (PinosListener *listener,
{
ModuleImpl *impl = SPA_CONTAINER_OF (listener, ModuleImpl, global_removed);
if (global->type == impl->core->uri.node) {
if (global->type == impl->core->type.node) {
PinosNode *node = global->object;
NodeInfo *info;

View file

@ -35,14 +35,14 @@ setup_video_node (PinosCore *core, SpaNode *spa_node, PinosProperties *pinos_pro
SpaResult res;
SpaProps *props;
SpaPODProp *prop;
const char *pattern, *pattern_uri;
const char *pattern, *pattern_type;
/* Retrieve pattern property */
pattern = pinos_properties_get (pinos_props, "pattern");
if (strcmp (pattern, "smpte-snow") == 0) {
pattern_uri = SPA_TYPE_PROPS__patternType ":smpte-snow";
pattern_type = SPA_TYPE_PROPS__patternType ":smpte-snow";
} else if (strcmp (pattern, "snow") == 0) {
pattern_uri = SPA_TYPE_PROPS__patternType ":snow";
pattern_type = SPA_TYPE_PROPS__patternType ":snow";
} else {
pinos_log_debug ("Unrecognized pattern");
return SPA_RESULT_ERROR;
@ -53,9 +53,9 @@ setup_video_node (PinosCore *core, SpaNode *spa_node, PinosProperties *pinos_pro
return SPA_RESULT_ERROR;
}
if ((prop = spa_pod_object_find_prop (props, spa_id_map_get_id (core->uri.map, SPA_TYPE_PROPS__patternType)))) {
if ((prop = spa_pod_object_find_prop (props, spa_type_map_get_id (core->type.map, SPA_TYPE_PROPS__patternType)))) {
if (prop->body.value.type == SPA_POD_TYPE_URI)
SPA_POD_VALUE (SpaPODURI, &prop->body.value) = spa_id_map_get_id (core->uri.map, pattern_uri);
SPA_POD_VALUE (SpaPODURI, &prop->body.value) = spa_type_map_get_id (core->type.map, pattern_type);
}
if ((res = spa_node_set_props (spa_node, props)) != SPA_RESULT_OK) {

View file

@ -67,11 +67,11 @@ add_item (PinosSpaMonitor *this, SpaMonitorItem *item)
SpaPOD *info = NULL;
spa_pod_object_query (item,
impl->core->uri.monitor_types.name, SPA_POD_TYPE_STRING, &name,
impl->core->uri.monitor_types.id, SPA_POD_TYPE_STRING, &id,
impl->core->uri.monitor_types.klass, SPA_POD_TYPE_STRING, &klass,
impl->core->uri.monitor_types.factory, SPA_POD_TYPE_POINTER, &factory,
impl->core->uri.monitor_types.info, SPA_POD_TYPE_STRUCT, &info,
impl->core->type.monitor.name, SPA_POD_TYPE_STRING, &name,
impl->core->type.monitor.id, SPA_POD_TYPE_STRING, &id,
impl->core->type.monitor.klass, SPA_POD_TYPE_STRING, &klass,
impl->core->type.monitor.factory, SPA_POD_TYPE_POINTER, &factory,
impl->core->type.monitor.info, SPA_POD_TYPE_STRUCT, &info,
0);
pinos_log_debug ("monitor %p: add: \"%s\" (%s)", this, name, id);
@ -85,11 +85,11 @@ add_item (PinosSpaMonitor *this, SpaMonitorItem *item)
pinos_log_error ("can't make factory instance: %d", res);
return;
}
if ((res = spa_handle_get_interface (handle, impl->core->uri.spa_node, &node_iface)) < 0) {
if ((res = spa_handle_get_interface (handle, impl->core->type.spa_node, &node_iface)) < 0) {
pinos_log_error ("can't get NODE interface: %d", res);
return;
}
if ((res = spa_handle_get_interface (handle, impl->core->uri.spa_clock, &clock_iface)) < 0) {
if ((res = spa_handle_get_interface (handle, impl->core->type.spa_clock, &clock_iface)) < 0) {
pinos_log_info ("no CLOCK interface: %d", res);
}
@ -151,8 +151,8 @@ remove_item (PinosSpaMonitor *this, SpaMonitorItem *item)
const char *name, *id;
spa_pod_object_query (item,
impl->core->uri.monitor_types.name, SPA_POD_TYPE_STRING, &name,
impl->core->uri.monitor_types.id, SPA_POD_TYPE_STRING, &id,
impl->core->type.monitor.name, SPA_POD_TYPE_STRING, &name,
impl->core->type.monitor.id, SPA_POD_TYPE_STRING, &id,
0);
pinos_log_debug ("monitor %p: remove: \"%s\" (%s)", this, name, id);
@ -169,20 +169,20 @@ on_monitor_event (SpaMonitor *monitor,
PinosSpaMonitor *this = user_data;
PinosSpaMonitorImpl *impl = SPA_CONTAINER_OF (this, PinosSpaMonitorImpl, this);
if (SPA_EVENT_TYPE (event) == impl->core->uri.monitor_types.Added) {
if (SPA_EVENT_TYPE (event) == impl->core->type.monitor.Added) {
SpaMonitorItem *item = SPA_POD_CONTENTS (SpaEvent, event);
add_item (this, item);
}
else if (SPA_EVENT_TYPE (event) == impl->core->uri.monitor_types.Removed) {
else if (SPA_EVENT_TYPE (event) == impl->core->type.monitor.Removed) {
SpaMonitorItem *item = SPA_POD_CONTENTS (SpaEvent, event);
remove_item (this, item);
}
else if (SPA_EVENT_TYPE (event) == impl->core->uri.monitor_types.Changed) {
else if (SPA_EVENT_TYPE (event) == impl->core->type.monitor.Changed) {
SpaMonitorItem *item = SPA_POD_CONTENTS (SpaEvent, event);
const char *name;
spa_pod_object_query (item,
impl->core->uri.monitor_types.name, SPA_POD_TYPE_STRING, &name,
impl->core->type.monitor.name, SPA_POD_TYPE_STRING, &name,
0);
pinos_log_debug ("monitor %p: changed: \"%s\"", this, name);
@ -253,7 +253,7 @@ pinos_spa_monitor_load (PinosCore *core,
goto init_failed;
}
if ((res = spa_handle_get_interface (handle,
core->uri.spa_monitor,
core->type.spa_monitor,
&iface)) < 0) {
free (handle);
pinos_log_error ("can't get MONITOR interface: %d", res);

View file

@ -81,7 +81,7 @@ pinos_spa_node_load (PinosCore *core,
goto init_failed;
}
if ((res = spa_handle_get_interface (handle,
core->uri.spa_node,
core->type.spa_node,
&iface)) < 0) {
pinos_log_error ("can't get interface %d", res);
goto interface_failed;
@ -89,7 +89,7 @@ pinos_spa_node_load (PinosCore *core,
spa_node = iface;
if ((res = spa_handle_get_interface (handle,
core->uri.spa_clock,
core->type.spa_clock,
&iface)) < 0) {
iface = NULL;
}

View file

@ -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)

View file

@ -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);

View file

@ -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,

View file

@ -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;
}

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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,

View file

@ -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;

View file

@ -187,26 +187,26 @@ dump_object (PinosContext *context,
uint32_t id,
DumpData *data)
{
if (type == context->uri.core) {
if (type == context->type.core) {
pinos_context_get_core_info (context,
dump_core_info,
data);
} else if (type == context->uri.node) {
} else if (type == context->type.node) {
pinos_context_get_node_info_by_id (context,
id,
dump_node_info,
data);
} else if (type == context->uri.module) {
} else if (type == context->type.module) {
pinos_context_get_module_info_by_id (context,
id,
dump_module_info,
data);
} else if (type == context->uri.client) {
} else if (type == context->type.client) {
pinos_context_get_client_info_by_id (context,
id,
dump_client_info,
data);
} else if (type == context->uri.link) {
} else if (type == context->type.link) {
pinos_context_get_link_info_by_id (context,
id,
dump_link_info,