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);
166 struct spa_list
link;
168 struct pw_proxy * (*func) (
struct pw_core *core,
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:323
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:366
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
#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:201
SPA_EXPORT void pw_global_destroy(struct pw_global *global)
Destroy a global.
Definition: global.c:367
void pw_mempool_destroy(struct pw_mempool *pool)
Clear and destroy a pool.
Definition: mem.c:167
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:73
const struct pw_properties * pw_context_get_properties(struct pw_context *context)
Get the context properties.
Definition: impl-core.c:37
const struct spa_support * pw_context_get_support(struct pw_context *context, uint32_t *n_support)
Get the context support objects.
SPA_EXPORT const char * pw_get_user_name(void)
Get the user name.
Definition: pipewire.c:463
#define PW_KEY_APP_PROCESS_ID
process id (pid)
Definition: keys.h:105
struct spa_hook resource_listener
Definition: impl-core.c:38
#define PW_KEY_CPU_MAX_ALIGN
maximum alignment needed to support all CPU optimizations
Definition: keys.h:80
int pw_core_disconnect(struct pw_core *core)
disconnect and destroy a core
Definition: core.c:449
#define PW_KEY_CORE_VERSION
The version of the core.
Definition: keys.h:48
#define PW_KEY_APP_LANGUAGE
application language if applicable, in standard POSIX format.
Definition: keys.h:102
#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:1530
#define PW_PERM_IS_R(p)
Definition: permission.h:50
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:107
void pw_impl_device_destroy(struct pw_impl_device *device)
Definition: impl-device.c:179
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:187
SPA_EXPORT const char * pw_get_host_name(void)
Get the host name.
Definition: pipewire.c:475
#define CLOCK_MIN_QUANTUM
Definition: context.c:46
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:428
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
SPA_EXPORT const char * pw_get_prgname(void)
Get the program name.
Definition: pipewire.c:448
#define PW_KEY_LIBRARY_NAME_DBUS
name of the dbus library to use
Definition: keys.h:67
SPA_EXPORT const char * pw_get_client_name(void)
Get the client name.
Definition: pipewire.c:493
context events emited by the context object added with pw_context_add_listener
Definition: context.h:96
@ PW_NODE_STATE_RUNNING
the node is running
Definition: node.h:55
#define DEFAULT_CLOCK_QUANTUM
Definition: context.c:50
#define PW_KEY_WINDOW_X11_DISPLAY
window system
Definition: keys.h:115
struct spa_hook object_listener
Definition: impl-core.c:39
SPA_EXPORT const char * pw_split_walk(const char *str, const char *delimiter, size_t *len, const char **state)
Split a string based on delimiters.
Definition: utils.c:45
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:108
#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:106
uint32_t pw_get_support(struct spa_support *support, uint32_t max_support)
Definition: pipewire.c:218
SPA_EXPORT void pw_data_loop_destroy(struct pw_data_loop *loop)
Destroy a data loop.
Definition: data-loop.c:162
SPA_EXPORT int pw_properties_update(struct pw_properties *props, const struct spa_dict *dict)
Update properties.
Definition: properties.c:258
struct spa_list link
Definition: context.h:166
#define DEFAULT_VIDEO_WIDTH
Definition: context.c:53
#define DEFAULT_CLOCK_MIN_QUANTUM
Definition: context.c:51
void pw_impl_core_destroy(struct pw_impl_core *core)
Definition: impl-core.c:424
static void pw_map_clear(struct pw_map *map)
Clear a map.
Definition: map.h:87
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
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:200
SPA_EXPORT int pw_properties_set(struct pw_properties *properties, const char *key, const char *value)
Set a property value.
Definition: properties.c:395
#define DEFAULT_VIDEO_RATE_NUM
Definition: context.c:55
#define NAME
Definition: context.c:44
void pw_resource_destroy(struct pw_resource *resource)
Destroy a resource.
Definition: resource.c:265
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.
#define CLOCK_MAX_QUANTUM
Definition: context.c:47
int pw_impl_core_register(struct pw_impl_core *core, struct pw_properties *properties)
Definition: impl-core.c:549
#define PW_KEY_LIBRARY_NAME_SYSTEM
name of the system library to use
Definition: keys.h:65
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 const char * pw_properties_get(const struct pw_properties *properties, const char *key)
Get a property.
Definition: properties.c:451
SPA_EXPORT int pw_impl_node_set_driver(struct pw_impl_node *node, struct pw_impl_node *driver)
Definition: impl-node.c:659
#define DEFAULT_MEM_ALLOW_MLOCK
Definition: context.c:58
#define PW_KEY_CORE_NAME
The name of the core.
Definition: keys.h:46
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:227
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:54
struct pw_control this
Definition: control.c:34
#define PW_KEY_APP_NAME
application keys
Definition: keys.h:95
#define PW_KEY_APP_PROCESS_SESSION_ID
login session of the application, on Unix the value of $XDG_SESSION_ID.
Definition: keys.h:111
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:1697
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:95
#define PW_ID_ANY
Definition: core.h:49
SPA_EXPORT void pw_impl_module_destroy(struct pw_impl_module *module)
Destroy a module.
Definition: impl-module.c:304
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:151
#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:52
@ 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:57
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:56
SPA_EXPORT enum pw_direction pw_direction_reverse(enum pw_direction direction)
Reverse the direction.
Definition: pipewire.c:512
int pw_unload_spa_handle(struct spa_handle *handle)
Definition: pipewire.c:308
#define DEFAULT_CLOCK_RATE
Definition: context.c:49
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:1816
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:330
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