PipeWire: context.h Source File

PipeWire 0.3.69

Loading...
Searching...
No Matches
src/pipewire/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#ifdef __cplusplus
9extern "C" {
10#endif
11
12#include <spa/utils/defs.h>
13#include <spa/utils/hook.h>
14
42struct pw_context;
43
44struct pw_global;
45struct pw_impl_client;
46
47#include <pipewire/core.h>
48#include <pipewire/loop.h>
49#include <pipewire/properties.h>
50
52struct pw_context_events {
53#define PW_VERSION_CONTEXT_EVENTS 0
54 uint32_t version;
55
57 void (*destroy) (void *data);
59 void (*free) (void *data);
61 void (*check_access) (void *data, struct pw_impl_client *client);
63 void (*global_added) (void *data, struct pw_global *global);
65 void (*global_removed) (void *data, struct pw_global *global);
66};
67
69 struct pw_context * pw_context_new(struct pw_loop *main_loop,
70 struct pw_properties *props,
71 size_t user_data_size );
72
74void pw_context_destroy(struct pw_context *context);
75
77void *pw_context_get_user_data(struct pw_context *context);
78
80void pw_context_add_listener(struct pw_context *context,
81 struct spa_hook *listener,
82 const struct pw_context_events *events,
83 void *data);
84
86const struct pw_properties *pw_context_get_properties(struct pw_context *context);
87
89int pw_context_update_properties(struct pw_context *context, const struct spa_dict *dict);
90
93const char *pw_context_get_conf_section(struct pw_context *context, const char *section);
95int pw_context_parse_conf_section(struct pw_context *context,
96 struct pw_properties *conf, const char *section);
97
99int pw_context_conf_update_props(struct pw_context *context, const char *section,
100 struct pw_properties *props);
102int pw_context_conf_section_for_each(struct pw_context *context, const char *section,
103 int (*callback) (void *data, const char *location, const char *section,
104 const char *str, size_t len),
105 void *data);
107int pw_context_conf_section_match_rules(struct pw_context *context, const char *section,
108 const struct spa_dict *props,
109 int (*callback) (void *data, const char *location, const char *action,
110 const char *str, size_t len),
111 void *data);
112
114const struct spa_support *pw_context_get_support(struct pw_context *context, uint32_t *n_support);
115
117struct pw_loop *pw_context_get_main_loop(struct pw_context *context);
118
120struct pw_data_loop *pw_context_get_data_loop(struct pw_context *context);
121
123struct pw_work_queue *pw_context_get_work_queue(struct pw_context *context);
124
129int pw_context_for_each_global(struct pw_context *context,
130 int (*callback) (void *data, struct pw_global *global),
131 void *data);
132
134struct pw_global *pw_context_find_global(struct pw_context *context,
135 uint32_t id );
136
138int pw_context_add_spa_lib(struct pw_context *context, const char *factory_regex, const char *lib);
139
141const char * pw_context_find_spa_lib(struct pw_context *context, const char *factory_name);
142
143struct spa_handle *pw_context_load_spa_handle(struct pw_context *context,
144 const char *factory_name,
145 const struct spa_dict *info);
146
147
149struct pw_export_type {
150 struct spa_list link;
151 const char *type;
152 struct pw_proxy * (*func) (struct pw_core *core,
153 const char *type, const struct spa_dict *props, void *object,
154 size_t user_data_size);
155};
156
159 int pw_context_register_export_type(struct pw_context *context, struct pw_export_type *type);
161const struct pw_export_type *pw_context_find_export_type(struct pw_context *context, const char *type);
162
164int pw_context_set_object(struct pw_context *context, const char *type, void *value);
166void *pw_context_get_object(struct pw_context *context, const char *type);
167
171#ifdef __cplusplus
172}
173#endif
174
175#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:464
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)
Definition: context.c:1543
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:1611
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:1573
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:380
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:470
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:510
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:523
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:934
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:1639
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:1585
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:1174
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:1067
pw_context_get_properties
const struct pw_properties * pw_context_get_properties(struct pw_context *context)
Get the context properties.
Definition: context.c:504
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:1531
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:542
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:492
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:486
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:168
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:1506
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:498
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:479
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:559
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:965
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: src/pipewire/context.h:59
pw_context_events::global_added
void(* global_added)(void *data, struct pw_global *global)
a new global object was added
Definition: src/pipewire/context.h:71
pw_context_events::destroy
void(* destroy)(void *data)
The context is being destroyed.
Definition: src/pipewire/context.h:65
pw_context_events::global_removed
void(* global_removed)(void *data, struct pw_global *global)
a global object was removed
Definition: src/pipewire/context.h:73
pw_context_events::free
void(* free)(void *data)
The context is being freed.
Definition: src/pipewire/context.h:67
pw_context_events::version
uint32_t version
Definition: src/pipewire/context.h:62
pw_context_events::check_access
void(* check_access)(void *data, struct pw_impl_client *client)
a new client object is added
Definition: src/pipewire/context.h:69
pw_context
pw_core
pw_data_loop
pw_export_type
data for registering export functions
Definition: src/pipewire/context.h:157
pw_export_type::type
const char * type
Definition: src/pipewire/context.h:159
pw_export_type::link
struct spa_list link
Definition: src/pipewire/context.h:158
pw_global
pw_impl_client
pw_loop
Definition: src/pipewire/loop.h:31
pw_properties
Definition: properties.h:33
pw_properties::dict
struct spa_dict dict
dictionary of key/values
Definition: properties.h:34
pw_proxy
pw_work_queue
spa_dict
Definition: utils/dict.h:39
spa_handle
Definition: plugin.h:30
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:331
spa_list
Definition: list.h:27
spa_support
Extra supporting infrastructure passed to the init() function of a factory.
Definition: plugin.h:76