Go to the documentation of this file.
20 #ifndef __PIPEWIRE_CORE_H__
21 #define __PIPEWIRE_CORE_H__
27 #include <spa/utils/defs.h>
28 #include <spa/utils/hook.h>
76 #define PW_PERM_R 0400
77 #define PW_PERM_W 0200
78 #define PW_PERM_X 0100
80 #define PW_PERM_RWX (PW_PERM_R|PW_PERM_W|PW_PERM_X)
82 #define PW_PERM_IS_R(p) (((p)&PW_PERM_R) == PW_PERM_R)
83 #define PW_PERM_IS_W(p) (((p)&PW_PERM_W) == PW_PERM_W)
84 #define PW_PERM_IS_X(p) (((p)&PW_PERM_X) == PW_PERM_X)
88 #define PW_VERSION_CORE_EVENTS 0
104 #define PW_CORE_PROP_USER_NAME "pipewire.core.user-name"
106 #define PW_CORE_PROP_HOST_NAME "pipewire.core.host-name"
108 #define PW_CORE_PROP_NAME "pipewire.core.name"
110 #define PW_CORE_PROP_VERSION "pipewire.core.version"
112 #define PW_CORE_PROP_DAEMON "pipewire.daemon"
122 struct spa_hook *listener,
152 int (*callback) (
void *data,
struct pw_global *global),
#define PW_CORE_PROP_USER_NAME
The user name that started the core.
Definition: core.h:104
SPA_EXPORT int pw_global_register(struct pw_global *global, struct pw_client *owner, struct pw_global *parent)
register a global to the core registry
Definition: global.c:102
Registry methods.
Definition: interfaces.h:380
SPA_EXPORT void pw_core_add_listener(struct pw_core *core, struct spa_hook *listener, const struct pw_core_events *events, void *data)
Add a new event listener to a core.
Definition: core.c:543
#define PW_VERSION_CORE_PROXY_METHODS
Definition: interfaces.h:115
#define pw_log_level_enabled(lev)
Check if a loglevel is enabled.
Definition: log.h:62
#define PW_CORE_PROP_VERSION
The version of the core.
Definition: core.h:110
static void * pw_map_lookup(struct pw_map *map, uint32_t id)
Find an item in the map.
Definition: map.h:152
const SPA_EXPORT char * pw_get_host_name(void)
Get the host name.
Definition: pipewire.c:353
@ PW_DIRECTION_OUTPUT
an output port direction
Definition: introspect.h:49
The core information.
Definition: introspect.h:76
PipeWire factory interface.
SPA_EXPORT int pw_data_loop_start(struct pw_data_loop *loop)
Start a data loop.
Definition: data-loop.c:128
SPA_EXPORT struct pw_type * pw_core_get_type(struct pw_core *core)
Get the type object of a core.
Definition: core.c:552
SPA_EXPORT void pw_global_destroy(struct pw_global *global)
Destroy a global.
Definition: global.c:241
static void pw_map_init(struct pw_map *map, size_t size, size_t extend)
Initialize a map.
Definition: map.h:70
int pw_core_for_each_global(struct pw_core *core, int(*callback)(void *data, struct pw_global *global), void *data)
Iterate the globals of the core.
Definition: core.c:613
void(* destroy)(void *data)
The core is being destroyed.
Definition: core.h:92
Represents a connection with a remote PipeWire instance.
PipeWire client object class.
void pw_core_add_listener(struct pw_core *core, struct spa_hook *listener, const struct pw_core_events *events, void *data)
Add a new event listener to a core.
Definition: core.c:543
const struct spa_support * pw_core_get_support(struct pw_core *core, uint32_t *n_support)
Get the core support objects.
Definition: core.c:558
uint32_t version
Definition: core.h:89
struct spa_hook resource_listener
Definition: factory.c:27
SPA_EXPORT void pw_node_destroy(struct pw_node *node)
Destroy a node.
Definition: node.c:626
SPA_EXPORT int pw_global_bind(struct pw_global *global, struct pw_client *client, uint32_t permissions, uint32_t version, uint32_t id)
Bind to a global.
Definition: global.c:213
@ PW_NODE_STATE_IDLE
the node is running but there is no active port
Definition: introspect.h:38
#define pw_core_resource_remove_id(r,...)
Definition: interfaces.h:339
#define PW_VERSION_CORE
Definition: interfaces.h:69
Global events, use pw_global_add_listener.
Definition: global.h:59
void pw_resource_set_implementation(struct pw_resource *resource, const void *implementation, void *data)
Set the resource implementation.
Definition: resource.c:128
#define pw_registry_resource_global(r,...)
Definition: interfaces.h:455
void * pw_factory_create_object(struct pw_factory *factory, struct pw_resource *resource, uint32_t type, uint32_t version, struct pw_properties *properties, uint32_t new_id)
Definition: factory.c:213
const SPA_EXPORT char * pw_get_library_version(void)
Get the currently running version.
Definition: pipewire.c:452
#define PW_VERSION_REGISTRY_PROXY_METHODS
Definition: interfaces.h:381
SPA_EXPORT struct pw_global * pw_core_find_global(struct pw_core *core, uint32_t id)
Find a core global by id.
Definition: core.c:631
struct spa_loop_utils * utils
loop utils
Definition: loop.h:40
#define pw_core_resource_done(r,...)
Definition: interfaces.h:337
#define PW_PERM_RWX
Definition: core.h:80
int pw_type_init(struct pw_type *type)
Initializes the type system.
Definition: type.c:44
void pw_global_add_listener(struct pw_global *global, struct spa_hook *listener, const struct pw_global_events *events, void *data)
Add an event listener on the global.
Definition: global.c:190
void(* global_removed)(void *data, struct pw_global *global)
a global object was removed
Definition: core.h:100
A global object visible to remote clients.
SPA_EXPORT const struct pw_core_info * pw_core_get_info(struct pw_core *core)
Get the core info object.
Definition: core.c:531
PipeWire type support struct.
Definition: type.h:51
struct spa_dict dict
Definition: properties.h:39
void(* free)(void *data)
The core is being freed.
Definition: core.h:94
static int pw_map_for_each(struct pw_map *map, int(*func)(void *item_data, void *data), void *data)
Iterate all map items.
Definition: map.h:171
uint32_t core
Definition: type.h:54
struct pw_loop * pw_data_loop_get_loop(struct pw_data_loop *loop)
Get the loop implementation of this data loop.
Definition: data-loop.c:114
#define pw_core_resource_info(r,...)
Definition: interfaces.h:340
#define PW_MAP_ID_TO_PTR(id)
Convert an id to a pointer that can be inserted into the map.
Definition: map.h:60
SPA_EXPORT struct pw_global * pw_global_new(struct pw_core *core, uint32_t type, uint32_t version, struct pw_properties *properties, void *object)
Create a new global.
Definition: global.c:61
SPA_EXPORT int pw_properties_setf(struct pw_properties *properties, const char *key, const char *format,...)
Set a property value by format.
Definition: properties.c:338
SPA_EXPORT int pw_core_for_each_global(struct pw_core *core, int(*callback)(void *data, struct pw_global *global), void *data)
Iterate the globals of the core.
Definition: core.c:613
void pw_remote_destroy(struct pw_remote *remote)
Destroy a remote.
Definition: remote.c:294
SPA_EXPORT struct pw_data_loop * pw_data_loop_new(struct pw_properties *properties)
Create a new pw_data_loop.
Definition: data-loop.c:60
void(* info_changed)(void *data, struct pw_core_info *info)
The core info changed, use pw_core_get_info() to get the updated info.
Definition: core.h:96
struct pw_port * pw_core_find_port(struct pw_core *core, struct pw_port *other_port, uint32_t id, struct pw_properties *props, uint32_t n_format_filters, struct spa_pod **format_filters, char **error)
Find a port to link with.
Definition: core.c:659
struct pw_resource * pw_resource_new(struct pw_client *client, uint32_t id, uint32_t permissions, uint32_t type, uint32_t version, size_t user_data_size)
Make a new resource for client.
Definition: resource.c:34
SPA_EXPORT struct pw_loop * pw_core_get_main_loop(struct pw_core *core)
get the core main loop
Definition: core.c:565
const SPA_EXPORT char * pw_get_user_name(void)
Get the user name.
Definition: pipewire.c:341
SPA_EXPORT void pw_module_destroy(struct pw_module *module)
Destroy a module.
Definition: module.c:287
int pw_core_find_format(struct pw_core *core, struct pw_port *output, struct pw_port *input, struct pw_properties *props, uint32_t n_format_filters, struct spa_pod **format_filters, struct spa_pod **format, struct spa_pod_builder *builder, char **error)
Find a common format between two ports.
Definition: core.c:755
#define PW_VERSION_RESOURCE_EVENTS
Definition: resource.h:63
SPA_EXPORT void pw_data_loop_destroy(struct pw_data_loop *loop)
Destroy a data loop.
Definition: data-loop.c:90
SPA_EXPORT struct pw_properties * pw_properties_new_dict(const struct spa_dict *dict)
Make a new properties object from the given dictionary.
Definition: properties.c:119
#define PW_PERM_IS_R(p)
Definition: core.h:82
SPA_EXPORT struct pw_core * pw_core_new(struct pw_loop *main_loop, struct pw_properties *properties)
Create a new core object.
Definition: core.c:377
void * pw_resource_get_user_data(struct pw_resource *resource)
Get the user data for the resource, the size was given in pw_resource_new.
Definition: resource.c:113
#define PW_CORE_PROP_HOST_NAME
The host name of the machine.
Definition: core.h:106
SPA_EXPORT void pw_core_destroy(struct pw_core *core)
Destroy a core object.
Definition: core.c:486
static void pw_map_clear(struct pw_map *map)
Clear a map.
Definition: map.h:81
#define PW_CORE_CHANGE_MASK_ALL
Definition: introspect.h:84
const SPA_EXPORT char * pw_properties_get(const struct pw_properties *properties, const char *key)
Get a property.
Definition: properties.c:361
struct pw_loop * pw_core_get_main_loop(struct pw_core *core)
get the core main loop
Definition: core.c:565
int pw_client_update_permissions(struct pw_client *client, const struct spa_dict *dict)
Update the client permissions.
Definition: client.c:452
SPA_EXPORT struct spa_log * pw_log_get(void)
Get the global log interface.
Definition: log.c:45
#define PW_CORE_CHANGE_MASK_PROPS
Definition: introspect.h:83
SPA_EXPORT const struct spa_support * pw_core_get_support(struct pw_core *core, uint32_t *n_support)
Get the core support objects.
Definition: core.c:558
uint32_t pw_global_get_permissions(struct pw_global *global, struct pw_client *client)
Get the permissions of the global for a given client.
Definition: global.c:37
Core methods.
Definition: interfaces.h:114
SPA_EXPORT int pw_properties_set(struct pw_properties *properties, const char *key, const char *value)
Set a property value.
Definition: properties.c:308
struct pw_port * pw_node_get_free_port(struct pw_node *node, enum pw_direction direction)
pw_node_get_free_port:
Definition: node.c:760
void pw_resource_destroy(struct pw_resource *resource)
Destroy a resource.
Definition: resource.c:169
#define PW_VERSION_GLOBAL_EVENTS
Definition: global.h:60
const struct pw_properties * pw_core_get_properties(struct pw_core *core)
Get the core properties.
Definition: core.c:571
struct pw_type * pw_core_get_type(struct pw_core *core)
Get the type object of a core.
Definition: core.c:552
enum pw_direction pw_direction_reverse(enum pw_direction direction)
Reverse the direction.
Definition: pipewire.c:441
SPA_EXPORT struct pw_factory * pw_core_find_factory(struct pw_core *core, const char *name)
Find a factory by name.
Definition: core.c:883
struct spa_type_param param
Definition: type.h:71
const struct pw_core_info * pw_core_get_info(struct pw_core *core)
Get the core info object.
Definition: core.c:531
#define pw_core_resource_error(r,...)
Definition: interfaces.h:338
struct pw_global * pw_core_get_global(struct pw_core *core)
Get the core global object.
Definition: core.c:537
SPA_EXPORT int pw_core_update_properties(struct pw_core *core, const struct spa_dict *dict)
Update core properties.
Definition: core.c:586
SPA_EXPORT struct pw_properties * pw_properties_new(const char *key,...)
Make a new properties object.
Definition: properties.c:89
void pw_log_error(const char *format,...)
SPA_EXPORT const struct pw_properties * pw_core_get_properties(struct pw_core *core)
Get the core properties.
Definition: core.c:571
struct pw_global * pw_core_find_global(struct pw_core *core, uint32_t id)
Find a core global by id.
Definition: core.c:631
static bool pw_map_insert_at(struct pw_map *map, uint32_t id, void *data)
Insert data in the map at an index.
Definition: map.h:119
struct spa_loop * loop
wrapped loop
Definition: loop.h:38
int pw_release_spa_dbus(void *dbus)
Definition: pipewire.c:236
SPA_EXPORT int pw_client_update_properties(struct pw_client *client, const struct spa_dict *dict)
Update client properties.
Definition: client.c:353
Resource events.
Definition: resource.h:62
#define PW_CORE_PROP_NAME
The name of the core.
Definition: core.h:108
void pw_resource_add_listener(struct pw_resource *resource, struct spa_hook *listener, const struct pw_resource_events *events, void *data)
Add an event listener.
Definition: resource.c:119
void * pw_get_spa_dbus(struct pw_loop *loop)
Definition: pipewire.c:202
uint32_t version
Definition: resource.h:64
void pw_log_debug(const char *format,...)
@ PW_PORT_STATE_CONFIGURE
the port is ready for format negotiation
Definition: port.h:53
void(* global_added)(void *data, struct pw_global *global)
a new global object was added
Definition: core.h:98
A collection of key/value pairs.
Definition: properties.h:38
SPA_EXPORT struct pw_global * pw_core_get_global(struct pw_core *core)
Get the core global object.
Definition: core.c:537
SPA_EXPORT void pw_properties_free(struct pw_properties *properties)
Free a properties object.
Definition: properties.c:245
core events emited by the core object added with pw_core_add_listener
Definition: core.h:87