interfaces.h
Go to the documentation of this file.
/* PipeWire
* 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 __PIPEWIRE_INTERFACES_H__
#define __PIPEWIRE_INTERFACES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/defs.h>
#include <spa/param/param.h>
#include <spa/node/node.h>
#include <pipewire/introspect.h>
#include <pipewire/proxy.h>
struct pw_core_proxy;
struct pw_registry_proxy;
struct pw_module_proxy;
struct pw_node_proxy;
struct pw_port_proxy;
struct pw_factory_proxy;
struct pw_client_proxy;
struct pw_link_proxy;
#define PW_TYPE_INTERFACE__Core PW_TYPE_INTERFACE_BASE "Core"
#define PW_TYPE_INTERFACE__Registry PW_TYPE_INTERFACE_BASE "Registry"
#define PW_TYPE_INTERFACE__Module PW_TYPE_INTERFACE_BASE "Module"
#define PW_TYPE_INTERFACE__Node PW_TYPE_INTERFACE_BASE "Node"
#define PW_TYPE_INTERFACE__Port PW_TYPE_INTERFACE_BASE "Port"
#define PW_TYPE_INTERFACE__Client PW_TYPE_INTERFACE_BASE "Client"
#define PW_TYPE_INTERFACE__Link PW_TYPE_INTERFACE_BASE "Link"
#define PW_VERSION_CORE 0
#define PW_CORE_PROXY_METHOD_HELLO 0
#define PW_CORE_PROXY_METHOD_UPDATE_TYPES 1
#define PW_CORE_PROXY_METHOD_SYNC 2
#define PW_CORE_PROXY_METHOD_GET_REGISTRY 3
#define PW_CORE_PROXY_METHOD_CLIENT_UPDATE 4
#define PW_CORE_PROXY_METHOD_PERMISSIONS 5
#define PW_CORE_PROXY_METHOD_CREATE_OBJECT 6
#define PW_CORE_PROXY_METHOD_DESTROY 7
#define PW_CORE_PROXY_METHOD_NUM 8
#define PW_CORE_PROXY_PERMISSIONS_DEFAULT "permissions.default"
#define PW_CORE_PROXY_PERMISSIONS_GLOBAL "permissions.global"
#define PW_CORE_PROXY_PERMISSIONS_EXISTING "permissions.existing"
#define PW_LINK_OUTPUT_NODE_ID "link.output_node.id"
#define PW_LINK_OUTPUT_PORT_ID "link.output_port.id"
#define PW_LINK_INPUT_NODE_ID "link.input_node.id"
#define PW_LINK_INPUT_PORT_ID "link.input_port.id"
struct pw_core_proxy_methods {
#define PW_VERSION_CORE_PROXY_METHODS 0
uint32_t version;
void (*hello) (void *object);
void (*update_types) (void *object,
uint32_t first_id,
const char **types,
uint32_t n_types);
void (*sync) (void *object, uint32_t seq);
void (*get_registry) (void *object, uint32_t version, uint32_t new_id);
void (*client_update) (void *object, const struct spa_dict *props);
void (*permissions) (void *object, const struct spa_dict *props);
void (*create_object) (void *object,
const char *factory_name,
uint32_t type,
uint32_t version,
const struct spa_dict *props,
uint32_t new_id);
void (*destroy) (void *object, uint32_t id);
};
static inline void
pw_core_proxy_hello(struct pw_core_proxy *core)
{
pw_proxy_do((struct pw_proxy*)core, struct pw_core_proxy_methods, hello);
}
static inline void
pw_core_proxy_update_types(struct pw_core_proxy *core, uint32_t first_id, const char **types, uint32_t n_types)
{
pw_proxy_do((struct pw_proxy*)core, struct pw_core_proxy_methods, update_types, first_id, types, n_types);
}
static inline void
pw_core_proxy_sync(struct pw_core_proxy *core, uint32_t seq)
{
pw_proxy_do((struct pw_proxy*)core, struct pw_core_proxy_methods, sync, seq);
}
static inline struct pw_registry_proxy *
pw_core_proxy_get_registry(struct pw_core_proxy *core, uint32_t type, uint32_t version, size_t user_data_size)
{
struct pw_proxy *p = pw_proxy_new((struct pw_proxy*)core, type, user_data_size);
pw_proxy_do((struct pw_proxy*)core, struct pw_core_proxy_methods, get_registry, version, pw_proxy_get_id(p));
return (struct pw_registry_proxy *) p;
}
static inline void
pw_core_proxy_client_update(struct pw_core_proxy *core, const struct spa_dict *props)
{
pw_proxy_do((struct pw_proxy*)core, struct pw_core_proxy_methods, client_update, props);
}
static inline void
pw_core_proxy_permissions(struct pw_core_proxy *core, const struct spa_dict *props)
{
pw_proxy_do((struct pw_proxy*)core, struct pw_core_proxy_methods, permissions, props);
}
static inline void *
pw_core_proxy_create_object(struct pw_core_proxy *core,
const char *factory_name,
uint32_t type,
uint32_t version,
const struct spa_dict *props,
size_t user_data_size)
{
struct pw_proxy *p = pw_proxy_new((struct pw_proxy*)core, type, user_data_size);
pw_proxy_do((struct pw_proxy*)core, struct pw_core_proxy_methods, create_object, factory_name,
type, version, props, pw_proxy_get_id(p));
return p;
}
static inline void
pw_core_proxy_destroy(struct pw_core_proxy *core, uint32_t id)
{
pw_proxy_do((struct pw_proxy*)core, struct pw_core_proxy_methods, destroy, id);
}
#define PW_CORE_PROXY_EVENT_UPDATE_TYPES 0
#define PW_CORE_PROXY_EVENT_DONE 1
#define PW_CORE_PROXY_EVENT_ERROR 2
#define PW_CORE_PROXY_EVENT_REMOVE_ID 3
#define PW_CORE_PROXY_EVENT_INFO 4
#define PW_CORE_PROXY_EVENT_NUM 5
struct pw_core_proxy_events {
#define PW_VERSION_CORE_PROXY_EVENTS 0
uint32_t version;
void (*update_types) (void *object,
uint32_t first_id,
const char **types,
uint32_t n_types);
void (*done) (void *object, uint32_t seq);
void (*error) (void *object, uint32_t id, int res, const char *error, ...);
void (*remove_id) (void *object, uint32_t id);
void (*info) (void *object, struct pw_core_info *info);
};
static inline void
pw_core_proxy_add_listener(struct pw_core_proxy *core,
struct spa_hook *listener,
const struct pw_core_proxy_events *events,
void *data)
{
pw_proxy_add_proxy_listener((struct pw_proxy*)core, listener, events, data);
}
#define pw_core_resource_update_types(r,...) pw_resource_notify(r,struct pw_core_proxy_events,update_types,__VA_ARGS__)
#define pw_core_resource_done(r,...) pw_resource_notify(r,struct pw_core_proxy_events,done,__VA_ARGS__)
#define pw_core_resource_error(r,...) pw_resource_notify(r,struct pw_core_proxy_events,error,__VA_ARGS__)
#define pw_core_resource_remove_id(r,...) pw_resource_notify(r,struct pw_core_proxy_events,remove_id,__VA_ARGS__)
#define pw_core_resource_info(r,...) pw_resource_notify(r,struct pw_core_proxy_events,info,__VA_ARGS__)
#define PW_VERSION_REGISTRY 0
#define PW_REGISTRY_PROXY_METHOD_BIND 0
#define PW_REGISTRY_PROXY_METHOD_NUM 1
struct pw_registry_proxy_methods {
#define PW_VERSION_REGISTRY_PROXY_METHODS 0
uint32_t version;
void (*bind) (void *object, uint32_t id, uint32_t type, uint32_t version, uint32_t new_id);
};
static inline void *
pw_registry_proxy_bind(struct pw_registry_proxy *registry,
uint32_t id, uint32_t type, uint32_t version,
size_t user_data_size)
{
struct pw_proxy *reg = (struct pw_proxy*)registry;
struct pw_proxy *p = pw_proxy_new(reg, type, user_data_size);
pw_proxy_do(reg, struct pw_registry_proxy_methods, bind, id, type, version, pw_proxy_get_id(p));
return p;
}
#define PW_REGISTRY_PROXY_EVENT_GLOBAL 0
#define PW_REGISTRY_PROXY_EVENT_GLOBAL_REMOVE 1
#define PW_REGISTRY_PROXY_EVENT_NUM 2
struct pw_registry_proxy_events {
#define PW_VERSION_REGISTRY_PROXY_EVENTS 0
uint32_t version;
void (*global) (void *object, uint32_t id, uint32_t parent_id,
uint32_t permissions, uint32_t type, uint32_t version,
const struct spa_dict *props);
void (*global_remove) (void *object, uint32_t id);
};
static inline void
pw_registry_proxy_add_listener(struct pw_registry_proxy *registry,
struct spa_hook *listener,
const struct pw_registry_proxy_events *events,
void *data)
{
pw_proxy_add_proxy_listener((struct pw_proxy*)registry, listener, events, data);
}
#define pw_registry_resource_global(r,...) pw_resource_notify(r,struct pw_registry_proxy_events,global,__VA_ARGS__)
#define pw_registry_resource_global_remove(r,...) pw_resource_notify(r,struct pw_registry_proxy_events,global_remove,__VA_ARGS__)
#define PW_VERSION_MODULE 0
#define PW_MODULE_PROXY_EVENT_INFO 0
#define PW_MODULE_PROXY_EVENT_NUM 1
struct pw_module_proxy_events {
#define PW_VERSION_MODULE_PROXY_EVENTS 0
uint32_t version;
void (*info) (void *object, struct pw_module_info *info);
};
static inline void
pw_module_proxy_add_listener(struct pw_module_proxy *module,
struct spa_hook *listener,
const struct pw_module_proxy_events *events,
void *data)
{
pw_proxy_add_proxy_listener((struct pw_proxy*)module, listener, events, data);
}
#define pw_module_resource_info(r,...) pw_resource_notify(r,struct pw_module_proxy_events,info,__VA_ARGS__)
#define PW_VERSION_NODE 0
#define PW_NODE_PROXY_EVENT_INFO 0
#define PW_NODE_PROXY_EVENT_PARAM 1
#define PW_NODE_PROXY_EVENT_NUM 2
struct pw_node_proxy_events {
#define PW_VERSION_NODE_PROXY_EVENTS 0
uint32_t version;
void (*info) (void *object, struct pw_node_info *info);
void (*param) (void *object,
uint32_t id, uint32_t index, uint32_t next,
const struct spa_pod *param);
};
static inline void
pw_node_proxy_add_listener(struct pw_node_proxy *node,
struct spa_hook *listener,
const struct pw_node_proxy_events *events,
void *data)
{
pw_proxy_add_proxy_listener((struct pw_proxy*)node, listener, events, data);
}
#define pw_node_resource_info(r,...) pw_resource_notify(r,struct pw_node_proxy_events,info,__VA_ARGS__)
#define pw_node_resource_param(r,...) pw_resource_notify(r,struct pw_node_proxy_events,param,__VA_ARGS__)
#define PW_NODE_PROXY_METHOD_ENUM_PARAMS 0
#define PW_NODE_PROXY_METHOD_NUM 1
struct pw_node_proxy_methods {
#define PW_VERSION_NODE_PROXY_METHODS 0
uint32_t version;
void (*enum_params) (void *object, uint32_t id, uint32_t start, uint32_t num,
const struct spa_pod *filter);
};
static inline void
pw_node_proxy_enum_params(struct pw_node_proxy *node, uint32_t id, uint32_t index,
uint32_t num, const struct spa_pod *filter)
{
pw_proxy_do((struct pw_proxy*)node, struct pw_node_proxy_methods, enum_params,
id, index, num, filter);
}
#define PW_VERSION_PORT 0
#define PW_PORT_PROXY_EVENT_INFO 0
#define PW_PORT_PROXY_EVENT_PARAM 1
#define PW_PORT_PROXY_EVENT_NUM 2
struct pw_port_proxy_events {
#define PW_VERSION_PORT_PROXY_EVENTS 0
uint32_t version;
void (*info) (void *object, struct pw_port_info *info);
void (*param) (void *object,
uint32_t id, uint32_t index, uint32_t next,
const struct spa_pod *param);
};
static inline void
pw_port_proxy_add_listener(struct pw_port_proxy *port,
struct spa_hook *listener,
const struct pw_port_proxy_events *events,
void *data)
{
pw_proxy_add_proxy_listener((struct pw_proxy*)port, listener, events, data);
}
#define pw_port_resource_info(r,...) pw_resource_notify(r,struct pw_port_proxy_events,info,__VA_ARGS__)
#define pw_port_resource_param(r,...) pw_resource_notify(r,struct pw_port_proxy_events,param,__VA_ARGS__)
#define PW_PORT_PROXY_METHOD_ENUM_PARAMS 0
#define PW_PORT_PROXY_METHOD_NUM 1
struct pw_port_proxy_methods {
#define PW_VERSION_PORT_PROXY_METHODS 0
uint32_t version;
void (*enum_params) (void *object, uint32_t id, uint32_t start, uint32_t num,
const struct spa_pod *filter);
};
static inline void
pw_port_proxy_enum_params(struct pw_port_proxy *port, uint32_t id, uint32_t index,
uint32_t num, const struct spa_pod *filter)
{
pw_proxy_do((struct pw_proxy*)port, struct pw_port_proxy_methods, enum_params,
id, index, num, filter);
}
#define PW_VERSION_FACTORY 0
#define PW_FACTORY_PROXY_EVENT_INFO 0
#define PW_FACTORY_PROXY_EVENT_NUM 1
struct pw_factory_proxy_events {
#define PW_VERSION_FACTORY_PROXY_EVENTS 0
uint32_t version;
void (*info) (void *object, struct pw_factory_info *info);
};
static inline void
pw_factory_proxy_add_listener(struct pw_factory_proxy *factory,
struct spa_hook *listener,
const struct pw_factory_proxy_events *events,
void *data)
{
pw_proxy_add_proxy_listener((struct pw_proxy*)factory, listener, events, data);
}
#define pw_factory_resource_info(r,...) pw_resource_notify(r,struct pw_factory_proxy_events,info,__VA_ARGS__)
#define PW_VERSION_CLIENT 0
#define PW_CLIENT_PROXY_EVENT_INFO 0
#define PW_CLIENT_PROXY_EVENT_NUM 1
struct pw_client_proxy_events {
#define PW_VERSION_CLIENT_PROXY_EVENTS 0
uint32_t version;
void (*info) (void *object, struct pw_client_info *info);
};
static inline void
pw_client_proxy_add_listener(struct pw_client_proxy *client,
struct spa_hook *listener,
const struct pw_client_proxy_events *events,
void *data)
{
pw_proxy_add_proxy_listener((struct pw_proxy*)client, listener, events, data);
}
#define pw_client_resource_info(r,...) pw_resource_notify(r,struct pw_client_proxy_events,info,__VA_ARGS__)
#define PW_VERSION_LINK 0
#define PW_LINK_PROXY_EVENT_INFO 0
#define PW_LINK_PROXY_EVENT_NUM 1
struct pw_link_proxy_events {
#define PW_VERSION_LINK_PROXY_EVENTS 0
uint32_t version;
void (*info) (void *object, struct pw_link_info *info);
};
static inline void
pw_link_proxy_add_listener(struct pw_link_proxy *link,
struct spa_hook *listener,
const struct pw_link_proxy_events *events,
void *data)
{
pw_proxy_add_proxy_listener((struct pw_proxy*)link, listener, events, data);
}
#define pw_link_resource_info(r,...) pw_resource_notify(r,struct pw_link_proxy_events,info,__VA_ARGS__)
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __PIPEWIRE_INTERFACES_H__ */
pw_module_proxy_events::version
uint32_t version
Definition: interfaces.h:467
pw_client_proxy_events::version
uint32_t version
Definition: interfaces.h:672
introspect.h
pw_proxy_new
struct pw_proxy * pw_proxy_new(struct pw_proxy *factory, uint32_t type, size_t user_data_size)
Make a new proxy object.
pw_core_proxy_methods::client_update
void(* client_update)(void *object, const struct spa_dict *props)
Update the client properties.
Definition: interfaces.h:161
pw_module_proxy_events
Module events.
Definition: interfaces.h:465
pw_core_proxy_methods::destroy
void(* destroy)(void *object, uint32_t id)
Destroy an object id.
Definition: interfaces.h:198
pw_port_proxy_events::info
void(* info)(void *object, struct pw_port_info *info)
Notify port info.
Definition: interfaces.h:576
pw_node_proxy_methods::version
uint32_t version
Definition: interfaces.h:536
pw_core_proxy_methods::get_registry
void(* get_registry)(void *object, uint32_t version, uint32_t new_id)
Get the registry object.
Definition: interfaces.h:156
pw_module_proxy_events::info
void(* info)(void *object, struct pw_module_info *info)
Notify module info.
Definition: interfaces.h:473
pw_port_info
Definition: introspect.h:168
pw_link_proxy_events::version
uint32_t version
Definition: interfaces.h:702
pw_core_info
The core information.
Definition: introspect.h:76
pw_core_proxy_methods::hello
void(* hello)(void *object)
Start a conversation with the server.
Definition: interfaces.h:124
pw_core_proxy_methods::permissions
void(* permissions)(void *object, const struct spa_dict *props)
Manage the permissions of the global objects.
Definition: interfaces.h:174
pw_registry_proxy_events::version
uint32_t version
Definition: interfaces.h:417
pw_factory_proxy_events
Factory events.
Definition: interfaces.h:641
pw_proxy
Represents an object on the client side.
pw_proxy_get_id
uint32_t pw_proxy_get_id(struct pw_proxy *proxy)
Get the local id of the proxy.
Definition: proxy.c:86
pw_node_proxy_events
Node events.
Definition: interfaces.h:494
pw_port_proxy_methods
Port methods.
Definition: interfaces.h:608
pw_proxy_do
#define pw_proxy_do(p, type, method,...)
Definition: proxy.h:149
pw_proxy_add_proxy_listener
void pw_proxy_add_proxy_listener(struct pw_proxy *proxy, struct spa_hook *listener, const void *events, void *data)
Add a listener for the events received from the remote resource.
Definition: proxy.c:107
pw_registry_proxy_methods::version
uint32_t version
Definition: interfaces.h:382
pw_port_info::id
uint32_t id
id of the global
Definition: introspect.h:169
pw_core_proxy_events::error
void(* error)(void *object, uint32_t id, int res, const char *error,...)
Fatal error event.
Definition: interfaces.h:306
pw_port_proxy_events::version
uint32_t version
Definition: interfaces.h:570
pw_node_info::id
uint32_t id
id of the global
Definition: introspect.h:143
pw_client_info
The client information.
Definition: introspect.h:125
pw_link_proxy_events
Link events.
Definition: interfaces.h:700
pw_factory_proxy_events::info
void(* info)(void *object, struct pw_factory_info *info)
Notify factory info.
Definition: interfaces.h:649
pw_port_proxy_events
Port events.
Definition: interfaces.h:568
pw_client_proxy_events::info
void(* info)(void *object, struct pw_client_info *info)
Notify client info.
Definition: interfaces.h:678
pw_node_proxy_events::version
uint32_t version
Definition: interfaces.h:496
pw_core_proxy_events
Core events.
Definition: interfaces.h:270
pw_factory_proxy_events::version
uint32_t version
Definition: interfaces.h:643
pw_link_info
The link information.
Definition: introspect.h:204
pw_factory_info
The factory information.
Definition: introspect.h:186
pw_core_proxy_methods::create_object
void(* create_object)(void *object, const char *factory_name, uint32_t type, uint32_t version, const struct spa_dict *props, uint32_t new_id)
Create a new object on the PipeWire server from a factory.
Definition: interfaces.h:186
pw_module_info
The module information.
Definition: introspect.h:103
proxy.h
pw_client_proxy_events
Client events.
Definition: interfaces.h:670
registry
Definition: pipewire.c:54
pw_core_proxy_methods::version
uint32_t version
Definition: interfaces.h:116
pw_link_proxy_events::info
void(* info)(void *object, struct pw_link_info *info)
Notify link info.
Definition: interfaces.h:708
pw_core_proxy_events::version
uint32_t version
Definition: interfaces.h:272
pw_node_proxy_methods
Node methods.
Definition: interfaces.h:534
pw_registry_proxy_methods
Registry methods.
Definition: interfaces.h:380
pw_core_proxy_events::info
void(* info)(void *object, struct pw_core_info *info)
Notify new core info.
Definition: interfaces.h:323
pw_port_proxy_methods::version
uint32_t version
Definition: interfaces.h:610
pw_node_info
The node information.
Definition: introspect.h:142
pw_core_proxy_methods::update_types
void(* update_types)(void *object, uint32_t first_id, const char **types, uint32_t n_types)
Update the type map.
Definition: interfaces.h:134
pw_node_proxy_events::info
void(* info)(void *object, struct pw_node_info *info)
Notify node info.
Definition: interfaces.h:502
pw_core_proxy_methods
Core methods.
Definition: interfaces.h:114
pw_registry_proxy_events
Registry events.
Definition: interfaces.h:415
pw_core_proxy_methods::sync
void(* sync)(void *object, uint32_t seq)
Do server roundtrip.
Definition: interfaces.h:147