2020-10-25 15:28:42 +01:00
|
|
|
/* PipeWire
|
|
|
|
|
*
|
|
|
|
|
* Copyright © 2020 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_MANAGER_H
|
|
|
|
|
#define PIPEWIRE_MANAGER_H
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <spa/utils/defs.h>
|
|
|
|
|
#include <spa/pod/pod.h>
|
|
|
|
|
|
|
|
|
|
#include <pipewire/pipewire.h>
|
|
|
|
|
|
|
|
|
|
struct pw_manager_object;
|
|
|
|
|
|
|
|
|
|
struct pw_manager_events {
|
|
|
|
|
#define PW_VERSION_MANAGER_EVENTS 0
|
|
|
|
|
uint32_t version;
|
|
|
|
|
|
|
|
|
|
void (*destroy) (void *data);
|
|
|
|
|
|
|
|
|
|
void (*sync) (void *data);
|
|
|
|
|
|
|
|
|
|
void (*added) (void *data, struct pw_manager_object *object);
|
|
|
|
|
|
|
|
|
|
void (*updated) (void *data, struct pw_manager_object *object);
|
|
|
|
|
|
|
|
|
|
void (*removed) (void *data, struct pw_manager_object *object);
|
2020-10-26 13:28:45 +01:00
|
|
|
|
2020-11-23 10:44:12 +01:00
|
|
|
void (*metadata) (void *data, struct pw_manager_object *object,
|
|
|
|
|
uint32_t subject, const char *key,
|
2020-10-26 13:28:45 +01:00
|
|
|
const char *type, const char *value);
|
2021-11-10 13:46:29 +01:00
|
|
|
|
|
|
|
|
void (*disconnect) (void *data);
|
2022-05-14 16:01:14 +03:00
|
|
|
|
|
|
|
|
void (*object_data_timeout) (void *data, struct pw_manager_object *object,
|
|
|
|
|
const char *key);
|
2020-10-26 13:28:45 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct pw_manager {
|
|
|
|
|
struct pw_core *core;
|
|
|
|
|
struct pw_registry *registry;
|
|
|
|
|
|
2020-11-05 10:36:13 +01:00
|
|
|
struct pw_core_info *info;
|
|
|
|
|
|
2020-10-26 13:28:45 +01:00
|
|
|
uint32_t n_objects;
|
|
|
|
|
struct spa_list object_list;
|
2020-10-25 15:28:42 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct pw_manager_param {
|
|
|
|
|
uint32_t id;
|
2022-10-27 20:10:33 +02:00
|
|
|
int32_t seq;
|
2020-10-26 13:28:45 +01:00
|
|
|
struct spa_list link; /**< link in manager_object param_list */
|
2020-10-25 15:28:42 +01:00
|
|
|
struct spa_pod *param;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct pw_manager_object {
|
2020-10-26 13:28:45 +01:00
|
|
|
struct spa_list link; /**< link in manager object_list */
|
2022-01-17 12:48:31 +01:00
|
|
|
uint64_t serial;
|
2020-10-25 15:28:42 +01:00
|
|
|
uint32_t id;
|
|
|
|
|
uint32_t permissions;
|
2020-11-09 09:41:12 +01:00
|
|
|
const char *type;
|
2020-10-25 15:28:42 +01:00
|
|
|
uint32_t version;
|
2022-01-17 11:28:40 +01:00
|
|
|
uint32_t index;
|
2020-10-25 15:28:42 +01:00
|
|
|
struct pw_properties *props;
|
2020-10-27 14:57:15 +01:00
|
|
|
struct pw_proxy *proxy;
|
2021-03-20 00:11:12 +02:00
|
|
|
char *message_object_path;
|
|
|
|
|
int (*message_handler)(struct pw_manager *m, struct pw_manager_object *o,
|
|
|
|
|
const char *message, const char *params, char **response);
|
2020-10-25 15:28:42 +01:00
|
|
|
|
2020-10-27 14:57:15 +01:00
|
|
|
int changed;
|
2020-10-25 15:28:42 +01:00
|
|
|
void *info;
|
2022-10-27 20:10:33 +02:00
|
|
|
struct spa_param_info *params;
|
|
|
|
|
uint32_t n_params;
|
|
|
|
|
|
2020-10-25 15:28:42 +01:00
|
|
|
struct spa_list param_list;
|
2020-11-13 09:52:02 +01:00
|
|
|
unsigned int creating:1;
|
2021-01-23 01:37:59 +02:00
|
|
|
unsigned int removing:1;
|
2020-10-25 15:28:42 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct pw_manager *pw_manager_new(struct pw_core *core);
|
|
|
|
|
|
|
|
|
|
void pw_manager_add_listener(struct pw_manager *manager,
|
|
|
|
|
struct spa_hook *listener,
|
|
|
|
|
const struct pw_manager_events *events, void *data);
|
|
|
|
|
|
2021-03-09 12:08:45 +01:00
|
|
|
int pw_manager_sync(struct pw_manager *manager);
|
|
|
|
|
|
2020-10-25 15:28:42 +01:00
|
|
|
void pw_manager_destroy(struct pw_manager *manager);
|
|
|
|
|
|
2020-10-29 11:59:16 +01:00
|
|
|
int pw_manager_set_metadata(struct pw_manager *manager,
|
2021-03-16 18:09:38 +01:00
|
|
|
struct pw_manager_object *metadata,
|
2020-10-29 11:59:16 +01:00
|
|
|
uint32_t subject, const char *key, const char *type,
|
2020-11-23 10:44:12 +01:00
|
|
|
const char *format, ...) SPA_PRINTF_FUNC(6,7);
|
2020-10-29 11:59:16 +01:00
|
|
|
|
2020-10-25 15:28:42 +01:00
|
|
|
int pw_manager_for_each_object(struct pw_manager *manager,
|
|
|
|
|
int (*callback) (void *data, struct pw_manager_object *object),
|
|
|
|
|
void *data);
|
|
|
|
|
|
2022-01-17 10:03:02 +01:00
|
|
|
void *pw_manager_object_add_data(struct pw_manager_object *o, const char *key, size_t size);
|
|
|
|
|
void *pw_manager_object_get_data(struct pw_manager_object *obj, const char *key);
|
2022-05-14 16:01:14 +03:00
|
|
|
void *pw_manager_object_add_temporary_data(struct pw_manager_object *o, const char *key,
|
|
|
|
|
size_t size, uint64_t lifetime_nsec);
|
2021-02-16 22:03:08 +02:00
|
|
|
|
2021-04-15 15:53:05 -04:00
|
|
|
bool pw_manager_object_is_client(struct pw_manager_object *o);
|
|
|
|
|
bool pw_manager_object_is_module(struct pw_manager_object *o);
|
|
|
|
|
bool pw_manager_object_is_card(struct pw_manager_object *o);
|
|
|
|
|
bool pw_manager_object_is_sink(struct pw_manager_object *o);
|
|
|
|
|
bool pw_manager_object_is_source(struct pw_manager_object *o);
|
|
|
|
|
bool pw_manager_object_is_monitor(struct pw_manager_object *o);
|
2021-04-20 21:05:59 +02:00
|
|
|
bool pw_manager_object_is_virtual(struct pw_manager_object *o);
|
2021-04-15 15:53:05 -04:00
|
|
|
bool pw_manager_object_is_source_or_monitor(struct pw_manager_object *o);
|
|
|
|
|
bool pw_manager_object_is_sink_input(struct pw_manager_object *o);
|
|
|
|
|
bool pw_manager_object_is_source_output(struct pw_manager_object *o);
|
|
|
|
|
bool pw_manager_object_is_recordable(struct pw_manager_object *o);
|
|
|
|
|
bool pw_manager_object_is_link(struct pw_manager_object *o);
|
|
|
|
|
|
2020-10-25 15:28:42 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
} /* extern "C" */
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif /* PIPEWIRE_MANAGER_H */
|