PipeWire 1.4.5 |

Loading...
Searching...
No Matches
global.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_GLOBAL_H
6#define PIPEWIRE_GLOBAL_H
7
8#ifdef __cplusplus
9 extern "C" {
10#endif
11
32
37 struct pw_global;
38
39#include <pipewire/impl.h>
40
41 typedef int (*pw_global_bind_func_t) (void *object,
42 struct pw_impl_client *client,
43 uint32_t permissions,
44 uint32_t version,
45 uint32_t id );
46
48 struct pw_global_events {
49#define PW_VERSION_GLOBAL_EVENTS 0
50 uint32_t version;
51
53 void (*destroy) (void *data);
55 void (*free) (void *data);
57 void (*permissions_changed) (void *data,
58 struct pw_impl_client *client,
59 uint32_t old_permissions,
60 uint32_t new_permissions);
61};
62
64 struct pw_global *
65 pw_global_new(struct pw_context *context,
66 const char *type,
67 uint32_t version,
68 uint32_t permission_mask,
69 struct pw_properties *properties,
70 pw_global_bind_func_t func,
71 void *object );
72
74 int pw_global_register(struct pw_global *global);
75
77 void pw_global_add_listener(struct pw_global *global,
78 struct spa_hook *listener,
79 const struct pw_global_events *events,
80 void *data);
81
83uint32_t pw_global_get_permissions(struct pw_global *global, struct pw_impl_client *client);
84
86 struct pw_context *pw_global_get_context(struct pw_global *global);
87
89 const char *pw_global_get_type(struct pw_global *global);
90
92 bool pw_global_is_type(struct pw_global *global, const char *type);
93
95uint32_t pw_global_get_version(struct pw_global *global);
96
98 const struct pw_properties *pw_global_get_properties(struct pw_global *global);
99
101 int pw_global_update_keys(struct pw_global *global,
102 const struct spa_dict *dict, const char * const keys[]);
103
106 void *pw_global_get_object(struct pw_global *global);
107
109uint32_t pw_global_get_id(struct pw_global *global);
110
112uint64_t pw_global_get_serial(struct pw_global *global);
113
115 int pw_global_add_resource(struct pw_global *global, struct pw_resource *resource);
116
121 int pw_global_for_each_resource(struct pw_global *global,
122 int (*callback) (void *data, struct pw_resource *resource),
123 void *data);
124
126 int pw_global_bind(struct pw_global *global,
127 struct pw_impl_client *client,
128 uint32_t permissions,
129 uint32_t version,
130 uint32_t id);
131
132 int pw_global_update_permissions(struct pw_global *global, struct pw_impl_client *client,
133 uint32_t old_permissions, uint32_t new_permissions);
134
136 void pw_global_destroy(struct pw_global *global);
137
141
142#ifdef __cplusplus
143}
144#endif
145
146#endif /* PIPEWIRE_GLOBAL_H */
pw_global_bind
int pw_global_bind(struct pw_global *global, struct pw_impl_client *client, uint32_t permissions, uint32_t version, uint32_t id)
Let a client bind to a global.
Definition global.c:306
pw_global_get_context
struct pw_context * pw_global_get_context(struct pw_global *global)
Get the context object of this global.
Definition global.c:208
pw_global_get_permissions
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:27
pw_global_bind_func_t
int(* pw_global_bind_func_t)(void *object, struct pw_impl_client *client, uint32_t permissions, uint32_t version, uint32_t id)
Definition global.h:46
pw_global_get_serial
uint64_t pw_global_get_serial(struct pw_global *global)
Get the serial number of the global.
Definition global.c:113
pw_global_get_version
uint32_t pw_global_get_version(struct pw_global *global)
Get the global version.
Definition global.c:226
pw_global_add_listener
void pw_global_add_listener(struct pw_global *global, struct spa_hook *listener, const struct pw_global_events *events, void *data)
Add an event listener on the global.
Definition global.c:284
pw_global_get_id
uint32_t pw_global_get_id(struct pw_global *global)
Get the unique id of the global.
Definition global.c:253
pw_global_destroy
void pw_global_destroy(struct pw_global *global)
Destroy a global.
Definition global.c:398
pw_global_for_each_resource
int pw_global_for_each_resource(struct pw_global *global, int(*callback)(void *data, struct pw_resource *resource), void *data)
Iterate all resources added to the global The callback should return 0 to fetch the next item,...
Definition global.c:270
pw_global_new
struct pw_global * pw_global_new(struct pw_context *context, const char *type, uint32_t version, uint32_t permission_mask, struct pw_properties *properties, pw_global_bind_func_t func, void *object)
Create a new global object.
Definition global.c:48
pw_global_update_permissions
int pw_global_update_permissions(struct pw_global *global, struct pw_impl_client *client, uint32_t old_permissions, uint32_t new_permissions)
Definition global.c:343
pw_global_get_type
const char * pw_global_get_type(struct pw_global *global)
Get the global type.
Definition global.c:214
pw_global_get_properties
const struct pw_properties * pw_global_get_properties(struct pw_global *global)
Get the global properties.
Definition global.c:232
pw_global_add_resource
int pw_global_add_resource(struct pw_global *global, struct pw_resource *resource)
Add a resource to a global.
Definition global.c:259
pw_global_get_object
void * pw_global_get_object(struct pw_global *global)
Get the object associated with the global.
Definition global.c:247
pw_global_is_type
bool pw_global_is_type(struct pw_global *global, const char *type)
Check a global type.
Definition global.c:220
pw_global_update_keys
int pw_global_update_keys(struct pw_global *global, const struct spa_dict *dict, const char *const keys[])
Update the global properties, must be done when unregistered.
Definition global.c:238
pw_global_register
int pw_global_register(struct pw_global *global)
Register a global object to the context registry.
Definition global.c:130
impl.h
pipewire/impl.h
pw_context
pw_global_events
Global events, use pw_global_add_listener.
Definition global.h:53
pw_global_events::destroy
void(* destroy)(void *data)
The global is destroyed.
Definition global.h:59
pw_global_events::version
uint32_t version
Definition global.h:56
pw_global_events::permissions_changed
void(* permissions_changed)(void *data, struct pw_impl_client *client, uint32_t old_permissions, uint32_t new_permissions)
The permissions changed for a client.
Definition global.h:63
pw_global
pw_impl_client
pw_properties
Definition properties.h:39
pw_properties::dict
struct spa_dict dict
dictionary of key/values
Definition properties.h:40
pw_resource
spa_dict
Definition dict.h:51
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:427