2017-03-02 16:06:45 +01:00
|
|
|
/* Simple Plugin API
|
|
|
|
|
* Copyright (C) 2016 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.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef __PINOS_INTERFACES_H__
|
|
|
|
|
#define __PINOS_INTERFACES_H__
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <spa/defs.h>
|
|
|
|
|
#include <spa/props.h>
|
|
|
|
|
#include <spa/format.h>
|
|
|
|
|
#include <spa/port.h>
|
|
|
|
|
#include <spa/node.h>
|
|
|
|
|
|
|
|
|
|
typedef struct _PinosClientNodeBuffer PinosClientNodeBuffer;
|
2017-03-09 13:00:56 +01:00
|
|
|
typedef struct _PinosInterface PinosInterface;
|
2017-03-02 16:06:45 +01:00
|
|
|
|
|
|
|
|
#include <pinos/client/introspect.h>
|
|
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
struct _PinosInterface {
|
|
|
|
|
uint32_t n_methods;
|
|
|
|
|
const void *methods;
|
|
|
|
|
uint32_t n_events;
|
|
|
|
|
const void *events;
|
|
|
|
|
};
|
|
|
|
|
|
2017-03-02 16:06:45 +01:00
|
|
|
typedef struct {
|
|
|
|
|
void (*client_update) (void *object,
|
|
|
|
|
const SpaDict *props);
|
|
|
|
|
void (*sync) (void *object,
|
|
|
|
|
uint32_t seq);
|
|
|
|
|
void (*get_registry) (void *object,
|
|
|
|
|
uint32_t new_id);
|
|
|
|
|
void (*create_node) (void *object,
|
|
|
|
|
const char *factory_name,
|
|
|
|
|
const char *name,
|
|
|
|
|
const SpaDict *props,
|
|
|
|
|
uint32_t new_id);
|
|
|
|
|
void (*create_client_node) (void *object,
|
|
|
|
|
const char *name,
|
|
|
|
|
const SpaDict *props,
|
|
|
|
|
uint32_t new_id);
|
2017-03-14 20:18:31 +01:00
|
|
|
void (*update_uris) (void *object,
|
|
|
|
|
uint32_t first_id,
|
|
|
|
|
uint32_t n_uris,
|
|
|
|
|
const char **uris);
|
2017-03-09 13:00:56 +01:00
|
|
|
} PinosCoreMethods;
|
2017-03-02 16:06:45 +01:00
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
#define pinos_core_do_client_update(r,...) ((PinosCoreMethods*)r->iface->methods)->client_update(r,__VA_ARGS__)
|
|
|
|
|
#define pinos_core_do_sync(r,...) ((PinosCoreMethods*)r->iface->methods)->sync(r,__VA_ARGS__)
|
|
|
|
|
#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__)
|
2017-03-14 20:18:31 +01:00
|
|
|
#define pinos_core_do_update_uris(r,...) ((PinosCoreMethods*)r->iface->methods)->update_uris(r,__VA_ARGS__)
|
2017-03-03 17:43:23 +01:00
|
|
|
|
2017-03-02 16:06:45 +01:00
|
|
|
typedef struct {
|
|
|
|
|
void (*info) (void *object,
|
|
|
|
|
PinosCoreInfo *info);
|
|
|
|
|
void (*done) (void *object,
|
|
|
|
|
uint32_t seq);
|
|
|
|
|
void (*error) (void *object,
|
|
|
|
|
uint32_t id,
|
|
|
|
|
SpaResult res,
|
2017-03-14 20:18:31 +01:00
|
|
|
const char *error, ...);
|
2017-03-02 16:06:45 +01:00
|
|
|
void (*remove_id) (void *object,
|
|
|
|
|
uint32_t id);
|
2017-03-14 20:18:31 +01:00
|
|
|
void (*update_uris) (void *object,
|
|
|
|
|
uint32_t first_id,
|
|
|
|
|
uint32_t n_uris,
|
|
|
|
|
const char **uris);
|
2017-03-09 13:00:56 +01:00
|
|
|
} PinosCoreEvents;
|
2017-03-02 16:06:45 +01:00
|
|
|
|
2017-03-14 20:18:31 +01:00
|
|
|
#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__)
|
2017-03-02 16:06:45 +01:00
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
void (*bind) (void *object,
|
|
|
|
|
uint32_t id,
|
|
|
|
|
uint32_t new_id);
|
2017-03-09 13:00:56 +01:00
|
|
|
} PinosRegistryMethods;
|
2017-03-02 16:06:45 +01:00
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
#define pinos_registry_do_bind(r,...) ((PinosRegistryMethods*)r->iface->methods)->bind(r,__VA_ARGS__)
|
2017-03-03 17:43:23 +01:00
|
|
|
|
2017-03-02 16:06:45 +01:00
|
|
|
typedef struct {
|
|
|
|
|
void (*global) (void *object,
|
|
|
|
|
uint32_t id,
|
|
|
|
|
const char *type);
|
|
|
|
|
void (*global_remove) (void *object,
|
|
|
|
|
uint32_t id);
|
2017-03-09 13:00:56 +01:00
|
|
|
} PinosRegistryEvents;
|
2017-03-02 16:06:45 +01:00
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
#define pinos_registry_notify_global(r,...) ((PinosRegistryEvents*)r->iface->events)->global(r,__VA_ARGS__)
|
|
|
|
|
#define pinos_registry_notify_global_remove(r,...) ((PinosRegistryEvents*)r->iface->events)->global_remove(r,__VA_ARGS__)
|
2017-03-02 16:06:45 +01:00
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
void (*info) (void *object,
|
|
|
|
|
PinosModuleInfo *info);
|
2017-03-09 13:00:56 +01:00
|
|
|
} PinosModuleEvents;
|
2017-03-02 16:06:45 +01:00
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
#define pinos_module_notify_info(r,...) ((PinosModuleEvents*)r->iface->events)->info(r,__VA_ARGS__)
|
2017-03-02 16:06:45 +01:00
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
void (*info) (void *object,
|
|
|
|
|
PinosNodeInfo *info);
|
2017-03-09 13:00:56 +01:00
|
|
|
} PinosNodeEvents;
|
2017-03-02 16:06:45 +01:00
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
#define pinos_node_notify_info(r,...) ((PinosNodeEvents*)r->iface->events)->info(r,__VA_ARGS__)
|
2017-03-02 16:06:45 +01:00
|
|
|
|
|
|
|
|
struct _PinosClientNodeBuffer {
|
|
|
|
|
uint32_t mem_id;
|
2017-03-07 11:56:43 +01:00
|
|
|
uint32_t offset;
|
|
|
|
|
uint32_t size;
|
2017-03-06 15:48:04 +01:00
|
|
|
SpaBuffer *buffer;
|
2017-03-02 16:06:45 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
void (*update) (void *object,
|
|
|
|
|
#define PINOS_MESSAGE_NODE_UPDATE_MAX_INPUTS (1 << 0)
|
|
|
|
|
#define PINOS_MESSAGE_NODE_UPDATE_MAX_OUTPUTS (1 << 1)
|
|
|
|
|
#define PINOS_MESSAGE_NODE_UPDATE_PROPS (1 << 2)
|
|
|
|
|
uint32_t change_mask,
|
2017-03-07 11:56:43 +01:00
|
|
|
uint32_t max_input_ports,
|
|
|
|
|
uint32_t max_output_ports,
|
2017-03-02 16:06:45 +01:00
|
|
|
const SpaProps *props);
|
|
|
|
|
|
|
|
|
|
void (*port_update) (void *object,
|
|
|
|
|
SpaDirection direction,
|
|
|
|
|
uint32_t port_id,
|
|
|
|
|
#define PINOS_MESSAGE_PORT_UPDATE_POSSIBLE_FORMATS (1 << 0)
|
|
|
|
|
#define PINOS_MESSAGE_PORT_UPDATE_FORMAT (1 << 1)
|
|
|
|
|
#define PINOS_MESSAGE_PORT_UPDATE_PROPS (1 << 2)
|
|
|
|
|
#define PINOS_MESSAGE_PORT_UPDATE_INFO (1 << 3)
|
|
|
|
|
uint32_t change_mask,
|
2017-03-07 11:56:43 +01:00
|
|
|
uint32_t n_possible_formats,
|
2017-03-06 15:48:04 +01:00
|
|
|
const SpaFormat **possible_formats,
|
|
|
|
|
const SpaFormat *format,
|
2017-03-02 16:06:45 +01:00
|
|
|
const SpaProps *props,
|
|
|
|
|
const SpaPortInfo *info);
|
|
|
|
|
void (*state_change) (void *object,
|
|
|
|
|
SpaNodeState state);
|
|
|
|
|
void (*event) (void *object,
|
2017-03-21 20:39:20 +01:00
|
|
|
SpaEvent *event);
|
2017-03-09 19:21:50 +01:00
|
|
|
void (*destroy) (void *object);
|
2017-03-09 13:00:56 +01:00
|
|
|
} PinosClientNodeMethods;
|
2017-03-02 16:06:45 +01:00
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
#define pinos_client_node_do_update(r,...) ((PinosClientNodeMethods*)r->iface->methods)->update(r,__VA_ARGS__)
|
|
|
|
|
#define pinos_client_node_do_port_update(r,...) ((PinosClientNodeMethods*)r->iface->methods)->port_update(r,__VA_ARGS__)
|
|
|
|
|
#define pinos_client_node_do_state_change(r,...) ((PinosClientNodeMethods*)r->iface->methods)->state_change(r,__VA_ARGS__)
|
|
|
|
|
#define pinos_client_node_do_event(r,...) ((PinosClientNodeMethods*)r->iface->methods)->event(r,__VA_ARGS__)
|
2017-03-09 19:21:50 +01:00
|
|
|
#define pinos_client_node_do_destroy(r) ((PinosClientNodeMethods*)r->iface->methods)->destroy(r)
|
2017-03-02 16:06:45 +01:00
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
void (*done) (void *object,
|
|
|
|
|
int datafd);
|
2017-03-21 20:39:20 +01:00
|
|
|
void (*event) (void *object,
|
|
|
|
|
const SpaEvent *event);
|
2017-03-02 16:06:45 +01:00
|
|
|
void (*add_port) (void *object,
|
|
|
|
|
uint32_t seq,
|
|
|
|
|
SpaDirection direction,
|
|
|
|
|
uint32_t port_id);
|
|
|
|
|
void (*remove_port) (void *object,
|
|
|
|
|
uint32_t seq,
|
|
|
|
|
SpaDirection direction,
|
|
|
|
|
uint32_t port_id);
|
|
|
|
|
void (*set_format) (void *object,
|
|
|
|
|
uint32_t seq,
|
|
|
|
|
SpaDirection direction,
|
|
|
|
|
uint32_t port_id,
|
|
|
|
|
SpaPortFormatFlags flags,
|
|
|
|
|
const SpaFormat *format);
|
|
|
|
|
void (*set_property) (void *object,
|
|
|
|
|
uint32_t seq,
|
|
|
|
|
uint32_t id,
|
2017-03-07 11:56:43 +01:00
|
|
|
uint32_t size,
|
2017-03-06 15:48:04 +01:00
|
|
|
const void *value);
|
2017-03-02 16:06:45 +01:00
|
|
|
void (*add_mem) (void *object,
|
|
|
|
|
SpaDirection direction,
|
|
|
|
|
uint32_t port_id,
|
|
|
|
|
uint32_t mem_id,
|
|
|
|
|
SpaDataType type,
|
|
|
|
|
int memfd,
|
|
|
|
|
uint32_t flags,
|
2017-03-07 11:56:43 +01:00
|
|
|
uint32_t offset,
|
|
|
|
|
uint32_t size);
|
2017-03-02 16:06:45 +01:00
|
|
|
void (*use_buffers) (void *object,
|
|
|
|
|
uint32_t seq,
|
|
|
|
|
SpaDirection direction,
|
|
|
|
|
uint32_t port_id,
|
2017-03-07 11:56:43 +01:00
|
|
|
uint32_t n_buffers,
|
2017-03-02 16:06:45 +01:00
|
|
|
PinosClientNodeBuffer *buffers);
|
|
|
|
|
void (*node_command) (void *object,
|
|
|
|
|
uint32_t seq,
|
2017-03-06 15:48:04 +01:00
|
|
|
const SpaNodeCommand *command);
|
2017-03-02 16:06:45 +01:00
|
|
|
void (*port_command) (void *object,
|
|
|
|
|
uint32_t port_id,
|
2017-03-06 15:48:04 +01:00
|
|
|
const SpaNodeCommand *command);
|
2017-03-02 16:06:45 +01:00
|
|
|
void (*transport) (void *object,
|
|
|
|
|
int memfd,
|
2017-03-07 11:56:43 +01:00
|
|
|
uint32_t offset,
|
|
|
|
|
uint32_t size);
|
2017-03-09 13:00:56 +01:00
|
|
|
} PinosClientNodeEvents;
|
|
|
|
|
|
|
|
|
|
#define pinos_client_node_notify_done(r,...) ((PinosClientNodeEvents*)r->iface->events)->done(r,__VA_ARGS__)
|
|
|
|
|
#define pinos_client_node_notify_event(r,...) ((PinosClientNodeEvents*)r->iface->events)->event(r,__VA_ARGS__)
|
|
|
|
|
#define pinos_client_node_notify_add_port(r,...) ((PinosClientNodeEvents*)r->iface->events)->add_port(r,__VA_ARGS__)
|
|
|
|
|
#define pinos_client_node_notify_remove_port(r,...) ((PinosClientNodeEvents*)r->iface->events)->remove_port(r,__VA_ARGS__)
|
|
|
|
|
#define pinos_client_node_notify_set_format(r,...) ((PinosClientNodeEvents*)r->iface->events)->set_format(r,__VA_ARGS__)
|
|
|
|
|
#define pinos_client_node_notify_set_property(r,...) ((PinosClientNodeEvents*)r->iface->events)->set_property(r,__VA_ARGS__)
|
|
|
|
|
#define pinos_client_node_notify_add_mem(r,...) ((PinosClientNodeEvents*)r->iface->events)->add_mem(r,__VA_ARGS__)
|
|
|
|
|
#define pinos_client_node_notify_use_buffers(r,...) ((PinosClientNodeEvents*)r->iface->events)->use_buffers(r,__VA_ARGS__)
|
|
|
|
|
#define pinos_client_node_notify_node_command(r,...) ((PinosClientNodeEvents*)r->iface->events)->node_command(r,__VA_ARGS__)
|
|
|
|
|
#define pinos_client_node_notify_port_command(r,...) ((PinosClientNodeEvents*)r->iface->events)->port_command(r,__VA_ARGS__)
|
|
|
|
|
#define pinos_client_node_notify_transport(r,...) ((PinosClientNodeEvents*)r->iface->events)->transport(r,__VA_ARGS__)
|
2017-03-02 16:06:45 +01:00
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
void (*info) (void *object,
|
|
|
|
|
PinosClientInfo *info);
|
2017-03-09 13:00:56 +01:00
|
|
|
} PinosClientEvents;
|
2017-03-02 16:06:45 +01:00
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
#define pinos_client_notify_info(r,...) ((PinosClientEvents*)r->iface->events)->info(r,__VA_ARGS__)
|
2017-03-02 16:06:45 +01:00
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
void (*info) (void *object,
|
|
|
|
|
PinosLinkInfo *info);
|
2017-03-09 13:00:56 +01:00
|
|
|
} PinosLinkEvents;
|
2017-03-02 16:06:45 +01:00
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
#define pinos_link_notify_info(r,...) ((PinosLinkEvents*)r->iface->events)->info(r,__VA_ARGS__)
|
2017-03-02 16:06:45 +01:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
} /* extern "C" */
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif /* __PINOS_INTERFACES_H__ */
|