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