5 #ifndef PIPEWIRE_CORE_H 6 #define PIPEWIRE_CORE_H 36 #define PW_TYPE_INTERFACE_Core PW_TYPE_INFO_INTERFACE_BASE "Core" 37 #define PW_TYPE_INTERFACE_Registry PW_TYPE_INFO_INTERFACE_BASE "Registry" 39 #define PW_CORE_PERM_MASK PW_PERM_R|PW_PERM_X|PW_PERM_M 41 #define PW_VERSION_CORE 4 43 #define PW_VERSION_REGISTRY 3 46 #ifndef PW_API_CORE_IMPL 47 #define PW_API_CORE_IMPL static inline 49 #ifndef PW_API_REGISTRY_IMPL 50 #define PW_API_REGISTRY_IMPL static inline 54 #define PW_DEFAULT_REMOTE "pipewire-0" 60 #define PW_ID_ANY (uint32_t)(0xffffffff) 71 #define PW_CORE_CHANGE_MASK_PROPS (1 << 0) 72 #define PW_CORE_CHANGE_MASK_ALL ((1 << 1)-1) 96 #define PW_CORE_EVENT_INFO 0 97 #define PW_CORE_EVENT_DONE 1 98 #define PW_CORE_EVENT_PING 2 99 #define PW_CORE_EVENT_ERROR 3 100 #define PW_CORE_EVENT_REMOVE_ID 4 101 #define PW_CORE_EVENT_BOUND_ID 5 102 #define PW_CORE_EVENT_ADD_MEM 6 103 #define PW_CORE_EVENT_REMOVE_MEM 7 104 #define PW_CORE_EVENT_BOUND_PROPS 8 105 #define PW_CORE_EVENT_NUM 9 111 #define PW_VERSION_CORE_EVENTS 1 131 void (*
done) (
void *data, uint32_t
id,
int seq);
138 void (*
ping) (
void *data, uint32_t
id,
int seq);
184 void (*
bound_id) (
void *data, uint32_t
id, uint32_t global_id);
200 void (*
add_mem) (
void *data, uint32_t
id, uint32_t type,
int fd, uint32_t flags);
227 #define PW_CORE_METHOD_ADD_LISTENER 0 228 #define PW_CORE_METHOD_HELLO 1 229 #define PW_CORE_METHOD_SYNC 2 230 #define PW_CORE_METHOD_PONG 3 231 #define PW_CORE_METHOD_ERROR 4 232 #define PW_CORE_METHOD_GET_REGISTRY 5 233 #define PW_CORE_METHOD_CREATE_OBJECT 6 234 #define PW_CORE_METHOD_DESTROY 7 235 #define PW_CORE_METHOD_NUM 8 246 #define PW_VERSION_CORE_METHODS 0 315 size_t user_data_size);
328 void * (*create_object) (
void *object,
329 const char *factory_name,
333 size_t user_data_size);
356 listener, events, data);
392 pw_core_errorv(struct
pw_core *core, uint32_t
id,
int seq,
403 pw_core_errorf(struct
pw_core *core, uint32_t
id,
int seq,
421 version, user_data_size);
427 const char *factory_name,
431 size_t user_data_size)
435 factory_name, type, version, props, user_data_size);
485 #define PW_REGISTRY_EVENT_GLOBAL 0 486 #define PW_REGISTRY_EVENT_GLOBAL_REMOVE 1 487 #define PW_REGISTRY_EVENT_NUM 2 491 #define PW_VERSION_REGISTRY_EVENTS 0 505 void (*
global) (
void *data, uint32_t
id,
506 uint32_t permissions,
const char *type, uint32_t
version,
520 #define PW_REGISTRY_METHOD_ADD_LISTENER 0 521 #define PW_REGISTRY_METHOD_BIND 1 522 #define PW_REGISTRY_METHOD_DESTROY 2 523 #define PW_REGISTRY_METHOD_NUM 3 527 #define PW_VERSION_REGISTRY_METHODS 0 546 void * (*bind) (
void *object, uint32_t
id,
const char *type, uint32_t
version,
547 size_t use_data_size);
557 int (*
destroy) (
void *object, uint32_t
id);
571 listener, events, data);
577 uint32_t
id,
const char *type, uint32_t
version,
578 size_t user_data_size)
582 id, type,
version, user_data_size);
615 size_t user_data_size);
631 size_t user_data_size);
644 size_t user_data_size);
687 size_t user_data_size );
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_registry_events *events, void *data)
Definition: core.h:579
uint32_t int int const char * message
Definition: core.h:432
PW_API_REGISTRY_IMPL int pw_registry_add_listener(struct pw_registry *registry, struct spa_hook *listener, const struct pw_registry_events *events, void *data)
Registry.
Definition: core.h:613
uint32_t version
Definition: core.h:536
Definition: properties.h:39
int pw_core_update_properties(struct pw_core *core, const struct spa_dict *dict)
Update the core properties.
Definition: core.c:154
#define spa_api_method_v(type, o, method, version,...)
Definition: hook.h:285
uint64_t change_mask
bitfield of changed fields since last call
Definition: core.h:92
Core events.
Definition: core.h:139
struct pw_client * pw_core_get_client(struct pw_core *core)
Get the client proxy of the connected core.
Definition: core.c:273
PW_API_CORE_IMPL int pw_core_hello(struct pw_core *object, uint32_t version)
Definition: core.h:400
const char * host_name
name of the machine the core is running on
Definition: core.h:85
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:427
Core methods.
Definition: core.h:284
struct spa_dict dict
dictionary of key/values
Definition: properties.h:40
PW_API_CORE_IMPL int pw_core_error(struct pw_core *object, uint32_t id, int seq, int res, const char *message)
Definition: core.h:424
int(* destroy)(void *object, void *proxy)
Destroy an resource.
Definition: core.h:383
uint32_t version
Definition: core.h:142
uint32_t cookie
a random cookie for identifying this instance of PipeWire
Definition: core.h:83
uint32_t id
id of the global
Definition: core.h:82
void(* global)(void *data, uint32_t id, uint32_t permissions, const char *type, uint32_t version, const struct spa_dict *props)
Notify of a new global object.
Definition: core.h:549
The core information.
Definition: core.h:81
struct pw_core * pw_context_connect(struct pw_context *context, struct pw_properties *properties, size_t user_data_size)
Connect to a PipeWire instance.
Definition: core.c:410
PW_API_CORE_IMPL struct pw_registry * pw_core_get_registry(struct pw_core *core, uint32_t version, size_t user_data_size)
Definition: core.h:457
#define PW_API_REGISTRY_IMPL
Definition: core.h:64
Registry events.
Definition: core.h:533
int(* error)(void *object, uint32_t id, int seq, int res, const char *message)
Fatal error event.
Definition: core.h:343
const char * version
version of the core
Definition: core.h:86
struct pw_mempool * pw_core_get_mempool(struct pw_core *core)
Get the core mempool object.
Definition: core.c:491
void(* add_mem)(void *data, uint32_t id, uint32_t type, int fd, uint32_t flags)
Add memory for a client.
Definition: core.h:230
int pw_core_steal_fd(struct pw_core *core)
Steal the fd of the core connection or < 0 on error.
Definition: core.c:476
struct pw_core * pw_context_connect_self(struct pw_context *context, struct pw_properties *properties, size_t user_data_size)
Connect to a given PipeWire instance.
Definition: core.c:462
void(* global_remove)(void *data, uint32_t id)
Notify of a global object removal.
Definition: core.h:561
PW_API_CORE_IMPL void pw_core_destroy(struct pw_core *core, void *proxy)
Definition: core.h:480
int pw_core_disconnect(struct pw_core *core)
disconnect and destroy a core
Definition: core.c:506
void(* info)(void *data, const struct pw_core_info *info)
Notify new core info.
Definition: core.h:152
int(* sync)(void *object, uint32_t id, int seq)
Do server roundtrip.
Definition: core.h:314
struct pw_context * pw_core_get_context(struct pw_core *core)
Get the context object used to created this core.
Definition: core.c:142
struct pw_proxy * pw_core_export(struct pw_core *core, const char *type, const struct spa_dict *props, void *object, size_t user_data_size)
Export an object into the PipeWire instance associated with core.
Definition: core.c:285
const char * user_name
name of the user that started the core
Definition: core.h:84
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_core_events *events, void *data)
Definition: core.h:289
uint32_t version
Definition: core.h:577
struct pw_proxy * pw_core_find_proxy(struct pw_core *core, uint32_t id)
Get the proxy with the given id.
Definition: core.c:279
buffer[1023]
Definition: core.h:437
int(* destroy)(void *object, uint32_t id)
Attempt to destroy a global object.
Definition: core.h:606
PW_API_CORE_IMPL int pw_core_sync(struct pw_core *object, uint32_t id, int seq)
Definition: core.h:408
void pw_core_info_free(struct pw_core_info *info)
Free a pw_core_info.
Definition: introspect.c:146
int pw_core_set_paused(struct pw_core *core, bool paused)
Pause or resume the core.
Definition: core.c:484
#define spa_api_method_r(rtype, def, type, o, method, version,...)
Definition: hook.h:291
Registry methods.
Definition: core.h:574
const struct pw_properties * pw_core_get_properties(struct pw_core *core)
Get properties from the core.
Definition: core.c:148
void(* error)(void *data, uint32_t id, int seq, int res, const char *message)
Fatal error event.
Definition: core.h:187
uint32_t int seq
Definition: core.h:432
uint32_t version
Definition: core.h:287
void(* bound_props)(void *data, uint32_t id, uint32_t global_id, const struct spa_dict *props)
Notify an object binding.
Definition: core.h:254
PW_API_CORE_IMPL int pw_core_pong(struct pw_core *object, uint32_t id, int seq)
Definition: core.h:416
int(* pong)(void *object, uint32_t id, int seq)
Reply to a server ping event.
Definition: core.h:324
PW_API_CORE_IMPL int pw_core_add_listener(struct pw_core *object, struct spa_hook *listener, const struct pw_core_events *events, void *data)
Definition: core.h:389
void(* bound_id)(void *data, uint32_t id, uint32_t global_id)
Notify an object binding.
Definition: core.h:214
struct pw_core_info * pw_core_info_update(struct pw_core_info *info, const struct pw_core_info *update)
Update an existing pw_core_info with update with reset.
Definition: introspect.c:139
vsnprintf(buffer, sizeof(buffer), message, args)
int(* hello)(void *object, uint32_t version)
Start a conversation with the server.
Definition: core.h:300
void(* remove_id)(void *data, uint32_t id)
Remove an object ID.
Definition: core.h:199
void(* done)(void *data, uint32_t id, int seq)
Emit a done event.
Definition: core.h:161
PW_API_REGISTRY_IMPL int pw_registry_destroy(struct pw_registry *registry, uint32_t id)
Definition: core.h:636
void * pw_core_get_user_data(struct pw_core *core)
Get the user_data.
Definition: core.c:172
A memory pool is a collection of pw_memblocks.
Definition: mem.h:66
void(* ping)(void *data, uint32_t id, int seq)
Emit a ping event.
Definition: core.h:168
uint32_t int int res
Definition: core.h:432
PW_API_REGISTRY_IMPL void * pw_registry_bind(struct pw_registry *registry, uint32_t id, const char *type, uint32_t version, size_t user_data_size)
Definition: core.h:625
uint32_t int int const char va_list args
Definition: core.h:434
void(* remove_mem)(void *data, uint32_t id)
Remove memory for a client.
Definition: core.h:237
uint32_t id
Definition: core.h:432
#define PW_API_CORE_IMPL
Definition: core.h:60
#define SPA_PRINTF_FUNC(fmt, arg1)
Definition: defs.h:295
struct pw_core * pw_context_connect_fd(struct pw_context *context, int fd, struct pw_properties *properties, size_t user_data_size)
Connect to a PipeWire instance on the given socket.
Definition: core.c:437
struct pw_core_info * pw_core_info_merge(struct pw_core_info *info, const struct pw_core_info *update, bool reset)
Update an existing pw_core_info with update.
Definition: introspect.c:108
uint32_t int int const char int r
Definition: core.h:445
PW_API_CORE_IMPL void * pw_core_create_object(struct pw_core *core, const char *factory_name, const char *type, uint32_t version, const struct spa_dict *props, size_t user_data_size)
Definition: core.h:466