Go to the documentation of this file.
25 #ifndef PIPEWIRE_CONTEXT_H
26 #define PIPEWIRE_CONTEXT_H
65 struct pw_impl_client;
73 #define PW_VERSION_CONTEXT_EVENTS 0
91 size_t user_data_size );
128 int (*callback) (
void *
data,
struct pw_global *global),
142 const char *factory_name,
150 struct pw_proxy * (*func) (
struct pw_core *core,
152 size_t user_data_size);
void(* global_removed)(void *data, struct pw_global *global)
a global object was removed
Definition: context.h:85
enum spa_log_level pw_log_level
The global log level.
Definition: log.c:39
struct pw_loop * pw_context_get_main_loop(struct pw_context *context)
get the context main loop
Definition: context.c:567
#define PW_PERM_IS_R(p)
Definition: permission.h:56
int int const char * pw_properties_get(const struct pw_properties *properties, const char *key)
Get a property.
Definition: properties.c:487
Definition: module-filter-chain.c:176
void pw_work_queue_destroy(struct pw_work_queue *queue)
Destroy a work queue.
Definition: work-queue.c:132
spa_direction
Definition: defs.h:78
data for registering export functions
Definition: context.h:147
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.
Definition: context.c:1370
#define PW_KEY_APP_PROCESS_USER
user name
Definition: src/pipewire/keys.h:120
const char * type
Definition: context.h:149
int pw_context_find_format(struct pw_context *context, struct pw_impl_port *output, struct pw_impl_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: context.c:800
struct pw_mempool * pw_mempool_new(struct pw_properties *props)
Create a new memory pool.
Definition: mem.c:133
const char * pw_get_prgname(void)
Get the program name.
Definition: pipewire.c:653
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:412
int pw_data_loop_start(struct pw_data_loop *loop)
Start the processing thread.
Definition: data-loop.c:204
int pw_properties_update(struct pw_properties *props, const struct spa_dict *dict)
Update properties.
Definition: properties.c:298
const struct spa_support * pw_context_get_support(struct pw_context *context, uint32_t *n_support)
Get the context support objects.
Definition: context.c:560
#define PW_KEY_APP_PROCESS_ID
process id (pid)
Definition: src/pipewire/keys.h:118
void(* destroy)(void *data)
The context is being destroyed.
Definition: context.h:77
struct pw_context * pw_context_new(struct pw_loop *main_loop, struct pw_properties *properties, size_t user_data_size)
Create a new context object.
Definition: context.c:249
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.
Definition: context.c:551
#define SPA_SUPPORT_INIT(type, data)
Definition: plugin.h:107
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:1928
void pw_mempool_destroy(struct pw_mempool *pool)
Clear and destroy a pool.
Definition: mem.c:168
#define SPA_NAME_SUPPORT_DBUS
A DBUS interface.
Definition: names.h:42
struct spa_pod_builder_state state
Definition: builder.h:67
int pw_context_add_spa_lib(struct pw_context *context, const char *factory_regexp, const char *lib)
add a spa library for the given factory_name regex
Definition: context.c:1303
@ PW_NODE_STATE_RUNNING
the node is running
Definition: src/pipewire/node.h:63
struct pw_impl_port * pw_context_find_port(struct pw_context *context, struct pw_impl_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: context.c:664
#define PW_KEY_CONFIG_NAME
a config file name
Definition: src/pipewire/keys.h:74
int pw_context_recalc_graph(struct pw_context *context, const char *reason)
Definition: context.c:1092
user data to add to an object
Definition: filter.c:75
#define SPA_FRACTION(num, denom)
Definition: defs.h:103
#define SPA_CLAMP(v, low, high)
Definition: defs.h:135
bool spa_streq(const char *s1, const char *s2)
Definition: string.h:50
#define spa_list_for_each(pos, head, member)
Definition: list.h:111
const char * pw_node_state_as_string(enum pw_node_state state)
Convert a pw_node_state to a readable string.
Definition: introspect.c:34
#define pw_thread_utils_drop_rt(...)
Definition: src/pipewire/thread.h:49
#define spa_cpu_get_vm_type(c)
Definition: cpu.h:148
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
bool spa_atou32(const char *str, uint32_t *val, int base)
Convert str to an uint32_t with the given base and store the result in val.
Definition: string.h:137
#define spa_aprintf(_fmt,...)
Definition: defs.h:323
uint32_t pw_get_support(struct spa_support *support, uint32_t max_support)
Definition: pipewire.c:233
Definition: src/pipewire/loop.h:47
#define SPA_EXPORT
Definition: defs.h:208
@ PW_NODE_STATE_IDLE
the node is running but there is no active port
Definition: src/pipewire/node.h:61
const char * type
Definition: context.c:1393
struct spa_thread * pw_data_loop_get_thread(struct pw_data_loop *loop)
Get the thread object.
Definition: data-loop.c:266
Definition: alsa-monitor.c:82
Definition: module-filter-chain.c:155
const char * pw_get_user_name(void)
Get the user name.
Definition: pipewire.c:663
struct spa_loop_utils * utils
loop utils
Definition: src/pipewire/loop.h:51
void pw_impl_core_destroy(struct pw_impl_core *core)
Definition: impl-core.c:479
int spa_node_port_enum_params_sync(struct spa_node *node, enum spa_direction direction, uint32_t port_id, uint32_t id, uint32_t *index, const struct spa_pod *filter, struct spa_pod **param, struct spa_pod_builder *builder)
Definition: build-12775836/doc/spa/node/utils.h:92
#define SPA_CPU_VM_NONE
Definition: cpu.h:93
void spa_hook_list_append(struct spa_hook_list *list, struct spa_hook *hook, const void *funcs, void *data)
Append a hook.
Definition: hook.h:316
void pw_resource_destroy(struct pw_resource *resource)
Destroy a resource.
Definition: resource.c:264
struct pw_work_queue * pw_context_get_work_queue(struct pw_context *context)
Get the work queue from the context: Since 0.3.26.
Definition: context.c:573
struct pw_data_loop * pw_data_loop_new(const struct spa_dict *props)
Make a new loop.
Definition: data-loop.c:153
#define SPA_PTROFF(ptr_, offset_, type_)
Return the address (buffer + offset) as pointer of type.
Definition: defs.h:159
#define pw_array_for_each(pos, array)
Definition: array.h:72
#define pw_thread_utils_acquire_rt(...)
Definition: src/pipewire/thread.h:48
Definition: pipewire.c:68
const char * pw_get_client_name(void)
Get the client name.
Definition: pipewire.c:711
#define SPA_PRINTF_FUNC(fmt, arg1)
Definition: defs.h:205
#define pw_array_remove(a, p)
Definition: array.h:82
#define SPA_POD_BUILDER_INIT(buffer, size)
Definition: builder.h:71
#define SPA_TYPE_INTERFACE_DataLoop
Definition: build-12775836/doc/spa/support/loop.h:42
struct spa_dict dict
dictionary of key/values
Definition: properties.h:50
#define SPA_CONTAINER_OF(p, t, m)
Definition: defs.h:170
@ SPA_PARAM_Format
configured format as SPA_TYPE_OBJECT_Format
Definition: param.h:48
void pw_impl_module_destroy(struct pw_impl_module *module)
Destroy a module.
Definition: impl-module.c:293
#define spa_list_consume(pos, head, member)
Definition: list.h:96
enum pw_direction pw_direction_reverse(enum pw_direction direction)
Reverse the direction.
Definition: pipewire.c:729
int pw_context_debug_port_params(struct pw_context *this, struct spa_node *node, enum spa_direction direction, uint32_t port_id, uint32_t id, int err, const char *debug,...)
Definition: context.c:745
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.
Definition: context.c:619
#define PW_KEY_CORE_NAME
The name of the core.
Definition: src/pipewire/keys.h:82
int pw_impl_core_register(struct pw_impl_core *core, struct pw_properties *properties)
Definition: impl-core.c:609
void(* check_access)(void *data, struct pw_impl_client *client)
a new client object is added
Definition: context.h:81
int pw_impl_node_set_state(struct pw_impl_node *node, enum pw_node_state state)
Set the node state.
Definition: impl-node.c:2057
void * value
Definition: context.c:1394
context events emitted by the context object added with pw_context_add_listener
Definition: context.h:72
#define PW_DIRECTION_OUTPUT
Definition: port.h:58
unsigned char active
Definition: bluez-autoswitch.c:82
void spa_list_remove(struct spa_list *elem)
Definition: list.h:69
#define DEFAULT_CLOCK_QUANTUM
Definition: context.c:53
#define SPA_N_ELEMENTS(arr)
Definition: defs.h:109
struct pw_global * pw_context_find_global(struct pw_context *context, uint32_t id)
Find a context global by id.
Definition: context.c:636
const struct pw_export_type * pw_context_find_export_type(struct pw_context *context, const char *type)
find information about registered export type
Definition: context.c:1382
#define PW_KEY_CONFIG_PREFIX
a config prefix directory
Definition: src/pipewire/keys.h:73
Definition: build-12775836/doc/spa/node/node.h:53
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:295
const char * pw_get_host_name(void)
Get the host name.
Definition: pipewire.c:675
#define PW_KEY_APP_PROCESS_BINARY
binary name
Definition: src/pipewire/keys.h:119
#define PW_KEY_APP_NAME
application keys
Definition: src/pipewire/keys.h:108
struct spa_system * system
system utils
Definition: src/pipewire/loop.h:48
void spa_json_init(struct spa_json *iter, const char *data, size_t size)
Definition: json.h:59
int pw_context_parse_conf_section(struct pw_context *context, struct pw_properties *conf, const char *section)
Definition: conf.c:645
int pw_core_disconnect(struct pw_core *core)
disconnect and destroy a core
Definition: core.c:488
struct spa_list link
Definition: context.h:148
#define DEFAULT_VIDEO_WIDTH
Definition: context.c:57
#define PW_KEY_APP_PROCESS_SESSION_ID
login session of the application, on Unix the value of $XDG_SESSION_ID.
Definition: src/pipewire/keys.h:124
#define DEFAULT_CLOCK_MIN_QUANTUM
Definition: context.c:54
@ SPA_LOG_LEVEL_DEBUG
Definition: build-12775836/doc/spa/support/log.h:51
#define SPA_FLAG_IS_SET(field, flag)
Definition: defs.h:73
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:191
void spa_list_init(struct spa_list *list)
Definition: list.h:44
#define spa_list_for_each_safe(pos, tmp, head, member)
Definition: list.h:129
void spa_pod_builder_init(struct spa_pod_builder *builder, void *data, uint32_t size)
Definition: builder.h:96
#define PW_KEY_LIBRARY_NAME_SYSTEM
name of the system library to use
Definition: src/pipewire/keys.h:60
Definition: utils/dict.h:48
int pw_context_update_properties(struct pw_context *context, const struct spa_dict *dict)
Update context properties.
Definition: context.c:600
@ PW_NODE_STATE_SUSPENDED
the node is suspended, the device might be closed
Definition: src/pipewire/node.h:59
const char * spa_dict_lookup(const struct spa_dict *dict, const char *key)
Definition: utils/dict.h:99
int pw_context_set_object(struct pw_context *context, const char *type, void *value)
add an object to the context
Definition: context.c:1408
int spa_json_get_string(struct spa_json *iter, char *res, int maxlen)
Definition: json.h:360
#define SPA_NODE_FLAG_NEED_CONFIGURE
node needs configuration before it can be started.
Definition: build-12775836/doc/spa/node/node.h:75
@ SPA_LOG_LEVEL_ERROR
Definition: build-12775836/doc/spa/support/log.h:48
void * spa_support_find(const struct spa_support *support, uint32_t n_support, const char *type)
Find a support item of the given type.
Definition: plugin.h:95
@ SPA_PARAM_EnumFormat
available formats as SPA_TYPE_OBJECT_Format
Definition: param.h:47
const struct pw_properties * pw_context_get_properties(struct pw_context *context)
Get the context properties.
Definition: context.c:581
void(* free)(void *data)
The context is being freed.
Definition: context.h:79
struct spa_handle * pw_context_load_spa_handle(struct pw_context *context, const char *factory_name, const struct spa_dict *info)
Definition: context.c:1340
#define spa_strerror(err)
Definition: result.h:51
uint32_t denom
Definition: defs.h:106
int pw_conf_load_conf(const char *prefix, const char *name, struct pw_properties *conf)
Definition: conf.c:344
void * pw_context_get_object(struct pw_context *context, const char *type)
get an object from the context
Definition: context.c:1430
const char * pw_context_find_spa_lib(struct pw_context *context, const char *factory_name)
find the library name for a spa factory
Definition: context.c:1328
#define PW_KEY_APP_LANGUAGE
application language if applicable, in standard POSIX format.
Definition: src/pipewire/keys.h:115
@ PW_IMPL_PORT_STATE_CONFIGURE
the port is ready for format negotiation
Definition: impl-port.h:52
#define PW_KEY_APP_PROCESS_HOST
host name
Definition: src/pipewire/keys.h:121
#define DEFAULT_VIDEO_RATE_NUM
Definition: context.c:59
#define pw_log_debug(...)
Definition: src/pipewire/log.h:89
#define PW_KEY_CORE_VERSION
The version of the core.
Definition: src/pipewire/keys.h:85
void pw_context_destroy(struct pw_context *context)
Destroy a context object.
Definition: context.c:464
#define PW_KEY_WINDOW_X11_DISPLAY
window system
Definition: src/pipewire/keys.h:128
Definition: module-protocol-native.c:103
#define NAME
Definition: context.c:50
#define spa_handle_get_interface(h,...)
Definition: plugin.h:73
void pw_impl_device_destroy(struct pw_impl_device *device)
Definition: impl-device.c:194
void pw_global_destroy(struct pw_global *global)
Destroy a global.
Definition: global.c:369
void pw_log_set_level(enum spa_log_level level)
Configure the logging level.
Definition: log.c:71
int pw_unload_spa_handle(struct spa_handle *handle)
Definition: pipewire.c:321
int pw_settings_init(struct pw_context *context)
Definition: settings.c:117
void pw_settings_clean(struct pw_context *context)
Definition: settings.c:147
struct pw_context * context
Definition: settings.c:43
int pw_properties_update_string(struct pw_properties *props, const char *str, size_t size)
Update the properties from the given string, overwriting any existing keys with the new values from s...
Definition: properties.c:154
int pw_properties_set(struct pw_properties *properties, const char *key, const char *value)
Set a property value.
Definition: properties.c:435
#define PW_ID_ANY
Definition: core.h:69
#define DEFAULT_CLOCK_POWER_OF_TWO_QUANTUM
Definition: context.c:56
void pw_data_loop_destroy(struct pw_data_loop *loop)
Destroy the loop.
Definition: data-loop.c:163
#define DEFAULT_MEM_WARN_MLOCK
Definition: context.c:62
#define DEFAULT_MEM_ALLOW_MLOCK
Definition: context.c:63
#define pw_log_warn(...)
Definition: src/pipewire/log.h:87
#define SPA_TYPE_INTERFACE_System
a collection of core system functions
Definition: system.h:48
pw_node_state
The different node states.
Definition: src/pipewire/node.h:56
#define DEFAULT_VIDEO_HEIGHT
Definition: context.c:58
struct pw_control this
Definition: control.c:34
int spa_json_enter_array(struct spa_json *iter, struct spa_json *sub)
Definition: json.h:224
struct pw_properties * pw_properties_copy(const struct pw_properties *properties)
Copy a properties object.
Definition: properties.c:222
#define SPA_TYPE_INTERFACE_DataSystem
Definition: system.h:49
void pw_impl_client_destroy(struct pw_impl_client *client)
Destroy a previously created client.
Definition: impl-client.c:577
const struct spa_type_info spa_type_param[]
Definition: param/type-info.h:46
int pw_impl_link_prepare(struct pw_impl_link *this)
Definition: impl-link.c:678
void * pw_context_get_user_data(struct pw_context *context)
Get the context user data.
Definition: context.c:545
#define SPA_TYPE_INTERFACE_Loop
Definition: build-12775836/doc/spa/support/loop.h:41
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:242
#define pw_log_info(...)
Definition: src/pipewire/log.h:88
uint32_t version
Definition: context.h:74
void pw_impl_node_destroy(struct pw_impl_node *node)
Destroy a node.
Definition: impl-node.c:1707
struct pw_work_queue * pw_work_queue_new(struct pw_loop *loop)
Create a new PipeWire Work Queue Object.
Definition: work-queue.c:98
void spa_hook_list_init(struct spa_hook_list *list)
Initialize a hook list to the empty list.
Definition: hook.h:305
int pw_impl_node_set_driver(struct pw_impl_node *node, struct pw_impl_node *driver)
Definition: impl-node.c:771
struct spa_loop * loop
wrapped loop
Definition: src/pipewire/loop.h:49
uint32_t num
Definition: defs.h:105
#define SPA_TYPE_INTERFACE_LoopUtils
Definition: build-12775836/doc/spa/support/loop.h:50
#define DEFAULT_CLOCK_MAX_QUANTUM
Definition: context.c:55
#define spa_cpu_get_max_align(c)
Definition: cpu.h:147
Extra supporting infrastructure passed to the init() function of a factory.
Definition: plugin.h:89
#define DEFAULT_LINK_MAX_BUFFERS
Definition: context.c:61
struct pw_properties * pw_properties_new(const char *key,...) 1
Make a new properties object.
Definition: properties.c:98
void(* global_added)(void *data, struct pw_global *global)
a new global object was added
Definition: context.h:83
#define DEFAULT_VIDEO_RATE_DENOM
Definition: context.c:60
int pw_properties_setf(struct pw_properties *properties, const char *key, const char *format,...) 1(3
#define PW_KEY_LIBRARY_NAME_DBUS
name of the dbus library to use
Definition: src/pipewire/keys.h:62
#define SPA_TYPE_INTERFACE_CPU
The CPU features interface.
Definition: cpu.h:49
#define DEFAULT_CLOCK_RATE
Definition: context.c:52
#define SPA_TYPE_INTERFACE_DBus
Definition: dbus.h:39
Definition: pipewire.c:80
Definition: properties.h:49
void spa_hook_list_clean(struct spa_hook_list *list)
Remove all hooks from the list.
Definition: hook.h:344
void pw_properties_free(struct pw_properties *properties)
Free a properties object.
Definition: properties.c:364
Definition: context.c:1392
const char * pw_context_get_conf_section(struct pw_context *context, const char *section)
Get a config section for this context.
Definition: context.c:587
#define SPA_KEY_LIBRARY_NAME
the name of a library.
Definition: plugin.h:216
#define pw_log_error(...)
Definition: src/pipewire/log.h:86
const char * spa_debug_type_find_name(const struct spa_type_info *info, uint32_t type)
Definition: types.h:68
#define spa_list_append(list, item)
Definition: list.h:81
#define PW_KEY_CPU_MAX_ALIGN
maximum alignment needed to support all CPU optimizations
Definition: src/pipewire/keys.h:92