mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-18 07:00:06 -05:00
Make interface types a string
This is more in line with wayland and it allows us to create new interfaces in modules without having to add anything to the type enum. It also removes some lookups to map type_id to readable name in debug.
This commit is contained in:
parent
9657486a81
commit
f391353c7f
123 changed files with 791 additions and 1251 deletions
|
|
@ -37,7 +37,9 @@ extern "C" {
|
|||
/**
|
||||
* The CPU features interface
|
||||
*/
|
||||
#define SPA_VERSION_CPU 0
|
||||
#define SPA_TYPE_INTERFACE_CPU SPA_TYPE_INFO_INTERFACE_BASE "CPU"
|
||||
|
||||
#define SPA_VERSION_CPU 0
|
||||
struct spa_cpu { struct spa_interface iface; };
|
||||
|
||||
/* x86 specific */
|
||||
|
|
|
|||
|
|
@ -31,7 +31,9 @@ extern "C" {
|
|||
|
||||
#include <spa/support/loop.h>
|
||||
|
||||
#define SPA_VERSION_DBUS 0
|
||||
#define SPA_TYPE_INTERFACE_DBus SPA_TYPE_INFO_INTERFACE_BASE "DBus"
|
||||
|
||||
#define SPA_VERSION_DBUS 0
|
||||
struct spa_dbus { struct spa_interface iface; };
|
||||
|
||||
enum spa_dbus_type {
|
||||
|
|
|
|||
|
|
@ -46,10 +46,13 @@ enum spa_log_level {
|
|||
/**
|
||||
* The Log interface
|
||||
*/
|
||||
#define SPA_TYPE_INTERFACE_Log SPA_TYPE_INFO_INTERFACE_BASE "Log"
|
||||
|
||||
#define SPA_VERSION_LOG 0
|
||||
|
||||
struct spa_log {
|
||||
/** the version of this log. This can be used to expand this
|
||||
* structure in the future */
|
||||
#define SPA_VERSION_LOG 0
|
||||
struct spa_interface iface;
|
||||
/**
|
||||
* Logging level, everything above this level is not logged
|
||||
|
|
|
|||
|
|
@ -33,12 +33,19 @@ extern "C" {
|
|||
#include <spa/utils/hook.h>
|
||||
#include <spa/support/system.h>
|
||||
|
||||
#define SPA_TYPE_INTERFACE_Loop SPA_TYPE_INFO_INTERFACE_BASE "Loop"
|
||||
#define SPA_TYPE_INTERFACE_DataLoop SPA_TYPE_INFO_INTERFACE_BASE "DataLoop"
|
||||
#define SPA_VERSION_LOOP 0
|
||||
struct spa_loop { struct spa_interface iface; };
|
||||
|
||||
#define SPA_TYPE_INTERFACE_LoopControl SPA_TYPE_INFO_INTERFACE_BASE "LoopControl"
|
||||
#define SPA_VERSION_LOOP_CONTROL 0
|
||||
struct spa_loop_control { struct spa_interface iface; };
|
||||
|
||||
#define SPA_TYPE_INTERFACE_LoopUtils SPA_TYPE_INFO_INTERFACE_BASE "LoopUtils"
|
||||
#define SPA_VERSION_LOOP_UTILS 0
|
||||
struct spa_loop_utils { struct spa_interface iface; };
|
||||
|
||||
struct spa_source;
|
||||
|
||||
typedef void (*spa_source_func_t) (struct spa_source *source);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ struct spa_handle {
|
|||
* -ENOTSUP when there are no interfaces
|
||||
* -EINVAL when handle or info is NULL
|
||||
*/
|
||||
int (*get_interface) (struct spa_handle *handle, uint32_t type, void **interface);
|
||||
int (*get_interface) (struct spa_handle *handle, const char *type, void **interface);
|
||||
/**
|
||||
* Clean up the memory of \a handle. After this, \a handle should not be used
|
||||
* anymore.
|
||||
|
|
@ -69,8 +69,8 @@ struct spa_handle {
|
|||
* handles.
|
||||
*/
|
||||
struct spa_interface_info {
|
||||
uint32_t type; /*< the type of the interface, can be
|
||||
* used to get the interface */
|
||||
const char *type; /*< the type of the interface, can be
|
||||
* used to get the interface */
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -78,18 +78,18 @@ struct spa_interface_info {
|
|||
* a factory. It can be extra information or interfaces such as logging.
|
||||
*/
|
||||
struct spa_support {
|
||||
uint32_t type; /*< the type of the support item */
|
||||
void *data; /*< specific data for the item */
|
||||
const char *type; /*< the type of the support item */
|
||||
void *data; /*< specific data for the item */
|
||||
};
|
||||
|
||||
/** Find a support item of the given type */
|
||||
static inline void *spa_support_find(const struct spa_support *support,
|
||||
uint32_t n_support,
|
||||
uint32_t type)
|
||||
const char *type)
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < n_support; i++) {
|
||||
if (support[i].type == type)
|
||||
if (strcmp(support[i].type, type) == 0)
|
||||
return support[i].data;
|
||||
}
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,9 @@ extern "C" {
|
|||
/**
|
||||
* a collection of core system functions
|
||||
*/
|
||||
#define SPA_TYPE_INTERFACE_System SPA_TYPE_INFO_INTERFACE_BASE "System"
|
||||
#define SPA_TYPE_INTERFACE_DataSystem SPA_TYPE_INFO_INTERFACE_BASE "DataSystem"
|
||||
|
||||
#define SPA_VERSION_SYSTEM 0
|
||||
struct spa_system { struct spa_interface iface; };
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue