PipeWire: pipewire/context.h Source File

PipeWire 1.6.5

Loading...
Searching...
No Matches
context.h
Go to the documentation of this file.
1/* PipeWire */
2/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
3/* SPDX-License-Identifier: MIT */
4
5#ifndef PIPEWIRE_CONTEXT_H
6#define PIPEWIRE_CONTEXT_H
7
8#include <spa/utils/defs.h>
9#include <spa/utils/hook.h>
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
37
42struct pw_context;
43
44struct pw_global;
45struct pw_impl_client;
46 struct pw_impl_node;
47
48#include <pipewire/core.h>
49#include <pipewire/loop.h>
50#include <pipewire/properties.h>
51
53 struct pw_context_events {
54#define PW_VERSION_CONTEXT_EVENTS 1
55 uint32_t version;
56
58 void (*destroy) (void *data);
60 void (*free) (void *data);
61 /** a new client object is added */
62 void (*check_access) (void *data, struct pw_impl_client *client);
64 void (*global_added) (void *data, struct pw_global *global);
66 void (*global_removed) (void *data, struct pw_global *global);
67
69 void (*driver_added) (void *data, struct pw_impl_node *node);
71 void (*driver_removed) (void *data, struct pw_impl_node *node);
72};
73
82struct pw_context * pw_context_new(struct pw_loop *main_loop,
83 struct pw_properties *props,
84 size_t user_data_size);
85
87void pw_context_destroy(struct pw_context *context);
88
90void *pw_context_get_user_data(struct pw_context *context);
91
93void pw_context_add_listener(struct pw_context *context,
94 struct spa_hook *listener,
95 const struct pw_context_events *events,
96 void *data);
97
99const struct pw_properties *pw_context_get_properties(struct pw_context *context);
100
102int pw_context_update_properties(struct pw_context *context, const struct spa_dict *dict);
103
106const char *pw_context_get_conf_section(struct pw_context *context, const char *section);
108int pw_context_parse_conf_section(struct pw_context *context,
109 struct pw_properties *conf, const char *section);
110
112int pw_context_conf_update_props(struct pw_context *context, const char *section,
113 struct pw_properties *props);
115int pw_context_conf_section_for_each(struct pw_context *context, const char *section,
116 int (*callback) (void *data, const char *location, const char *section,
117 const char *str, size_t len),
118 void *data);
120int pw_context_conf_section_match_rules(struct pw_context *context, const char *section,
121 const struct spa_dict *props,
122 int (*callback) (void *data, const char *location, const char *action,
123 const char *str, size_t len),
124 void *data);
125
127const struct spa_support *pw_context_get_support(struct pw_context *context, uint32_t *n_support);
128
130struct pw_loop *pw_context_get_main_loop(struct pw_context *context);
131
135struct pw_data_loop *pw_context_get_data_loop(struct pw_context *context);
136
139struct pw_loop *pw_context_acquire_loop(struct pw_context *context, const struct spa_dict *props);
142void pw_context_release_loop(struct pw_context *context, struct pw_loop *loop);
143
145struct pw_work_queue *pw_context_get_work_queue(struct pw_context *context);
146
148struct pw_timer_queue *pw_context_get_timer_queue(struct pw_context *context);
149
151struct pw_mempool *pw_context_get_mempool(struct pw_context *context);
152
157int pw_context_for_each_global(struct pw_context *context,
158 int (*callback) (void *data, struct pw_global *global),
159 void *data);
160
165struct pw_global *pw_context_find_global(struct pw_context *context,
166 uint32_t id );
167
169int pw_context_add_spa_lib(struct pw_context *context, const char *factory_regex, const char *lib);
170
172const char * pw_context_find_spa_lib(struct pw_context *context, const char *factory_name);
173
175struct spa_handle *pw_context_load_spa_handle(struct pw_context *context,
176 const char *factory_name,
177 const struct spa_dict *info);
178
179
181struct pw_export_type {
182 struct spa_list link;
183 const char *type;
184 struct pw_proxy * (*func) (struct pw_core *core,
185 const char *type, const struct spa_dict *props, void *object,
186 size_t user_data_size);
187};
188
190 * extension modules */
191 int pw_context_register_export_type(struct pw_context *context, struct pw_export_type *type);
193const struct pw_export_type *pw_context_find_export_type(struct pw_context *context, const char *type);
194
197
203int pw_context_set_object(struct pw_context *context, const char *type, void *value);
210void *pw_context_get_object(struct pw_context *context, const char *type);
211
215#ifdef __cplusplus
216}
217#endif
218
219#endif /* PIPEWIRE_CONTEXT_H */
core.h
pipewire/core.h
defs.h
spa/utils/defs.h
pw_context_get_user_data
void * pw_context_get_user_data(struct pw_context *context)
Get the context user data.
Definition context.c:698
pw_context_load_spa_handle
struct spa_handle * pw_context_load_spa_handle(struct pw_context *context, const char *factory_name, const struct spa_dict *info)
Load a SPA handle from a context.
Definition context.c:1885
pw_context_set_object
int pw_context_set_object(struct pw_context *context, const char *type, void *value)
add an object to the context
Definition context.c:1953
pw_context_get_timer_queue
struct pw_timer_queue * pw_context_get_timer_queue(struct pw_context *context)
Get the timer queue from the context: Since 1.6.0.
Definition context.c:843
pw_context_register_export_type
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:1915
pw_context_destroy
void pw_context_destroy(struct pw_context *context)
destroy a context object, all resources except the main_loop will be destroyed
Definition context.c:608
pw_context_add_listener
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:704
pw_context_get_conf_section
const char * pw_context_get_conf_section(struct pw_context *context, const char *section)
Get a config section for this context.
Definition context.c:863
pw_context_update_properties
int pw_context_update_properties(struct pw_context *context, const struct spa_dict *dict)
Update the context properties.
Definition context.c:876
pw_context_conf_section_for_each
int pw_context_conf_section_for_each(struct pw_context *context, const char *section, int(*callback)(void *data, const char *location, const char *section, const char *str, size_t len), void *data)
emit callback for all config sections.
Definition conf.c:1398
pw_context_get_object
void * pw_context_get_object(struct pw_context *context, const char *type)
get an object from the context
Definition context.c:1987
pw_context_find_export_type
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:1927
pw_context_conf_section_match_rules
int pw_context_conf_section_match_rules(struct pw_context *context, const char *section, const struct spa_dict *props, int(*callback)(void *data, const char *location, const char *action, const char *str, size_t len), void *data)
emit callback for all matched properties.
Definition conf.c:1433
pw_context_conf_update_props
int pw_context_conf_update_props(struct pw_context *context, const char *section, struct pw_properties *props)
update properties from a section into props.
Definition conf.c:1390
pw_context_get_properties
const struct pw_properties * pw_context_get_properties(struct pw_context *context)
Get the context properties.
Definition context.c:857
pw_context_find_spa_lib
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:1873
pw_context_release_loop
void pw_context_release_loop(struct pw_context *context, struct pw_loop *loop)
Release a data-loop.
Definition context.c:821
pw_context_get_mempool
struct pw_mempool * pw_context_get_mempool(struct pw_context *context)
Get the memory pool from the context: Since 0.3.74.
Definition context.c:851
pw_context_for_each_global
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:908
pw_context_get_data_loop
struct pw_data_loop * pw_context_get_data_loop(struct pw_context *context)
Get the context data loop.
Definition context.c:791
pw_context_get_main_loop
struct pw_loop * pw_context_get_main_loop(struct pw_context *context)
Get the context main loop.
Definition context.c:734
pw_context_new
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.
Definition context.c:395
pw_context_add_spa_lib
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
Definition context.c:1848
pw_context_acquire_loop
struct pw_loop * pw_context_acquire_loop(struct pw_context *context, const struct spa_dict *props)
Get a data-loop.
Definition context.c:798
pw_context_get_work_queue
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:837
pw_context_get_support
const struct spa_support * pw_context_get_support(struct pw_context *context, uint32_t *n_support)
Get the context support objects.
Definition context.c:728
pw_context_find_global
struct pw_global * pw_context_find_global(struct pw_context *context, uint32_t id)
Find a context global by id.
Definition context.c:925
pw_context_parse_conf_section
int pw_context_parse_conf_section(struct pw_context *context, struct pw_properties *conf, const char *section)
Parse a standard config section for this context.
Definition conf.c:1408
hook.h
spa/utils/hook.h
properties.h
pipewire/properties.h
loop.h
pipewire/loop.h
pw_context_events
context events emitted by the context object added with pw_context_add_listener
Definition context.h:61
pw_context_events::global_added
void(* global_added)(void *data, struct pw_global *global)
a new global object was added
Definition context.h:73
pw_context_events::destroy
void(* destroy)(void *data)
The context is being destroyed.
Definition context.h:67
pw_context_events::driver_removed
void(* driver_removed)(void *data, struct pw_impl_node *node)
a driver was removed, since 0.3.75 version:1
Definition context.h:80
pw_context_events::global_removed
void(* global_removed)(void *data, struct pw_global *global)
a global object was removed
Definition context.h:75
pw_context_events::version
uint32_t version
Definition context.h:64
pw_context_events::check_access
void(* check_access)(void *data, struct pw_impl_client *client)
a new client object is added
Definition context.h:71
pw_context_events::driver_added
void(* driver_added)(void *data, struct pw_impl_node *node)
a driver was added, since 0.3.75 version:1
Definition context.h:78
pw_context
pw_core
pw_data_loop
pw_export_type
data for registering export functions
Definition context.h:190
pw_export_type::type
const char * type
Definition context.h:192
pw_export_type::link
struct spa_list link
Definition context.h:191
pw_global
pw_impl_client
pw_impl_node
pw_loop
Definition loop.h:33
pw_loop::loop
struct spa_loop * loop
wrapped loop
Definition loop.h:35
pw_mempool
A memory pool is a collection of pw_memblocks.
Definition mem.h:66
pw_properties
Definition properties.h:39
pw_properties::dict
struct spa_dict dict
dictionary of key/values
Definition properties.h:40
pw_proxy
pw_work_queue
spa_dict
Definition dict.h:51
spa_handle
Definition plugin.h:43
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:427
spa_list
Definition list.h:39
spa_support
Extra supporting infrastructure passed to the init() function of a factory.
Definition plugin.h:98