PipeWire  0.3.15
impl-core.h
Go to the documentation of this file.
1 /* PipeWire
2  *
3  * Copyright © 2018 Wim Taymans
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 
25 #ifndef PIPEWIRE_IMPL_CORE_H
26 #define PIPEWIRE_IMPL_CORE_H
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
38 struct pw_impl_core;
39 
40 #include <pipewire/context.h>
41 #include <pipewire/global.h>
42 #include <pipewire/properties.h>
43 #include <pipewire/resource.h>
44 
47 #define PW_VERSION_IMPL_CORE_EVENTS 0
48  uint32_t version;
49 
51  void (*destroy) (void *data);
53  void (*free) (void *data);
55  void (*initialized) (void *data);
56 };
57 
58 struct pw_impl_core *pw_context_create_core(struct pw_context *context,
59  struct pw_properties *properties,
60  size_t user_data_size);
61 
62 /* get the default core in a context */
63 struct pw_impl_core *pw_context_get_default_core(struct pw_context *context);
64 
66 const struct pw_properties *pw_impl_core_get_properties(struct pw_impl_core *core);
67 
69 const struct pw_core_info *pw_impl_core_get_info(struct pw_impl_core *core);
70 
72 int pw_impl_core_update_properties(struct pw_impl_core *core, const struct spa_dict *dict);
73 
74 int pw_impl_core_register(struct pw_impl_core *core,
75  struct pw_properties *properties);
76 
77 void pw_impl_core_destroy(struct pw_impl_core *core);
78 
79 void *pw_impl_core_get_user_data(struct pw_impl_core *core);
80 
82 struct pw_global *pw_impl_core_get_global(struct pw_impl_core *core);
83 
85 void pw_impl_core_add_listener(struct pw_impl_core *core,
86  struct spa_hook *listener,
87  const struct pw_impl_core_events *events,
88  void *data);
89 
90 #ifdef __cplusplus
91 }
92 #endif
93 
94 #endif /* PIPEWIRE_IMPL_CORE_H */
res
static uint32_t int int res
Definition: core.h:326
PW_VERSION_CLIENT
#define PW_VERSION_CLIENT
Definition: client.h:40
global.h
pw_context_create_core
struct pw_impl_core * pw_context_create_core(struct pw_context *context, struct pw_properties *properties, size_t user_data_size)
Definition: impl-core.c:373
pw_impl_core_events
Factory events, listen to them with pw_impl_core_add_listener.
Definition: impl-core.h:46
pw_pipewire::pw_get_host_name
const SPA_EXPORT char * pw_get_host_name(void)
Get the host name.
Definition: pipewire.c:554
pw_log::pw_log_error
#define pw_log_error(...)
pw_impl_core_add_listener
void pw_impl_core_add_listener(struct pw_impl_core *core, struct spa_hook *listener, const struct pw_impl_core_events *events, void *data)
Add an event listener.
Definition: impl-core.c:624
PW_CORE_CHANGE_MASK_ALL
#define PW_CORE_CHANGE_MASK_ALL
Definition: core.h:63
pw_core_info
The core information.
Definition: core.h:55
pw_impl_core_add_listener
SPA_EXPORT void pw_impl_core_add_listener(struct pw_impl_core *core, struct spa_hook *listener, const struct pw_impl_core_events *events, void *data)
Add an event listener.
Definition: impl-core.c:624
pw_global::pw_global_destroy
SPA_EXPORT void pw_global_destroy(struct pw_global *global)
Destroy a global.
Definition: global.c:377
NAME
#define NAME
Definition: impl-core.c:35
resource_data
Definition: impl-core.c:37
PW_KEY_OBJECT_ID
#define PW_KEY_OBJECT_ID
a global object id
Definition: keys.h:60
pw_impl_client_find_resource
struct pw_resource * pw_impl_client_find_resource(struct pw_impl_client *client, uint32_t id)
Get a resource with the given id.
Definition: impl-client.c:519
data
Definition: filter.c:71
resource_data::resource_listener
struct spa_hook resource_listener
Definition: impl-core.c:39
PW_KEY_CORE_VERSION
#define PW_KEY_CORE_VERSION
The version of the core.
Definition: keys.h:71
pw_resource_remove
void pw_resource_remove(struct pw_resource *resource)
Remove a resource, like pw_resource_destroy but without sending a remove_id message to the client.
Definition: resource.c:291
pw_impl_core_events::version
uint32_t version
Definition: impl-core.h:48
pw_global_events
Global events, use pw_global_add_listener.
Definition: global.h:65
PW_VERSION_CORE
#define PW_VERSION_CORE
Definition: core.h:40
pw_impl_client
PipeWire client object class.
pw_get_library_version
const SPA_EXPORT char * pw_get_library_version(void)
Get the currently running version.
Definition: pipewire.c:608
PW_PERM_IS_R
#define PW_PERM_IS_R(p)
Definition: permission.h:53
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:45
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:262
r
static uint32_t int int const char int r
Definition: core.h:338
pw_global
A global object visible to remote clients.
pw_impl_core_register
SPA_EXPORT int pw_impl_core_register(struct pw_impl_core *core, struct pw_properties *properties)
Definition: impl-core.c:561
pw_impl_core_get_user_data
SPA_EXPORT void * pw_impl_core_get_user_data(struct pw_impl_core *core)
Definition: impl-core.c:612
impl.h
pw_impl_core_get_info
const struct pw_core_info * pw_impl_core_get_info(struct pw_impl_core *core)
Get the core information.
pw_properties::dict
struct spa_dict dict
dictionary of key/values
Definition: properties.h:46
pw_impl_core_events::free
void(* free)(void *data)
the core is freed
Definition: impl-core.h:53
pw_impl_core_get_properties
const struct pw_properties * pw_impl_core_get_properties(struct pw_impl_core *core)
Get the core properties.
Definition: impl-core.c:532
pw_map::pw_map_for_each
static int pw_map_for_each(struct pw_map *map, int(*func)(void *item_data, void *data), void *data)
Iterate all map items.
Definition: map.h:188
pw_map::pw_map_insert_at
static int pw_map_insert_at(struct pw_map *map, uint32_t id, void *data)
Insert data in the map at an index.
Definition: map.h:133
pw_properties::pw_properties_setf
SPA_EXPORT int pw_properties_setf(struct pw_properties *properties, const char *key, const char *format,...)
Set a property value by format.
Definition: properties.c:433
resource_data::object_listener
struct spa_hook object_listener
Definition: impl-core.c:40
pw_pipewire::pw_get_user_name
const SPA_EXPORT char * pw_get_user_name(void)
Get the user name.
Definition: pipewire.c:542
message
static uint32_t int int const char * message
Definition: core.h:326
pw_resource_errorf_id
void void pw_resource_errorf_id(struct pw_resource *resource, uint32_t id, int res, const char *error,...) SPA_PRINTF_FUNC(4
pw_impl_core_update_properties
int pw_impl_core_update_properties(struct pw_impl_core *core, const struct spa_dict *dict)
Update the core properties.
Definition: impl-core.c:538
pw_context_find_global
struct pw_global * pw_context_find_global(struct pw_context *context, uint32_t id)
Find a context global by id.
pw_global_update_keys
int pw_global_update_keys(struct pw_global *global, const struct spa_dict *dict, const char *keys[])
Update the global properties, must be done when unregistered.
Definition: global.c:215
pw_log::pw_log_debug
#define pw_log_debug(...)
PW_VERSION_RESOURCE_EVENTS
#define PW_VERSION_RESOURCE_EVENTS
Definition: resource.h:65
PW_PERM_IS_X
#define PW_PERM_IS_X(p)
Definition: permission.h:55
pw_impl_core
PipeWire core interface.
resource.h
PW_TYPE_INTERFACE_Core
#define PW_TYPE_INTERFACE_Core
Definition: core.h:37
pw_properties::pw_properties_new_dict
SPA_EXPORT struct pw_properties * pw_properties_new_dict(const struct spa_dict *dict)
Make a new properties object from the given dictionary.
Definition: properties.c:128
pw_properties::pw_properties_update
SPA_EXPORT int pw_properties_update(struct pw_properties *props, const struct spa_dict *dict)
Update properties.
Definition: properties.c:263
pw_core_methods
Core methods.
Definition: core.h:220
pw_resource_get_user_data
void * pw_resource_get_user_data(struct pw_resource *resource)
Get the user data for the resource, the size was given in pw_resource_new.
Definition: resource.c:159
PW_PERM_ALL
#define PW_PERM_ALL
Definition: permission.h:58
pw_impl_core_destroy
void pw_impl_core_destroy(struct pw_impl_core *core)
Definition: impl-core.c:431
pw_mempool_clear
void pw_mempool_clear(struct pw_mempool *pool)
Clear a pool.
Definition: mem.c:158
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:237
pw_impl_factory_create_object
void * pw_impl_factory_create_object(struct pw_impl_factory *factory, struct pw_resource *resource, const char *type, uint32_t version, struct pw_properties *properties, uint32_t new_id)
Definition: impl-factory.c:261
pw_properties::pw_properties_get
const SPA_EXPORT char * pw_properties_get(const struct pw_properties *properties, const char *key)
Get a property.
Definition: properties.c:456
pw_context
the PipeWire context
pw_context_create_core
SPA_EXPORT struct pw_impl_core * pw_context_create_core(struct pw_context *context, struct pw_properties *properties, size_t user_data_size)
Definition: impl-core.c:373
PW_VERSION_CORE_METHODS
#define PW_VERSION_CORE_METHODS
Definition: core.h:221
pw_context_get_default_core
struct pw_impl_core * pw_context_get_default_core(struct pw_context *context)
Definition: impl-core.c:425
pw_impl_core_get_global
struct pw_global * pw_impl_core_get_global(struct pw_impl_core *core)
Get the global of this core.
Definition: impl-core.c:618
pw_resource
Client owned objects.
pw_resource_add_object_listener
void pw_resource_add_object_listener(struct pw_resource *resource, struct spa_hook *listener, const void *funcs, void *data)
Set the resource implementation.
Definition: resource.c:174
pw_impl_core_get_properties
SPA_EXPORT const struct pw_properties * pw_impl_core_get_properties(struct pw_impl_core *core)
Get the core properties.
Definition: impl-core.c:532
pw_resource_destroy
void pw_resource_destroy(struct pw_resource *resource)
Destroy a resource.
Definition: resource.c:264
PW_VERSION_GLOBAL_EVENTS
#define PW_VERSION_GLOBAL_EVENTS
Definition: global.h:66
pw_impl_core_register
int pw_impl_core_register(struct pw_impl_core *core, struct pw_properties *properties)
Definition: impl-core.c:561
pw_log::pw_log_trace
#define pw_log_trace(...)
PW_KEY_HOST_NAME
#define PW_KEY_HOST_NAME
The host name of the machine.
Definition: keys.h:65
pw_context::pw_context_find_factory
SPA_EXPORT struct pw_impl_factory * pw_context_find_factory(struct pw_context *context, const char *name)
Find a factory by name.
Definition: impl-factory.c:287
pw_impl_core_destroy
SPA_EXPORT void pw_impl_core_destroy(struct pw_impl_core *core)
Definition: impl-core.c:431
resource_data::data
struct result_device_params_data data
Definition: impl-device.c:64
PW_CORE_CHANGE_MASK_PROPS
#define PW_CORE_CHANGE_MASK_PROPS
Definition: core.h:62
pw_impl_core_get_global
SPA_EXPORT struct pw_global * pw_impl_core_get_global(struct pw_impl_core *core)
Get the global of this core.
Definition: impl-core.c:618
PW_KEY_CORE_NAME
#define PW_KEY_CORE_NAME
The name of the core.
Definition: keys.h:68
pw_resource_new
struct pw_resource * pw_resource_new(struct pw_impl_client *client, uint32_t id, uint32_t permissions, const char *type, uint32_t version, size_t user_data_size)
Make a new resource for client.
Definition: resource.c:43
context.h
pw_global::pw_global_new
SPA_EXPORT 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.
Definition: global.c:67
PW_TYPE_INTERFACE_Registry
#define PW_TYPE_INTERFACE_Registry
Definition: core.h:38
pw_impl_core_get_user_data
void * pw_impl_core_get_user_data(struct pw_impl_core *core)
Definition: impl-core.c:612
pw_registry_methods
Registry methods.
Definition: core.h:448
pw_impl_core_update_properties
SPA_EXPORT int pw_impl_core_update_properties(struct pw_impl_core *core, const struct spa_dict *dict)
Update the core properties.
Definition: impl-core.c:538
pw_impl_core_events::initialized
void(* initialized)(void *data)
the core is initialized
Definition: impl-core.h:55
pw_properties::pw_properties_new
SPA_EXPORT struct pw_properties * pw_properties_new(const char *key,...)
Make a new properties object.
Definition: properties.c:98
pw_context_get_default_core
SPA_EXPORT struct pw_impl_core * pw_context_get_default_core(struct pw_context *context)
Definition: impl-core.c:425
seq
static uint32_t int seq
Definition: core.h:325
resource_data::resource
struct pw_resource * resource
Definition: impl-core.c:38
properties.h
PW_VERSION_REGISTRY_METHODS
#define PW_VERSION_REGISTRY_METHODS
Definition: core.h:449
pw_global::pw_global_register
SPA_EXPORT int pw_global_register(struct pw_global *global)
register a global to the context registry
Definition: global.c:128
pw_impl_factory
PipeWire factory interface.
PW_KEY_USER_NAME
#define PW_KEY_USER_NAME
The user name that runs pipewire.
Definition: keys.h:64
pw_resource_events
Resource events.
Definition: resource.h:64
pw_impl_core_events::destroy
void(* destroy)(void *data)
the core is destroyed
Definition: impl-core.h:51
pw_resource_add_listener
void pw_resource_add_listener(struct pw_resource *resource, struct spa_hook *listener, const struct pw_resource_events *events, void *data)
Add an event listener.
Definition: resource.c:165
pw_resource_events::version
uint32_t version
Definition: resource.h:66
pw_global::pw_global_bind
SPA_EXPORT int pw_global_bind(struct pw_global *global, struct pw_impl_client *client, uint32_t permissions, uint32_t version, uint32_t id)
Bind to a global.
Definition: global.c:284
pw_properties
A collection of key/value pairs.
Definition: properties.h:45
pw_properties::pw_properties_free
SPA_EXPORT void pw_properties_free(struct pw_properties *properties)
Free a properties object.
Definition: properties.c:335