PipeWire  0.2.7
global.h
Go to the documentation of this file.
1 /* PipeWire
2  * Copyright (C) 2017 Wim Taymans <wim.taymans@gmail.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef __PIPEWIRE_GLOBAL_H__
21 #define __PIPEWIRE_GLOBAL_H__
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
52 struct pw_global;
53 
54 #include <pipewire/core.h>
55 #include <pipewire/client.h>
56 #include <pipewire/properties.h>
57 
60 #define PW_VERSION_GLOBAL_EVENTS 1
61  uint32_t version;
62 
64  void (*destroy) (void *data);
65 
67  void (*free) (void *data);
68 
69  /* bind the global */
70  void (*bind) (void *data,
71  struct pw_client *client,
72  uint32_t permissions,
73  uint32_t version,
74  uint32_t id );
75 
76  /* permissions for the global changed, Since version 1 */
77  void (*permissions_changed) (void *data,
78  struct pw_client *client,
79  uint32_t old_permissions,
80  uint32_t new_permissions);
81 };
82 
84 struct pw_global *
85 pw_global_new(struct pw_core *core,
86  uint32_t type,
87  uint32_t version,
88  struct pw_properties *properties,
89  void *object );
90 
92 int pw_global_register(struct pw_global *global,
93  struct pw_client *owner,
94  struct pw_global *parent);
95 
97 void pw_global_add_listener(struct pw_global *global,
98  struct spa_hook *listener,
99  const struct pw_global_events *events,
100  void *data);
101 
103 uint32_t pw_global_get_permissions(struct pw_global *global, struct pw_client *client);
104 
106 struct pw_core *pw_global_get_core(struct pw_global *global);
107 
109 struct pw_client *pw_global_get_owner(struct pw_global *global);
110 
112 struct pw_global *pw_global_get_parent(struct pw_global *global);
113 
115 uint32_t pw_global_get_type(struct pw_global *global);
116 
118 uint32_t pw_global_get_version(struct pw_global *global);
119 
121 const struct pw_properties *pw_global_get_properties(struct pw_global *global);
122 
125 void *pw_global_get_object(struct pw_global *global);
126 
128 uint32_t pw_global_get_id(struct pw_global *global);
129 
131 int pw_global_bind(struct pw_global *global,
132  struct pw_client *client,
133  uint32_t permissions,
134  uint32_t version,
135  uint32_t id);
136 
138 void pw_global_destroy(struct pw_global *global);
139 
140 #ifdef __cplusplus
141 }
142 #endif
143 
144 #endif /* __PIPEWIRE_GLOBAL_H__ */
pw_global::pw_global_register
SPA_EXPORT int pw_global_register(struct pw_global *global, struct pw_client *owner, struct pw_global *parent)
register a global to the core registry
Definition: global.c:102
global.h
pw_global_events::bind
void(* bind)(void *data, struct pw_client *client, uint32_t permissions, uint32_t version, uint32_t id)
Definition: global.h:70
pw_map::pw_map_remove
static void pw_map_remove(struct pw_map *map, uint32_t id)
Remove an item at index.
Definition: map.h:140
pw_global_events::destroy
void(* destroy)(void *data)
The global is destroyed.
Definition: global.h:64
pw_global_add_listener
SPA_EXPORT 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:190
pw_global_get_version
uint32_t pw_global_get_version(struct pw_global *global)
Get the global version.
Definition: global.c:166
pw_global::pw_global_destroy
SPA_EXPORT void pw_global_destroy(struct pw_global *global)
Destroy a global.
Definition: global.c:241
pw_client
PipeWire client object class.
pw_global_events::free
void(* free)(void *data)
The global is freed.
Definition: global.h:67
pw_global_get_version
SPA_EXPORT uint32_t pw_global_get_version(struct pw_global *global)
Get the global version.
Definition: global.c:166
pw_global::pw_global_bind
SPA_EXPORT int pw_global_bind(struct pw_global *global, struct pw_client *client, uint32_t permissions, uint32_t version, uint32_t id)
Bind to a global.
Definition: global.c:213
pw_global_events::version
uint32_t version
Definition: global.h:61
pw_global_get_type
uint32_t pw_global_get_type(struct pw_global *global)
Get the global type.
Definition: global.c:160
pw_global_events
Global events, use pw_global_add_listener.
Definition: global.h:59
pw_registry_resource_global
#define pw_registry_resource_global(r,...)
Definition: interfaces.h:455
impl
Definition: control.c:25
PW_PERM_RWX
#define PW_PERM_RWX
Definition: core.h:80
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:190
pw_global_get_properties
SPA_EXPORT const struct pw_properties * pw_global_get_properties(struct pw_global *global)
Get the global properties.
Definition: global.c:172
pw_global
A global object visible to remote clients.
pw_map::pw_map_insert_new
static uint32_t pw_map_insert_new(struct pw_map *map, void *data)
Insert data in the map.
Definition: map.h:92
pw_global_get_id
SPA_EXPORT uint32_t pw_global_get_id(struct pw_global *global)
Get the unique id of the global.
Definition: global.c:184
pw_global::pw_global_new
SPA_EXPORT struct pw_global * pw_global_new(struct pw_core *core, uint32_t type, uint32_t version, struct pw_properties *properties, void *object)
Create a new global.
Definition: global.c:61
pw_registry_resource_global_remove
#define pw_registry_resource_global_remove(r,...)
Definition: interfaces.h:456
pw_global_get_object
SPA_EXPORT void * pw_global_get_object(struct pw_global *global)
Get the object associated with the global.
Definition: global.c:178
pw_global_get_owner
SPA_EXPORT struct pw_client * pw_global_get_owner(struct pw_global *global)
Get the owner of the global.
Definition: global.c:148
PW_PERM_IS_R
#define PW_PERM_IS_R(p)
Definition: core.h:82
pw_global_get_parent
SPA_EXPORT struct pw_global * pw_global_get_parent(struct pw_global *global)
Get the parent of a global.
Definition: global.c:154
pw_global_get_object
void * pw_global_get_object(struct pw_global *global)
Get the object associated with the global.
Definition: global.c:178
pw_global_get_id
uint32_t pw_global_get_id(struct pw_global *global)
Get the unique id of the global.
Definition: global.c:184
pw_global_events::permissions_changed
void(* permissions_changed)(void *data, struct pw_client *client, uint32_t old_permissions, uint32_t new_permissions)
Definition: global.h:77
pw_global_get_permissions
uint32_t pw_global_get_permissions(struct pw_global *global, struct pw_client *client)
Get the permissions of the global for a given client.
Definition: global.c:37
pw_core
the core PipeWire object
pw_resource
Client owned objects.
pw_global_get_owner
struct pw_client * pw_global_get_owner(struct pw_global *global)
Get the owner of the global.
Definition: global.c:148
registry
Definition: pipewire.c:54
core.h
pw_core_resource_error
#define pw_core_resource_error(r,...)
Definition: interfaces.h:338
impl::this
struct pw_control this
Definition: control.c:26
pw_global_get_core
struct pw_core * pw_global_get_core(struct pw_global *global)
Get the core object of this global.
Definition: global.c:142
pw_global_get_permissions
SPA_EXPORT uint32_t pw_global_get_permissions(struct pw_global *global, struct pw_client *client)
Get the permissions of the global for a given client.
Definition: global.c:37
pw_global_get_type
SPA_EXPORT uint32_t pw_global_get_type(struct pw_global *global)
Get the global type.
Definition: global.c:160
pipewire.h
properties.h
pw_global_get_properties
const struct pw_properties * pw_global_get_properties(struct pw_global *global)
Get the global properties.
Definition: global.c:172
pw_global_get_parent
struct pw_global * pw_global_get_parent(struct pw_global *global)
Get the parent of a global.
Definition: global.c:154
pw_global_get_core
SPA_EXPORT struct pw_core * pw_global_get_core(struct pw_global *global)
Get the core object of this global.
Definition: global.c:142
client.h
pw_log::pw_log_debug
void pw_log_debug(const char *format,...)
pw_properties
A collection of key/value pairs.
Definition: properties.h:38
pw_properties::pw_properties_free
SPA_EXPORT void pw_properties_free(struct pw_properties *properties)
Free a properties object.
Definition: properties.c:245