global.h
Go to the documentation of this file.
/* PipeWire
*
* Copyright © 2018 Wim Taymans
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef PIPEWIRE_GLOBAL_H
#define PIPEWIRE_GLOBAL_H
#ifdef __cplusplus
extern "C" {
#endif
struct pw_global;
#include <pipewire/impl.h>
typedef int (*pw_global_bind_func_t) (void *object,
struct pw_impl_client *client,
uint32_t permissions,
uint32_t version,
uint32_t id );
struct pw_global_events {
#define PW_VERSION_GLOBAL_EVENTS 0
uint32_t version;
void (*destroy) (void *data);
void (*free) (void *data);
void (*permissions_changed) (void *data,
struct pw_impl_client *client,
uint32_t old_permissions,
uint32_t new_permissions);
};
struct pw_global *
pw_global_new(struct pw_context *context,
const char *type,
uint32_t version,
struct pw_properties *properties,
pw_global_bind_func_t func,
void *object );
int pw_global_register(struct pw_global *global);
void pw_global_add_listener(struct pw_global *global,
struct spa_hook *listener,
const struct pw_global_events *events,
void *data);
uint32_t pw_global_get_permissions(struct pw_global *global, struct pw_impl_client *client);
struct pw_context *pw_global_get_context(struct pw_global *global);
const char *pw_global_get_type(struct pw_global *global);
bool pw_global_is_type(struct pw_global *global, const char *type);
uint32_t pw_global_get_version(struct pw_global *global);
const struct pw_properties *pw_global_get_properties(struct pw_global *global);
int pw_global_update_keys(struct pw_global *global,
const struct spa_dict *dict, const char * const keys[]);
void *pw_global_get_object(struct pw_global *global);
uint32_t pw_global_get_id(struct pw_global *global);
uint64_t pw_global_get_serial(struct pw_global *global);
int pw_global_add_resource(struct pw_global *global, struct pw_resource *resource);
int pw_global_for_each_resource(struct pw_global *global,
int (*callback) (void *data, struct pw_resource *resource),
void *data);
int pw_global_bind(struct pw_global *global,
struct pw_impl_client *client,
uint32_t permissions,
uint32_t version,
uint32_t id);
int pw_global_update_permissions(struct pw_global *global, struct pw_impl_client *client,
uint32_t old_permissions, uint32_t new_permissions);
void pw_global_destroy(struct pw_global *global);
#ifdef __cplusplus
}
#endif
#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:314
pw_global_get_type
const char * pw_global_get_type(struct pw_global *global)
Get the global type.
Definition: global.c:222
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:46
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:66
pw_global_get_serial
uint64_t pw_global_get_serial(struct pw_global *global)
Get the serial number of the global.
Definition: global.c:121
pw_global_new
struct pw_global * pw_global_new(struct pw_context *context, const char *type, uint32_t version, struct pw_properties *properties, pw_global_bind_func_t func, void *object)
Create a new global object.
Definition: global.c:67
pw_global_get_version
uint32_t pw_global_get_version(struct pw_global *global)
Get the global version.
Definition: global.c:234
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:292
pw_global_get_id
uint32_t pw_global_get_id(struct pw_global *global)
Get the unique id of the global.
Definition: global.c:261
pw_global_destroy
void pw_global_destroy(struct pw_global *global)
Destroy a global.
Definition: global.c:406
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:278
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:351
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:267
pw_global_get_properties
const struct pw_properties * pw_global_get_properties(struct pw_global *global)
Get the global properties.
Definition: global.c:240
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:216
pw_global_get_object
void * pw_global_get_object(struct pw_global *global)
Get the object associated with the global.
Definition: global.c:255
pw_global_is_type
bool pw_global_is_type(struct pw_global *global, const char *type)
Check a global type.
Definition: global.c:228
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:246
pw_global_register
int pw_global_register(struct pw_global *global)
Register a global object to the context registry.
Definition: global.c:138
impl.h
pipewire/impl.h
pw_context
pw_global_events
Global events, use pw_global_add_listener.
Definition: global.h:73
pw_global_events::free
void(* free)(void *data)
The global is freed.
Definition: global.h:81
pw_global_events::destroy
void(* destroy)(void *data)
The global is destroyed.
Definition: global.h:79
pw_global_events::version
uint32_t version
Definition: global.h:76
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:83
pw_global
Definition: context.h:67
pw_impl_client
pw_properties
Definition: properties.h:53
pw_properties::dict
struct spa_dict dict
dictionary of key/values
Definition: properties.h:54
pw_resource
Definition: impl.h:49
spa_dict
Definition: dict.h:59
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:342