Go to the documentation of this file.
25 #ifndef PIPEWIRE_CONTEXT_H
26 #define PIPEWIRE_CONTEXT_H
32 #include <spa/utils/defs.h>
33 #include <spa/utils/hook.h>
97 #define PW_VERSION_CONTEXT_EVENTS 0
115 size_t user_data_size );
125 struct spa_hook *listener,
160 const char *factory_name,
161 const struct spa_dict *info);
169 const char *
type,
const struct spa_dict *props,
void *object,
170 size_t user_data_size);
static uint32_t int int res
Definition: core.h:326
void(* global_removed)(void *data, struct pw_global *global)
a global object was removed
Definition: context.h:109
int pw_context_set_object(struct pw_context *context, const char *type, void *value)
add an object to the context
int pw_context_update_properties(struct pw_context *context, const struct spa_dict *dict)
Update the context properties.
struct pw_loop * pw_context_get_main_loop(struct pw_context *context)
get the context main loop
struct pw_impl_core * pw_context_create_core(struct pw_context *context, struct pw_properties *properties, size_t user_data_size)
Definition: impl-core.c:373
data for registering export functions
Definition: context.h:165
static void * pw_map_lookup(struct pw_map *map, uint32_t id)
Find an item in the map.
Definition: map.h:169
const char * type
Definition: context.h:167
const SPA_EXPORT char * pw_get_host_name(void)
Get the host name.
Definition: pipewire.c:554
#define pw_log_error(...)
void * pw_context_get_object(struct pw_context *context, const char *type)
get an object from the context
void(* destroy)(void *data)
The context is being destroyed.
Definition: context.h:101
SPA_EXPORT int pw_data_loop_start(struct pw_data_loop *loop)
Start a data loop.
Definition: data-loop.c:206
SPA_EXPORT void pw_global_destroy(struct pw_global *global)
Destroy a global.
Definition: global.c:377
void pw_mempool_destroy(struct pw_mempool *pool)
Clear and destroy a pool.
Definition: mem.c:170
static void pw_map_init(struct pw_map *map, size_t size, size_t extend)
Initialize a map.
Definition: map.h:76
const char * pw_context_find_spa_lib(struct pw_context *context, const char *factory_name)
find the library name for a spa factory
#define PW_KEY_CONTEXT_PROFILE_MODULES
a context profile for modules
Definition: keys.h:63
const struct pw_properties * pw_context_get_properties(struct pw_context *context)
Get the context properties.
SPA_EXPORT char ** pw_split_strv(const char *str, const char *delimiter, int max_tokens, int *n_tokens)
Split a string based on delimiters.
Definition: utils.c:71
const struct spa_support * pw_context_get_support(struct pw_context *context, uint32_t *n_support)
Get the context support objects.
#define PW_KEY_APP_PROCESS_ID
process id (pid)
Definition: keys.h:104
#define PW_KEY_CPU_MAX_ALIGN
maximum alignment needed to support all CPU optimizations
Definition: keys.h:78
int pw_core_disconnect(struct pw_core *core)
disconnect and destroy a core
Definition: core.c:492
#define PW_KEY_CORE_VERSION
The version of the core.
Definition: keys.h:71
#define PW_KEY_APP_LANGUAGE
application language if applicable, in standard POSIX format.
Definition: keys.h:101
#define pw_array_remove(a, p)
Definition: array.h:77
PipeWire client object class.
void pw_context_destroy(struct pw_context *context)
destroy a context object, all resources except the main_loop will be destroyed
SPA_EXPORT void pw_impl_node_destroy(struct pw_impl_node *node)
Destroy a node.
Definition: impl-node.c:1627
#define PW_PERM_IS_R(p)
Definition: permission.h:53
struct spa_loop_utils * utils
loop utils
Definition: loop.h:45
uint32_t pw_global_get_permissions(struct pw_global *global, struct pw_impl_client *client)
Get the permissions of the global for a given client.
Definition: global.c:45
void * pw_context_get_user_data(struct pw_context *context)
Get the context user data.
#define pw_array_for_each(pos, array)
Definition: array.h:67
struct spa_handle * pw_context_load_spa_handle(struct pw_context *context, const char *factory_name, const struct spa_dict *info)
const struct pw_export_type * pw_context_find_export_type(struct pw_context *context, const char *type)
find information about registered export type
Definition: pipewire.c:58
A global object visible to remote clients.
struct spa_dict dict
dictionary of key/values
Definition: properties.h:46
#define PW_KEY_APP_PROCESS_USER
user name
Definition: keys.h:106
void pw_impl_device_destroy(struct pw_impl_device *device)
Definition: impl-device.c:180
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:192
#define CLOCK_MIN_QUANTUM
Definition: context.c:47
void(* check_access)(void *data, struct pw_impl_client *client)
a new client object is added
Definition: context.h:105
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:433
SPA_EXPORT struct pw_impl_module * pw_context_load_module(struct pw_context *context, const char *name, const char *args, struct pw_properties *properties)
Load a module.
Definition: impl-module.c:157
#define PW_KEY_LIBRARY_NAME_DBUS
name of the dbus library to use
Definition: keys.h:57
context events emitted by the context object added with pw_context_add_listener
Definition: context.h:96
const SPA_EXPORT char * pw_get_client_name(void)
Get the client name.
Definition: pipewire.c:578
@ PW_NODE_STATE_RUNNING
the node is running
Definition: node.h:55
#define DEFAULT_CLOCK_QUANTUM
Definition: context.c:51
#define PW_KEY_WINDOW_X11_DISPLAY
window system
Definition: keys.h:114
SPA_EXPORT void pw_impl_client_destroy(struct pw_impl_client *client)
Destroy a client object.
Definition: impl-client.c:557
const SPA_EXPORT char * pw_get_user_name(void)
Get the user name.
Definition: pipewire.c:542
struct pw_global * pw_context_find_global(struct pw_context *context, uint32_t id)
Find a context global by id.
#define PW_KEY_APP_PROCESS_HOST
host name
Definition: keys.h:107
#define pw_log_debug(...)
Represents an object on the client side.
struct spa_system * system
system utils
Definition: loop.h:42
#define PW_KEY_APP_PROCESS_BINARY
binary name
Definition: keys.h:105
uint32_t pw_get_support(struct spa_support *support, uint32_t max_support)
Definition: pipewire.c:220
SPA_EXPORT void pw_data_loop_destroy(struct pw_data_loop *loop)
Destroy a data loop.
Definition: data-loop.c:164
SPA_EXPORT int pw_properties_update(struct pw_properties *props, const struct spa_dict *dict)
Update properties.
Definition: properties.c:263
struct spa_list link
Definition: context.h:166
#define DEFAULT_VIDEO_WIDTH
Definition: context.c:54
#define DEFAULT_CLOCK_MIN_QUANTUM
Definition: context.c:52
void pw_impl_core_destroy(struct pw_impl_core *core)
Definition: impl-core.c:431
static void pw_map_clear(struct pw_map *map)
Clear a map.
Definition: map.h:87
const SPA_EXPORT char * pw_properties_get(const struct pw_properties *properties, const char *key)
Get a property.
Definition: properties.c:456
int pw_context_register_export_type(struct pw_context *context, struct pw_export_type *type)
register a type that can be exported on a context_proxy.
void(* free)(void *data)
The context is being freed.
Definition: context.h:103
static uint32_t int int const char va_list args
Definition: core.h:327
struct pw_context * pw_context_new(struct pw_loop *main_loop, struct pw_properties *props, size_t user_data_size)
Make a new context object for a given main_loop.
static void * pw_array_add(struct pw_array *arr, size_t size)
Add ref size bytes to arr.
Definition: array.h:127
SPA_EXPORT struct pw_properties * pw_properties_copy(const struct pw_properties *properties)
Copy a properties object.
Definition: properties.c:205
SPA_EXPORT int pw_properties_set(struct pw_properties *properties, const char *key, const char *value)
Set a property value.
Definition: properties.c:400
#define DEFAULT_VIDEO_RATE_NUM
Definition: context.c:56
#define NAME
Definition: context.c:45
void pw_resource_destroy(struct pw_resource *resource)
Destroy a resource.
Definition: resource.c:264
int pw_context_for_each_global(struct pw_context *context, int(*callback)(void *data, struct pw_global *global), void *data)
Iterate the globals of the context.
vsnprintf(buffer, sizeof(buffer), message, args)
#define CLOCK_MAX_QUANTUM
Definition: context.c:48
int pw_impl_core_register(struct pw_impl_core *core, struct pw_properties *properties)
Definition: impl-core.c:561
#define PW_KEY_LIBRARY_NAME_SYSTEM
name of the system library to use
Definition: keys.h:55
void pw_context_add_listener(struct pw_context *context, struct spa_hook *listener, const struct pw_context_events *events, void *data)
Add a new event listener to a context.
SPA_EXPORT int pw_impl_node_set_driver(struct pw_impl_node *node, struct pw_impl_node *driver)
Definition: impl-node.c:726
#define DEFAULT_MEM_ALLOW_MLOCK
Definition: context.c:59
#define PW_KEY_CORE_NAME
The name of the core.
Definition: keys.h:68
struct spa_handle * pw_load_spa_handle(const char *lib, const char *factory_name, const struct spa_dict *info, uint32_t n_support, const struct spa_support support[])
Definition: pipewire.c:229
int pw_context_add_spa_lib(struct pw_context *context, const char *factory_regex, const char *lib)
add a spa library for the given factory_name regex
struct pw_mempool * pw_mempool_new(struct pw_properties *props)
Create a new memory pool.
Definition: mem.c:133
#define DEFAULT_VIDEO_HEIGHT
Definition: context.c:55
struct pw_control this
Definition: control.c:34
#define PW_KEY_APP_NAME
application keys
Definition: keys.h:94
#define PW_KEY_APP_PROCESS_SESSION_ID
login session of the application, on Unix the value of $XDG_SESSION_ID.
Definition: keys.h:110
int pw_impl_link_prepare(struct pw_impl_link *this)
Definition: impl-link.c:662
struct pw_impl_port * pw_impl_node_find_port(struct pw_impl_node *node, enum pw_direction direction, uint32_t port_id)
Find the port with direction and port_id or NULL when not found.
Definition: impl-node.c:1791
uint32_t version
Definition: context.h:98
SPA_EXPORT struct pw_properties * pw_properties_new(const char *key,...)
Make a new properties object.
Definition: properties.c:98
#define PW_ID_ANY
Definition: core.h:52
SPA_EXPORT void pw_impl_module_destroy(struct pw_impl_module *module)
Destroy a module.
Definition: impl-module.c:304
SPA_EXPORT void pw_free_strv(char **str)
Free a NULL terminated array of strings.
Definition: utils.c:105
SPA_EXPORT struct pw_data_loop * pw_data_loop_new(const struct spa_dict *props)
Create a new pw_data_loop.
Definition: data-loop.c:153
#define PW_DIRECTION_OUTPUT
Definition: port.h:49
struct spa_loop * loop
wrapped loop
Definition: loop.h:43
pw_node_state
Definition: node.h:48
#define DEFAULT_CLOCK_MAX_QUANTUM
Definition: context.c:53
const SPA_EXPORT char * pw_get_prgname(void)
Get the program name.
Definition: pipewire.c:511
@ PW_NODE_STATE_IDLE
the node is running but there is no active port
Definition: node.h:53
#define DEFAULT_LINK_MAX_BUFFERS
Definition: context.c:58
void(* global_added)(void *data, struct pw_global *global)
a new global object was added
Definition: context.h:107
#define DEFAULT_VIDEO_RATE_DENOM
Definition: context.c:57
SPA_EXPORT enum pw_direction pw_direction_reverse(enum pw_direction direction)
Reverse the direction.
Definition: pipewire.c:597
int pw_unload_spa_handle(struct spa_handle *handle)
Definition: pipewire.c:308
#define DEFAULT_CLOCK_RATE
Definition: context.c:50
SPA_EXPORT int pw_impl_node_set_state(struct pw_impl_node *node, enum pw_node_state state)
Set the node state.
Definition: impl-node.c:1922
Definition: pipewire.c:70
A collection of key/value pairs.
Definition: properties.h:45
SPA_EXPORT void pw_properties_free(struct pw_properties *properties)
Free a properties object.
Definition: properties.c:335
PipeWire device interface.
static void pw_array_init(struct pw_array *arr, size_t extend)
Initialize the array with given extend.
Definition: array.h:85
@ PW_IMPL_PORT_STATE_CONFIGURE
the port is ready for format negotiation
Definition: impl-port.h:53