mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
Add mapper
Ger rid of static ids for interfaces and replace with something we can register dynamically Implement logger.
This commit is contained in:
parent
a68e5d5124
commit
fc4fd1424a
43 changed files with 997 additions and 360 deletions
|
|
@ -26,6 +26,9 @@ extern "C" {
|
|||
|
||||
typedef struct _SpaBuffer SpaBuffer;
|
||||
|
||||
#define SPA_BUFFER_URI "http://spaplug.in/ns/buffer"
|
||||
#define SPA_BUFFER_PREFIX SPA_BUFFER_URI "#"
|
||||
|
||||
/**
|
||||
* SpaMetaType:
|
||||
* @SPA_META_TYPE_INVALID: invalid metadata, should be ignored
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@ extern "C" {
|
|||
|
||||
typedef struct _SpaClock SpaClock;
|
||||
|
||||
#define SPA_CLOCK_URI "http://spaplug.in/ns/clock"
|
||||
#define SPA_CLOCK_PREFIX SPA_CLOCK_URI "#"
|
||||
|
||||
/**
|
||||
* SpaClockState:
|
||||
* @SPA_CLOCK_STATE_STOPPED: the clock is stopped
|
||||
|
|
@ -42,10 +45,6 @@ typedef enum {
|
|||
#include <spa/plugin.h>
|
||||
#include <spa/props.h>
|
||||
|
||||
#define SPA_INTERFACE_ID_CLOCK 1
|
||||
#define SPA_INTERFACE_ID_CLOCK_NAME "Clock interface"
|
||||
#define SPA_INTERFACE_ID_CLOCK_DESCRIPTION "Clock interface"
|
||||
|
||||
/**
|
||||
* SpaClock:
|
||||
*
|
||||
|
|
|
|||
68
spa/include/spa/id-map.h
Normal file
68
spa/include/spa/id-map.h
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/* 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 __SPA_ID_MAP_H__
|
||||
#define __SPA_ID_MAP_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _SpaIDMap SpaIDMap;
|
||||
|
||||
#include <spa/defs.h>
|
||||
#include <spa/plugin.h>
|
||||
|
||||
#define SPA_ID_MAP_URI "http://spaplug.in/ns/id-map"
|
||||
|
||||
/**
|
||||
* SpaIDMap:
|
||||
*
|
||||
* Maps between uri and its id
|
||||
*/
|
||||
struct _SpaIDMap {
|
||||
/* pointer to the handle owning this interface */
|
||||
SpaHandle *handle;
|
||||
/* the total size of this structure. This can be used to expand this
|
||||
* structure in the future */
|
||||
size_t size;
|
||||
/**
|
||||
* SpaIDMap::info
|
||||
*
|
||||
* Extra information about the map
|
||||
*/
|
||||
const SpaDict *info;
|
||||
|
||||
uint32_t (*get_id) (SpaIDMap *map,
|
||||
const char *uri);
|
||||
|
||||
const char * (*get_uri) (SpaIDMap *map,
|
||||
uint32_t id);
|
||||
};
|
||||
|
||||
#define spa_id_map_get_id(n,...) (n)->get_id((n),__VA_ARGS__)
|
||||
#define spa_id_map_get_uri(n,...) (n)->get_uri((n),__VA_ARGS__)
|
||||
|
||||
SpaIDMap * spa_id_map_get_default (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* __SPA_ID_MAP_H__ */
|
||||
|
|
@ -26,16 +26,14 @@ extern "C" {
|
|||
|
||||
typedef struct _SpaLog SpaLog;
|
||||
|
||||
#define SPA_LOG_URI "http://spaplug.in/ns/log"
|
||||
#define SPA_LOG_PREFIX SPA_LOG_URI "#"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <spa/defs.h>
|
||||
#include <spa/plugin.h>
|
||||
|
||||
#define SPA_SUPPORT_ID_LOG 3
|
||||
#define SPA_INTERFACE_ID_LOG 3
|
||||
#define SPA_INTERFACE_ID_LOG_NAME "Log interface"
|
||||
#define SPA_INTERFACE_ID_LOG_DESCRIPTION "Log interface"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SPA_LOG_LEVEL_NONE = 0,
|
||||
|
|
@ -114,7 +112,7 @@ struct _SpaLog {
|
|||
#if __STDC_VERSION__ >= 199901L
|
||||
|
||||
#define spa_log_log(l,lev,...) \
|
||||
if ((l) && (l)->level > lev) \
|
||||
if ((l) && (l)->level >= lev) \
|
||||
(l)->log((l),lev,__VA_ARGS__)
|
||||
|
||||
#define spa_log_error(l,...) spa_log_log(l,SPA_LOG_LEVEL_ERROR,__FILE__,__LINE__,__func__,__VA_ARGS__)
|
||||
|
|
@ -128,7 +126,7 @@ struct _SpaLog {
|
|||
#define SPA_LOG_FUNC(name,lev) \
|
||||
static inline void spa_log_##name (SpaLog *l, const char *format, ...) \
|
||||
{ \
|
||||
if ((l) && (l)->level > lev) { \
|
||||
if ((l) && (l)->level >= lev) { \
|
||||
va_list varargs; \
|
||||
va_start (varargs, format); \
|
||||
(l)->logv((l),lev,__FILE__,__LINE__,__func__,format,varargs); \
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@ extern "C" {
|
|||
|
||||
typedef struct _SpaMonitor SpaMonitor;
|
||||
|
||||
#define SPA_MONITOR_URI "http://spaplug.in/ns/monitor"
|
||||
#define SPA_MONITOR_PREFIX SPA_MONITOR_URI "#"
|
||||
|
||||
#include <spa/defs.h>
|
||||
#include <spa/dict.h>
|
||||
#include <spa/plugin.h>
|
||||
|
|
@ -95,10 +98,6 @@ typedef void (*SpaMonitorEventCallback) (SpaMonitor *monitor,
|
|||
SpaMonitorEvent *event,
|
||||
void *user_data);
|
||||
|
||||
#define SPA_INTERFACE_ID_MONITOR 2
|
||||
#define SPA_INTERFACE_ID_MONITOR_NAME "Monitor interface"
|
||||
#define SPA_INTERFACE_ID_MONITOR_DESCRIPTION "Device Monitor interface"
|
||||
|
||||
/**
|
||||
* SpaMonitor:
|
||||
*
|
||||
|
|
|
|||
|
|
@ -29,6 +29,16 @@ typedef struct _SpaNodeCommand SpaNodeCommand;
|
|||
#include <spa/defs.h>
|
||||
#include <spa/clock.h>
|
||||
|
||||
#define SPA_NODE_COMMAND_URI "http://spaplug.in/ns/node-command"
|
||||
#define SPA_NODE_COMMAND_PREFIX SPA_NODE_COMMAND_URI "#"
|
||||
|
||||
#define SPA_NODE_COMMAND__Pause SPA_NODE_COMMAND_PREFIX "Pause"
|
||||
#define SPA_NODE_COMMAND__Start SPA_NODE_COMMAND_PREFIX "Start"
|
||||
#define SPA_NODE_COMMAND__Flush SPA_NODE_COMMAND_PREFIX "Flush"
|
||||
#define SPA_NODE_COMMAND__Drain SPA_NODE_COMMAND_PREFIX "Drain"
|
||||
#define SPA_NODE_COMMAND__Marker SPA_NODE_COMMAND_PREFIX "Marker"
|
||||
#define SPA_NODE_COMMAND__ClockUpdate SPA_NODE_COMMAND_PREFIX "ClockUpdate"
|
||||
|
||||
typedef enum {
|
||||
SPA_NODE_COMMAND_INVALID = 0,
|
||||
SPA_NODE_COMMAND_PAUSE,
|
||||
|
|
|
|||
|
|
@ -30,6 +30,22 @@ typedef struct _SpaNodeEvent SpaNodeEvent;
|
|||
#include <spa/poll.h>
|
||||
#include <spa/node.h>
|
||||
|
||||
#define SPA_NODE_EVENT_URI "http://spaplug.in/ns/node-event"
|
||||
#define SPA_NODE_EVENT_PREFIX SPA_NODE_EVENT_URI "#"
|
||||
|
||||
#define SPA_NODE_EVENT__AsyncComplete SPA_NODE_EVENT_PREFIX "AsyncComplete"
|
||||
#define SPA_NODE_EVENT__HaveOutput SPA_NODE_EVENT_PREFIX "HaveOutput"
|
||||
#define SPA_NODE_EVENT__NeedInput SPA_NODE_EVENT_PREFIX "NeedInput"
|
||||
#define SPA_NODE_EVENT__ReuseBuffer SPA_NODE_EVENT_PREFIX "ReuseBuffer"
|
||||
#define SPA_NODE_EVENT__AddPoll SPA_NODE_EVENT_PREFIX "AddPoll"
|
||||
#define SPA_NODE_EVENT__UpdatePoll SPA_NODE_EVENT_PREFIX "UpdatePoll"
|
||||
#define SPA_NODE_EVENT__RemovePoll SPA_NODE_EVENT_PREFIX "RemovePoll"
|
||||
#define SPA_NODE_EVENT__Drained SPA_NODE_EVENT_PREFIX "Drained"
|
||||
#define SPA_NODE_EVENT__Marker SPA_NODE_EVENT_PREFIX "Marker"
|
||||
#define SPA_NODE_EVENT__Error SPA_NODE_EVENT_PREFIX "Error"
|
||||
#define SPA_NODE_EVENT__Buffering SPA_NODE_EVENT_PREFIX "Buffering"
|
||||
#define SPA_NODE_EVENT__RequestClockUpdate SPA_NODE_EVENT_PREFIX "RequestClockUpdate"
|
||||
|
||||
/**
|
||||
* SpaEventType:
|
||||
* @SPA_NODE_EVENT_TYPE_INVALID: invalid event, should be ignored
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@ extern "C" {
|
|||
|
||||
typedef struct _SpaNode SpaNode;
|
||||
|
||||
#define SPA_NODE_URI "http://spaplug.in/ns/node"
|
||||
#define SPA_NODE_PREFIX SPA_NODE_URI "#"
|
||||
|
||||
/**
|
||||
* SpaNodeState:
|
||||
* @SPA_NODE_STATE_INIT: the node is initializing
|
||||
|
|
@ -139,10 +142,6 @@ typedef void (*SpaNodeEventCallback) (SpaNode *node,
|
|||
SpaNodeEvent *event,
|
||||
void *user_data);
|
||||
|
||||
#define SPA_INTERFACE_ID_NODE 0
|
||||
#define SPA_INTERFACE_ID_NODE_NAME "Node interface"
|
||||
#define SPA_INTERFACE_ID_NODE_DESCRIPTION "Main processing node interface"
|
||||
|
||||
/**
|
||||
* SpaNode:
|
||||
*
|
||||
|
|
|
|||
|
|
@ -65,30 +65,26 @@ struct _SpaHandle {
|
|||
|
||||
/**
|
||||
* SpaInterfaceInfo:
|
||||
* @interface_id: the id of the interface, can be used to get the interface
|
||||
* @name: name of the interface
|
||||
* @description: Human readable description of the interface.
|
||||
* @uri: the uri of the interface, can be used to get the interface
|
||||
*
|
||||
* This structure lists the information about available interfaces on
|
||||
* handles.
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t interface_id;
|
||||
const char *name;
|
||||
const char *description;
|
||||
const char *uri;
|
||||
} SpaInterfaceInfo;
|
||||
|
||||
/**
|
||||
* SpaSupport:
|
||||
* @support_id: the id of the support item
|
||||
* @uri: the uri of the support item
|
||||
* @data: specific data for the item
|
||||
*
|
||||
* Extra supporting infrastructure passed to the init() function of
|
||||
* a factory. It can be extra information or interfaces such as logging.
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t support_id;
|
||||
void *data;
|
||||
const char *uri;
|
||||
void *data;
|
||||
} SpaSupport;
|
||||
|
||||
struct _SpaHandleFactory {
|
||||
|
|
@ -133,7 +129,7 @@ struct _SpaHandleFactory {
|
|||
SpaResult (*init) (const SpaHandleFactory *factory,
|
||||
SpaHandle *handle,
|
||||
const SpaDict *info,
|
||||
const SpaSupport **support,
|
||||
const SpaSupport *support,
|
||||
unsigned int n_support);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -29,6 +29,13 @@ typedef struct _SpaAllocParam SpaAllocParam;
|
|||
#include <spa/defs.h>
|
||||
#include <spa/buffer.h>
|
||||
|
||||
#define SPA_ALLOC_PARAM_URI "http://spaplug.in/ns/alloc-param"
|
||||
#define SPA_ALLOC_PARAM_PREFIX SPA_ALLOC_PARAM_URI "#"
|
||||
|
||||
#define SPA_ALLOC_PARAM__Buffers SPA_ALLOC_PARAM_PREFIX "Buffers"
|
||||
#define SPA_ALLOC_PARAM__MetaEnable SPA_ALLOC_PARAM_PREFIX "MetaEnable"
|
||||
#define SPA_ALLOC_PARAM__VideoPadding SPA_ALLOC_PARAM_PREFIX "VideoPadding"
|
||||
|
||||
/**
|
||||
* SpaAllocParamType:
|
||||
* @SPA_ALLOC_PARAM_TYPE_INVALID: invalid type, should be ignored
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@ extern "C" {
|
|||
|
||||
typedef struct _SpaProps SpaProps;
|
||||
|
||||
#define SPA_PROPS_URI "http://spaplug.in/ns/props"
|
||||
#define SPA_PROPS_PREFIX SPA_PROPS_URI "#"
|
||||
|
||||
#include <string.h>
|
||||
#include <spa/defs.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@ extern "C" {
|
|||
|
||||
typedef struct _SpaQueue SpaQueue;
|
||||
|
||||
#define SPA_QUEUE_URI "http://spaplug.in/ns/queue"
|
||||
#define SPA_QUEUE_PREFIX SPA_QUEUE_URI "#"
|
||||
|
||||
#include <spa/defs.h>
|
||||
|
||||
struct _SpaQueue {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@ extern "C" {
|
|||
|
||||
typedef struct _SpaRingbuffer SpaRingbuffer;
|
||||
|
||||
#define SPA_RINGBUFFER_URI "http://spaplug.in/ns/ringbuffer"
|
||||
#define SPA_RINGBUFFER_PREFIX SPA_RINGBUFFER_URI "#"
|
||||
|
||||
#include <spa/defs.h>
|
||||
|
||||
typedef struct {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue