mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
pw_core -> pw_context
The proxy API is the one that we would like to expose for applications and the other API is used internally when implementing modules or factories. The current pw_core object is really a context for all objects so name it that way. It also makes it possible to rename pw_core_proxy to pw_proxy later.
This commit is contained in:
parent
42103a8218
commit
8ea78c2e3f
113 changed files with 905 additions and 906 deletions
|
|
@ -68,7 +68,7 @@ typedef struct {
|
||||||
struct pw_loop *loop;
|
struct pw_loop *loop;
|
||||||
struct pw_thread_loop *main_loop;
|
struct pw_thread_loop *main_loop;
|
||||||
|
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
|
|
||||||
struct pw_core_proxy *core_proxy;
|
struct pw_core_proxy *core_proxy;
|
||||||
struct spa_hook core_listener;
|
struct spa_hook core_listener;
|
||||||
|
|
@ -113,8 +113,8 @@ static void snd_pcm_pipewire_free(snd_pcm_pipewire_t *pw)
|
||||||
if (pw) {
|
if (pw) {
|
||||||
if (pw->main_loop)
|
if (pw->main_loop)
|
||||||
pw_thread_loop_stop(pw->main_loop);
|
pw_thread_loop_stop(pw->main_loop);
|
||||||
if (pw->core)
|
if (pw->context)
|
||||||
pw_core_destroy(pw->core);
|
pw_context_destroy(pw->context);
|
||||||
if (pw->main_loop)
|
if (pw->main_loop)
|
||||||
pw_thread_loop_destroy(pw->main_loop);
|
pw_thread_loop_destroy(pw->main_loop);
|
||||||
if (pw->fd >= 0)
|
if (pw->fd >= 0)
|
||||||
|
|
@ -814,7 +814,7 @@ static int snd_pcm_pipewire_open(snd_pcm_t **pcmp, const char *name,
|
||||||
|
|
||||||
pw->loop = pw_loop_new(NULL);
|
pw->loop = pw_loop_new(NULL);
|
||||||
pw->main_loop = pw_thread_loop_new(pw->loop, "alsa-pipewire");
|
pw->main_loop = pw_thread_loop_new(pw->loop, "alsa-pipewire");
|
||||||
pw->core = pw_core_new(pw->loop, NULL, 0);
|
pw->context = pw_context_new(pw->loop, NULL, 0);
|
||||||
|
|
||||||
props = pw_properties_new(NULL, NULL);
|
props = pw_properties_new(NULL, NULL);
|
||||||
str = pw_get_prgname();
|
str = pw_get_prgname();
|
||||||
|
|
@ -827,7 +827,7 @@ static int snd_pcm_pipewire_open(snd_pcm_t **pcmp, const char *name,
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
pw_thread_loop_lock(pw->main_loop);
|
pw_thread_loop_lock(pw->main_loop);
|
||||||
pw->core_proxy = pw_core_connect(pw->core, props, 0);
|
pw->core_proxy = pw_context_connect(pw->context, props, 0);
|
||||||
if (pw->core_proxy == NULL) {
|
if (pw->core_proxy == NULL) {
|
||||||
err = -errno;
|
err = -errno;
|
||||||
pw_thread_loop_unlock(pw->main_loop);
|
pw_thread_loop_unlock(pw->main_loop);
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,7 @@ struct port {
|
||||||
struct context {
|
struct context {
|
||||||
struct pw_main_loop *main;
|
struct pw_main_loop *main;
|
||||||
struct pw_thread_loop *loop;
|
struct pw_thread_loop *loop;
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
|
|
||||||
struct pw_map globals;
|
struct pw_map globals;
|
||||||
struct spa_list free_objects;
|
struct spa_list free_objects;
|
||||||
|
|
@ -2102,13 +2102,13 @@ jack_client_t * jack_client_open (const char *client_name,
|
||||||
strncpy(client->name, client_name, JACK_CLIENT_NAME_SIZE);
|
strncpy(client->name, client_name, JACK_CLIENT_NAME_SIZE);
|
||||||
client->context.main = pw_main_loop_new(NULL);
|
client->context.main = pw_main_loop_new(NULL);
|
||||||
client->context.loop = pw_thread_loop_new(pw_main_loop_get_loop(client->context.main), client_name);
|
client->context.loop = pw_thread_loop_new(pw_main_loop_get_loop(client->context.main), client_name);
|
||||||
client->context.core = pw_core_new(pw_thread_loop_get_loop(client->context.loop), NULL, 0);
|
client->context.context = pw_context_new(pw_thread_loop_get_loop(client->context.loop), NULL, 0);
|
||||||
spa_list_init(&client->context.free_objects);
|
spa_list_init(&client->context.free_objects);
|
||||||
spa_list_init(&client->context.nodes);
|
spa_list_init(&client->context.nodes);
|
||||||
spa_list_init(&client->context.ports);
|
spa_list_init(&client->context.ports);
|
||||||
spa_list_init(&client->context.links);
|
spa_list_init(&client->context.links);
|
||||||
|
|
||||||
support = pw_core_get_support(client->context.core, &n_support);
|
support = pw_context_get_support(client->context.context, &n_support);
|
||||||
|
|
||||||
mix2 = mix2_c;
|
mix2 = mix2_c;
|
||||||
cpu_iface = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU);
|
cpu_iface = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU);
|
||||||
|
|
@ -2142,7 +2142,7 @@ jack_client_t * jack_client_open (const char *client_name,
|
||||||
|
|
||||||
pw_thread_loop_lock(client->context.loop);
|
pw_thread_loop_lock(client->context.loop);
|
||||||
|
|
||||||
client->core_proxy = pw_core_connect(client->context.core,
|
client->core_proxy = pw_context_connect(client->context.context,
|
||||||
pw_properties_new(
|
pw_properties_new(
|
||||||
PW_KEY_CLIENT_NAME, client_name,
|
PW_KEY_CLIENT_NAME, client_name,
|
||||||
PW_KEY_CLIENT_API, "jack",
|
PW_KEY_CLIENT_API, "jack",
|
||||||
|
|
@ -2250,7 +2250,7 @@ int jack_client_close (jack_client_t *client)
|
||||||
pw_thread_loop_stop(c->context.loop);
|
pw_thread_loop_stop(c->context.loop);
|
||||||
|
|
||||||
c->destroyed = true;
|
c->destroyed = true;
|
||||||
pw_core_destroy(c->context.core);
|
pw_context_destroy(c->context.context);
|
||||||
pw_thread_loop_destroy(c->context.loop);
|
pw_thread_loop_destroy(c->context.loop);
|
||||||
pw_main_loop_destroy(c->context.main);
|
pw_main_loop_destroy(c->context.main);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -900,7 +900,7 @@ pa_operation* pa_context_subscribe(pa_context *c, pa_subscription_mask_t m, pa_c
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char *name, PA_CONST pa_proplist *p)
|
pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char *name, PA_CONST pa_proplist *p)
|
||||||
{
|
{
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
struct pw_loop *loop;
|
struct pw_loop *loop;
|
||||||
struct pw_properties *props;
|
struct pw_properties *props;
|
||||||
pa_context *c;
|
pa_context *c;
|
||||||
|
|
@ -915,14 +915,14 @@ pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char *
|
||||||
pw_properties_update(props, &p->props->dict);
|
pw_properties_update(props, &p->props->dict);
|
||||||
|
|
||||||
loop = mainloop->userdata;
|
loop = mainloop->userdata;
|
||||||
core = pw_core_new(loop, NULL, sizeof(struct pa_context));
|
context = pw_context_new(loop, NULL, sizeof(struct pa_context));
|
||||||
if (core == NULL)
|
if (context == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
c = pw_core_get_user_data(core);
|
c = pw_context_get_user_data(context);
|
||||||
c->props = props;
|
c->props = props;
|
||||||
c->loop = loop;
|
c->loop = loop;
|
||||||
c->core = core;
|
c->context = context;
|
||||||
c->proplist = p ? pa_proplist_copy(p) : pa_proplist_new();
|
c->proplist = p ? pa_proplist_copy(p) : pa_proplist_new();
|
||||||
c->refcount = 1;
|
c->refcount = 1;
|
||||||
c->client_index = PA_INVALID_INDEX;
|
c->client_index = PA_INVALID_INDEX;
|
||||||
|
|
@ -942,10 +942,10 @@ pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char *
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_core_destroy(pa_mainloop_api*m, void *userdata)
|
static void do_context_destroy(pa_mainloop_api*m, void *userdata)
|
||||||
{
|
{
|
||||||
pa_context *c = userdata;
|
pa_context *c = userdata;
|
||||||
pw_core_destroy(c->core);
|
pw_context_destroy(c->context);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void context_free(pa_context *c)
|
static void context_free(pa_context *c)
|
||||||
|
|
@ -960,7 +960,7 @@ static void context_free(pa_context *c)
|
||||||
if (c->core_info)
|
if (c->core_info)
|
||||||
pw_core_info_free(c->core_info);
|
pw_core_info_free(c->core_info);
|
||||||
|
|
||||||
pa_mainloop_api_once(c->mainloop, do_core_destroy, c);
|
pa_mainloop_api_once(c->mainloop, do_context_destroy, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
|
|
@ -1056,7 +1056,7 @@ int pa_context_connect(pa_context *c, const char *server, pa_context_flags_t fla
|
||||||
|
|
||||||
pa_context_set_state(c, PA_CONTEXT_CONNECTING);
|
pa_context_set_state(c, PA_CONTEXT_CONNECTING);
|
||||||
|
|
||||||
c->core_proxy = pw_core_connect(c->core, pw_properties_copy(c->props), 0);
|
c->core_proxy = pw_context_connect(c->context, pw_properties_copy(c->props), 0);
|
||||||
if (c->core_proxy == NULL) {
|
if (c->core_proxy == NULL) {
|
||||||
context_fail(c, PA_ERR_CONNECTIONREFUSED);
|
context_fail(c, PA_ERR_CONNECTIONREFUSED);
|
||||||
res = -1;
|
res = -1;
|
||||||
|
|
|
||||||
|
|
@ -282,7 +282,7 @@ struct pa_context {
|
||||||
uint32_t client_index;
|
uint32_t client_index;
|
||||||
|
|
||||||
struct pw_loop *loop;
|
struct pw_loop *loop;
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
|
|
||||||
struct pw_properties *props;
|
struct pw_properties *props;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ static const char whitespace[] = " \t";
|
||||||
/** \endcond */
|
/** \endcond */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
execute_command_help(struct pw_command *command, struct pw_core *core, char **err)
|
execute_command_help(struct pw_command *command, struct pw_context *context, char **err)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -100,7 +100,7 @@ no_mem:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
execute_command_set_prop(struct pw_command *command, struct pw_core *core, char **err)
|
execute_command_set_prop(struct pw_command *command, struct pw_context *context, char **err)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -136,11 +136,11 @@ error_alloc:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
execute_command_add_spa_lib(struct pw_command *command, struct pw_core *core, char **err)
|
execute_command_add_spa_lib(struct pw_command *command, struct pw_context *context, char **err)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
res = pw_core_add_spa_lib(core, command->args[1], command->args[2]);
|
res = pw_context_add_spa_lib(context, command->args[1], command->args[2]);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
asprintf(err, "could not add spa library \"%s\"", command->args[1]);
|
asprintf(err, "could not add spa library \"%s\"", command->args[1]);
|
||||||
return res;
|
return res;
|
||||||
|
|
@ -176,11 +176,11 @@ no_mem:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
execute_command_module_load(struct pw_command *command, struct pw_core *core, char **err)
|
execute_command_module_load(struct pw_command *command, struct pw_context *context, char **err)
|
||||||
{
|
{
|
||||||
struct pw_module *module;
|
struct pw_module *module;
|
||||||
|
|
||||||
module = pw_module_load(core, command->args[1], command->args[2], NULL);
|
module = pw_module_load(context, command->args[1], command->args[2], NULL);
|
||||||
if (module == NULL) {
|
if (module == NULL) {
|
||||||
asprintf(err, "could not load module \"%s\": %m", command->args[1]);
|
asprintf(err, "could not load module \"%s\": %m", command->args[1]);
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
@ -216,7 +216,7 @@ no_mem:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
execute_command_exec(struct pw_command *command, struct pw_core *core, char **err)
|
execute_command_exec(struct pw_command *command, struct pw_context *context, char **err)
|
||||||
{
|
{
|
||||||
int pid;
|
int pid;
|
||||||
|
|
||||||
|
|
@ -315,14 +315,14 @@ out:
|
||||||
/** Run a command
|
/** Run a command
|
||||||
*
|
*
|
||||||
* \param command A \ref pw_command
|
* \param command A \ref pw_command
|
||||||
* \param core A \ref pw_core
|
* \param context A \ref pw_context
|
||||||
* \param err Return location for an error string, or NULL
|
* \param err Return location for an error string, or NULL
|
||||||
* \return 0 on success, < 0 on error
|
* \return 0 on success, < 0 on error
|
||||||
*
|
*
|
||||||
* \memberof pw_command
|
* \memberof pw_command
|
||||||
*/
|
*/
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
int pw_command_run(struct pw_command *command, struct pw_core *core, char **err)
|
int pw_command_run(struct pw_command *command, struct pw_context *context, char **err)
|
||||||
{
|
{
|
||||||
return command->func(command, core, err);
|
return command->func(command, context, err);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,11 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <pipewire/core.h>
|
#include <pipewire/context.h>
|
||||||
|
|
||||||
struct pw_command;
|
struct pw_command;
|
||||||
|
|
||||||
typedef int (*pw_command_func_t) (struct pw_command *command, struct pw_core *core, char **err);
|
typedef int (*pw_command_func_t) (struct pw_command *command, struct pw_context *context, char **err);
|
||||||
|
|
||||||
/** \class pw_command
|
/** \class pw_command
|
||||||
*
|
*
|
||||||
|
|
@ -54,7 +54,7 @@ pw_command_parse(struct pw_properties *properties, const char *line, char **err)
|
||||||
void
|
void
|
||||||
pw_command_free(struct pw_command *command);
|
pw_command_free(struct pw_command *command);
|
||||||
|
|
||||||
int pw_command_run(struct pw_command *command, struct pw_core *core, char **err);
|
int pw_command_run(struct pw_command *command, struct pw_context *context, char **err);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -186,21 +186,21 @@ int pw_daemon_config_load(struct pw_daemon_config *config, char **err)
|
||||||
/**
|
/**
|
||||||
* pw_daemon_config_run_commands:
|
* pw_daemon_config_run_commands:
|
||||||
* @config: A #struct pw_daemon_config
|
* @config: A #struct pw_daemon_config
|
||||||
* @core: A #struct pw_core
|
* @context: A #struct pw_context
|
||||||
*
|
*
|
||||||
* Run all commands that have been parsed. The list of commands will be cleared
|
* Run all commands that have been parsed. The list of commands will be cleared
|
||||||
* when this function has been called.
|
* when this function has been called.
|
||||||
*
|
*
|
||||||
* Returns: 0 if all commands where executed with success, otherwise < 0.
|
* Returns: 0 if all commands where executed with success, otherwise < 0.
|
||||||
*/
|
*/
|
||||||
int pw_daemon_config_run_commands(struct pw_daemon_config *config, struct pw_core *core)
|
int pw_daemon_config_run_commands(struct pw_daemon_config *config, struct pw_context *context)
|
||||||
{
|
{
|
||||||
char *err = NULL;
|
char *err = NULL;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct pw_command *command;
|
struct pw_command *command;
|
||||||
|
|
||||||
spa_list_for_each(command, &config->commands, link) {
|
spa_list_for_each(command, &config->commands, link) {
|
||||||
if ((ret = pw_command_run(command, core, &err)) < 0) {
|
if ((ret = pw_command_run(command, context, &err)) < 0) {
|
||||||
pw_log_warn("could not run command %s: %s", command->args[0], err);
|
pw_log_warn("could not run command %s: %s", command->args[0], err);
|
||||||
free(err);
|
free(err);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <pipewire/core.h>
|
#include <pipewire/context.h>
|
||||||
|
|
||||||
struct pw_daemon_config {
|
struct pw_daemon_config {
|
||||||
struct spa_list commands;
|
struct spa_list commands;
|
||||||
|
|
@ -45,7 +45,7 @@ int pw_daemon_config_load_file(struct pw_daemon_config *config, const char *file
|
||||||
|
|
||||||
int pw_daemon_config_load(struct pw_daemon_config *config, char **err);
|
int pw_daemon_config_load(struct pw_daemon_config *config, char **err);
|
||||||
|
|
||||||
int pw_daemon_config_run_commands(struct pw_daemon_config *config, struct pw_core *core);
|
int pw_daemon_config_run_commands(struct pw_daemon_config *config, struct pw_context *context);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
#include <spa/utils/result.h>
|
#include <spa/utils/result.h>
|
||||||
|
|
||||||
#include <pipewire/pipewire.h>
|
#include <pipewire/pipewire.h>
|
||||||
#include <pipewire/core.h>
|
#include <pipewire/context.h>
|
||||||
#include <pipewire/module.h>
|
#include <pipewire/module.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
@ -54,7 +54,7 @@ static void show_help(const char *name)
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
struct pw_main_loop *loop;
|
struct pw_main_loop *loop;
|
||||||
struct pw_daemon_config *config;
|
struct pw_daemon_config *config;
|
||||||
struct pw_properties *properties;
|
struct pw_properties *properties;
|
||||||
|
|
@ -114,15 +114,15 @@ int main(int argc, char *argv[])
|
||||||
pw_loop_add_signal(pw_main_loop_get_loop(loop), SIGINT, do_quit, loop);
|
pw_loop_add_signal(pw_main_loop_get_loop(loop), SIGINT, do_quit, loop);
|
||||||
pw_loop_add_signal(pw_main_loop_get_loop(loop), SIGTERM, do_quit, loop);
|
pw_loop_add_signal(pw_main_loop_get_loop(loop), SIGTERM, do_quit, loop);
|
||||||
|
|
||||||
core = pw_core_new(pw_main_loop_get_loop(loop),
|
context = pw_context_new(pw_main_loop_get_loop(loop),
|
||||||
properties, 0);
|
properties, 0);
|
||||||
|
|
||||||
if (core == NULL) {
|
if (context == NULL) {
|
||||||
pw_log_error("failed to create core: %m");
|
pw_log_error("failed to create context: %m");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((res = pw_daemon_config_run_commands(config, core)) < 0) {
|
if ((res = pw_daemon_config_run_commands(config, context)) < 0) {
|
||||||
pw_log_error("failed to run config commands: %s", spa_strerror(res));
|
pw_log_error("failed to run config commands: %s", spa_strerror(res));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -132,7 +132,7 @@ int main(int argc, char *argv[])
|
||||||
pw_log_info("leave main loop");
|
pw_log_info("leave main loop");
|
||||||
|
|
||||||
pw_daemon_config_free(config);
|
pw_daemon_config_free(config);
|
||||||
pw_core_destroy(core);
|
pw_context_destroy(context);
|
||||||
pw_main_loop_destroy(loop);
|
pw_main_loop_destroy(loop);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ struct impl {
|
||||||
struct timespec now;
|
struct timespec now;
|
||||||
|
|
||||||
struct pw_main_loop *loop;
|
struct pw_main_loop *loop;
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
|
|
||||||
struct pw_core_proxy *core_proxy;
|
struct pw_core_proxy *core_proxy;
|
||||||
struct spa_hook core_listener;
|
struct spa_hook core_listener;
|
||||||
|
|
@ -108,7 +108,7 @@ static struct node *create_node(struct object *obj, uint32_t id,
|
||||||
{
|
{
|
||||||
struct node *node;
|
struct node *node;
|
||||||
struct impl *impl = obj->impl;
|
struct impl *impl = obj->impl;
|
||||||
struct pw_core *core = impl->core;
|
struct pw_context *context = impl->context;
|
||||||
struct spa_handle *handle;
|
struct spa_handle *handle;
|
||||||
int res;
|
int res;
|
||||||
void *iface;
|
void *iface;
|
||||||
|
|
@ -118,7 +118,7 @@ static struct node *create_node(struct object *obj, uint32_t id,
|
||||||
if (info->type != SPA_TYPE_INTERFACE_Node)
|
if (info->type != SPA_TYPE_INTERFACE_Node)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
handle = pw_core_load_spa_handle(core,
|
handle = pw_context_load_spa_handle(context,
|
||||||
info->factory_name,
|
info->factory_name,
|
||||||
info->props);
|
info->props);
|
||||||
if (handle == NULL) {
|
if (handle == NULL) {
|
||||||
|
|
@ -216,7 +216,7 @@ static void update_object(struct impl *impl, struct object *obj,
|
||||||
static struct object *create_object(struct impl *impl, uint32_t id,
|
static struct object *create_object(struct impl *impl, uint32_t id,
|
||||||
const struct spa_device_object_info *info)
|
const struct spa_device_object_info *info)
|
||||||
{
|
{
|
||||||
struct pw_core *core = impl->core;
|
struct pw_context *context = impl->context;
|
||||||
struct object *obj;
|
struct object *obj;
|
||||||
struct spa_handle *handle;
|
struct spa_handle *handle;
|
||||||
int res;
|
int res;
|
||||||
|
|
@ -227,7 +227,7 @@ static struct object *create_object(struct impl *impl, uint32_t id,
|
||||||
if (info->type != SPA_TYPE_INTERFACE_Device)
|
if (info->type != SPA_TYPE_INTERFACE_Device)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
handle = pw_core_load_spa_handle(core,
|
handle = pw_context_load_spa_handle(context,
|
||||||
info->factory_name,
|
info->factory_name,
|
||||||
info->props);
|
info->props);
|
||||||
if (handle == NULL) {
|
if (handle == NULL) {
|
||||||
|
|
@ -314,7 +314,7 @@ static int start_monitor(struct impl *impl)
|
||||||
int res;
|
int res;
|
||||||
void *iface;
|
void *iface;
|
||||||
|
|
||||||
handle = pw_core_load_spa_handle(impl->core, SPA_NAME_API_BLUEZ5_ENUM_DBUS, NULL);
|
handle = pw_context_load_spa_handle(impl->context, SPA_NAME_API_BLUEZ5_ENUM_DBUS, NULL);
|
||||||
if (handle == NULL) {
|
if (handle == NULL) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
goto out;
|
goto out;
|
||||||
|
|
@ -363,15 +363,15 @@ int main(int argc, char *argv[])
|
||||||
pw_init(&argc, &argv);
|
pw_init(&argc, &argv);
|
||||||
|
|
||||||
impl.loop = pw_main_loop_new(NULL);
|
impl.loop = pw_main_loop_new(NULL);
|
||||||
impl.core = pw_core_new(pw_main_loop_get_loop(impl.loop), NULL, 0);
|
impl.context = pw_context_new(pw_main_loop_get_loop(impl.loop), NULL, 0);
|
||||||
|
|
||||||
pw_core_add_spa_lib(impl.core, "api.bluez5.*", "bluez5/libspa-bluez5");
|
pw_context_add_spa_lib(impl.context, "api.bluez5.*", "bluez5/libspa-bluez5");
|
||||||
|
|
||||||
clock_gettime(CLOCK_MONOTONIC, &impl.now);
|
clock_gettime(CLOCK_MONOTONIC, &impl.now);
|
||||||
|
|
||||||
spa_list_init(&impl.device_list);
|
spa_list_init(&impl.device_list);
|
||||||
|
|
||||||
impl.core_proxy = pw_core_connect(impl.core, NULL, 0);
|
impl.core_proxy = pw_context_connect(impl.context, NULL, 0);
|
||||||
if (impl.core_proxy == NULL) {
|
if (impl.core_proxy == NULL) {
|
||||||
pw_log_error(NAME" %p: can't connect %m", &impl);
|
pw_log_error(NAME" %p: can't connect %m", &impl);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -388,7 +388,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
pw_main_loop_run(impl.loop);
|
pw_main_loop_run(impl.loop);
|
||||||
|
|
||||||
pw_core_destroy(impl.core);
|
pw_context_destroy(impl.context);
|
||||||
pw_main_loop_destroy(impl.loop);
|
pw_main_loop_destroy(impl.loop);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ struct data {
|
||||||
|
|
||||||
struct pw_main_loop *loop;
|
struct pw_main_loop *loop;
|
||||||
|
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
|
|
||||||
struct pw_core_proxy *core_proxy;
|
struct pw_core_proxy *core_proxy;
|
||||||
struct spa_hook core_listener;
|
struct spa_hook core_listener;
|
||||||
|
|
@ -518,7 +518,7 @@ int main(int argc, char *argv[])
|
||||||
pw_init(&argc, &argv);
|
pw_init(&argc, &argv);
|
||||||
|
|
||||||
data.loop = pw_main_loop_new(NULL);
|
data.loop = pw_main_loop_new(NULL);
|
||||||
data.core = pw_core_new(pw_main_loop_get_loop(data.loop), NULL, 0);
|
data.context = pw_context_new(pw_main_loop_get_loop(data.loop), NULL, 0);
|
||||||
data.path = argc > 1 ? argv[1] : NULL;
|
data.path = argc > 1 ? argv[1] : NULL;
|
||||||
|
|
||||||
spa_hook_list_init(&data.hooks);
|
spa_hook_list_init(&data.hooks);
|
||||||
|
|
@ -548,7 +548,7 @@ int main(int argc, char *argv[])
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
data.core_proxy = pw_core_connect(data.core, NULL, 0);
|
data.core_proxy = pw_context_connect(data.context, NULL, 0);
|
||||||
if (data.core_proxy == NULL) {
|
if (data.core_proxy == NULL) {
|
||||||
printf("can't connect: %m\n");
|
printf("can't connect: %m\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -561,7 +561,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
pw_main_loop_run(data.loop);
|
pw_main_loop_run(data.loop);
|
||||||
|
|
||||||
pw_core_destroy(data.core);
|
pw_context_destroy(data.context);
|
||||||
pw_main_loop_destroy(data.loop);
|
pw_main_loop_destroy(data.loop);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ struct data {
|
||||||
|
|
||||||
struct pw_main_loop *loop;
|
struct pw_main_loop *loop;
|
||||||
|
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
|
|
||||||
struct pw_core_proxy *core_proxy;
|
struct pw_core_proxy *core_proxy;
|
||||||
struct spa_hook core_listener;
|
struct spa_hook core_listener;
|
||||||
|
|
@ -509,7 +509,7 @@ int main(int argc, char *argv[])
|
||||||
pw_init(&argc, &argv);
|
pw_init(&argc, &argv);
|
||||||
|
|
||||||
data.loop = pw_main_loop_new(NULL);
|
data.loop = pw_main_loop_new(NULL);
|
||||||
data.core = pw_core_new(pw_main_loop_get_loop(data.loop), NULL, 0);
|
data.context = pw_context_new(pw_main_loop_get_loop(data.loop), NULL, 0);
|
||||||
data.path = argc > 1 ? argv[1] : NULL;
|
data.path = argc > 1 ? argv[1] : NULL;
|
||||||
|
|
||||||
data.info_all = SPA_PORT_CHANGE_MASK_FLAGS |
|
data.info_all = SPA_PORT_CHANGE_MASK_FLAGS |
|
||||||
|
|
@ -531,7 +531,7 @@ int main(int argc, char *argv[])
|
||||||
spa_list_init(&data.empty);
|
spa_list_init(&data.empty);
|
||||||
spa_hook_list_init(&data.hooks);
|
spa_hook_list_init(&data.hooks);
|
||||||
|
|
||||||
if ((data.core_proxy = pw_core_connect(data.core, NULL, 0)) == NULL) {
|
if ((data.core_proxy = pw_context_connect(data.context, NULL, 0)) == NULL) {
|
||||||
printf("can't connect: %m\n");
|
printf("can't connect: %m\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -542,7 +542,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
pw_main_loop_run(data.loop);
|
pw_main_loop_run(data.loop);
|
||||||
|
|
||||||
pw_core_destroy(data.core);
|
pw_context_destroy(data.context);
|
||||||
pw_main_loop_destroy(data.loop);
|
pw_main_loop_destroy(data.loop);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
struct data {
|
struct data {
|
||||||
struct pw_main_loop *loop;
|
struct pw_main_loop *loop;
|
||||||
|
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
|
|
||||||
struct pw_core_proxy *core_proxy;
|
struct pw_core_proxy *core_proxy;
|
||||||
struct spa_hook core_listener;
|
struct spa_hook core_listener;
|
||||||
|
|
@ -51,7 +51,7 @@ static int make_device(struct data *data)
|
||||||
struct pw_factory *factory;
|
struct pw_factory *factory;
|
||||||
struct pw_properties *props;
|
struct pw_properties *props;
|
||||||
|
|
||||||
factory = pw_core_find_factory(data->core, "spa-device-factory");
|
factory = pw_context_find_factory(data->context, "spa-device-factory");
|
||||||
if (factory == NULL)
|
if (factory == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
@ -111,13 +111,13 @@ int main(int argc, char *argv[])
|
||||||
l = pw_main_loop_get_loop(data.loop);
|
l = pw_main_loop_get_loop(data.loop);
|
||||||
pw_loop_add_signal(l, SIGINT, do_quit, &data);
|
pw_loop_add_signal(l, SIGINT, do_quit, &data);
|
||||||
pw_loop_add_signal(l, SIGTERM, do_quit, &data);
|
pw_loop_add_signal(l, SIGTERM, do_quit, &data);
|
||||||
data.core = pw_core_new(l, NULL, 0);
|
data.context = pw_context_new(l, NULL, 0);
|
||||||
data.library = argv[1];
|
data.library = argv[1];
|
||||||
data.factory = argv[2];
|
data.factory = argv[2];
|
||||||
|
|
||||||
pw_module_load(data.core, "libpipewire-module-spa-device-factory", NULL, NULL);
|
pw_module_load(data.context, "libpipewire-module-spa-device-factory", NULL, NULL);
|
||||||
|
|
||||||
data.core_proxy = pw_core_connect(data.core, NULL, 0);
|
data.core_proxy = pw_context_connect(data.context, NULL, 0);
|
||||||
if (data.core_proxy == NULL) {
|
if (data.core_proxy == NULL) {
|
||||||
pw_log_error("can't connect %m");
|
pw_log_error("can't connect %m");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -132,7 +132,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
pw_main_loop_run(data.loop);
|
pw_main_loop_run(data.loop);
|
||||||
|
|
||||||
pw_core_destroy(data.core);
|
pw_context_destroy(data.context);
|
||||||
pw_main_loop_destroy(data.loop);
|
pw_main_loop_destroy(data.loop);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
struct data {
|
struct data {
|
||||||
struct pw_main_loop *loop;
|
struct pw_main_loop *loop;
|
||||||
|
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
|
|
||||||
struct pw_core_proxy *core_proxy;
|
struct pw_core_proxy *core_proxy;
|
||||||
struct spa_hook core_listener;
|
struct spa_hook core_listener;
|
||||||
|
|
@ -77,7 +77,7 @@ static int make_node(struct data *data)
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
|
||||||
hndl = pw_core_load_spa_handle(data->core, data->factory, &props->dict);
|
hndl = pw_context_load_spa_handle(data->context, data->factory, &props->dict);
|
||||||
if (hndl == NULL)
|
if (hndl == NULL)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
|
|
@ -144,15 +144,15 @@ int main(int argc, char *argv[])
|
||||||
l = pw_main_loop_get_loop(data.loop);
|
l = pw_main_loop_get_loop(data.loop);
|
||||||
pw_loop_add_signal(l, SIGINT, do_quit, &data);
|
pw_loop_add_signal(l, SIGINT, do_quit, &data);
|
||||||
pw_loop_add_signal(l, SIGTERM, do_quit, &data);
|
pw_loop_add_signal(l, SIGTERM, do_quit, &data);
|
||||||
data.core = pw_core_new(l, NULL, 0);
|
data.context = pw_context_new(l, NULL, 0);
|
||||||
data.library = argv[1];
|
data.library = argv[1];
|
||||||
data.factory = argv[2];
|
data.factory = argv[2];
|
||||||
if (argc > 3)
|
if (argc > 3)
|
||||||
data.path = argv[3];
|
data.path = argv[3];
|
||||||
|
|
||||||
pw_module_load(data.core, "libpipewire-module-spa-node-factory", NULL, NULL);
|
pw_module_load(data.context, "libpipewire-module-spa-node-factory", NULL, NULL);
|
||||||
|
|
||||||
data.core_proxy = pw_core_connect(data.core, NULL, 0);
|
data.core_proxy = pw_context_connect(data.context, NULL, 0);
|
||||||
if (data.core_proxy == NULL) {
|
if (data.core_proxy == NULL) {
|
||||||
printf("can't connect: %m\n");
|
printf("can't connect: %m\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -168,7 +168,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
pw_main_loop_run(data.loop);
|
pw_main_loop_run(data.loop);
|
||||||
|
|
||||||
pw_core_destroy(data.core);
|
pw_context_destroy(data.context);
|
||||||
pw_main_loop_destroy(data.loop);
|
pw_main_loop_destroy(data.loop);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ struct data {
|
||||||
struct pw_main_loop *loop;
|
struct pw_main_loop *loop;
|
||||||
struct spa_source *timer;
|
struct spa_source *timer;
|
||||||
|
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
struct pw_core_proxy *core_proxy;
|
struct pw_core_proxy *core_proxy;
|
||||||
struct spa_port_info port_info;
|
struct spa_port_info port_info;
|
||||||
|
|
||||||
|
|
@ -401,7 +401,7 @@ int main(int argc, char *argv[])
|
||||||
pw_init(&argc, &argv);
|
pw_init(&argc, &argv);
|
||||||
|
|
||||||
data.loop = pw_main_loop_new(NULL);
|
data.loop = pw_main_loop_new(NULL);
|
||||||
data.core = pw_core_new(
|
data.context = pw_context_new(
|
||||||
pw_main_loop_get_loop(data.loop),
|
pw_main_loop_get_loop(data.loop),
|
||||||
pw_properties_new(
|
pw_properties_new(
|
||||||
PW_KEY_CORE_DAEMON, "0",
|
PW_KEY_CORE_DAEMON, "0",
|
||||||
|
|
@ -409,8 +409,8 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
spa_hook_list_init(&data.hooks);
|
spa_hook_list_init(&data.hooks);
|
||||||
|
|
||||||
pw_module_load(data.core, "libpipewire-module-spa-node-factory", NULL, NULL);
|
pw_module_load(data.context, "libpipewire-module-spa-node-factory", NULL, NULL);
|
||||||
pw_module_load(data.core, "libpipewire-module-link-factory", NULL, NULL);
|
pw_module_load(data.context, "libpipewire-module-link-factory", NULL, NULL);
|
||||||
|
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||||
printf("can't initialize SDL: %s\n", SDL_GetError());
|
printf("can't initialize SDL: %s\n", SDL_GetError());
|
||||||
|
|
@ -423,7 +423,7 @@ int main(int argc, char *argv[])
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
data.core_proxy = pw_core_connect_self(data.core, NULL, 0);
|
data.core_proxy = pw_context_connect_self(data.context, NULL, 0);
|
||||||
if (data.core_proxy == NULL) {
|
if (data.core_proxy == NULL) {
|
||||||
printf("can't connect to core: %m\n");
|
printf("can't connect to core: %m\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -433,7 +433,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
pw_main_loop_run(data.loop);
|
pw_main_loop_run(data.loop);
|
||||||
|
|
||||||
pw_core_destroy(data.core);
|
pw_context_destroy(data.context);
|
||||||
pw_main_loop_destroy(data.loop);
|
pw_main_loop_destroy(data.loop);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -539,7 +539,7 @@ static const struct sm_object_events device_events = {
|
||||||
static struct device *alsa_create_device(struct impl *impl, uint32_t id,
|
static struct device *alsa_create_device(struct impl *impl, uint32_t id,
|
||||||
const struct spa_device_object_info *info)
|
const struct spa_device_object_info *info)
|
||||||
{
|
{
|
||||||
struct pw_core *core = impl->session->core;
|
struct pw_context *context = impl->session->context;
|
||||||
struct device *device;
|
struct device *device;
|
||||||
struct spa_handle *handle;
|
struct spa_handle *handle;
|
||||||
int res;
|
int res;
|
||||||
|
|
@ -553,7 +553,7 @@ static struct device *alsa_create_device(struct impl *impl, uint32_t id,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle = pw_core_load_spa_handle(core,
|
handle = pw_context_load_spa_handle(context,
|
||||||
info->factory_name,
|
info->factory_name,
|
||||||
info->props);
|
info->props);
|
||||||
if (handle == NULL) {
|
if (handle == NULL) {
|
||||||
|
|
@ -700,7 +700,7 @@ static int alsa_start_jack_device(struct impl *impl)
|
||||||
|
|
||||||
void *sm_alsa_monitor_start(struct sm_media_session *session)
|
void *sm_alsa_monitor_start(struct sm_media_session *session)
|
||||||
{
|
{
|
||||||
struct pw_core *core = session->core;
|
struct pw_context *context = session->context;
|
||||||
struct impl *impl;
|
struct impl *impl;
|
||||||
void *iface;
|
void *iface;
|
||||||
int res;
|
int res;
|
||||||
|
|
@ -718,7 +718,7 @@ void *sm_alsa_monitor_start(struct sm_media_session *session)
|
||||||
else
|
else
|
||||||
pw_log_debug("got dbus connection %p", impl->conn);
|
pw_log_debug("got dbus connection %p", impl->conn);
|
||||||
|
|
||||||
impl->handle = pw_core_load_spa_handle(core, SPA_NAME_API_ALSA_ENUM_UDEV, NULL);
|
impl->handle = pw_context_load_spa_handle(context, SPA_NAME_API_ALSA_ENUM_UDEV, NULL);
|
||||||
if (impl->handle == NULL) {
|
if (impl->handle == NULL) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
goto out_free;
|
goto out_free;
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ static struct bluez5_node *bluez5_create_node(struct bluez5_object *obj, uint32_
|
||||||
{
|
{
|
||||||
struct bluez5_node *node;
|
struct bluez5_node *node;
|
||||||
struct impl *impl = obj->impl;
|
struct impl *impl = obj->impl;
|
||||||
struct pw_core *core = impl->session->core;
|
struct pw_context *context = impl->session->context;
|
||||||
struct pw_factory *factory;
|
struct pw_factory *factory;
|
||||||
int res;
|
int res;
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
@ -142,7 +142,7 @@ static struct bluez5_node *bluez5_create_node(struct bluez5_object *obj, uint32_
|
||||||
node->object = obj;
|
node->object = obj;
|
||||||
node->id = id;
|
node->id = id;
|
||||||
|
|
||||||
factory = pw_core_find_factory(core, "adapter");
|
factory = pw_context_find_factory(context, "adapter");
|
||||||
if (factory == NULL) {
|
if (factory == NULL) {
|
||||||
pw_log_error("no adapter factory found");
|
pw_log_error("no adapter factory found");
|
||||||
res = -EIO;
|
res = -EIO;
|
||||||
|
|
@ -236,7 +236,7 @@ static void bluez5_update_object(struct impl *impl, struct bluez5_object *obj,
|
||||||
static struct bluez5_object *bluez5_create_object(struct impl *impl, uint32_t id,
|
static struct bluez5_object *bluez5_create_object(struct impl *impl, uint32_t id,
|
||||||
const struct spa_device_object_info *info)
|
const struct spa_device_object_info *info)
|
||||||
{
|
{
|
||||||
struct pw_core *core = impl->session->core;
|
struct pw_context *context = impl->session->context;
|
||||||
struct bluez5_object *obj;
|
struct bluez5_object *obj;
|
||||||
struct spa_handle *handle;
|
struct spa_handle *handle;
|
||||||
int res;
|
int res;
|
||||||
|
|
@ -249,7 +249,7 @@ static struct bluez5_object *bluez5_create_object(struct impl *impl, uint32_t id
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle = pw_core_load_spa_handle(core,
|
handle = pw_context_load_spa_handle(context,
|
||||||
info->factory_name,
|
info->factory_name,
|
||||||
info->props);
|
info->props);
|
||||||
if (handle == NULL) {
|
if (handle == NULL) {
|
||||||
|
|
@ -346,12 +346,12 @@ static const struct spa_device_events bluez5_enum_callbacks =
|
||||||
void *sm_bluez5_monitor_start(struct sm_media_session *session)
|
void *sm_bluez5_monitor_start(struct sm_media_session *session)
|
||||||
{
|
{
|
||||||
struct spa_handle *handle;
|
struct spa_handle *handle;
|
||||||
struct pw_core *core = session->core;
|
struct pw_context *context = session->context;
|
||||||
int res;
|
int res;
|
||||||
void *iface;
|
void *iface;
|
||||||
struct impl *impl;
|
struct impl *impl;
|
||||||
|
|
||||||
handle = pw_core_load_spa_handle(core, SPA_NAME_API_BLUEZ5_ENUM_DBUS, NULL);
|
handle = pw_context_load_spa_handle(context, SPA_NAME_API_BLUEZ5_ENUM_DBUS, NULL);
|
||||||
if (handle == NULL) {
|
if (handle == NULL) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
||||||
|
|
@ -1523,7 +1523,7 @@ static const struct pw_proxy_events client_session_proxy_events = {
|
||||||
|
|
||||||
static int start_session(struct impl *impl)
|
static int start_session(struct impl *impl)
|
||||||
{
|
{
|
||||||
impl->monitor_core = pw_core_connect(impl->this.core, NULL, 0);
|
impl->monitor_core = pw_context_connect(impl->this.context, NULL, 0);
|
||||||
if (impl->monitor_core == NULL) {
|
if (impl->monitor_core == NULL) {
|
||||||
pw_log_error("can't start monitor: %m");
|
pw_log_error("can't start monitor: %m");
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
@ -1579,14 +1579,14 @@ static void core_error(void *data, uint32_t id, int seq, int res, const char *me
|
||||||
|
|
||||||
|
|
||||||
static const struct pw_core_proxy_events core_events = {
|
static const struct pw_core_proxy_events core_events = {
|
||||||
PW_VERSION_CORE_EVENTS,
|
PW_VERSION_CORE_PROXY_EVENTS,
|
||||||
.done = core_done,
|
.done = core_done,
|
||||||
.error = core_error
|
.error = core_error
|
||||||
};
|
};
|
||||||
|
|
||||||
static int start_policy(struct impl *impl)
|
static int start_policy(struct impl *impl)
|
||||||
{
|
{
|
||||||
impl->policy_core = pw_core_connect(impl->this.core, NULL, 0);
|
impl->policy_core = pw_context_connect(impl->this.context, NULL, 0);
|
||||||
if (impl->policy_core == NULL) {
|
if (impl->policy_core == NULL) {
|
||||||
pw_log_error("can't start policy: %m");
|
pw_log_error("can't start policy: %m");
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
@ -1614,11 +1614,11 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
impl.loop = pw_main_loop_new(NULL);
|
impl.loop = pw_main_loop_new(NULL);
|
||||||
impl.this.loop = pw_main_loop_get_loop(impl.loop);
|
impl.this.loop = pw_main_loop_get_loop(impl.loop);
|
||||||
impl.this.core = pw_core_new(impl.this.loop, NULL, 0);
|
impl.this.context = pw_context_new(impl.this.loop, NULL, 0);
|
||||||
|
|
||||||
pw_core_add_spa_lib(impl.this.core, "api.bluez5.*", "bluez5/libspa-bluez5");
|
pw_context_add_spa_lib(impl.this.context, "api.bluez5.*", "bluez5/libspa-bluez5");
|
||||||
pw_core_add_spa_lib(impl.this.core, "api.alsa.*", "alsa/libspa-alsa");
|
pw_context_add_spa_lib(impl.this.context, "api.alsa.*", "alsa/libspa-alsa");
|
||||||
pw_core_add_spa_lib(impl.this.core, "api.v4l2.*", "v4l2/libspa-v4l2");
|
pw_context_add_spa_lib(impl.this.context, "api.v4l2.*", "v4l2/libspa-v4l2");
|
||||||
|
|
||||||
pw_map_init(&impl.globals, 64, 64);
|
pw_map_init(&impl.globals, 64, 64);
|
||||||
spa_list_init(&impl.global_list);
|
spa_list_init(&impl.global_list);
|
||||||
|
|
@ -1627,7 +1627,7 @@ int main(int argc, char *argv[])
|
||||||
spa_list_init(&impl.sync_list);
|
spa_list_init(&impl.sync_list);
|
||||||
spa_hook_list_init(&impl.hooks);
|
spa_hook_list_init(&impl.hooks);
|
||||||
|
|
||||||
support = pw_core_get_support(impl.this.core, &n_support);
|
support = pw_context_get_support(impl.this.context, &n_support);
|
||||||
|
|
||||||
impl.dbus = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DBus);
|
impl.dbus = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DBus);
|
||||||
if (impl.dbus)
|
if (impl.dbus)
|
||||||
|
|
@ -1644,7 +1644,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
pw_main_loop_run(impl.loop);
|
pw_main_loop_run(impl.loop);
|
||||||
|
|
||||||
pw_core_destroy(impl.this.core);
|
pw_context_destroy(impl.this.context);
|
||||||
pw_main_loop_destroy(impl.loop);
|
pw_main_loop_destroy(impl.loop);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,7 @@ struct sm_media_session {
|
||||||
struct sm_session *session; /** session object managed by this session */
|
struct sm_session *session; /** session object managed by this session */
|
||||||
|
|
||||||
struct pw_loop *loop; /** the main loop */
|
struct pw_loop *loop; /** the main loop */
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
|
|
||||||
struct spa_dbus_connection *dbus_connection;
|
struct spa_dbus_connection *dbus_connection;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ struct impl {
|
||||||
struct sm_media_session *session;
|
struct sm_media_session *session;
|
||||||
struct spa_hook listener;
|
struct spa_hook listener;
|
||||||
|
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
|
|
||||||
struct spa_list endpoint_list;
|
struct spa_list endpoint_list;
|
||||||
int seq;
|
int seq;
|
||||||
|
|
@ -474,6 +474,9 @@ static int rescan_endpoint(struct impl *impl, struct endpoint *ep)
|
||||||
peer = sm_object_get_data(obj, SESSION_KEY);
|
peer = sm_object_get_data(obj, SESSION_KEY);
|
||||||
goto do_link;
|
goto do_link;
|
||||||
}
|
}
|
||||||
|
if (obj->type == PW_TYPE_INTERFACE_Node) {
|
||||||
|
pw_log_debug(NAME " %p: target is node", impl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
str = spa_dict_lookup(props, PW_KEY_NODE_DONT_RECONNECT);
|
str = spa_dict_lookup(props, PW_KEY_NODE_DONT_RECONNECT);
|
||||||
|
|
@ -542,7 +545,7 @@ void *sm_policy_ep_start(struct sm_media_session *session)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
impl->session = session;
|
impl->session = session;
|
||||||
impl->core = session->core;
|
impl->context = session->context;
|
||||||
|
|
||||||
spa_list_init(&impl->endpoint_list);
|
spa_list_init(&impl->endpoint_list);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -261,7 +261,7 @@ static int v4l2_update_device_props(struct v4l2_object *obj)
|
||||||
static struct v4l2_object *v4l2_create_object(struct impl *impl, uint32_t id,
|
static struct v4l2_object *v4l2_create_object(struct impl *impl, uint32_t id,
|
||||||
const struct spa_device_object_info *info)
|
const struct spa_device_object_info *info)
|
||||||
{
|
{
|
||||||
struct pw_core *core = impl->session->core;
|
struct pw_context *context = impl->session->context;
|
||||||
struct v4l2_object *obj;
|
struct v4l2_object *obj;
|
||||||
struct spa_handle *handle;
|
struct spa_handle *handle;
|
||||||
int res;
|
int res;
|
||||||
|
|
@ -274,7 +274,7 @@ static struct v4l2_object *v4l2_create_object(struct impl *impl, uint32_t id,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle = pw_core_load_spa_handle(core,
|
handle = pw_context_load_spa_handle(context,
|
||||||
info->factory_name,
|
info->factory_name,
|
||||||
info->props);
|
info->props);
|
||||||
if (handle == NULL) {
|
if (handle == NULL) {
|
||||||
|
|
@ -364,7 +364,7 @@ static const struct spa_device_events v4l2_udev_callbacks =
|
||||||
|
|
||||||
void * sm_v4l2_monitor_start(struct sm_media_session *sess)
|
void * sm_v4l2_monitor_start(struct sm_media_session *sess)
|
||||||
{
|
{
|
||||||
struct pw_core *core = sess->core;
|
struct pw_context *context = sess->context;
|
||||||
struct impl *impl;
|
struct impl *impl;
|
||||||
int res;
|
int res;
|
||||||
void *iface;
|
void *iface;
|
||||||
|
|
@ -375,7 +375,7 @@ void * sm_v4l2_monitor_start(struct sm_media_session *sess)
|
||||||
|
|
||||||
impl->session = sess;
|
impl->session = sess;
|
||||||
|
|
||||||
impl->handle = pw_core_load_spa_handle(core, SPA_NAME_API_V4L2_ENUM_UDEV, NULL);
|
impl->handle = pw_context_load_spa_handle(context, SPA_NAME_API_V4L2_ENUM_UDEV, NULL);
|
||||||
if (impl->handle == NULL) {
|
if (impl->handle == NULL) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
goto out_free;
|
goto out_free;
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ struct data {
|
||||||
struct pw_main_loop *loop;
|
struct pw_main_loop *loop;
|
||||||
struct spa_source *timer;
|
struct spa_source *timer;
|
||||||
|
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
struct pw_core_proxy *core_proxy;
|
struct pw_core_proxy *core_proxy;
|
||||||
|
|
||||||
struct pw_stream *stream;
|
struct pw_stream *stream;
|
||||||
|
|
@ -280,11 +280,11 @@ int main(int argc, char *argv[])
|
||||||
pw_init(&argc, &argv);
|
pw_init(&argc, &argv);
|
||||||
|
|
||||||
data.loop = pw_main_loop_new(NULL);
|
data.loop = pw_main_loop_new(NULL);
|
||||||
data.core = pw_core_new(pw_main_loop_get_loop(data.loop), NULL, 0);
|
data.context = pw_context_new(pw_main_loop_get_loop(data.loop), NULL, 0);
|
||||||
|
|
||||||
data.timer = pw_loop_add_timer(pw_main_loop_get_loop(data.loop), on_timeout, &data);
|
data.timer = pw_loop_add_timer(pw_main_loop_get_loop(data.loop), on_timeout, &data);
|
||||||
|
|
||||||
data.core_proxy = pw_core_connect(data.core, NULL, 0);
|
data.core_proxy = pw_context_connect(data.context, NULL, 0);
|
||||||
if (data.core_proxy == NULL)
|
if (data.core_proxy == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
@ -318,7 +318,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
pw_main_loop_run(data.loop);
|
pw_main_loop_run(data.loop);
|
||||||
|
|
||||||
pw_core_destroy(data.core);
|
pw_context_destroy(data.context);
|
||||||
pw_main_loop_destroy(data.loop);
|
pw_main_loop_destroy(data.loop);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -361,7 +361,7 @@ on_core_error(void *data, uint32_t id, int seq, int res, const char *message)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct pw_core_proxy_events core_events = {
|
static const struct pw_core_proxy_events core_events = {
|
||||||
PW_VERSION_CORE_EVENTS,
|
PW_VERSION_CORE_PROXY_EVENTS,
|
||||||
.info = on_core_info,
|
.info = on_core_info,
|
||||||
.done = on_core_done,
|
.done = on_core_done,
|
||||||
.error = on_core_error,
|
.error = on_core_error,
|
||||||
|
|
@ -524,7 +524,7 @@ gst_pipewire_device_provider_probe (GstDeviceProvider * provider)
|
||||||
{
|
{
|
||||||
GstPipeWireDeviceProvider *self = GST_PIPEWIRE_DEVICE_PROVIDER (provider);
|
GstPipeWireDeviceProvider *self = GST_PIPEWIRE_DEVICE_PROVIDER (provider);
|
||||||
struct pw_loop *l = NULL;
|
struct pw_loop *l = NULL;
|
||||||
struct pw_core *c = NULL;
|
struct pw_context *c = NULL;
|
||||||
struct core_data *data;
|
struct core_data *data;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (self, "starting probe");
|
GST_DEBUG_OBJECT (self, "starting probe");
|
||||||
|
|
@ -532,16 +532,16 @@ gst_pipewire_device_provider_probe (GstDeviceProvider * provider)
|
||||||
if (!(l = pw_loop_new (NULL)))
|
if (!(l = pw_loop_new (NULL)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!(c = pw_core_new (l, NULL, sizeof(*data))))
|
if (!(c = pw_context_new (l, NULL, sizeof(*data))))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
data = pw_core_get_user_data(c);
|
data = pw_context_get_user_data(c);
|
||||||
data->self = self;
|
data->self = self;
|
||||||
spa_list_init(&data->nodes);
|
spa_list_init(&data->nodes);
|
||||||
spa_list_init(&data->ports);
|
spa_list_init(&data->ports);
|
||||||
|
|
||||||
spa_list_init(&self->pending);
|
spa_list_init(&self->pending);
|
||||||
self->core_proxy = pw_core_connect (c, NULL, 0);
|
self->core_proxy = pw_context_connect (c, NULL, 0);
|
||||||
if (self->core_proxy == NULL)
|
if (self->core_proxy == NULL)
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
||||||
|
|
@ -567,7 +567,7 @@ gst_pipewire_device_provider_probe (GstDeviceProvider * provider)
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (self, "disconnect");
|
GST_DEBUG_OBJECT (self, "disconnect");
|
||||||
pw_core_proxy_disconnect (self->core_proxy);
|
pw_core_proxy_disconnect (self->core_proxy);
|
||||||
pw_core_destroy (c);
|
pw_context_destroy (c);
|
||||||
pw_loop_destroy (l);
|
pw_loop_destroy (l);
|
||||||
|
|
||||||
return *self->devices;
|
return *self->devices;
|
||||||
|
|
@ -594,9 +594,9 @@ gst_pipewire_device_provider_start (GstDeviceProvider * provider)
|
||||||
goto failed_main_loop;
|
goto failed_main_loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(self->core = pw_core_new (self->loop, NULL, sizeof(*data)))) {
|
if (!(self->context = pw_context_new (self->loop, NULL, sizeof(*data)))) {
|
||||||
GST_ERROR_OBJECT (self, "Could not create PipeWire core");
|
GST_ERROR_OBJECT (self, "Could not create PipeWire context");
|
||||||
goto failed_core;
|
goto failed_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pw_thread_loop_start (self->main_loop) < 0) {
|
if (pw_thread_loop_start (self->main_loop) < 0) {
|
||||||
|
|
@ -606,14 +606,14 @@ gst_pipewire_device_provider_start (GstDeviceProvider * provider)
|
||||||
|
|
||||||
pw_thread_loop_lock (self->main_loop);
|
pw_thread_loop_lock (self->main_loop);
|
||||||
|
|
||||||
if ((self->core_proxy = pw_core_connect (self->core, NULL, 0)) == NULL) {
|
if ((self->core_proxy = pw_context_connect (self->context, NULL, 0)) == NULL) {
|
||||||
GST_ERROR_OBJECT (self, "Failed to connect");
|
GST_ERROR_OBJECT (self, "Failed to connect");
|
||||||
goto failed_connect;
|
goto failed_connect;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (self, "connected");
|
GST_DEBUG_OBJECT (self, "connected");
|
||||||
|
|
||||||
data = pw_core_get_user_data(self->core);
|
data = pw_context_get_user_data(self->context);
|
||||||
data->self = self;
|
data->self = self;
|
||||||
spa_list_init(&data->nodes);
|
spa_list_init(&data->nodes);
|
||||||
spa_list_init(&data->ports);
|
spa_list_init(&data->ports);
|
||||||
|
|
@ -643,9 +643,9 @@ gst_pipewire_device_provider_start (GstDeviceProvider * provider)
|
||||||
failed_connect:
|
failed_connect:
|
||||||
pw_thread_loop_unlock (self->main_loop);
|
pw_thread_loop_unlock (self->main_loop);
|
||||||
failed_start:
|
failed_start:
|
||||||
pw_core_destroy (self->core);
|
pw_context_destroy (self->context);
|
||||||
self->core = NULL;
|
self->context = NULL;
|
||||||
failed_core:
|
failed_context:
|
||||||
pw_thread_loop_destroy (self->main_loop);
|
pw_thread_loop_destroy (self->main_loop);
|
||||||
self->main_loop = NULL;
|
self->main_loop = NULL;
|
||||||
failed_main_loop:
|
failed_main_loop:
|
||||||
|
|
@ -665,9 +665,9 @@ gst_pipewire_device_provider_stop (GstDeviceProvider * provider)
|
||||||
pw_core_proxy_disconnect (self->core_proxy);
|
pw_core_proxy_disconnect (self->core_proxy);
|
||||||
self->core_proxy = NULL;
|
self->core_proxy = NULL;
|
||||||
}
|
}
|
||||||
if (self->core) {
|
if (self->context) {
|
||||||
pw_core_destroy (self->core);
|
pw_context_destroy (self->context);
|
||||||
self->core = NULL;
|
self->context = NULL;
|
||||||
}
|
}
|
||||||
if (self->main_loop) {
|
if (self->main_loop) {
|
||||||
pw_thread_loop_destroy (self->main_loop);
|
pw_thread_loop_destroy (self->main_loop);
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ struct _GstPipeWireDeviceProvider {
|
||||||
struct pw_loop *loop;
|
struct pw_loop *loop;
|
||||||
struct pw_thread_loop *main_loop;
|
struct pw_thread_loop *main_loop;
|
||||||
|
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
|
|
||||||
struct pw_core_proxy *core_proxy;
|
struct pw_core_proxy *core_proxy;
|
||||||
struct spa_list pending;
|
struct spa_list pending;
|
||||||
|
|
|
||||||
|
|
@ -283,7 +283,7 @@ gst_pipewire_sink_init (GstPipeWireSink * sink)
|
||||||
|
|
||||||
sink->loop = pw_loop_new (NULL);
|
sink->loop = pw_loop_new (NULL);
|
||||||
sink->main_loop = pw_thread_loop_new (sink->loop, "pipewire-sink-loop");
|
sink->main_loop = pw_thread_loop_new (sink->loop, "pipewire-sink-loop");
|
||||||
sink->core = pw_core_new (sink->loop, NULL, 0);
|
sink->context = pw_context_new (sink->loop, NULL, 0);
|
||||||
GST_DEBUG ("loop %p %p", sink->loop, sink->main_loop);
|
GST_DEBUG ("loop %p %p", sink->loop, sink->main_loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -706,9 +706,9 @@ gst_pipewire_sink_open (GstPipeWireSink * pwsink)
|
||||||
pw_thread_loop_lock (pwsink->main_loop);
|
pw_thread_loop_lock (pwsink->main_loop);
|
||||||
|
|
||||||
if (pwsink->fd == -1)
|
if (pwsink->fd == -1)
|
||||||
pwsink->core_proxy = pw_core_connect (pwsink->core, NULL, 0);
|
pwsink->core_proxy = pw_context_connect (pwsink->context, NULL, 0);
|
||||||
else
|
else
|
||||||
pwsink->core_proxy = pw_core_connect_fd (pwsink->core, dup(pwsink->fd), NULL, 0);
|
pwsink->core_proxy = pw_context_connect_fd (pwsink->context, dup(pwsink->fd), NULL, 0);
|
||||||
|
|
||||||
if (pwsink->core_proxy == NULL)
|
if (pwsink->core_proxy == NULL)
|
||||||
goto connect_error;
|
goto connect_error;
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ struct _GstPipeWireSink {
|
||||||
struct pw_loop *loop;
|
struct pw_loop *loop;
|
||||||
struct pw_thread_loop *main_loop;
|
struct pw_thread_loop *main_loop;
|
||||||
|
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
struct pw_core_proxy *core_proxy;
|
struct pw_core_proxy *core_proxy;
|
||||||
|
|
||||||
struct pw_stream *stream;
|
struct pw_stream *stream;
|
||||||
|
|
|
||||||
|
|
@ -208,8 +208,8 @@ gst_pipewire_src_finalize (GObject * object)
|
||||||
|
|
||||||
clear_queue (pwsrc);
|
clear_queue (pwsrc);
|
||||||
|
|
||||||
pw_core_destroy (pwsrc->core);
|
pw_context_destroy (pwsrc->context);
|
||||||
pwsrc->core = NULL;
|
pwsrc->context = NULL;
|
||||||
pw_thread_loop_destroy (pwsrc->main_loop);
|
pw_thread_loop_destroy (pwsrc->main_loop);
|
||||||
pwsrc->main_loop = NULL;
|
pwsrc->main_loop = NULL;
|
||||||
pw_loop_destroy (pwsrc->loop);
|
pw_loop_destroy (pwsrc->loop);
|
||||||
|
|
@ -331,7 +331,7 @@ gst_pipewire_src_init (GstPipeWireSrc * src)
|
||||||
src->pool = gst_pipewire_pool_new ();
|
src->pool = gst_pipewire_pool_new ();
|
||||||
src->loop = pw_loop_new (NULL);
|
src->loop = pw_loop_new (NULL);
|
||||||
src->main_loop = pw_thread_loop_new (src->loop, "pipewire-main-loop");
|
src->main_loop = pw_thread_loop_new (src->loop, "pipewire-main-loop");
|
||||||
src->core = pw_core_new (src->loop, NULL, 0);
|
src->context = pw_context_new (src->loop, NULL, 0);
|
||||||
GST_DEBUG ("loop %p, mainloop %p", src->loop, src->main_loop);
|
GST_DEBUG ("loop %p, mainloop %p", src->loop, src->main_loop);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -940,9 +940,9 @@ gst_pipewire_src_open (GstPipeWireSrc * pwsrc)
|
||||||
pw_thread_loop_lock (pwsrc->main_loop);
|
pw_thread_loop_lock (pwsrc->main_loop);
|
||||||
|
|
||||||
if (pwsrc->fd == -1)
|
if (pwsrc->fd == -1)
|
||||||
pwsrc->core_proxy = pw_core_connect (pwsrc->core, NULL, 0);
|
pwsrc->core_proxy = pw_context_connect (pwsrc->context, NULL, 0);
|
||||||
else
|
else
|
||||||
pwsrc->core_proxy = pw_core_connect_fd (pwsrc->core, dup(pwsrc->fd), NULL, 0);
|
pwsrc->core_proxy = pw_context_connect_fd (pwsrc->context, dup(pwsrc->fd), NULL, 0);
|
||||||
|
|
||||||
if (pwsrc->core_proxy == NULL)
|
if (pwsrc->core_proxy == NULL)
|
||||||
goto connect_error;
|
goto connect_error;
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ struct _GstPipeWireSrc {
|
||||||
struct pw_loop *loop;
|
struct pw_loop *loop;
|
||||||
struct pw_thread_loop *main_loop;
|
struct pw_thread_loop *main_loop;
|
||||||
|
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
struct pw_core_proxy *core_proxy;
|
struct pw_core_proxy *core_proxy;
|
||||||
|
|
||||||
struct pw_stream *stream;
|
struct pw_stream *stream;
|
||||||
|
|
|
||||||
|
|
@ -43,10 +43,10 @@ static const struct spa_dict_item module_props[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct impl {
|
struct impl {
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
struct pw_properties *properties;
|
struct pw_properties *properties;
|
||||||
|
|
||||||
struct spa_hook core_listener;
|
struct spa_hook context_listener;
|
||||||
struct spa_hook module_listener;
|
struct spa_hook module_listener;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -112,7 +112,7 @@ static int check_flatpak(struct pw_client *client, int pid)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
core_check_access(void *data, struct pw_client *client)
|
context_check_access(void *data, struct pw_client *client)
|
||||||
{
|
{
|
||||||
struct impl *impl = data;
|
struct impl *impl = data;
|
||||||
struct pw_permission permissions[1];
|
struct pw_permission permissions[1];
|
||||||
|
|
@ -190,16 +190,16 @@ blacklisted:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct pw_core_events core_events = {
|
static const struct pw_context_events context_events = {
|
||||||
PW_VERSION_CORE_EVENTS,
|
PW_VERSION_CONTEXT_EVENTS,
|
||||||
.check_access = core_check_access,
|
.check_access = context_check_access,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void module_destroy(void *data)
|
static void module_destroy(void *data)
|
||||||
{
|
{
|
||||||
struct impl *impl = data;
|
struct impl *impl = data;
|
||||||
|
|
||||||
spa_hook_remove(&impl->core_listener);
|
spa_hook_remove(&impl->context_listener);
|
||||||
spa_hook_remove(&impl->module_listener);
|
spa_hook_remove(&impl->module_listener);
|
||||||
|
|
||||||
if (impl->properties)
|
if (impl->properties)
|
||||||
|
|
@ -216,7 +216,7 @@ static const struct pw_module_events module_events = {
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
int pipewire__module_init(struct pw_module *module, const char *args)
|
int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
{
|
{
|
||||||
struct pw_core *core = pw_module_get_core(module);
|
struct pw_context *context = pw_module_get_context(module);
|
||||||
struct pw_properties *props;
|
struct pw_properties *props;
|
||||||
struct impl *impl;
|
struct impl *impl;
|
||||||
|
|
||||||
|
|
@ -231,10 +231,10 @@ int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
else
|
else
|
||||||
props = NULL;
|
props = NULL;
|
||||||
|
|
||||||
impl->core = core;
|
impl->context = context;
|
||||||
impl->properties = props;
|
impl->properties = props;
|
||||||
|
|
||||||
pw_core_add_listener(core, &impl->core_listener, &core_events, impl);
|
pw_context_add_listener(context, &impl->context_listener, &context_events, impl);
|
||||||
pw_module_add_listener(module, &impl->module_listener, &module_events, impl);
|
pw_module_add_listener(module, &impl->module_listener, &module_events, impl);
|
||||||
|
|
||||||
pw_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props));
|
pw_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props));
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ struct factory_data {
|
||||||
|
|
||||||
struct spa_list node_list;
|
struct spa_list node_list;
|
||||||
|
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
struct pw_module *module;
|
struct pw_module *module;
|
||||||
struct spa_hook module_listener;
|
struct spa_hook module_listener;
|
||||||
};
|
};
|
||||||
|
|
@ -175,7 +175,7 @@ static void *create_object(void *_data,
|
||||||
if (factory_name == NULL)
|
if (factory_name == NULL)
|
||||||
goto error_properties;
|
goto error_properties;
|
||||||
|
|
||||||
slave = pw_spa_node_load(d->core,
|
slave = pw_spa_node_load(d->context,
|
||||||
factory_name,
|
factory_name,
|
||||||
PW_SPA_NODE_FLAG_ACTIVATE |
|
PW_SPA_NODE_FLAG_ACTIVATE |
|
||||||
PW_SPA_NODE_FLAG_NO_REGISTER,
|
PW_SPA_NODE_FLAG_NO_REGISTER,
|
||||||
|
|
@ -184,7 +184,7 @@ static void *create_object(void *_data,
|
||||||
goto error_no_mem;
|
goto error_no_mem;
|
||||||
}
|
}
|
||||||
|
|
||||||
adapter = pw_adapter_new(pw_module_get_core(d->module),
|
adapter = pw_adapter_new(pw_module_get_context(d->module),
|
||||||
slave,
|
slave,
|
||||||
properties,
|
properties,
|
||||||
sizeof(struct node_data));
|
sizeof(struct node_data));
|
||||||
|
|
@ -283,11 +283,11 @@ static const struct pw_module_events module_events = {
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
int pipewire__module_init(struct pw_module *module, const char *args)
|
int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
{
|
{
|
||||||
struct pw_core *core = pw_module_get_core(module);
|
struct pw_context *context = pw_module_get_context(module);
|
||||||
struct pw_factory *factory;
|
struct pw_factory *factory;
|
||||||
struct factory_data *data;
|
struct factory_data *data;
|
||||||
|
|
||||||
factory = pw_factory_new(core,
|
factory = pw_factory_new(context,
|
||||||
"adapter",
|
"adapter",
|
||||||
PW_TYPE_INTERFACE_Node,
|
PW_TYPE_INTERFACE_Node,
|
||||||
PW_VERSION_NODE_PROXY,
|
PW_VERSION_NODE_PROXY,
|
||||||
|
|
@ -300,7 +300,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
|
|
||||||
data = pw_factory_get_user_data(factory);
|
data = pw_factory_get_user_data(factory);
|
||||||
data->this = factory;
|
data->this = factory;
|
||||||
data->core = core;
|
data->context = context;
|
||||||
data->module = module;
|
data->module = module;
|
||||||
spa_list_init(&data->node_list);
|
spa_list_init(&data->node_list);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ struct buffer {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct node {
|
struct node {
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
|
|
||||||
struct pw_node *node;
|
struct pw_node *node;
|
||||||
struct spa_hook node_listener;
|
struct spa_hook node_listener;
|
||||||
|
|
@ -186,7 +186,7 @@ static int find_format(struct pw_node *node, enum pw_direction direction,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct pw_node *pw_adapter_new(struct pw_core *core,
|
struct pw_node *pw_adapter_new(struct pw_context *context,
|
||||||
struct pw_node *slave,
|
struct pw_node *slave,
|
||||||
struct pw_properties *props,
|
struct pw_properties *props,
|
||||||
size_t user_data_size)
|
size_t user_data_size)
|
||||||
|
|
@ -255,7 +255,7 @@ struct pw_node *pw_adapter_new(struct pw_core *core,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
node = pw_spa_node_load(core,
|
node = pw_spa_node_load(context,
|
||||||
factory_name,
|
factory_name,
|
||||||
PW_SPA_NODE_FLAG_ACTIVATE | PW_SPA_NODE_FLAG_NO_REGISTER,
|
PW_SPA_NODE_FLAG_ACTIVATE | PW_SPA_NODE_FLAG_NO_REGISTER,
|
||||||
pw_properties_copy(props),
|
pw_properties_copy(props),
|
||||||
|
|
@ -267,7 +267,7 @@ struct pw_node *pw_adapter_new(struct pw_core *core,
|
||||||
}
|
}
|
||||||
|
|
||||||
n = pw_spa_node_get_user_data(node);
|
n = pw_spa_node_get_user_data(node);
|
||||||
n->core = core;
|
n->context = context;
|
||||||
n->node = node;
|
n->node = node;
|
||||||
n->slave = slave;
|
n->slave = slave;
|
||||||
n->direction = direction;
|
n->direction = direction;
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ extern "C" {
|
||||||
#define ADAPTER_USAGE PW_KEY_NODE_NAME"=<string> "
|
#define ADAPTER_USAGE PW_KEY_NODE_NAME"=<string> "
|
||||||
|
|
||||||
struct pw_node *
|
struct pw_node *
|
||||||
pw_adapter_new(struct pw_core *core,
|
pw_adapter_new(struct pw_context *context,
|
||||||
struct pw_node *slave,
|
struct pw_node *slave,
|
||||||
struct pw_properties *properties,
|
struct pw_properties *properties,
|
||||||
size_t user_data_size);
|
size_t user_data_size);
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ struct pw_proxy *pw_core_proxy_spa_device_export(struct pw_core_proxy *core_prox
|
||||||
uint32_t type, struct pw_properties *props, void *object,
|
uint32_t type, struct pw_properties *props, void *object,
|
||||||
size_t user_data_size);
|
size_t user_data_size);
|
||||||
|
|
||||||
struct pw_protocol *pw_protocol_native_ext_client_device_init(struct pw_core *core);
|
struct pw_protocol *pw_protocol_native_ext_client_device_init(struct pw_context *context);
|
||||||
|
|
||||||
struct factory_data {
|
struct factory_data {
|
||||||
struct pw_factory *this;
|
struct pw_factory *this;
|
||||||
|
|
@ -160,11 +160,11 @@ static const struct pw_module_events module_events = {
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
int pipewire__module_init(struct pw_module *module, const char *args)
|
int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
{
|
{
|
||||||
struct pw_core *core = pw_module_get_core(module);
|
struct pw_context *context = pw_module_get_context(module);
|
||||||
struct pw_factory *factory;
|
struct pw_factory *factory;
|
||||||
struct factory_data *data;
|
struct factory_data *data;
|
||||||
|
|
||||||
factory = pw_factory_new(core,
|
factory = pw_factory_new(context,
|
||||||
"client-device",
|
"client-device",
|
||||||
SPA_TYPE_INTERFACE_Device,
|
SPA_TYPE_INTERFACE_Device,
|
||||||
SPA_VERSION_DEVICE,
|
SPA_VERSION_DEVICE,
|
||||||
|
|
@ -185,11 +185,11 @@ int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
&impl_factory,
|
&impl_factory,
|
||||||
data);
|
data);
|
||||||
|
|
||||||
pw_protocol_native_ext_client_device_init(core);
|
pw_protocol_native_ext_client_device_init(context);
|
||||||
|
|
||||||
data->export_spadevice.type = SPA_TYPE_INTERFACE_Device;
|
data->export_spadevice.type = SPA_TYPE_INTERFACE_Device;
|
||||||
data->export_spadevice.func = pw_core_proxy_spa_device_export;
|
data->export_spadevice.func = pw_core_proxy_spa_device_export;
|
||||||
pw_core_register_export_type(core, &data->export_spadevice);
|
pw_context_register_export_type(context, &data->export_spadevice);
|
||||||
|
|
||||||
pw_module_add_listener(module, &data->module_listener, &module_events, data);
|
pw_module_add_listener(module, &data->module_listener, &module_events, data);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -535,11 +535,11 @@ static const struct pw_protocol_marshal pw_protocol_native_client_device_marshal
|
||||||
.client_demarshal = pw_protocol_native_device_method_demarshal,
|
.client_demarshal = pw_protocol_native_device_method_demarshal,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pw_protocol *pw_protocol_native_ext_client_device_init(struct pw_core *core)
|
struct pw_protocol *pw_protocol_native_ext_client_device_init(struct pw_context *context)
|
||||||
{
|
{
|
||||||
struct pw_protocol *protocol;
|
struct pw_protocol *protocol;
|
||||||
|
|
||||||
protocol = pw_core_find_protocol(core, PW_TYPE_INFO_PROTOCOL_Native);
|
protocol = pw_context_find_protocol(context, PW_TYPE_INFO_PROTOCOL_Native);
|
||||||
|
|
||||||
if (protocol == NULL)
|
if (protocol == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@
|
||||||
#include "pipewire/private.h"
|
#include "pipewire/private.h"
|
||||||
|
|
||||||
struct impl {
|
struct impl {
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
struct pw_device *device;
|
struct pw_device *device;
|
||||||
struct spa_hook device_listener;
|
struct spa_hook device_listener;
|
||||||
|
|
||||||
|
|
@ -119,7 +119,7 @@ struct pw_device *pw_client_device_new(struct pw_resource *resource,
|
||||||
struct impl *impl;
|
struct impl *impl;
|
||||||
struct pw_device *device;
|
struct pw_device *device;
|
||||||
struct pw_client *client = pw_resource_get_client(resource);
|
struct pw_client *client = pw_resource_get_client(resource);
|
||||||
struct pw_core *core = pw_client_get_core(client);
|
struct pw_context *context = pw_client_get_context(client);
|
||||||
|
|
||||||
if (properties == NULL)
|
if (properties == NULL)
|
||||||
properties = pw_properties_new(NULL, NULL);
|
properties = pw_properties_new(NULL, NULL);
|
||||||
|
|
@ -128,13 +128,13 @@ struct pw_device *pw_client_device_new(struct pw_resource *resource,
|
||||||
|
|
||||||
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d", client->global->id);
|
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d", client->global->id);
|
||||||
|
|
||||||
device = pw_device_new(core, properties, sizeof(struct impl));
|
device = pw_device_new(context, properties, sizeof(struct impl));
|
||||||
if (device == NULL)
|
if (device == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
impl = pw_device_get_user_data(device);
|
impl = pw_device_get_user_data(device);
|
||||||
impl->device = device;
|
impl->device = device;
|
||||||
impl->core = core;
|
impl->context = context;
|
||||||
impl->resource = resource;
|
impl->resource = resource;
|
||||||
|
|
||||||
pw_device_add_listener(impl->device,
|
pw_device_add_listener(impl->device,
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,8 @@ struct pw_proxy *pw_core_proxy_node_export(struct pw_core_proxy *core_proxy,
|
||||||
struct pw_proxy *pw_core_proxy_spa_node_export(struct pw_core_proxy *core_proxy,
|
struct pw_proxy *pw_core_proxy_spa_node_export(struct pw_core_proxy *core_proxy,
|
||||||
uint32_t type, struct pw_properties *props, void *object, size_t user_data_size);
|
uint32_t type, struct pw_properties *props, void *object, size_t user_data_size);
|
||||||
|
|
||||||
struct pw_protocol *pw_protocol_native_ext_client_node_init(struct pw_core *core);
|
struct pw_protocol *pw_protocol_native_ext_client_node_init(struct pw_context *context);
|
||||||
struct pw_protocol *pw_protocol_native_ext_client_node0_init(struct pw_core *core);
|
struct pw_protocol *pw_protocol_native_ext_client_node0_init(struct pw_context *context);
|
||||||
|
|
||||||
struct factory_data {
|
struct factory_data {
|
||||||
struct pw_factory *this;
|
struct pw_factory *this;
|
||||||
|
|
@ -151,11 +151,11 @@ static const struct pw_module_events module_events = {
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
int pipewire__module_init(struct pw_module *module, const char *args)
|
int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
{
|
{
|
||||||
struct pw_core *core = pw_module_get_core(module);
|
struct pw_context *context = pw_module_get_context(module);
|
||||||
struct pw_factory *factory;
|
struct pw_factory *factory;
|
||||||
struct factory_data *data;
|
struct factory_data *data;
|
||||||
|
|
||||||
factory = pw_factory_new(core,
|
factory = pw_factory_new(context,
|
||||||
"client-node",
|
"client-node",
|
||||||
PW_TYPE_INTERFACE_ClientNode,
|
PW_TYPE_INTERFACE_ClientNode,
|
||||||
PW_VERSION_CLIENT_NODE,
|
PW_VERSION_CLIENT_NODE,
|
||||||
|
|
@ -174,16 +174,16 @@ int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
&impl_factory,
|
&impl_factory,
|
||||||
data);
|
data);
|
||||||
|
|
||||||
pw_protocol_native_ext_client_node_init(core);
|
pw_protocol_native_ext_client_node_init(context);
|
||||||
pw_protocol_native_ext_client_node0_init(core);
|
pw_protocol_native_ext_client_node0_init(context);
|
||||||
|
|
||||||
data->export_node.type = PW_TYPE_INTERFACE_Node;
|
data->export_node.type = PW_TYPE_INTERFACE_Node;
|
||||||
data->export_node.func = pw_core_proxy_node_export;
|
data->export_node.func = pw_core_proxy_node_export;
|
||||||
pw_core_register_export_type(core, &data->export_node);
|
pw_context_register_export_type(context, &data->export_node);
|
||||||
|
|
||||||
data->export_spanode.type = SPA_TYPE_INTERFACE_Node;
|
data->export_spanode.type = SPA_TYPE_INTERFACE_Node;
|
||||||
data->export_spanode.func = pw_core_proxy_spa_node_export;
|
data->export_spanode.func = pw_core_proxy_spa_node_export;
|
||||||
pw_core_register_export_type(core, &data->export_spanode);
|
pw_context_register_export_type(context, &data->export_spanode);
|
||||||
|
|
||||||
pw_module_add_listener(module, &data->module_listener, &module_events, data);
|
pw_module_add_listener(module, &data->module_listener, &module_events, data);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ struct node {
|
||||||
struct impl {
|
struct impl {
|
||||||
struct pw_client_node this;
|
struct pw_client_node this;
|
||||||
|
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
|
|
||||||
struct node node;
|
struct node node;
|
||||||
|
|
||||||
|
|
@ -341,7 +341,7 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
mm = pw_mempool_import_map(this->client->pool,
|
mm = pw_mempool_import_map(this->client->pool,
|
||||||
impl->core->pool, data, size, tag);
|
impl->context->pool, data, size, tag);
|
||||||
if (mm == NULL)
|
if (mm == NULL)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
|
|
@ -659,7 +659,7 @@ static int do_port_set_io(struct impl *impl,
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
mm = pw_mempool_import_map(this->client->pool,
|
mm = pw_mempool_import_map(this->client->pool,
|
||||||
impl->core->pool, data, size, tag);
|
impl->context->pool, data, size, tag);
|
||||||
if (mm == NULL)
|
if (mm == NULL)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
|
|
@ -756,7 +756,7 @@ do_port_use_buffers(struct impl *impl,
|
||||||
else
|
else
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if ((mem = pw_mempool_find_ptr(impl->core->pool, baseptr)) == NULL)
|
if ((mem = pw_mempool_find_ptr(impl->context->pool, baseptr)) == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
data_size = buffers[i]->n_datas * sizeof(struct spa_chunk);
|
data_size = buffers[i]->n_datas * sizeof(struct spa_chunk);
|
||||||
|
|
@ -1252,7 +1252,7 @@ static void node_initialized(void *data)
|
||||||
|
|
||||||
size = sizeof(struct spa_io_buffers) * MAX_AREAS;
|
size = sizeof(struct spa_io_buffers) * MAX_AREAS;
|
||||||
|
|
||||||
impl->io_areas = pw_mempool_alloc(impl->core->pool,
|
impl->io_areas = pw_mempool_alloc(impl->context->pool,
|
||||||
PW_MEMBLOCK_FLAG_READWRITE |
|
PW_MEMBLOCK_FLAG_READWRITE |
|
||||||
PW_MEMBLOCK_FLAG_MAP |
|
PW_MEMBLOCK_FLAG_MAP |
|
||||||
PW_MEMBLOCK_FLAG_SEAL,
|
PW_MEMBLOCK_FLAG_SEAL,
|
||||||
|
|
@ -1619,7 +1619,7 @@ struct pw_client_node *pw_client_node_new(struct pw_resource *resource,
|
||||||
struct impl *impl;
|
struct impl *impl;
|
||||||
struct pw_client_node *this;
|
struct pw_client_node *this;
|
||||||
struct pw_client *client = pw_resource_get_client(resource);
|
struct pw_client *client = pw_resource_get_client(resource);
|
||||||
struct pw_core *core = pw_client_get_core(client);
|
struct pw_context *context = pw_client_get_context(client);
|
||||||
const struct spa_support *support;
|
const struct spa_support *support;
|
||||||
uint32_t n_support;
|
uint32_t n_support;
|
||||||
int res;
|
int res;
|
||||||
|
|
@ -1641,11 +1641,11 @@ struct pw_client_node *pw_client_node_new(struct pw_resource *resource,
|
||||||
|
|
||||||
this = &impl->this;
|
this = &impl->this;
|
||||||
|
|
||||||
impl->core = core;
|
impl->context = context;
|
||||||
impl->fds[0] = impl->fds[1] = -1;
|
impl->fds[0] = impl->fds[1] = -1;
|
||||||
pw_log_debug(NAME " %p: new", &impl->node);
|
pw_log_debug(NAME " %p: new", &impl->node);
|
||||||
|
|
||||||
support = pw_core_get_support(impl->core, &n_support);
|
support = pw_context_get_support(impl->context, &n_support);
|
||||||
node_init(&impl->node, NULL, support, n_support);
|
node_init(&impl->node, NULL, support, n_support);
|
||||||
impl->node.impl = impl;
|
impl->node.impl = impl;
|
||||||
impl->node.resource = resource;
|
impl->node.resource = resource;
|
||||||
|
|
@ -1655,7 +1655,7 @@ struct pw_client_node *pw_client_node_new(struct pw_resource *resource,
|
||||||
pw_map_init(&impl->io_map, 64, 64);
|
pw_map_init(&impl->io_map, 64, 64);
|
||||||
|
|
||||||
this->resource = resource;
|
this->resource = resource;
|
||||||
this->node = pw_spa_node_new(core,
|
this->node = pw_spa_node_new(context,
|
||||||
PW_SPA_NODE_FLAG_ASYNC |
|
PW_SPA_NODE_FLAG_ASYNC |
|
||||||
(do_register ? 0 : PW_SPA_NODE_FLAG_NO_REGISTER),
|
(do_register ? 0 : PW_SPA_NODE_FLAG_NO_REGISTER),
|
||||||
(struct spa_node *)&impl->node.node,
|
(struct spa_node *)&impl->node.node,
|
||||||
|
|
|
||||||
|
|
@ -1157,11 +1157,11 @@ static const struct pw_protocol_marshal pw_protocol_native_client_node_marshal =
|
||||||
.client_demarshal = pw_protocol_native_client_node_event_demarshal,
|
.client_demarshal = pw_protocol_native_client_node_event_demarshal,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pw_protocol *pw_protocol_native_ext_client_node_init(struct pw_core *core)
|
struct pw_protocol *pw_protocol_native_ext_client_node_init(struct pw_context *context)
|
||||||
{
|
{
|
||||||
struct pw_protocol *protocol;
|
struct pw_protocol *protocol;
|
||||||
|
|
||||||
protocol = pw_core_find_protocol(core, PW_TYPE_INFO_PROTOCOL_Native);
|
protocol = pw_context_find_protocol(context, PW_TYPE_INFO_PROTOCOL_Native);
|
||||||
|
|
||||||
if (protocol == NULL)
|
if (protocol == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ struct link {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct node_data {
|
struct node_data {
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
|
|
||||||
struct pw_mempool *pool;
|
struct pw_mempool *pool;
|
||||||
|
|
||||||
|
|
@ -168,7 +168,7 @@ deactivate_mix(struct node_data *data, struct mix *mix)
|
||||||
{
|
{
|
||||||
if (mix->active) {
|
if (mix->active) {
|
||||||
pw_log_debug("node %p: mix %p deactivate", data, mix);
|
pw_log_debug("node %p: mix %p deactivate", data, mix);
|
||||||
pw_loop_invoke(data->core->data_loop,
|
pw_loop_invoke(data->context->data_loop,
|
||||||
do_deactivate_mix, SPA_ID_INVALID, NULL, 0, true, mix);
|
do_deactivate_mix, SPA_ID_INVALID, NULL, 0, true, mix);
|
||||||
mix->active = false;
|
mix->active = false;
|
||||||
}
|
}
|
||||||
|
|
@ -190,7 +190,7 @@ activate_mix(struct node_data *data, struct mix *mix)
|
||||||
{
|
{
|
||||||
if (!mix->active) {
|
if (!mix->active) {
|
||||||
pw_log_debug("node %p: mix %p activate", data, mix);
|
pw_log_debug("node %p: mix %p activate", data, mix);
|
||||||
pw_loop_invoke(data->core->data_loop,
|
pw_loop_invoke(data->context->data_loop,
|
||||||
do_activate_mix, SPA_ID_INVALID, NULL, 0, false, mix);
|
do_activate_mix, SPA_ID_INVALID, NULL, 0, false, mix);
|
||||||
mix->active = true;
|
mix->active = true;
|
||||||
}
|
}
|
||||||
|
|
@ -1128,7 +1128,7 @@ static struct pw_proxy *node_export(struct pw_core_proxy *core_proxy, void *obje
|
||||||
data->pool = pw_core_proxy_get_mempool(core_proxy);
|
data->pool = pw_core_proxy_get_mempool(core_proxy);
|
||||||
data->node = node;
|
data->node = node;
|
||||||
data->do_free = do_free;
|
data->do_free = do_free;
|
||||||
data->core = pw_node_get_core(node);
|
data->context = pw_node_get_context(node);
|
||||||
data->client_node = (struct pw_client_node_proxy *)client_node;
|
data->client_node = (struct pw_client_node_proxy *)client_node;
|
||||||
data->remote_id = SPA_ID_INVALID;
|
data->remote_id = SPA_ID_INVALID;
|
||||||
|
|
||||||
|
|
@ -1183,7 +1183,7 @@ struct pw_proxy *pw_core_proxy_spa_node_export(struct pw_core_proxy *core_proxy,
|
||||||
{
|
{
|
||||||
struct pw_node *node;
|
struct pw_node *node;
|
||||||
|
|
||||||
node = pw_node_new(pw_core_proxy_get_core(core_proxy), props, 0);
|
node = pw_node_new(pw_core_proxy_get_context(core_proxy), props, 0);
|
||||||
if (node == NULL)
|
if (node == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@
|
||||||
#include "pipewire/interfaces.h"
|
#include "pipewire/interfaces.h"
|
||||||
#include "pipewire/private.h"
|
#include "pipewire/private.h"
|
||||||
|
|
||||||
#include "pipewire/core.h"
|
#include "pipewire/context.h"
|
||||||
#include "modules/spa/spa-node.h"
|
#include "modules/spa/spa-node.h"
|
||||||
#include "client-node.h"
|
#include "client-node.h"
|
||||||
#include "transport.h"
|
#include "transport.h"
|
||||||
|
|
@ -136,7 +136,7 @@ struct impl {
|
||||||
|
|
||||||
bool client_reuse;
|
bool client_reuse;
|
||||||
|
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
|
|
||||||
struct node node;
|
struct node node;
|
||||||
|
|
||||||
|
|
@ -600,7 +600,7 @@ impl_node_port_set_io(void *object,
|
||||||
|
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
if ((mem = pw_mempool_find_ptr(impl->core->pool, data)) == NULL)
|
if ((mem = pw_mempool_find_ptr(impl->context->pool, data)) == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
mem_offset = SPA_PTRDIFF(data, mem->map->ptr);
|
mem_offset = SPA_PTRDIFF(data, mem->map->ptr);
|
||||||
|
|
@ -683,7 +683,7 @@ impl_node_port_use_buffers(void *object,
|
||||||
else
|
else
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if ((mem = pw_mempool_find_ptr(impl->core->pool, baseptr)) == NULL)
|
if ((mem = pw_mempool_find_ptr(impl->context->pool, baseptr)) == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
data_size = 0;
|
data_size = 0;
|
||||||
|
|
@ -910,7 +910,7 @@ static void setup_transport(struct impl *impl)
|
||||||
n_outputs = this->n_outputs;
|
n_outputs = this->n_outputs;
|
||||||
max_outputs = this->info.max_output_ports == 0 ? this->n_outputs : this->info.max_output_ports;
|
max_outputs = this->info.max_output_ports == 0 ? this->n_outputs : this->info.max_output_ports;
|
||||||
|
|
||||||
impl->transport = pw_client_node0_transport_new(impl->core, max_inputs, max_outputs);
|
impl->transport = pw_client_node0_transport_new(impl->context, max_inputs, max_outputs);
|
||||||
impl->transport->area->n_input_ports = n_inputs;
|
impl->transport->area->n_input_ports = n_inputs;
|
||||||
impl->transport->area->n_output_ports = n_outputs;
|
impl->transport->area->n_output_ports = n_outputs;
|
||||||
}
|
}
|
||||||
|
|
@ -1256,7 +1256,7 @@ struct pw_client_node0 *pw_client_node0_new(struct pw_resource *resource,
|
||||||
struct impl *impl;
|
struct impl *impl;
|
||||||
struct pw_client_node0 *this;
|
struct pw_client_node0 *this;
|
||||||
struct pw_client *client = pw_resource_get_client(resource);
|
struct pw_client *client = pw_resource_get_client(resource);
|
||||||
struct pw_core *core = pw_client_get_core(client);
|
struct pw_context *context = pw_client_get_context(client);
|
||||||
const struct spa_support *support;
|
const struct spa_support *support;
|
||||||
uint32_t n_support;
|
uint32_t n_support;
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
@ -1279,11 +1279,11 @@ struct pw_client_node0 *pw_client_node0_new(struct pw_resource *resource,
|
||||||
|
|
||||||
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d", client->global->id);
|
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d", client->global->id);
|
||||||
|
|
||||||
impl->core = core;
|
impl->context = context;
|
||||||
impl->fds[0] = impl->fds[1] = -1;
|
impl->fds[0] = impl->fds[1] = -1;
|
||||||
pw_log_debug("client-node %p: new", impl);
|
pw_log_debug("client-node %p: new", impl);
|
||||||
|
|
||||||
support = pw_core_get_support(impl->core, &n_support);
|
support = pw_context_get_support(impl->context, &n_support);
|
||||||
|
|
||||||
node_init(&impl->node, NULL, support, n_support);
|
node_init(&impl->node, NULL, support, n_support);
|
||||||
impl->node.impl = impl;
|
impl->node.impl = impl;
|
||||||
|
|
@ -1297,7 +1297,7 @@ struct pw_client_node0 *pw_client_node0_new(struct pw_resource *resource,
|
||||||
|
|
||||||
impl->node.resource = resource;
|
impl->node.resource = resource;
|
||||||
this->resource = resource;
|
this->resource = resource;
|
||||||
this->node = pw_spa_node_new(core,
|
this->node = pw_spa_node_new(context,
|
||||||
PW_SPA_NODE_FLAG_ASYNC,
|
PW_SPA_NODE_FLAG_ASYNC,
|
||||||
&impl->node.node,
|
&impl->node.node,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
|
||||||
|
|
@ -503,11 +503,11 @@ static const struct pw_protocol_marshal pw_protocol_native_client_node_marshal =
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pw_protocol *pw_protocol_native_ext_client_node0_init(struct pw_core *core)
|
struct pw_protocol *pw_protocol_native_ext_client_node0_init(struct pw_context *context)
|
||||||
{
|
{
|
||||||
struct pw_protocol *protocol;
|
struct pw_protocol *protocol;
|
||||||
|
|
||||||
protocol = pw_core_find_protocol(core, PW_TYPE_INFO_PROTOCOL_Native);
|
protocol = pw_context_find_protocol(context, PW_TYPE_INFO_PROTOCOL_Native);
|
||||||
|
|
||||||
if (protocol == NULL)
|
if (protocol == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ static int parse_message(struct pw_client_node0_transport *trans, void *message)
|
||||||
* \memberof pw_client_node0_transport
|
* \memberof pw_client_node0_transport
|
||||||
*/
|
*/
|
||||||
struct pw_client_node0_transport *
|
struct pw_client_node0_transport *
|
||||||
pw_client_node0_transport_new(struct pw_core *core,
|
pw_client_node0_transport_new(struct pw_context *context,
|
||||||
uint32_t max_input_ports, uint32_t max_output_ports)
|
uint32_t max_input_ports, uint32_t max_output_ports)
|
||||||
{
|
{
|
||||||
struct transport *impl;
|
struct transport *impl;
|
||||||
|
|
@ -207,7 +207,7 @@ pw_client_node0_transport_new(struct pw_core *core,
|
||||||
trans = &impl->trans;
|
trans = &impl->trans;
|
||||||
impl->offset = 0;
|
impl->offset = 0;
|
||||||
|
|
||||||
impl->mem = pw_mempool_alloc(core->pool,
|
impl->mem = pw_mempool_alloc(context->pool,
|
||||||
PW_MEMBLOCK_FLAG_READWRITE |
|
PW_MEMBLOCK_FLAG_READWRITE |
|
||||||
PW_MEMBLOCK_FLAG_MAP |
|
PW_MEMBLOCK_FLAG_MAP |
|
||||||
PW_MEMBLOCK_FLAG_SEAL,
|
PW_MEMBLOCK_FLAG_SEAL,
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ struct pw_client_node0_transport_info {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pw_client_node0_transport *
|
struct pw_client_node0_transport *
|
||||||
pw_client_node0_transport_new(struct pw_core *core, uint32_t max_input_ports, uint32_t max_output_ports);
|
pw_client_node0_transport_new(struct pw_context *context, uint32_t max_input_ports, uint32_t max_output_ports);
|
||||||
|
|
||||||
struct pw_client_node0_transport *
|
struct pw_client_node0_transport *
|
||||||
pw_client_node0_transport_new_from_info(struct pw_client_node0_transport_info *info);
|
pw_client_node0_transport_new_from_info(struct pw_client_node0_transport_info *info);
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,7 @@ static void *create_object(void *_data,
|
||||||
struct pw_client *client = NULL;
|
struct pw_client *client = NULL;
|
||||||
struct pw_node *output_node, *input_node;
|
struct pw_node *output_node, *input_node;
|
||||||
struct pw_port *outport, *inport;
|
struct pw_port *outport, *inport;
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
struct pw_global *global;
|
struct pw_global *global;
|
||||||
struct pw_link *link;
|
struct pw_link *link;
|
||||||
uint32_t output_node_id, input_node_id;
|
uint32_t output_node_id, input_node_id;
|
||||||
|
|
@ -192,7 +192,7 @@ static void *create_object(void *_data,
|
||||||
bool linger;
|
bool linger;
|
||||||
|
|
||||||
client = pw_resource_get_client(resource);
|
client = pw_resource_get_client(resource);
|
||||||
core = pw_client_get_core(client);
|
context = pw_client_get_context(client);
|
||||||
|
|
||||||
if (properties == NULL)
|
if (properties == NULL)
|
||||||
goto error_properties;
|
goto error_properties;
|
||||||
|
|
@ -213,13 +213,13 @@ static void *create_object(void *_data,
|
||||||
str = pw_properties_get(properties, PW_KEY_LINK_INPUT_PORT);
|
str = pw_properties_get(properties, PW_KEY_LINK_INPUT_PORT);
|
||||||
input_port_id = str ? pw_properties_parse_int(str) : -1;
|
input_port_id = str ? pw_properties_parse_int(str) : -1;
|
||||||
|
|
||||||
global = pw_core_find_global(core, output_node_id);
|
global = pw_context_find_global(context, output_node_id);
|
||||||
if (global == NULL || pw_global_get_type(global) != PW_TYPE_INTERFACE_Node)
|
if (global == NULL || pw_global_get_type(global) != PW_TYPE_INTERFACE_Node)
|
||||||
goto error_output;
|
goto error_output;
|
||||||
|
|
||||||
output_node = pw_global_get_object(global);
|
output_node = pw_global_get_object(global);
|
||||||
|
|
||||||
global = pw_core_find_global(core, input_node_id);
|
global = pw_context_find_global(context, input_node_id);
|
||||||
if (global == NULL || pw_global_get_type(global) != PW_TYPE_INTERFACE_Node)
|
if (global == NULL || pw_global_get_type(global) != PW_TYPE_INTERFACE_Node)
|
||||||
goto error_input;
|
goto error_input;
|
||||||
|
|
||||||
|
|
@ -229,7 +229,7 @@ static void *create_object(void *_data,
|
||||||
outport = get_port(output_node, SPA_DIRECTION_OUTPUT);
|
outport = get_port(output_node, SPA_DIRECTION_OUTPUT);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
global = pw_core_find_global(core, output_port_id);
|
global = pw_context_find_global(context, output_port_id);
|
||||||
if (global == NULL || pw_global_get_type(global) != PW_TYPE_INTERFACE_Port)
|
if (global == NULL || pw_global_get_type(global) != PW_TYPE_INTERFACE_Port)
|
||||||
goto error_output_port;
|
goto error_output_port;
|
||||||
|
|
||||||
|
|
@ -241,7 +241,7 @@ static void *create_object(void *_data,
|
||||||
if (input_port_id == SPA_ID_INVALID)
|
if (input_port_id == SPA_ID_INVALID)
|
||||||
inport = get_port(input_node, SPA_DIRECTION_INPUT);
|
inport = get_port(input_node, SPA_DIRECTION_INPUT);
|
||||||
else {
|
else {
|
||||||
global = pw_core_find_global(core, input_port_id);
|
global = pw_context_find_global(context, input_port_id);
|
||||||
if (global == NULL || pw_global_get_type(global) != PW_TYPE_INTERFACE_Port)
|
if (global == NULL || pw_global_get_type(global) != PW_TYPE_INTERFACE_Port)
|
||||||
goto error_input_port;
|
goto error_input_port;
|
||||||
|
|
||||||
|
|
@ -258,7 +258,7 @@ static void *create_object(void *_data,
|
||||||
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d", client->global->id);
|
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d", client->global->id);
|
||||||
|
|
||||||
|
|
||||||
link = pw_link_new(core, outport, inport, NULL, properties, sizeof(struct link_data));
|
link = pw_link_new(context, outport, inport, NULL, properties, sizeof(struct link_data));
|
||||||
properties = NULL;
|
properties = NULL;
|
||||||
if (link == NULL) {
|
if (link == NULL) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
|
|
@ -364,11 +364,11 @@ static const struct pw_module_events module_events = {
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
int pipewire__module_init(struct pw_module *module, const char *args)
|
int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
{
|
{
|
||||||
struct pw_core *core = pw_module_get_core(module);
|
struct pw_context *context = pw_module_get_context(module);
|
||||||
struct pw_factory *factory;
|
struct pw_factory *factory;
|
||||||
struct factory_data *data;
|
struct factory_data *data;
|
||||||
|
|
||||||
factory = pw_factory_new(core,
|
factory = pw_factory_new(context,
|
||||||
"link-factory",
|
"link-factory",
|
||||||
PW_TYPE_INTERFACE_Link,
|
PW_TYPE_INTERFACE_Link,
|
||||||
PW_VERSION_LINK_PROXY,
|
PW_VERSION_LINK_PROXY,
|
||||||
|
|
|
||||||
|
|
@ -43,13 +43,13 @@ static const struct spa_dict_item module_props[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void * pw_metadata_new(struct pw_core *core, struct pw_resource *resource,
|
void * pw_metadata_new(struct pw_context *context, struct pw_resource *resource,
|
||||||
struct pw_properties *properties);
|
struct pw_properties *properties);
|
||||||
|
|
||||||
struct pw_proxy *pw_core_proxy_metadata_export(struct pw_core_proxy *core_proxy,
|
struct pw_proxy *pw_core_proxy_metadata_export(struct pw_core_proxy *core_proxy,
|
||||||
uint32_t type, struct pw_properties *props, void *object, size_t user_data_size);
|
uint32_t type, struct pw_properties *props, void *object, size_t user_data_size);
|
||||||
|
|
||||||
int pw_protocol_native_ext_metadata_init(struct pw_core *core);
|
int pw_protocol_native_ext_metadata_init(struct pw_context *context);
|
||||||
|
|
||||||
struct factory_data {
|
struct factory_data {
|
||||||
struct pw_factory *this;
|
struct pw_factory *this;
|
||||||
|
|
@ -79,7 +79,7 @@ static void *create_object(void *_data,
|
||||||
}
|
}
|
||||||
|
|
||||||
pw_log_debug(".");
|
pw_log_debug(".");
|
||||||
result = pw_metadata_new(pw_client_get_core(client), metadata_resource, properties);
|
result = pw_metadata_new(pw_client_get_context(client), metadata_resource, properties);
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
goto error_node;
|
goto error_node;
|
||||||
|
|
@ -146,15 +146,15 @@ static const struct pw_module_events module_events = {
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
int pipewire__module_init(struct pw_module *module, const char *args)
|
int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
{
|
{
|
||||||
struct pw_core *core = pw_module_get_core(module);
|
struct pw_context *context = pw_module_get_context(module);
|
||||||
struct pw_factory *factory;
|
struct pw_factory *factory;
|
||||||
struct factory_data *data;
|
struct factory_data *data;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
if ((res = pw_protocol_native_ext_metadata_init(core)) < 0)
|
if ((res = pw_protocol_native_ext_metadata_init(context)) < 0)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
factory = pw_factory_new(core,
|
factory = pw_factory_new(context,
|
||||||
"metadata",
|
"metadata",
|
||||||
PW_TYPE_INTERFACE_Metadata,
|
PW_TYPE_INTERFACE_Metadata,
|
||||||
PW_VERSION_METADATA,
|
PW_VERSION_METADATA,
|
||||||
|
|
@ -175,7 +175,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
|
|
||||||
data->export_metadata.type = PW_TYPE_INTERFACE_Metadata;
|
data->export_metadata.type = PW_TYPE_INTERFACE_Metadata;
|
||||||
data->export_metadata.func = pw_core_proxy_metadata_export;
|
data->export_metadata.func = pw_core_proxy_metadata_export;
|
||||||
pw_core_register_export_type(core, &data->export_metadata);
|
pw_context_register_export_type(context, &data->export_metadata);
|
||||||
|
|
||||||
pw_module_add_listener(module, &data->module_listener, &module_events, data);
|
pw_module_add_listener(module, &data->module_listener, &module_events, data);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ global_bind(void *_data, struct pw_client *client, uint32_t permissions,
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
pw_metadata_new(struct pw_core *core, struct pw_resource *resource,
|
pw_metadata_new(struct pw_context *context, struct pw_resource *resource,
|
||||||
struct pw_properties *properties)
|
struct pw_properties *properties)
|
||||||
{
|
{
|
||||||
struct impl *impl;
|
struct impl *impl;
|
||||||
|
|
@ -162,7 +162,7 @@ pw_metadata_new(struct pw_core *core, struct pw_resource *resource,
|
||||||
|
|
||||||
pw_resource_install_marshal(resource, true);
|
pw_resource_install_marshal(resource, true);
|
||||||
|
|
||||||
impl->global = pw_global_new(core,
|
impl->global = pw_global_new(context,
|
||||||
PW_TYPE_INTERFACE_Metadata,
|
PW_TYPE_INTERFACE_Metadata,
|
||||||
PW_VERSION_METADATA,
|
PW_VERSION_METADATA,
|
||||||
properties,
|
properties,
|
||||||
|
|
|
||||||
|
|
@ -321,11 +321,11 @@ static const struct pw_protocol_marshal pw_protocol_native_metadata_impl_marshal
|
||||||
.client_demarshal = pw_protocol_native_metadata_client_method_demarshal,
|
.client_demarshal = pw_protocol_native_metadata_client_method_demarshal,
|
||||||
};
|
};
|
||||||
|
|
||||||
int pw_protocol_native_ext_metadata_init(struct pw_core *core)
|
int pw_protocol_native_ext_metadata_init(struct pw_context *context)
|
||||||
{
|
{
|
||||||
struct pw_protocol *protocol;
|
struct pw_protocol *protocol;
|
||||||
|
|
||||||
protocol = pw_core_find_protocol(core, PW_TYPE_INFO_PROTOCOL_Native);
|
protocol = pw_context_find_protocol(context, PW_TYPE_INFO_PROTOCOL_Native);
|
||||||
if (protocol == NULL)
|
if (protocol == NULL)
|
||||||
return -EPROTO;
|
return -EPROTO;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@
|
||||||
#include "pipewire/private.h"
|
#include "pipewire/private.h"
|
||||||
|
|
||||||
struct impl {
|
struct impl {
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
struct pw_device *device;
|
struct pw_device *device;
|
||||||
struct spa_hook device_listener;
|
struct spa_hook device_listener;
|
||||||
|
|
||||||
|
|
@ -108,7 +108,7 @@ struct pw_device *pw_client_device_new(struct pw_resource *resource,
|
||||||
struct impl *impl;
|
struct impl *impl;
|
||||||
struct pw_device *device;
|
struct pw_device *device;
|
||||||
struct pw_client *client = pw_resource_get_client(resource);
|
struct pw_client *client = pw_resource_get_client(resource);
|
||||||
struct pw_core *core = pw_client_get_core(client);
|
struct pw_context *context = pw_client_get_context(client);
|
||||||
|
|
||||||
if (properties == NULL)
|
if (properties == NULL)
|
||||||
properties = pw_properties_new(NULL, NULL);
|
properties = pw_properties_new(NULL, NULL);
|
||||||
|
|
@ -117,13 +117,13 @@ struct pw_device *pw_client_device_new(struct pw_resource *resource,
|
||||||
|
|
||||||
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d", client->global->id);
|
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d", client->global->id);
|
||||||
|
|
||||||
device = pw_device_new(core, properties, sizeof(struct impl));
|
device = pw_device_new(context, properties, sizeof(struct impl));
|
||||||
if (device == NULL)
|
if (device == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
impl = pw_device_get_user_data(device);
|
impl = pw_device_get_user_data(device);
|
||||||
impl->device = device;
|
impl->device = device;
|
||||||
impl->core = core;
|
impl->context = context;
|
||||||
impl->resource = resource;
|
impl->resource = resource;
|
||||||
|
|
||||||
pw_resource_install_marshal(resource, true);
|
pw_resource_install_marshal(resource, true);
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ struct protocol_data {
|
||||||
|
|
||||||
struct client {
|
struct client {
|
||||||
struct pw_protocol_client this;
|
struct pw_protocol_client this;
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
|
|
||||||
struct spa_source *source;
|
struct spa_source *source;
|
||||||
|
|
||||||
|
|
@ -124,12 +124,12 @@ process_messages(struct client_data *data)
|
||||||
{
|
{
|
||||||
struct pw_protocol_native_connection *conn = data->connection;
|
struct pw_protocol_native_connection *conn = data->connection;
|
||||||
struct pw_client *client = data->client;
|
struct pw_client *client = data->client;
|
||||||
struct pw_core *core = client->core;
|
struct pw_context *context = client->context;
|
||||||
const struct pw_protocol_native_message *msg;
|
const struct pw_protocol_native_message *msg;
|
||||||
struct pw_resource *resource;
|
struct pw_resource *resource;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
core->current_client = client;
|
context->current_client = client;
|
||||||
|
|
||||||
/* when the client is busy processing an async action, stop processing messages
|
/* when the client is busy processing an async action, stop processing messages
|
||||||
* for the client until it finishes the action */
|
* for the client until it finishes the action */
|
||||||
|
|
@ -197,7 +197,7 @@ process_messages(struct client_data *data)
|
||||||
goto invalid_message;
|
goto invalid_message;
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
core->current_client = NULL;
|
context->current_client = NULL;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
invalid_method:
|
invalid_method:
|
||||||
|
|
@ -233,7 +233,7 @@ client_busy_changed(void *data, bool busy)
|
||||||
SPA_FLAG_UPDATE(mask, SPA_IO_IN, !busy);
|
SPA_FLAG_UPDATE(mask, SPA_IO_IN, !busy);
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: busy changed %d", client->protocol, busy);
|
pw_log_debug(NAME" %p: busy changed %d", client->protocol, busy);
|
||||||
pw_loop_update_io(client->core->main_loop, c->source, mask);
|
pw_loop_update_io(client->context->main_loop, c->source, mask);
|
||||||
|
|
||||||
if (!busy)
|
if (!busy)
|
||||||
process_messages(c);
|
process_messages(c);
|
||||||
|
|
@ -262,7 +262,7 @@ connection_data(void *data, int fd, uint32_t mask)
|
||||||
if (res >= 0) {
|
if (res >= 0) {
|
||||||
int mask = this->source->mask;
|
int mask = this->source->mask;
|
||||||
SPA_FLAG_CLEAR(mask, SPA_IO_OUT);
|
SPA_FLAG_CLEAR(mask, SPA_IO_OUT);
|
||||||
pw_loop_update_io(client->protocol->core->main_loop,
|
pw_loop_update_io(client->protocol->context->main_loop,
|
||||||
this->source, mask);
|
this->source, mask);
|
||||||
} else if (res != EAGAIN) {
|
} else if (res != EAGAIN) {
|
||||||
pw_log_error("client %p: could not flush: %s",
|
pw_log_error("client %p: could not flush: %s",
|
||||||
|
|
@ -283,7 +283,7 @@ static void client_free(void *data)
|
||||||
spa_list_remove(&client->protocol_link);
|
spa_list_remove(&client->protocol_link);
|
||||||
|
|
||||||
if (this->source)
|
if (this->source)
|
||||||
pw_loop_destroy_source(client->protocol->core->main_loop, this->source);
|
pw_loop_destroy_source(client->protocol->context->main_loop, this->source);
|
||||||
if (this->connection)
|
if (this->connection)
|
||||||
pw_protocol_native_connection_destroy(this->connection);
|
pw_protocol_native_connection_destroy(this->connection);
|
||||||
|
|
||||||
|
|
@ -300,11 +300,11 @@ static void on_start(void *data, uint32_t version)
|
||||||
{
|
{
|
||||||
struct client_data *this = data;
|
struct client_data *this = data;
|
||||||
struct pw_client *client = this->client;
|
struct pw_client *client = this->client;
|
||||||
struct pw_core *core = client->core;
|
struct pw_context *context = client->context;
|
||||||
|
|
||||||
pw_log_debug("version %d", version);
|
pw_log_debug("version %d", version);
|
||||||
|
|
||||||
if (pw_global_bind(pw_core_get_global(core), client,
|
if (pw_global_bind(pw_context_get_global(context), client,
|
||||||
PW_PERM_RWX, version, 0) < 0)
|
PW_PERM_RWX, version, 0) < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -326,7 +326,7 @@ static struct client_data *client_new(struct server *s, int fd)
|
||||||
struct pw_protocol *protocol = s->this.protocol;
|
struct pw_protocol *protocol = s->this.protocol;
|
||||||
socklen_t len;
|
socklen_t len;
|
||||||
struct ucred ucred;
|
struct ucred ucred;
|
||||||
struct pw_core *core = protocol->core;
|
struct pw_context *context = protocol->context;
|
||||||
struct pw_properties *props;
|
struct pw_properties *props;
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
struct protocol_data *d = pw_protocol_get_user_data(protocol);
|
struct protocol_data *d = pw_protocol_get_user_data(protocol);
|
||||||
|
|
@ -356,7 +356,7 @@ static struct client_data *client_new(struct server *s, int fd)
|
||||||
|
|
||||||
pw_properties_setf(props, PW_KEY_MODULE_ID, "%d", d->module->global->id);
|
pw_properties_setf(props, PW_KEY_MODULE_ID, "%d", d->module->global->id);
|
||||||
|
|
||||||
client = pw_client_new(protocol->core,
|
client = pw_client_new(protocol->context,
|
||||||
props,
|
props,
|
||||||
sizeof(struct client_data));
|
sizeof(struct client_data));
|
||||||
if (client == NULL)
|
if (client == NULL)
|
||||||
|
|
@ -368,7 +368,7 @@ static struct client_data *client_new(struct server *s, int fd)
|
||||||
spa_list_append(&s->this.client_list, &client->protocol_link);
|
spa_list_append(&s->this.client_list, &client->protocol_link);
|
||||||
|
|
||||||
this->client = client;
|
this->client = client;
|
||||||
this->source = pw_loop_add_io(pw_core_get_main_loop(core),
|
this->source = pw_loop_add_io(pw_context_get_main_loop(context),
|
||||||
fd, SPA_IO_ERR | SPA_IO_HUP, true,
|
fd, SPA_IO_ERR | SPA_IO_HUP, true,
|
||||||
connection_data, this);
|
connection_data, this);
|
||||||
if (this->source == NULL) {
|
if (this->source == NULL) {
|
||||||
|
|
@ -376,7 +376,7 @@ static struct client_data *client_new(struct server *s, int fd)
|
||||||
goto cleanup_client;
|
goto cleanup_client;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->connection = pw_protocol_native_connection_new(protocol->core, fd);
|
this->connection = pw_protocol_native_connection_new(protocol->context, fd);
|
||||||
if (this->connection == NULL) {
|
if (this->connection == NULL) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
goto cleanup_client;
|
goto cleanup_client;
|
||||||
|
|
@ -395,7 +395,7 @@ static struct client_data *client_new(struct server *s, int fd)
|
||||||
goto cleanup_client;
|
goto cleanup_client;
|
||||||
|
|
||||||
if (!client->busy)
|
if (!client->busy)
|
||||||
pw_loop_update_io(pw_core_get_main_loop(core),
|
pw_loop_update_io(pw_context_get_main_loop(context),
|
||||||
this->source, this->source->mask | SPA_IO_IN);
|
this->source, this->source->mask | SPA_IO_IN);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
@ -554,7 +554,7 @@ static int add_socket(struct pw_protocol *protocol, struct server *s)
|
||||||
}
|
}
|
||||||
|
|
||||||
s->activated = activated;
|
s->activated = activated;
|
||||||
s->loop = pw_core_get_main_loop(protocol->core);
|
s->loop = pw_context_get_main_loop(protocol->context);
|
||||||
if (s->loop == NULL) {
|
if (s->loop == NULL) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
goto error_close;
|
goto error_close;
|
||||||
|
|
@ -595,8 +595,8 @@ on_remote_data(void *data, int fd, uint32_t mask)
|
||||||
struct client *impl = data;
|
struct client *impl = data;
|
||||||
struct pw_core_proxy *this = impl->this.core_proxy;
|
struct pw_core_proxy *this = impl->this.core_proxy;
|
||||||
struct pw_protocol_native_connection *conn = impl->connection;
|
struct pw_protocol_native_connection *conn = impl->connection;
|
||||||
struct pw_core *core = pw_core_proxy_get_core(this);
|
struct pw_context *context = pw_core_proxy_get_context(this);
|
||||||
struct pw_loop *loop = pw_core_get_main_loop(core);
|
struct pw_loop *loop = pw_context_get_main_loop(context);
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
if (mask & (SPA_IO_ERR | SPA_IO_HUP)) {
|
if (mask & (SPA_IO_ERR | SPA_IO_HUP)) {
|
||||||
|
|
@ -698,7 +698,7 @@ static void on_need_flush(void *data)
|
||||||
int mask = impl->source->mask;
|
int mask = impl->source->mask;
|
||||||
impl->flushing = true;
|
impl->flushing = true;
|
||||||
SPA_FLAG_SET(mask, SPA_IO_OUT);
|
SPA_FLAG_SET(mask, SPA_IO_OUT);
|
||||||
pw_loop_update_io(impl->core->main_loop,
|
pw_loop_update_io(impl->context->main_loop,
|
||||||
impl->source, mask);
|
impl->source, mask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -717,7 +717,7 @@ static int impl_connect_fd(struct pw_protocol_client *client, int fd, bool do_cl
|
||||||
|
|
||||||
pw_protocol_native_connection_set_fd(impl->connection, fd);
|
pw_protocol_native_connection_set_fd(impl->connection, fd);
|
||||||
impl->flushing = true;
|
impl->flushing = true;
|
||||||
impl->source = pw_loop_add_io(impl->core->main_loop,
|
impl->source = pw_loop_add_io(impl->context->main_loop,
|
||||||
fd,
|
fd,
|
||||||
SPA_IO_IN | SPA_IO_OUT | SPA_IO_HUP | SPA_IO_ERR,
|
SPA_IO_IN | SPA_IO_OUT | SPA_IO_HUP | SPA_IO_ERR,
|
||||||
do_close, on_remote_data, impl);
|
do_close, on_remote_data, impl);
|
||||||
|
|
@ -747,7 +747,7 @@ static void impl_disconnect(struct pw_protocol_client *client)
|
||||||
impl->disconnecting = true;
|
impl->disconnecting = true;
|
||||||
|
|
||||||
if (impl->source)
|
if (impl->source)
|
||||||
pw_loop_destroy_source(impl->core->main_loop, impl->source);
|
pw_loop_destroy_source(impl->context->main_loop, impl->source);
|
||||||
impl->source = NULL;
|
impl->source = NULL;
|
||||||
|
|
||||||
if (impl->connection)
|
if (impl->connection)
|
||||||
|
|
@ -825,8 +825,8 @@ impl_new_client(struct pw_protocol *protocol,
|
||||||
this = &impl->this;
|
this = &impl->this;
|
||||||
this->protocol = protocol;
|
this->protocol = protocol;
|
||||||
|
|
||||||
impl->core = protocol->core;
|
impl->context = protocol->context;
|
||||||
impl->connection = pw_protocol_native_connection_new(protocol->core, -1);
|
impl->connection = pw_protocol_native_connection_new(protocol->context, -1);
|
||||||
if (impl->connection == NULL) {
|
if (impl->connection == NULL) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
goto error_free;
|
goto error_free;
|
||||||
|
|
@ -836,7 +836,7 @@ impl_new_client(struct pw_protocol *protocol,
|
||||||
str = pw_properties_get(properties, PW_KEY_REMOTE_INTENTION);
|
str = pw_properties_get(properties, PW_KEY_REMOTE_INTENTION);
|
||||||
if (str == NULL &&
|
if (str == NULL &&
|
||||||
(str = pw_properties_get(properties, PW_KEY_REMOTE_NAME)) != NULL &&
|
(str = pw_properties_get(properties, PW_KEY_REMOTE_NAME)) != NULL &&
|
||||||
strcmp(str, impl->core->info.name) == 0)
|
strcmp(str, impl->context->info.name) == 0)
|
||||||
str = "internal";
|
str = "internal";
|
||||||
}
|
}
|
||||||
if (str == NULL)
|
if (str == NULL)
|
||||||
|
|
@ -905,7 +905,7 @@ static void on_before_hook(void *_data)
|
||||||
if (res == -EAGAIN) {
|
if (res == -EAGAIN) {
|
||||||
int mask = data->source->mask;
|
int mask = data->source->mask;
|
||||||
SPA_FLAG_SET(mask, SPA_IO_OUT);
|
SPA_FLAG_SET(mask, SPA_IO_OUT);
|
||||||
pw_loop_update_io(client->protocol->core->main_loop,
|
pw_loop_update_io(client->protocol->context->main_loop,
|
||||||
data->source, mask);
|
data->source, mask);
|
||||||
} else if (res < 0) {
|
} else if (res < 0) {
|
||||||
pw_log_warn("client %p: could not flush: %s",
|
pw_log_warn("client %p: could not flush: %s",
|
||||||
|
|
@ -940,7 +940,7 @@ create_server(struct pw_protocol *protocol,
|
||||||
const struct pw_properties *properties)
|
const struct pw_properties *properties)
|
||||||
{
|
{
|
||||||
struct pw_protocol_server *this;
|
struct pw_protocol_server *this;
|
||||||
struct pw_core *core = protocol->core;
|
struct pw_context *context = protocol->context;
|
||||||
struct server *s;
|
struct server *s;
|
||||||
|
|
||||||
if ((s = calloc(1, sizeof(struct server))) == NULL)
|
if ((s = calloc(1, sizeof(struct server))) == NULL)
|
||||||
|
|
@ -955,7 +955,7 @@ create_server(struct pw_protocol *protocol,
|
||||||
|
|
||||||
spa_list_append(&protocol->server_list, &this->link);
|
spa_list_append(&protocol->server_list, &this->link);
|
||||||
|
|
||||||
pw_loop_add_hook(pw_core_get_main_loop(core), &s->hook, &impl_hooks, s);
|
pw_loop_add_hook(pw_context_get_main_loop(context), &s->hook, &impl_hooks, s);
|
||||||
|
|
||||||
pw_log_info(NAME" %p: created server %p", protocol, this);
|
pw_log_info(NAME" %p: created server %p", protocol, this);
|
||||||
|
|
||||||
|
|
@ -1085,17 +1085,17 @@ static const struct pw_module_events module_events = {
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
int pipewire__module_init(struct pw_module *module, const char *args)
|
int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
{
|
{
|
||||||
struct pw_core *core = pw_module_get_core(module);
|
struct pw_context *context = pw_module_get_context(module);
|
||||||
struct pw_protocol *this;
|
struct pw_protocol *this;
|
||||||
const char *val;
|
const char *val;
|
||||||
struct protocol_data *d;
|
struct protocol_data *d;
|
||||||
const struct pw_properties *props;
|
const struct pw_properties *props;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
if (pw_core_find_protocol(core, PW_TYPE_INFO_PROTOCOL_Native) != NULL)
|
if (pw_context_find_protocol(context, PW_TYPE_INFO_PROTOCOL_Native) != NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
this = pw_protocol_new(core, PW_TYPE_INFO_PROTOCOL_Native, sizeof(struct protocol_data));
|
this = pw_protocol_new(context, PW_TYPE_INFO_PROTOCOL_Native, sizeof(struct protocol_data));
|
||||||
if (this == NULL)
|
if (this == NULL)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
|
|
@ -1115,7 +1115,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
|
|
||||||
d->local = create_server(this, props);
|
d->local = create_server(this, props);
|
||||||
|
|
||||||
props = pw_core_get_properties(core);
|
props = pw_context_get_properties(context);
|
||||||
|
|
||||||
val = getenv("PIPEWIRE_DAEMON");
|
val = getenv("PIPEWIRE_DAEMON");
|
||||||
if (val == NULL)
|
if (val == NULL)
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ struct buffer {
|
||||||
|
|
||||||
struct impl {
|
struct impl {
|
||||||
struct pw_protocol_native_connection this;
|
struct pw_protocol_native_connection this;
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
|
|
||||||
struct buffer in, out;
|
struct buffer in, out;
|
||||||
struct spa_pod_builder builder;
|
struct spa_pod_builder builder;
|
||||||
|
|
@ -225,7 +225,7 @@ static void clear_buffer(struct buffer *buf)
|
||||||
*
|
*
|
||||||
* \memberof pw_protocol_native_connection
|
* \memberof pw_protocol_native_connection
|
||||||
*/
|
*/
|
||||||
struct pw_protocol_native_connection *pw_protocol_native_connection_new(struct pw_core *core, int fd)
|
struct pw_protocol_native_connection *pw_protocol_native_connection_new(struct pw_context *context, int fd)
|
||||||
{
|
{
|
||||||
struct impl *impl;
|
struct impl *impl;
|
||||||
struct pw_protocol_native_connection *this;
|
struct pw_protocol_native_connection *this;
|
||||||
|
|
@ -235,7 +235,7 @@ struct pw_protocol_native_connection *pw_protocol_native_connection_new(struct p
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
debug_messages = pw_debug_is_category_enabled("connection");
|
debug_messages = pw_debug_is_category_enabled("connection");
|
||||||
impl->core = core;
|
impl->context = context;
|
||||||
|
|
||||||
this = &impl->this;
|
this = &impl->this;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ pw_protocol_native_connection_add_listener(struct pw_protocol_native_connection
|
||||||
}
|
}
|
||||||
|
|
||||||
struct pw_protocol_native_connection *
|
struct pw_protocol_native_connection *
|
||||||
pw_protocol_native_connection_new(struct pw_core *core, int fd);
|
pw_protocol_native_connection_new(struct pw_context *context, int fd);
|
||||||
|
|
||||||
int pw_protocol_native_connection_set_fd(struct pw_protocol_native_connection *conn, int fd);
|
int pw_protocol_native_connection_set_fd(struct pw_protocol_native_connection *conn, int fd);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -123,23 +123,23 @@ static void test_read_write(struct pw_protocol_native_connection *in,
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct pw_main_loop *loop;
|
struct pw_main_loop *loop;
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
struct pw_protocol_native_connection *in, *out;
|
struct pw_protocol_native_connection *in, *out;
|
||||||
int fds[2];
|
int fds[2];
|
||||||
|
|
||||||
pw_init(&argc, &argv);
|
pw_init(&argc, &argv);
|
||||||
|
|
||||||
loop = pw_main_loop_new(NULL);
|
loop = pw_main_loop_new(NULL);
|
||||||
core = pw_core_new(pw_main_loop_get_loop(loop), NULL, 0);
|
context = pw_context_new(pw_main_loop_get_loop(loop), NULL, 0);
|
||||||
|
|
||||||
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) {
|
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) {
|
||||||
spa_assert_not_reached();
|
spa_assert_not_reached();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
in = pw_protocol_native_connection_new(core, fds[0]);
|
in = pw_protocol_native_connection_new(context, fds[0]);
|
||||||
spa_assert(in != NULL);
|
spa_assert(in != NULL);
|
||||||
out = pw_protocol_native_connection_new(core, fds[1]);
|
out = pw_protocol_native_connection_new(context, fds[1]);
|
||||||
spa_assert(out != NULL);
|
spa_assert(out != NULL);
|
||||||
|
|
||||||
test_create(in);
|
test_create(in);
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ static const struct spa_dict_item module_props[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct impl {
|
struct impl {
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
|
|
||||||
struct spa_loop *loop;
|
struct spa_loop *loop;
|
||||||
struct spa_system *system;
|
struct spa_system *system;
|
||||||
|
|
@ -486,7 +486,7 @@ static void idle_func(struct spa_source *source)
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
int pipewire__module_init(struct pw_module *module, const char *args)
|
int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
{
|
{
|
||||||
struct pw_core *core = pw_module_get_core(module);
|
struct pw_context *context = pw_module_get_context(module);
|
||||||
struct impl *impl;
|
struct impl *impl;
|
||||||
struct spa_loop *loop;
|
struct spa_loop *loop;
|
||||||
struct spa_system *system;
|
struct spa_system *system;
|
||||||
|
|
@ -494,7 +494,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
uint32_t n_support;
|
uint32_t n_support;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
support = pw_core_get_support(core, &n_support);
|
support = pw_context_get_support(context, &n_support);
|
||||||
|
|
||||||
loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
|
loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
|
||||||
if (loop == NULL)
|
if (loop == NULL)
|
||||||
|
|
@ -510,7 +510,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
|
|
||||||
pw_log_debug("module %p: new", impl);
|
pw_log_debug("module %p: new", impl);
|
||||||
|
|
||||||
impl->core = core;
|
impl->context = context;
|
||||||
impl->loop = loop;
|
impl->loop = loop;
|
||||||
impl->system = system;
|
impl->system = system;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ int client_endpoint_factory_init(struct pw_module *module);
|
||||||
/* client-session.c */
|
/* client-session.c */
|
||||||
int client_session_factory_init(struct pw_module *module);
|
int client_session_factory_init(struct pw_module *module);
|
||||||
/* protocol-native.c */
|
/* protocol-native.c */
|
||||||
struct pw_protocol *pw_protocol_native_ext_session_manager_init(struct pw_core *core);
|
struct pw_protocol *pw_protocol_native_ext_session_manager_init(struct pw_context *context);
|
||||||
|
|
||||||
static const struct spa_dict_item module_props[] = {
|
static const struct spa_dict_item module_props[] = {
|
||||||
{ PW_KEY_MODULE_AUTHOR, "George Kiagiadakis <george.kiagiadakis@collabora.com>" },
|
{ PW_KEY_MODULE_AUTHOR, "George Kiagiadakis <george.kiagiadakis@collabora.com>" },
|
||||||
|
|
@ -43,12 +43,12 @@ static const struct spa_dict_item module_props[] = {
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
int pipewire__module_init(struct pw_module *module, const char *args)
|
int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
{
|
{
|
||||||
struct pw_core *core = pw_module_get_core(module);
|
struct pw_context *context = pw_module_get_context(module);
|
||||||
|
|
||||||
client_endpoint_factory_init(module);
|
client_endpoint_factory_init(module);
|
||||||
client_session_factory_init(module);
|
client_session_factory_init(module);
|
||||||
|
|
||||||
pw_protocol_native_ext_session_manager_init(core);
|
pw_protocol_native_ext_session_manager_init(context);
|
||||||
|
|
||||||
pw_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props));
|
pw_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ static int client_endpoint_stream_update(void *object,
|
||||||
struct pw_properties *props = NULL;
|
struct pw_properties *props = NULL;
|
||||||
|
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
struct pw_core *core = pw_global_get_core(endpoint->global);
|
struct pw_context *context = pw_global_get_context(endpoint->global);
|
||||||
const char *keys[] = {
|
const char *keys[] = {
|
||||||
PW_KEY_FACTORY_ID,
|
PW_KEY_FACTORY_ID,
|
||||||
PW_KEY_CLIENT_ID,
|
PW_KEY_CLIENT_ID,
|
||||||
|
|
@ -103,7 +103,7 @@ static int client_endpoint_stream_update(void *object,
|
||||||
pw_properties_update_keys(props, info->props, keys);
|
pw_properties_update_keys(props, info->props, keys);
|
||||||
|
|
||||||
if (endpoint_stream_init(stream, stream_id, endpoint->info.id,
|
if (endpoint_stream_init(stream, stream_id, endpoint->info.id,
|
||||||
this, core, props) < 0)
|
this, context, props) < 0)
|
||||||
goto no_mem;
|
goto no_mem;
|
||||||
|
|
||||||
spa_list_append(&this->streams, &stream->link);
|
spa_list_append(&this->streams, &stream->link);
|
||||||
|
|
@ -169,7 +169,7 @@ static void *create_object(void *data,
|
||||||
struct pw_factory *factory = d->factory;
|
struct pw_factory *factory = d->factory;
|
||||||
struct client_endpoint *this;
|
struct client_endpoint *this;
|
||||||
struct pw_client *owner = pw_resource_get_client(owner_resource);
|
struct pw_client *owner = pw_resource_get_client(owner_resource);
|
||||||
struct pw_core *core = pw_client_get_core(owner);
|
struct pw_context *context = pw_client_get_context(owner);
|
||||||
|
|
||||||
this = calloc(1, sizeof(struct client_endpoint));
|
this = calloc(1, sizeof(struct client_endpoint));
|
||||||
if (this == NULL)
|
if (this == NULL)
|
||||||
|
|
@ -191,7 +191,7 @@ static void *create_object(void *data,
|
||||||
if (this->resource == NULL)
|
if (this->resource == NULL)
|
||||||
goto no_mem;
|
goto no_mem;
|
||||||
|
|
||||||
if (endpoint_init(&this->endpoint, this, core, properties) < 0)
|
if (endpoint_init(&this->endpoint, this, context, properties) < 0)
|
||||||
goto no_mem;
|
goto no_mem;
|
||||||
|
|
||||||
pw_resource_add_listener(this->resource, &this->resource_listener,
|
pw_resource_add_listener(this->resource, &this->resource_listener,
|
||||||
|
|
@ -252,11 +252,11 @@ static const struct pw_module_events module_events = {
|
||||||
|
|
||||||
int client_endpoint_factory_init(struct pw_module *module)
|
int client_endpoint_factory_init(struct pw_module *module)
|
||||||
{
|
{
|
||||||
struct pw_core *core = pw_module_get_core(module);
|
struct pw_context *context = pw_module_get_context(module);
|
||||||
struct pw_factory *factory;
|
struct pw_factory *factory;
|
||||||
struct factory_data *data;
|
struct factory_data *data;
|
||||||
|
|
||||||
factory = pw_factory_new(core,
|
factory = pw_factory_new(context,
|
||||||
"client-endpoint",
|
"client-endpoint",
|
||||||
PW_TYPE_INTERFACE_ClientEndpoint,
|
PW_TYPE_INTERFACE_ClientEndpoint,
|
||||||
PW_VERSION_CLIENT_ENDPOINT_PROXY,
|
PW_VERSION_CLIENT_ENDPOINT_PROXY,
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ static int client_session_link_update(void *object,
|
||||||
struct pw_properties *props = NULL;
|
struct pw_properties *props = NULL;
|
||||||
|
|
||||||
if (!link) {
|
if (!link) {
|
||||||
struct pw_core *core = pw_global_get_core(session->global);
|
struct pw_context *context = pw_global_get_context(session->global);
|
||||||
const char *keys[] = {
|
const char *keys[] = {
|
||||||
PW_KEY_FACTORY_ID,
|
PW_KEY_FACTORY_ID,
|
||||||
PW_KEY_CLIENT_ID,
|
PW_KEY_CLIENT_ID,
|
||||||
|
|
@ -102,7 +102,7 @@ static int client_session_link_update(void *object,
|
||||||
pw_properties_update_keys(props, info->props, keys);
|
pw_properties_update_keys(props, info->props, keys);
|
||||||
|
|
||||||
if (endpoint_link_init(link, link_id, session->info.id,
|
if (endpoint_link_init(link, link_id, session->info.id,
|
||||||
this, core, props) < 0)
|
this, context, props) < 0)
|
||||||
goto no_mem;
|
goto no_mem;
|
||||||
|
|
||||||
spa_list_append(&this->links, &link->link);
|
spa_list_append(&this->links, &link->link);
|
||||||
|
|
@ -168,7 +168,7 @@ static void *create_object(void *data,
|
||||||
struct pw_factory *factory = d->factory;
|
struct pw_factory *factory = d->factory;
|
||||||
struct client_session *this;
|
struct client_session *this;
|
||||||
struct pw_client *owner = pw_resource_get_client(owner_resource);
|
struct pw_client *owner = pw_resource_get_client(owner_resource);
|
||||||
struct pw_core *core = pw_client_get_core(owner);
|
struct pw_context *context = pw_client_get_context(owner);
|
||||||
|
|
||||||
this = calloc(1, sizeof(struct client_session));
|
this = calloc(1, sizeof(struct client_session));
|
||||||
if (this == NULL)
|
if (this == NULL)
|
||||||
|
|
@ -190,7 +190,7 @@ static void *create_object(void *data,
|
||||||
if (this->resource == NULL)
|
if (this->resource == NULL)
|
||||||
goto no_mem;
|
goto no_mem;
|
||||||
|
|
||||||
if (session_init(&this->session, this, core, properties) < 0)
|
if (session_init(&this->session, this, context, properties) < 0)
|
||||||
goto no_mem;
|
goto no_mem;
|
||||||
|
|
||||||
pw_resource_add_listener(this->resource, &this->resource_listener,
|
pw_resource_add_listener(this->resource, &this->resource_listener,
|
||||||
|
|
@ -251,11 +251,11 @@ static const struct pw_module_events module_events = {
|
||||||
|
|
||||||
int client_session_factory_init(struct pw_module *module)
|
int client_session_factory_init(struct pw_module *module)
|
||||||
{
|
{
|
||||||
struct pw_core *core = pw_module_get_core(module);
|
struct pw_context *context = pw_module_get_context(module);
|
||||||
struct pw_factory *factory;
|
struct pw_factory *factory;
|
||||||
struct factory_data *data;
|
struct factory_data *data;
|
||||||
|
|
||||||
factory = pw_factory_new(core,
|
factory = pw_factory_new(context,
|
||||||
"client-session",
|
"client-session",
|
||||||
PW_TYPE_INTERFACE_ClientSession,
|
PW_TYPE_INTERFACE_ClientSession,
|
||||||
PW_VERSION_CLIENT_SESSION_PROXY,
|
PW_VERSION_CLIENT_SESSION_PROXY,
|
||||||
|
|
|
||||||
|
|
@ -294,7 +294,7 @@ static int endpoint_link_bind(void *_data, struct pw_client *client,
|
||||||
int endpoint_link_init(struct endpoint_link *this,
|
int endpoint_link_init(struct endpoint_link *this,
|
||||||
uint32_t id, uint32_t session_id,
|
uint32_t id, uint32_t session_id,
|
||||||
struct client_session *client_sess,
|
struct client_session *client_sess,
|
||||||
struct pw_core *core,
|
struct pw_context *context,
|
||||||
struct pw_properties *properties)
|
struct pw_properties *properties)
|
||||||
{
|
{
|
||||||
pw_log_debug(NAME" %p: new", this);
|
pw_log_debug(NAME" %p: new", this);
|
||||||
|
|
@ -309,7 +309,7 @@ int endpoint_link_init(struct endpoint_link *this,
|
||||||
if (!properties)
|
if (!properties)
|
||||||
goto no_mem;
|
goto no_mem;
|
||||||
|
|
||||||
this->global = pw_global_new (core,
|
this->global = pw_global_new(context,
|
||||||
PW_TYPE_INTERFACE_EndpointLink,
|
PW_TYPE_INTERFACE_EndpointLink,
|
||||||
PW_VERSION_ENDPOINT_LINK_PROXY,
|
PW_VERSION_ENDPOINT_LINK_PROXY,
|
||||||
properties, endpoint_link_bind, this);
|
properties, endpoint_link_bind, this);
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ struct endpoint_link {
|
||||||
int endpoint_link_init(struct endpoint_link *this,
|
int endpoint_link_init(struct endpoint_link *this,
|
||||||
uint32_t id, uint32_t session_id,
|
uint32_t id, uint32_t session_id,
|
||||||
struct client_session *client_sess,
|
struct client_session *client_sess,
|
||||||
struct pw_core *core,
|
struct pw_context *context,
|
||||||
struct pw_properties *properties);
|
struct pw_properties *properties);
|
||||||
|
|
||||||
void endpoint_link_clear(struct endpoint_link *this);
|
void endpoint_link_clear(struct endpoint_link *this);
|
||||||
|
|
|
||||||
|
|
@ -276,7 +276,7 @@ static int endpoint_stream_bind(void *_data, struct pw_client *client,
|
||||||
int endpoint_stream_init(struct endpoint_stream *this,
|
int endpoint_stream_init(struct endpoint_stream *this,
|
||||||
uint32_t id, uint32_t endpoint_id,
|
uint32_t id, uint32_t endpoint_id,
|
||||||
struct client_endpoint *client_ep,
|
struct client_endpoint *client_ep,
|
||||||
struct pw_core *core,
|
struct pw_context *context,
|
||||||
struct pw_properties *properties)
|
struct pw_properties *properties)
|
||||||
{
|
{
|
||||||
pw_log_debug(NAME" %p: new", this);
|
pw_log_debug(NAME" %p: new", this);
|
||||||
|
|
@ -291,7 +291,7 @@ int endpoint_stream_init(struct endpoint_stream *this,
|
||||||
if (!properties)
|
if (!properties)
|
||||||
goto no_mem;
|
goto no_mem;
|
||||||
|
|
||||||
this->global = pw_global_new (core,
|
this->global = pw_global_new (context,
|
||||||
PW_TYPE_INTERFACE_EndpointStream,
|
PW_TYPE_INTERFACE_EndpointStream,
|
||||||
PW_VERSION_ENDPOINT_STREAM_PROXY,
|
PW_VERSION_ENDPOINT_STREAM_PROXY,
|
||||||
properties, endpoint_stream_bind, this);
|
properties, endpoint_stream_bind, this);
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ struct endpoint_stream {
|
||||||
int endpoint_stream_init(struct endpoint_stream *this,
|
int endpoint_stream_init(struct endpoint_stream *this,
|
||||||
uint32_t id, uint32_t endpoint_id,
|
uint32_t id, uint32_t endpoint_id,
|
||||||
struct client_endpoint *client_ep,
|
struct client_endpoint *client_ep,
|
||||||
struct pw_core *core,
|
struct pw_context *context,
|
||||||
struct pw_properties *properties);
|
struct pw_properties *properties);
|
||||||
|
|
||||||
void endpoint_stream_clear(struct endpoint_stream *this);
|
void endpoint_stream_clear(struct endpoint_stream *this);
|
||||||
|
|
|
||||||
|
|
@ -297,7 +297,7 @@ static int endpoint_bind(void *_data, struct pw_client *client,
|
||||||
|
|
||||||
int endpoint_init(struct endpoint *this,
|
int endpoint_init(struct endpoint *this,
|
||||||
struct client_endpoint *client_ep,
|
struct client_endpoint *client_ep,
|
||||||
struct pw_core *core,
|
struct pw_context *context,
|
||||||
struct pw_properties *properties)
|
struct pw_properties *properties)
|
||||||
{
|
{
|
||||||
const char *keys[] = {
|
const char *keys[] = {
|
||||||
|
|
@ -326,7 +326,7 @@ int endpoint_init(struct endpoint *this,
|
||||||
|
|
||||||
pw_properties_update_keys(properties, &this->props->dict, keys);
|
pw_properties_update_keys(properties, &this->props->dict, keys);
|
||||||
|
|
||||||
this->global = pw_global_new (core,
|
this->global = pw_global_new (context,
|
||||||
PW_TYPE_INTERFACE_Endpoint,
|
PW_TYPE_INTERFACE_Endpoint,
|
||||||
PW_VERSION_ENDPOINT_PROXY,
|
PW_VERSION_ENDPOINT_PROXY,
|
||||||
properties, endpoint_bind, this);
|
properties, endpoint_bind, this);
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ struct endpoint {
|
||||||
|
|
||||||
int endpoint_init(struct endpoint *this,
|
int endpoint_init(struct endpoint *this,
|
||||||
struct client_endpoint *client_ep,
|
struct client_endpoint *client_ep,
|
||||||
struct pw_core *core,
|
struct pw_context *context,
|
||||||
struct pw_properties *properties);
|
struct pw_properties *properties);
|
||||||
|
|
||||||
void endpoint_clear(struct endpoint *this);
|
void endpoint_clear(struct endpoint *this);
|
||||||
|
|
|
||||||
|
|
@ -2001,11 +2001,11 @@ static const struct pw_protocol_marshal pw_protocol_native_session_marshal = {
|
||||||
&pw_protocol_native_session_event_demarshal,
|
&pw_protocol_native_session_event_demarshal,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pw_protocol *pw_protocol_native_ext_session_manager_init(struct pw_core *core)
|
struct pw_protocol *pw_protocol_native_ext_session_manager_init(struct pw_context *context)
|
||||||
{
|
{
|
||||||
struct pw_protocol *protocol;
|
struct pw_protocol *protocol;
|
||||||
|
|
||||||
protocol = pw_core_find_protocol(core, PW_TYPE_INFO_PROTOCOL_Native);
|
protocol = pw_context_find_protocol(context, PW_TYPE_INFO_PROTOCOL_Native);
|
||||||
|
|
||||||
if (protocol == NULL)
|
if (protocol == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
|
|
@ -267,7 +267,7 @@ static int session_bind(void *_data, struct pw_client *client,
|
||||||
|
|
||||||
int session_init(struct session *this,
|
int session_init(struct session *this,
|
||||||
struct client_session *client_sess,
|
struct client_session *client_sess,
|
||||||
struct pw_core *core,
|
struct pw_context *context,
|
||||||
struct pw_properties *properties)
|
struct pw_properties *properties)
|
||||||
{
|
{
|
||||||
const char *keys[] = {
|
const char *keys[] = {
|
||||||
|
|
@ -287,7 +287,7 @@ int session_init(struct session *this,
|
||||||
|
|
||||||
pw_properties_update_keys(properties, &this->props->dict, keys);
|
pw_properties_update_keys(properties, &this->props->dict, keys);
|
||||||
|
|
||||||
this->global = pw_global_new (core,
|
this->global = pw_global_new (context,
|
||||||
PW_TYPE_INTERFACE_Session,
|
PW_TYPE_INTERFACE_Session,
|
||||||
PW_VERSION_SESSION_PROXY,
|
PW_VERSION_SESSION_PROXY,
|
||||||
properties, session_bind, this);
|
properties, session_bind, this);
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ struct session {
|
||||||
|
|
||||||
int session_init(struct session *this,
|
int session_init(struct session *this,
|
||||||
struct client_session *client_sess,
|
struct client_session *client_sess,
|
||||||
struct pw_core *core,
|
struct pw_context *context,
|
||||||
struct pw_properties *properties);
|
struct pw_properties *properties);
|
||||||
|
|
||||||
void session_clear(struct session *this);
|
void session_clear(struct session *this);
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ static const struct spa_dict_item module_props[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct factory_data {
|
struct factory_data {
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
struct pw_module *module;
|
struct pw_module *module;
|
||||||
struct pw_factory *this;
|
struct pw_factory *this;
|
||||||
|
|
||||||
|
|
@ -83,7 +83,7 @@ static void *create_object(void *_data,
|
||||||
uint32_t new_id)
|
uint32_t new_id)
|
||||||
{
|
{
|
||||||
struct factory_data *data = _data;
|
struct factory_data *data = _data;
|
||||||
struct pw_core *core = data->core;
|
struct pw_context *context = data->context;
|
||||||
struct pw_device *device;
|
struct pw_device *device;
|
||||||
const char *factory_name;
|
const char *factory_name;
|
||||||
struct device_data *nd;
|
struct device_data *nd;
|
||||||
|
|
@ -107,7 +107,7 @@ static void *create_object(void *_data,
|
||||||
pw_global_get_id(pw_client_get_global(client)));
|
pw_global_get_id(pw_client_get_global(client)));
|
||||||
}
|
}
|
||||||
|
|
||||||
device = pw_spa_device_load(core,
|
device = pw_spa_device_load(context,
|
||||||
factory_name,
|
factory_name,
|
||||||
0,
|
0,
|
||||||
properties,
|
properties,
|
||||||
|
|
@ -201,11 +201,11 @@ static const struct pw_module_events module_events = {
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
int pipewire__module_init(struct pw_module *module, const char *args)
|
int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
{
|
{
|
||||||
struct pw_core *core = pw_module_get_core(module);
|
struct pw_context *context = pw_module_get_context(module);
|
||||||
struct pw_factory *factory;
|
struct pw_factory *factory;
|
||||||
struct factory_data *data;
|
struct factory_data *data;
|
||||||
|
|
||||||
factory = pw_factory_new(core,
|
factory = pw_factory_new(context,
|
||||||
"spa-device-factory",
|
"spa-device-factory",
|
||||||
PW_TYPE_INTERFACE_Device,
|
PW_TYPE_INTERFACE_Device,
|
||||||
PW_VERSION_DEVICE_PROXY,
|
PW_VERSION_DEVICE_PROXY,
|
||||||
|
|
@ -217,7 +217,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
data = pw_factory_get_user_data(factory);
|
data = pw_factory_get_user_data(factory);
|
||||||
data->this = factory;
|
data->this = factory;
|
||||||
data->module = module;
|
data->module = module;
|
||||||
data->core = core;
|
data->context = context;
|
||||||
spa_list_init(&data->device_list);
|
spa_list_init(&data->device_list);
|
||||||
|
|
||||||
pw_factory_add_listener(factory, &data->factory_listener, &factory_events, data);
|
pw_factory_add_listener(factory, &data->factory_listener, &factory_events, data);
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#include <pipewire/core.h>
|
#include <pipewire/context.h>
|
||||||
#include <pipewire/log.h>
|
#include <pipewire/log.h>
|
||||||
#include <pipewire/module.h>
|
#include <pipewire/module.h>
|
||||||
#include <pipewire/utils.h>
|
#include <pipewire/utils.h>
|
||||||
|
|
@ -48,7 +48,7 @@ static const struct spa_dict_item module_props[] = {
|
||||||
|
|
||||||
struct device_data {
|
struct device_data {
|
||||||
struct pw_device *this;
|
struct pw_device *this;
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
|
|
||||||
struct spa_hook module_listener;
|
struct spa_hook module_listener;
|
||||||
};
|
};
|
||||||
|
|
@ -73,7 +73,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
struct pw_properties *props = NULL;
|
struct pw_properties *props = NULL;
|
||||||
char **argv = NULL;
|
char **argv = NULL;
|
||||||
int n_tokens;
|
int n_tokens;
|
||||||
struct pw_core *core = pw_module_get_core(module);
|
struct pw_context *context = pw_module_get_context(module);
|
||||||
struct pw_device *device;
|
struct pw_device *device;
|
||||||
struct device_data *data;
|
struct device_data *data;
|
||||||
int res;
|
int res;
|
||||||
|
|
@ -93,7 +93,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
device = pw_spa_device_load(core,
|
device = pw_spa_device_load(context,
|
||||||
argv[0],
|
argv[0],
|
||||||
0,
|
0,
|
||||||
props,
|
props,
|
||||||
|
|
@ -107,7 +107,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
|
|
||||||
data = pw_spa_device_get_user_data(device);
|
data = pw_spa_device_get_user_data(device);
|
||||||
data->this = device;
|
data->this = device;
|
||||||
data->core = core;
|
data->context = context;
|
||||||
|
|
||||||
pw_log_debug("module %p: new", module);
|
pw_log_debug("module %p: new", module);
|
||||||
pw_module_add_listener(module, &data->module_listener, &module_events, data);
|
pw_module_add_listener(module, &data->module_listener, &module_events, data);
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ static const struct spa_dict_item module_props[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct factory_data {
|
struct factory_data {
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
struct pw_factory *this;
|
struct pw_factory *this;
|
||||||
struct pw_module *module;
|
struct pw_module *module;
|
||||||
|
|
||||||
|
|
@ -101,7 +101,7 @@ static void *create_object(void *_data,
|
||||||
uint32_t new_id)
|
uint32_t new_id)
|
||||||
{
|
{
|
||||||
struct factory_data *data = _data;
|
struct factory_data *data = _data;
|
||||||
struct pw_core *core = data->core;
|
struct pw_context *context = data->context;
|
||||||
struct pw_node *node;
|
struct pw_node *node;
|
||||||
const char *factory_name;
|
const char *factory_name;
|
||||||
struct node_data *nd;
|
struct node_data *nd;
|
||||||
|
|
@ -125,7 +125,7 @@ static void *create_object(void *_data,
|
||||||
pw_global_get_id(pw_client_get_global(client)));
|
pw_global_get_id(pw_client_get_global(client)));
|
||||||
}
|
}
|
||||||
|
|
||||||
node = pw_spa_node_load(core,
|
node = pw_spa_node_load(context,
|
||||||
factory_name,
|
factory_name,
|
||||||
PW_SPA_NODE_FLAG_ACTIVATE,
|
PW_SPA_NODE_FLAG_ACTIVATE,
|
||||||
properties,
|
properties,
|
||||||
|
|
@ -235,11 +235,11 @@ static const struct pw_module_events module_events = {
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
int pipewire__module_init(struct pw_module *module, const char *args)
|
int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
{
|
{
|
||||||
struct pw_core *core = pw_module_get_core(module);
|
struct pw_context *context = pw_module_get_context(module);
|
||||||
struct pw_factory *factory;
|
struct pw_factory *factory;
|
||||||
struct factory_data *data;
|
struct factory_data *data;
|
||||||
|
|
||||||
factory = pw_factory_new(core,
|
factory = pw_factory_new(context,
|
||||||
"spa-node-factory",
|
"spa-node-factory",
|
||||||
PW_TYPE_INTERFACE_Node,
|
PW_TYPE_INTERFACE_Node,
|
||||||
PW_VERSION_NODE_PROXY,
|
PW_VERSION_NODE_PROXY,
|
||||||
|
|
@ -250,7 +250,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
|
|
||||||
data = pw_factory_get_user_data(factory);
|
data = pw_factory_get_user_data(factory);
|
||||||
data->this = factory;
|
data->this = factory;
|
||||||
data->core = core;
|
data->context = context;
|
||||||
data->module = module;
|
data->module = module;
|
||||||
spa_list_init(&data->node_list);
|
spa_list_init(&data->node_list);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#include <pipewire/core.h>
|
#include <pipewire/context.h>
|
||||||
#include <pipewire/keys.h>
|
#include <pipewire/keys.h>
|
||||||
#include <pipewire/log.h>
|
#include <pipewire/log.h>
|
||||||
#include <pipewire/module.h>
|
#include <pipewire/module.h>
|
||||||
|
|
@ -50,7 +50,7 @@ static const struct spa_dict_item module_props[] = {
|
||||||
|
|
||||||
struct node_data {
|
struct node_data {
|
||||||
struct pw_node *this;
|
struct pw_node *this;
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
struct pw_properties *properties;
|
struct pw_properties *properties;
|
||||||
|
|
||||||
struct spa_hook module_listener;
|
struct spa_hook module_listener;
|
||||||
|
|
@ -74,7 +74,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
struct pw_properties *props = NULL;
|
struct pw_properties *props = NULL;
|
||||||
char **argv = NULL;
|
char **argv = NULL;
|
||||||
int n_tokens, res;
|
int n_tokens, res;
|
||||||
struct pw_core *core = pw_module_get_core(module);
|
struct pw_context *context = pw_module_get_context(module);
|
||||||
struct pw_node *node;
|
struct pw_node *node;
|
||||||
struct node_data *data;
|
struct node_data *data;
|
||||||
|
|
||||||
|
|
@ -93,7 +93,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
node = pw_spa_node_load(core,
|
node = pw_spa_node_load(context,
|
||||||
argv[0],
|
argv[0],
|
||||||
PW_SPA_NODE_FLAG_ACTIVATE,
|
PW_SPA_NODE_FLAG_ACTIVATE,
|
||||||
props,
|
props,
|
||||||
|
|
@ -108,7 +108,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
|
||||||
|
|
||||||
data = pw_spa_node_get_user_data(node);
|
data = pw_spa_node_get_user_data(node);
|
||||||
data->this = node;
|
data->this = node;
|
||||||
data->core = core;
|
data->context = context;
|
||||||
data->properties = props;
|
data->properties = props;
|
||||||
|
|
||||||
pw_log_debug("module %p: new", module);
|
pw_log_debug("module %p: new", module);
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ static const struct pw_device_events device_events = {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pw_device *
|
struct pw_device *
|
||||||
pw_spa_device_new(struct pw_core *core,
|
pw_spa_device_new(struct pw_context *context,
|
||||||
enum pw_spa_device_flags flags,
|
enum pw_spa_device_flags flags,
|
||||||
struct spa_device *device,
|
struct spa_device *device,
|
||||||
struct spa_handle *handle,
|
struct spa_handle *handle,
|
||||||
|
|
@ -84,7 +84,7 @@ pw_spa_device_new(struct pw_core *core,
|
||||||
struct impl *impl;
|
struct impl *impl;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
this = pw_device_new(core, properties, sizeof(struct impl) + user_data_size);
|
this = pw_device_new(context, properties, sizeof(struct impl) + user_data_size);
|
||||||
if (this == NULL)
|
if (this == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
@ -118,7 +118,7 @@ void *pw_spa_device_get_user_data(struct pw_device *device)
|
||||||
return impl->user_data;
|
return impl->user_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct pw_device *pw_spa_device_load(struct pw_core *core,
|
struct pw_device *pw_spa_device_load(struct pw_context *context,
|
||||||
const char *factory_name,
|
const char *factory_name,
|
||||||
enum pw_spa_device_flags flags,
|
enum pw_spa_device_flags flags,
|
||||||
struct pw_properties *properties,
|
struct pw_properties *properties,
|
||||||
|
|
@ -129,7 +129,7 @@ struct pw_device *pw_spa_device_load(struct pw_core *core,
|
||||||
void *iface;
|
void *iface;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
handle = pw_core_load_spa_handle(core, factory_name,
|
handle = pw_context_load_spa_handle(context, factory_name,
|
||||||
properties ? &properties->dict : NULL);
|
properties ? &properties->dict : NULL);
|
||||||
if (handle == NULL)
|
if (handle == NULL)
|
||||||
goto error_load;
|
goto error_load;
|
||||||
|
|
@ -137,7 +137,7 @@ struct pw_device *pw_spa_device_load(struct pw_core *core,
|
||||||
if ((res = spa_handle_get_interface(handle, SPA_TYPE_INTERFACE_Device, &iface)) < 0)
|
if ((res = spa_handle_get_interface(handle, SPA_TYPE_INTERFACE_Device, &iface)) < 0)
|
||||||
goto error_interface;
|
goto error_interface;
|
||||||
|
|
||||||
this = pw_spa_device_new(core, flags,
|
this = pw_spa_device_new(context, flags,
|
||||||
iface, handle, properties, user_data_size);
|
iface, handle, properties, user_data_size);
|
||||||
if (this == NULL)
|
if (this == NULL)
|
||||||
goto error_device;
|
goto error_device;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#include <spa/monitor/device.h>
|
#include <spa/monitor/device.h>
|
||||||
|
|
||||||
#include <pipewire/core.h>
|
#include <pipewire/context.h>
|
||||||
#include <pipewire/device.h>
|
#include <pipewire/device.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
@ -40,7 +40,7 @@ enum pw_spa_device_flags {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pw_device *
|
struct pw_device *
|
||||||
pw_spa_device_new(struct pw_core *core,
|
pw_spa_device_new(struct pw_context *context,
|
||||||
enum pw_spa_device_flags flags,
|
enum pw_spa_device_flags flags,
|
||||||
struct spa_device *device,
|
struct spa_device *device,
|
||||||
struct spa_handle *handle,
|
struct spa_handle *handle,
|
||||||
|
|
@ -48,7 +48,7 @@ pw_spa_device_new(struct pw_core *core,
|
||||||
size_t user_data_size);
|
size_t user_data_size);
|
||||||
|
|
||||||
struct pw_device *
|
struct pw_device *
|
||||||
pw_spa_device_load(struct pw_core *core,
|
pw_spa_device_load(struct pw_context *context,
|
||||||
const char *factory_name,
|
const char *factory_name,
|
||||||
enum pw_spa_device_flags flags,
|
enum pw_spa_device_flags flags,
|
||||||
struct pw_properties *properties,
|
struct pw_properties *properties,
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ static const struct pw_node_events node_events = {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pw_node *
|
struct pw_node *
|
||||||
pw_spa_node_new(struct pw_core *core,
|
pw_spa_node_new(struct pw_context *context,
|
||||||
enum pw_spa_node_flags flags,
|
enum pw_spa_node_flags flags,
|
||||||
struct spa_node *node,
|
struct spa_node *node,
|
||||||
struct spa_handle *handle,
|
struct spa_handle *handle,
|
||||||
|
|
@ -117,7 +117,7 @@ pw_spa_node_new(struct pw_core *core,
|
||||||
struct impl *impl;
|
struct impl *impl;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
this = pw_node_new(core, properties, sizeof(struct impl) + user_data_size);
|
this = pw_node_new(context, properties, sizeof(struct impl) + user_data_size);
|
||||||
if (this == NULL) {
|
if (this == NULL) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
|
|
@ -161,7 +161,7 @@ void *pw_spa_node_get_user_data(struct pw_node *node)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
setup_props(struct pw_core *core, struct spa_node *spa_node, struct pw_properties *pw_props)
|
setup_props(struct pw_context *context, struct spa_node *spa_node, struct pw_properties *pw_props)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
struct spa_pod *props;
|
struct spa_pod *props;
|
||||||
|
|
@ -234,7 +234,7 @@ setup_props(struct pw_core *core, struct spa_node *spa_node, struct pw_propertie
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct pw_node *pw_spa_node_load(struct pw_core *core,
|
struct pw_node *pw_spa_node_load(struct pw_context *context,
|
||||||
const char *factory_name,
|
const char *factory_name,
|
||||||
enum pw_spa_node_flags flags,
|
enum pw_spa_node_flags flags,
|
||||||
struct pw_properties *properties,
|
struct pw_properties *properties,
|
||||||
|
|
@ -247,7 +247,7 @@ struct pw_node *pw_spa_node_load(struct pw_core *core,
|
||||||
struct spa_handle *handle;
|
struct spa_handle *handle;
|
||||||
void *iface;
|
void *iface;
|
||||||
|
|
||||||
handle = pw_core_load_spa_handle(core,
|
handle = pw_context_load_spa_handle(context,
|
||||||
factory_name,
|
factory_name,
|
||||||
properties ? &properties->dict : NULL);
|
properties ? &properties->dict : NULL);
|
||||||
if (handle == NULL) {
|
if (handle == NULL) {
|
||||||
|
|
@ -265,12 +265,12 @@ struct pw_node *pw_spa_node_load(struct pw_core *core,
|
||||||
spa_node = iface;
|
spa_node = iface;
|
||||||
|
|
||||||
if (properties != NULL) {
|
if (properties != NULL) {
|
||||||
if (setup_props(core, spa_node, properties) < 0) {
|
if (setup_props(context, spa_node, properties) < 0) {
|
||||||
pw_log_warn("can't setup properties: %s", spa_strerror(res));
|
pw_log_warn("can't setup properties: %s", spa_strerror(res));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this = pw_spa_node_new(core, flags,
|
this = pw_spa_node_new(context, flags,
|
||||||
spa_node, handle, properties, user_data_size);
|
spa_node, handle, properties, user_data_size);
|
||||||
if (this == NULL) {
|
if (this == NULL) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#include <spa/node/node.h>
|
#include <spa/node/node.h>
|
||||||
|
|
||||||
#include <pipewire/core.h>
|
#include <pipewire/context.h>
|
||||||
#include <pipewire/node.h>
|
#include <pipewire/node.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
@ -41,7 +41,7 @@ enum pw_spa_node_flags {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pw_node *
|
struct pw_node *
|
||||||
pw_spa_node_new(struct pw_core *core,
|
pw_spa_node_new(struct pw_context *context,
|
||||||
enum pw_spa_node_flags flags,
|
enum pw_spa_node_flags flags,
|
||||||
struct spa_node *node,
|
struct spa_node *node,
|
||||||
struct spa_handle *handle,
|
struct spa_handle *handle,
|
||||||
|
|
@ -49,7 +49,7 @@ pw_spa_node_new(struct pw_core *core,
|
||||||
size_t user_data_size);
|
size_t user_data_size);
|
||||||
|
|
||||||
struct pw_node *
|
struct pw_node *
|
||||||
pw_spa_node_load(struct pw_core *core,
|
pw_spa_node_load(struct pw_context *context,
|
||||||
const char *factory_name,
|
const char *factory_name,
|
||||||
enum pw_spa_node_flags flags,
|
enum pw_spa_node_flags flags,
|
||||||
struct pw_properties *properties,
|
struct pw_properties *properties,
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,7 @@ static struct spa_pod *find_param(struct spa_pod **params, uint32_t n_params, ui
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
int pw_buffers_negotiate(struct pw_core *core, uint32_t flags,
|
int pw_buffers_negotiate(struct pw_context *context, uint32_t flags,
|
||||||
struct spa_node *outnode, uint32_t out_port_id,
|
struct spa_node *outnode, uint32_t out_port_id,
|
||||||
struct spa_node *innode, uint32_t in_port_id,
|
struct spa_node *innode, uint32_t in_port_id,
|
||||||
struct pw_buffers *result)
|
struct pw_buffers *result)
|
||||||
|
|
@ -241,12 +241,12 @@ int pw_buffers_negotiate(struct pw_core *core, uint32_t flags,
|
||||||
offset += SPA_ROUND_UP_N(SPA_POD_SIZE(params[i]), 8);
|
offset += SPA_ROUND_UP_N(SPA_POD_SIZE(params[i]), 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((str = pw_properties_get(core->properties, "link.max-buffers")) != NULL)
|
if ((str = pw_properties_get(context->properties, "link.max-buffers")) != NULL)
|
||||||
max_buffers = pw_properties_parse_int(str);
|
max_buffers = pw_properties_parse_int(str);
|
||||||
else
|
else
|
||||||
max_buffers = MAX_BUFFERS;
|
max_buffers = MAX_BUFFERS;
|
||||||
|
|
||||||
if ((str = pw_properties_get(core->properties, PW_KEY_CPU_MAX_ALIGN)) != NULL)
|
if ((str = pw_properties_get(context->properties, PW_KEY_CPU_MAX_ALIGN)) != NULL)
|
||||||
align = pw_properties_parse_int(str);
|
align = pw_properties_parse_int(str);
|
||||||
else
|
else
|
||||||
align = MAX_ALIGN;
|
align = MAX_ALIGN;
|
||||||
|
|
@ -287,7 +287,7 @@ int pw_buffers_negotiate(struct pw_core *core, uint32_t flags,
|
||||||
data_strides[0] = stride;
|
data_strides[0] = stride;
|
||||||
data_aligns[0] = align;
|
data_aligns[0] = align;
|
||||||
|
|
||||||
if ((res = alloc_buffers(core->pool,
|
if ((res = alloc_buffers(context->pool,
|
||||||
max_buffers,
|
max_buffers,
|
||||||
n_params,
|
n_params,
|
||||||
params,
|
params,
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#include <spa/node/node.h>
|
#include <spa/node/node.h>
|
||||||
|
|
||||||
#include <pipewire/core.h>
|
#include <pipewire/context.h>
|
||||||
#include <pipewire/mem.h>
|
#include <pipewire/mem.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
@ -46,7 +46,7 @@ struct pw_buffers {
|
||||||
uint32_t flags; /**< flags */
|
uint32_t flags; /**< flags */
|
||||||
};
|
};
|
||||||
|
|
||||||
int pw_buffers_negotiate(struct pw_core *core, uint32_t flags,
|
int pw_buffers_negotiate(struct pw_context *context, uint32_t flags,
|
||||||
struct spa_node *outnode, uint32_t out_port_id,
|
struct spa_node *outnode, uint32_t out_port_id,
|
||||||
struct spa_node *innode, uint32_t in_port_id,
|
struct spa_node *innode, uint32_t in_port_id,
|
||||||
struct pw_buffers *result);
|
struct pw_buffers *result);
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
/** \cond */
|
/** \cond */
|
||||||
struct impl {
|
struct impl {
|
||||||
struct pw_client this;
|
struct pw_client this;
|
||||||
struct spa_hook core_listener;
|
struct spa_hook context_listener;
|
||||||
struct pw_array permissions;
|
struct pw_array permissions;
|
||||||
struct spa_hook pool_listener;
|
struct spa_hook pool_listener;
|
||||||
};
|
};
|
||||||
|
|
@ -118,7 +118,7 @@ static int client_error(void *object, uint32_t id, int res, const char *error)
|
||||||
struct pw_global *global;
|
struct pw_global *global;
|
||||||
struct pw_resource *r, *t;
|
struct pw_resource *r, *t;
|
||||||
|
|
||||||
global = pw_core_find_global(client->core, id);
|
global = pw_context_find_global(client->context, id);
|
||||||
if (global == NULL)
|
if (global == NULL)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
|
|
@ -257,7 +257,7 @@ static const struct pw_mempool_events pool_events = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
core_global_removed(void *data, struct pw_global *global)
|
context_global_removed(void *data, struct pw_global *global)
|
||||||
{
|
{
|
||||||
struct impl *impl = data;
|
struct impl *impl = data;
|
||||||
struct pw_client *client = &impl->this;
|
struct pw_client *client = &impl->this;
|
||||||
|
|
@ -269,14 +269,14 @@ core_global_removed(void *data, struct pw_global *global)
|
||||||
p->permissions = SPA_ID_INVALID;
|
p->permissions = SPA_ID_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct pw_core_events core_events = {
|
static const struct pw_context_events context_events = {
|
||||||
PW_VERSION_CORE_EVENTS,
|
PW_VERSION_CONTEXT_EVENTS,
|
||||||
.global_removed = core_global_removed,
|
.global_removed = context_global_removed,
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Make a new client object
|
/** Make a new client object
|
||||||
*
|
*
|
||||||
* \param core a \ref pw_core object to register the client with
|
* \param context a \ref pw_context object to register the client with
|
||||||
* \param ucred a ucred structure or NULL when unknown
|
* \param ucred a ucred structure or NULL when unknown
|
||||||
* \param properties optional client properties, ownership is taken
|
* \param properties optional client properties, ownership is taken
|
||||||
* \return a newly allocated client object
|
* \return a newly allocated client object
|
||||||
|
|
@ -284,7 +284,7 @@ static const struct pw_core_events core_events = {
|
||||||
* \memberof pw_client
|
* \memberof pw_client
|
||||||
*/
|
*/
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
struct pw_client *pw_client_new(struct pw_core *core,
|
struct pw_client *pw_client_new(struct pw_context *context,
|
||||||
struct pw_properties *properties,
|
struct pw_properties *properties,
|
||||||
size_t user_data_size)
|
size_t user_data_size)
|
||||||
{
|
{
|
||||||
|
|
@ -302,7 +302,7 @@ struct pw_client *pw_client_new(struct pw_core *core,
|
||||||
this = &impl->this;
|
this = &impl->this;
|
||||||
pw_log_debug(NAME" %p: new", this);
|
pw_log_debug(NAME" %p: new", this);
|
||||||
|
|
||||||
this->core = core;
|
this->context = context;
|
||||||
|
|
||||||
if (properties == NULL)
|
if (properties == NULL)
|
||||||
properties = pw_properties_new(NULL, NULL);
|
properties = pw_properties_new(NULL, NULL);
|
||||||
|
|
@ -338,11 +338,11 @@ struct pw_client *pw_client_new(struct pw_core *core,
|
||||||
|
|
||||||
pw_map_init(&this->objects, 0, 32);
|
pw_map_init(&this->objects, 0, 32);
|
||||||
|
|
||||||
pw_core_add_listener(core, &impl->core_listener, &core_events, impl);
|
pw_context_add_listener(context, &impl->context_listener, &context_events, impl);
|
||||||
|
|
||||||
this->info.props = &this->properties->dict;
|
this->info.props = &this->properties->dict;
|
||||||
|
|
||||||
pw_core_emit_check_access(core, this);
|
pw_context_emit_check_access(context, this);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
|
|
@ -374,7 +374,7 @@ SPA_EXPORT
|
||||||
int pw_client_register(struct pw_client *client,
|
int pw_client_register(struct pw_client *client,
|
||||||
struct pw_properties *properties)
|
struct pw_properties *properties)
|
||||||
{
|
{
|
||||||
struct pw_core *core = client->core;
|
struct pw_context *context = client->context;
|
||||||
const char *keys[] = {
|
const char *keys[] = {
|
||||||
PW_KEY_MODULE_ID,
|
PW_KEY_MODULE_ID,
|
||||||
PW_KEY_PROTOCOL,
|
PW_KEY_PROTOCOL,
|
||||||
|
|
@ -397,7 +397,7 @@ int pw_client_register(struct pw_client *client,
|
||||||
|
|
||||||
pw_properties_update_keys(properties, &client->properties->dict, keys);
|
pw_properties_update_keys(properties, &client->properties->dict, keys);
|
||||||
|
|
||||||
client->global = pw_global_new(core,
|
client->global = pw_global_new(context,
|
||||||
PW_TYPE_INTERFACE_Client,
|
PW_TYPE_INTERFACE_Client,
|
||||||
PW_VERSION_CLIENT_PROXY,
|
PW_VERSION_CLIENT_PROXY,
|
||||||
properties,
|
properties,
|
||||||
|
|
@ -406,7 +406,7 @@ int pw_client_register(struct pw_client *client,
|
||||||
if (client->global == NULL)
|
if (client->global == NULL)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
spa_list_append(&core->client_list, &client->link);
|
spa_list_append(&context->client_list, &client->link);
|
||||||
client->registered = true;
|
client->registered = true;
|
||||||
|
|
||||||
client->info.id = client->global->id;
|
client->info.id = client->global->id;
|
||||||
|
|
@ -427,9 +427,9 @@ error_existed:
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
struct pw_core *pw_client_get_core(struct pw_client *client)
|
struct pw_context *pw_client_get_context(struct pw_client *client)
|
||||||
{
|
{
|
||||||
return client->core;
|
return client->context;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
|
|
@ -484,7 +484,7 @@ void pw_client_destroy(struct pw_client *client)
|
||||||
pw_log_debug(NAME" %p: destroy", client);
|
pw_log_debug(NAME" %p: destroy", client);
|
||||||
pw_client_emit_destroy(client);
|
pw_client_emit_destroy(client);
|
||||||
|
|
||||||
spa_hook_remove(&impl->core_listener);
|
spa_hook_remove(&impl->context_listener);
|
||||||
|
|
||||||
if (client->registered)
|
if (client->registered)
|
||||||
spa_list_remove(&client->link);
|
spa_list_remove(&client->link);
|
||||||
|
|
@ -565,7 +565,7 @@ SPA_EXPORT
|
||||||
int pw_client_update_permissions(struct pw_client *client,
|
int pw_client_update_permissions(struct pw_client *client,
|
||||||
uint32_t n_permissions, const struct pw_permission *permissions)
|
uint32_t n_permissions, const struct pw_permission *permissions)
|
||||||
{
|
{
|
||||||
struct pw_core *core = client->core;
|
struct pw_context *context = client->context;
|
||||||
struct pw_permission *def;
|
struct pw_permission *def;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
|
|
@ -581,7 +581,7 @@ int pw_client_update_permissions(struct pw_client *client,
|
||||||
old_perm = def->permissions;
|
old_perm = def->permissions;
|
||||||
new_perm = permissions[i].permissions;
|
new_perm = permissions[i].permissions;
|
||||||
|
|
||||||
if (core->current_client == client)
|
if (context->current_client == client)
|
||||||
new_perm &= old_perm;
|
new_perm &= old_perm;
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: set default permissions %08x -> %08x",
|
pw_log_debug(NAME" %p: set default permissions %08x -> %08x",
|
||||||
|
|
@ -589,7 +589,7 @@ int pw_client_update_permissions(struct pw_client *client,
|
||||||
|
|
||||||
def->permissions = new_perm;
|
def->permissions = new_perm;
|
||||||
|
|
||||||
spa_list_for_each(global, &core->global_list, link) {
|
spa_list_for_each(global, &context->global_list, link) {
|
||||||
p = find_permission(client, global->id);
|
p = find_permission(client, global->id);
|
||||||
if (p->id != SPA_ID_INVALID)
|
if (p->id != SPA_ID_INVALID)
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -599,7 +599,7 @@ int pw_client_update_permissions(struct pw_client *client,
|
||||||
else {
|
else {
|
||||||
struct pw_global *global;
|
struct pw_global *global;
|
||||||
|
|
||||||
global = pw_core_find_global(client->core, permissions[i].id);
|
global = pw_context_find_global(client->context, permissions[i].id);
|
||||||
if (global == NULL || global->id != permissions[i].id) {
|
if (global == NULL || global->id != permissions[i].id) {
|
||||||
pw_log_warn(NAME" %p: invalid global %d", client, permissions[i].id);
|
pw_log_warn(NAME" %p: invalid global %d", client, permissions[i].id);
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -612,7 +612,7 @@ int pw_client_update_permissions(struct pw_client *client,
|
||||||
old_perm = p->permissions == SPA_ID_INVALID ? def->permissions : p->permissions;
|
old_perm = p->permissions == SPA_ID_INVALID ? def->permissions : p->permissions;
|
||||||
new_perm = permissions[i].permissions;
|
new_perm = permissions[i].permissions;
|
||||||
|
|
||||||
if (core->current_client == client)
|
if (context->current_client == client)
|
||||||
new_perm &= old_perm;
|
new_perm &= old_perm;
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: set global %d permissions %08x -> %08x",
|
pw_log_debug(NAME" %p: set global %d permissions %08x -> %08x",
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
struct pw_client;
|
struct pw_client;
|
||||||
|
|
||||||
#include <pipewire/core.h>
|
#include <pipewire/context.h>
|
||||||
#include <pipewire/global.h>
|
#include <pipewire/global.h>
|
||||||
#include <pipewire/introspect.h>
|
#include <pipewire/introspect.h>
|
||||||
#include <pipewire/properties.h>
|
#include <pipewire/properties.h>
|
||||||
|
|
@ -74,7 +74,7 @@ struct pw_client;
|
||||||
*
|
*
|
||||||
* \section sec_page_client_resources Resources
|
* \section sec_page_client_resources Resources
|
||||||
*
|
*
|
||||||
* When a client binds to core global object, a resource is made for this
|
* When a client binds to context global object, a resource is made for this
|
||||||
* binding and a unique id is assigned to the resources. The client and
|
* binding and a unique id is assigned to the resources. The client and
|
||||||
* server will use this id as the destination when exchanging messages.
|
* server will use this id as the destination when exchanging messages.
|
||||||
* See also \ref page_resource
|
* See also \ref page_resource
|
||||||
|
|
@ -111,7 +111,7 @@ struct pw_client_events {
|
||||||
|
|
||||||
/** Create a new client. This is mainly used by protocols. */
|
/** Create a new client. This is mainly used by protocols. */
|
||||||
struct pw_client *
|
struct pw_client *
|
||||||
pw_client_new(struct pw_core *core, /**< the core object */
|
pw_client_new(struct pw_context *context, /**< the context object */
|
||||||
struct pw_properties *properties, /**< client properties */
|
struct pw_properties *properties, /**< client properties */
|
||||||
size_t user_data_size /**< extra user data size */);
|
size_t user_data_size /**< extra user data size */);
|
||||||
|
|
||||||
|
|
@ -138,10 +138,10 @@ int pw_client_update_permissions(struct pw_client *client, uint32_t n_permission
|
||||||
/** Get the client properties */
|
/** Get the client properties */
|
||||||
const struct pw_properties *pw_client_get_properties(struct pw_client *client);
|
const struct pw_properties *pw_client_get_properties(struct pw_client *client);
|
||||||
|
|
||||||
/** Get the core used to create this client */
|
/** Get the context used to create this client */
|
||||||
struct pw_core *pw_client_get_core(struct pw_client *client);
|
struct pw_context *pw_client_get_context(struct pw_client *client);
|
||||||
|
|
||||||
/** Get the client core resource */
|
/** Get the client context resource */
|
||||||
struct pw_resource *pw_client_get_core_resource(struct pw_client *client);
|
struct pw_resource *pw_client_get_core_resource(struct pw_client *client);
|
||||||
|
|
||||||
/** Get a resource with the given id */
|
/** Get a resource with the given id */
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
#include <pipewire/private.h>
|
#include <pipewire/private.h>
|
||||||
#include <pipewire/interfaces.h>
|
#include <pipewire/interfaces.h>
|
||||||
#include <pipewire/protocol.h>
|
#include <pipewire/protocol.h>
|
||||||
#include <pipewire/core.h>
|
#include <pipewire/context.h>
|
||||||
#include <pipewire/data-loop.h>
|
#include <pipewire/data-loop.h>
|
||||||
#include <pipewire/device.h>
|
#include <pipewire/device.h>
|
||||||
#include <pipewire/map.h>
|
#include <pipewire/map.h>
|
||||||
|
|
@ -48,11 +48,11 @@
|
||||||
#include <pipewire/module.h>
|
#include <pipewire/module.h>
|
||||||
#include <pipewire/version.h>
|
#include <pipewire/version.h>
|
||||||
|
|
||||||
#define NAME "core"
|
#define NAME "context"
|
||||||
|
|
||||||
/** \cond */
|
/** \cond */
|
||||||
struct impl {
|
struct impl {
|
||||||
struct pw_core this;
|
struct pw_context this;
|
||||||
struct spa_handle *dbus_handle;
|
struct spa_handle *dbus_handle;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -73,11 +73,11 @@ static void * registry_bind(void *object, uint32_t id,
|
||||||
{
|
{
|
||||||
struct pw_resource *resource = object;
|
struct pw_resource *resource = object;
|
||||||
struct pw_client *client = resource->client;
|
struct pw_client *client = resource->client;
|
||||||
struct pw_core *core = resource->core;
|
struct pw_context *context = resource->context;
|
||||||
struct pw_global *global;
|
struct pw_global *global;
|
||||||
uint32_t permissions, new_id = user_data_size;
|
uint32_t permissions, new_id = user_data_size;
|
||||||
|
|
||||||
if ((global = pw_core_find_global(core, id)) == NULL)
|
if ((global = pw_context_find_global(context, id)) == NULL)
|
||||||
goto error_no_id;
|
goto error_no_id;
|
||||||
|
|
||||||
permissions = pw_global_get_permissions(global, client);
|
permissions = pw_global_get_permissions(global, client);
|
||||||
|
|
@ -117,12 +117,12 @@ static int registry_destroy(void *object, uint32_t id)
|
||||||
{
|
{
|
||||||
struct pw_resource *resource = object;
|
struct pw_resource *resource = object;
|
||||||
struct pw_client *client = resource->client;
|
struct pw_client *client = resource->client;
|
||||||
struct pw_core *core = resource->core;
|
struct pw_context *context = resource->context;
|
||||||
struct pw_global *global;
|
struct pw_global *global;
|
||||||
uint32_t permissions;
|
uint32_t permissions;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
if ((global = pw_core_find_global(core, id)) == NULL)
|
if ((global = pw_context_find_global(context, id)) == NULL)
|
||||||
goto error_no_id;
|
goto error_no_id;
|
||||||
|
|
||||||
permissions = pw_global_get_permissions(global, client);
|
permissions = pw_global_get_permissions(global, client);
|
||||||
|
|
@ -183,7 +183,7 @@ static int core_hello(void *object, uint32_t version)
|
||||||
{
|
{
|
||||||
struct pw_resource *resource = object;
|
struct pw_resource *resource = object;
|
||||||
struct pw_client *client = resource->client;
|
struct pw_client *client = resource->client;
|
||||||
struct pw_core *this = resource->core;
|
struct pw_context *this = resource->context;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: hello %d from resource %p", this, version, resource);
|
pw_log_debug(NAME" %p: hello %d from resource %p", this, version, resource);
|
||||||
|
|
@ -203,7 +203,7 @@ static int core_hello(void *object, uint32_t version)
|
||||||
static int core_sync(void *object, uint32_t id, int seq)
|
static int core_sync(void *object, uint32_t id, int seq)
|
||||||
{
|
{
|
||||||
struct pw_resource *resource = object;
|
struct pw_resource *resource = object;
|
||||||
pw_log_trace(NAME" %p: sync %d for resource %d", resource->core, seq, id);
|
pw_log_trace(NAME" %p: sync %d for resource %d", resource->context, seq, id);
|
||||||
pw_core_resource_done(resource, id, seq);
|
pw_core_resource_done(resource, id, seq);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -214,7 +214,7 @@ static int core_pong(void *object, uint32_t id, int seq)
|
||||||
struct pw_client *client = resource->client;
|
struct pw_client *client = resource->client;
|
||||||
struct pw_resource *r;
|
struct pw_resource *r;
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: pong %d for resource %d", resource->core, seq, id);
|
pw_log_debug(NAME" %p: pong %d for resource %d", resource->context, seq, id);
|
||||||
|
|
||||||
if ((r = pw_client_find_resource(client, id)) == NULL)
|
if ((r = pw_client_find_resource(client, id)) == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
@ -229,7 +229,7 @@ static int core_error(void *object, uint32_t id, int seq, int res, const char *m
|
||||||
struct pw_client *client = resource->client;
|
struct pw_client *client = resource->client;
|
||||||
struct pw_resource *r;
|
struct pw_resource *r;
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: error %d for resource %d: %s", resource->core, res, id, message);
|
pw_log_debug(NAME" %p: error %d for resource %d: %s", resource->context, res, id, message);
|
||||||
|
|
||||||
if ((r = pw_client_find_resource(client, id)) == NULL)
|
if ((r = pw_client_find_resource(client, id)) == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
@ -242,7 +242,7 @@ static struct pw_registry_proxy * core_get_registry(void *object, uint32_t versi
|
||||||
{
|
{
|
||||||
struct pw_resource *resource = object;
|
struct pw_resource *resource = object;
|
||||||
struct pw_client *client = resource->client;
|
struct pw_client *client = resource->client;
|
||||||
struct pw_core *this = resource->core;
|
struct pw_context *this = resource->context;
|
||||||
struct pw_global *global;
|
struct pw_global *global;
|
||||||
struct pw_resource *registry_resource;
|
struct pw_resource *registry_resource;
|
||||||
struct resource_data *data;
|
struct resource_data *data;
|
||||||
|
|
@ -310,11 +310,11 @@ core_create_object(void *object,
|
||||||
struct pw_factory *factory;
|
struct pw_factory *factory;
|
||||||
void *obj;
|
void *obj;
|
||||||
struct pw_properties *properties;
|
struct pw_properties *properties;
|
||||||
struct pw_core *this = client->core;
|
struct pw_context *this = client->context;
|
||||||
uint32_t new_id = user_data_size;
|
uint32_t new_id = user_data_size;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
factory = pw_core_find_factory(this, factory_name);
|
factory = pw_context_find_factory(this, factory_name);
|
||||||
if (factory == NULL || factory->global == NULL)
|
if (factory == NULL || factory->global == NULL)
|
||||||
goto error_no_factory;
|
goto error_no_factory;
|
||||||
|
|
||||||
|
|
@ -372,7 +372,7 @@ static int core_destroy(void *object, void *proxy)
|
||||||
struct pw_resource *resource = object;
|
struct pw_resource *resource = object;
|
||||||
struct pw_client *client = resource->client;
|
struct pw_client *client = resource->client;
|
||||||
struct pw_resource *r = proxy;
|
struct pw_resource *r = proxy;
|
||||||
pw_log_debug(NAME" %p: destroy resource %p from client %p", resource->core, r, client);
|
pw_log_debug(NAME" %p: destroy resource %p from client %p", resource->context, r, client);
|
||||||
pw_resource_destroy(r);
|
pw_resource_destroy(r);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -408,7 +408,7 @@ global_bind(void *_data,
|
||||||
uint32_t version,
|
uint32_t version,
|
||||||
uint32_t id)
|
uint32_t id)
|
||||||
{
|
{
|
||||||
struct pw_core *this = _data;
|
struct pw_context *this = _data;
|
||||||
struct pw_global *global = this->global;
|
struct pw_global *global = this->global;
|
||||||
struct pw_resource *resource;
|
struct pw_resource *resource;
|
||||||
struct resource_data *data;
|
struct resource_data *data;
|
||||||
|
|
@ -449,10 +449,10 @@ error:
|
||||||
|
|
||||||
static void global_destroy(void *object)
|
static void global_destroy(void *object)
|
||||||
{
|
{
|
||||||
struct pw_core *core = object;
|
struct pw_context *context = object;
|
||||||
spa_hook_remove(&core->global_listener);
|
spa_hook_remove(&context->global_listener);
|
||||||
core->global = NULL;
|
context->global = NULL;
|
||||||
pw_core_destroy(core);
|
pw_context_destroy(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct pw_global_events global_events = {
|
static const struct pw_global_events global_events = {
|
||||||
|
|
@ -460,7 +460,7 @@ static const struct pw_global_events global_events = {
|
||||||
.destroy = global_destroy,
|
.destroy = global_destroy,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int load_module_profile(struct pw_core *this, const char *profile)
|
static int load_module_profile(struct pw_context *this, const char *profile)
|
||||||
{
|
{
|
||||||
pw_log_debug(NAME" %p: module profile %s", this, profile);
|
pw_log_debug(NAME" %p: module profile %s", this, profile);
|
||||||
if (strcmp(profile, "default") == 0) {
|
if (strcmp(profile, "default") == 0) {
|
||||||
|
|
@ -475,21 +475,21 @@ static int load_module_profile(struct pw_core *this, const char *profile)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Create a new core object
|
/** Create a new context object
|
||||||
*
|
*
|
||||||
* \param main_loop the main loop to use
|
* \param main_loop the main loop to use
|
||||||
* \param properties extra properties for the core, ownership it taken
|
* \param properties extra properties for the context, ownership it taken
|
||||||
* \return a newly allocated core object
|
* \return a newly allocated context object
|
||||||
*
|
*
|
||||||
* \memberof pw_core
|
* \memberof pw_context
|
||||||
*/
|
*/
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
struct pw_core *pw_core_new(struct pw_loop *main_loop,
|
struct pw_context *pw_context_new(struct pw_loop *main_loop,
|
||||||
struct pw_properties *properties,
|
struct pw_properties *properties,
|
||||||
size_t user_data_size)
|
size_t user_data_size)
|
||||||
{
|
{
|
||||||
struct impl *impl;
|
struct impl *impl;
|
||||||
struct pw_core *this;
|
struct pw_context *this;
|
||||||
const char *name, *lib, *str;
|
const char *name, *lib, *str;
|
||||||
void *dbus_iface = NULL;
|
void *dbus_iface = NULL;
|
||||||
uint32_t n_support;
|
uint32_t n_support;
|
||||||
|
|
@ -520,7 +520,7 @@ struct pw_core *pw_core_new(struct pw_loop *main_loop,
|
||||||
this->properties = properties;
|
this->properties = properties;
|
||||||
|
|
||||||
pr = pw_properties_copy(properties);
|
pr = pw_properties_copy(properties);
|
||||||
if ((str = pw_properties_get(pr, "core.data-loop." PW_KEY_LIBRARY_NAME_SYSTEM)))
|
if ((str = pw_properties_get(pr, "context.data-loop." PW_KEY_LIBRARY_NAME_SYSTEM)))
|
||||||
pw_properties_set(pr, PW_KEY_LIBRARY_NAME_SYSTEM, str);
|
pw_properties_set(pr, PW_KEY_LIBRARY_NAME_SYSTEM, str);
|
||||||
|
|
||||||
this->data_loop_impl = pw_data_loop_new(pr);
|
this->data_loop_impl = pw_data_loop_new(pr);
|
||||||
|
|
@ -647,16 +647,16 @@ error_cleanup:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Destroy a core object
|
/** Destroy a context object
|
||||||
*
|
*
|
||||||
* \param core a core to destroy
|
* \param context a context to destroy
|
||||||
*
|
*
|
||||||
* \memberof pw_core
|
* \memberof pw_context
|
||||||
*/
|
*/
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
void pw_core_destroy(struct pw_core *core)
|
void pw_context_destroy(struct pw_context *context)
|
||||||
{
|
{
|
||||||
struct impl *impl = SPA_CONTAINER_OF(core, struct impl, this);
|
struct impl *impl = SPA_CONTAINER_OF(context, struct impl, this);
|
||||||
struct pw_global *global;
|
struct pw_global *global;
|
||||||
struct pw_module *module;
|
struct pw_module *module;
|
||||||
struct pw_device *device;
|
struct pw_device *device;
|
||||||
|
|
@ -665,145 +665,145 @@ void pw_core_destroy(struct pw_core *core)
|
||||||
struct pw_node *node;
|
struct pw_node *node;
|
||||||
struct factory_entry *entry;
|
struct factory_entry *entry;
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: destroy", core);
|
pw_log_debug(NAME" %p: destroy", context);
|
||||||
pw_core_emit_destroy(core);
|
pw_context_emit_destroy(context);
|
||||||
|
|
||||||
spa_hook_remove(&core->global_listener);
|
spa_hook_remove(&context->global_listener);
|
||||||
|
|
||||||
spa_list_consume(core_proxy, &core->core_proxy_list, link)
|
spa_list_consume(core_proxy, &context->core_proxy_list, link)
|
||||||
pw_core_proxy_disconnect(core_proxy);
|
pw_core_proxy_disconnect(core_proxy);
|
||||||
|
|
||||||
spa_list_consume(module, &core->module_list, link)
|
spa_list_consume(module, &context->module_list, link)
|
||||||
pw_module_destroy(module);
|
pw_module_destroy(module);
|
||||||
|
|
||||||
spa_list_consume(node, &core->node_list, link)
|
spa_list_consume(node, &context->node_list, link)
|
||||||
pw_node_destroy(node);
|
pw_node_destroy(node);
|
||||||
|
|
||||||
spa_list_consume(device, &core->device_list, link)
|
spa_list_consume(device, &context->device_list, link)
|
||||||
pw_device_destroy(device);
|
pw_device_destroy(device);
|
||||||
|
|
||||||
spa_list_consume(resource, &core->registry_resource_list, link)
|
spa_list_consume(resource, &context->registry_resource_list, link)
|
||||||
pw_resource_destroy(resource);
|
pw_resource_destroy(resource);
|
||||||
|
|
||||||
spa_list_consume(global, &core->global_list, link)
|
spa_list_consume(global, &context->global_list, link)
|
||||||
pw_global_destroy(global);
|
pw_global_destroy(global);
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: free", core);
|
pw_log_debug(NAME" %p: free", context);
|
||||||
pw_core_emit_free(core);
|
pw_context_emit_free(context);
|
||||||
|
|
||||||
pw_mempool_destroy(core->pool);
|
pw_mempool_destroy(context->pool);
|
||||||
|
|
||||||
pw_data_loop_destroy(core->data_loop_impl);
|
pw_data_loop_destroy(context->data_loop_impl);
|
||||||
|
|
||||||
pw_properties_free(core->properties);
|
pw_properties_free(context->properties);
|
||||||
|
|
||||||
if (impl->dbus_handle)
|
if (impl->dbus_handle)
|
||||||
pw_unload_spa_handle(impl->dbus_handle);
|
pw_unload_spa_handle(impl->dbus_handle);
|
||||||
|
|
||||||
pw_array_for_each(entry, &core->factory_lib) {
|
pw_array_for_each(entry, &context->factory_lib) {
|
||||||
regfree(&entry->regex);
|
regfree(&entry->regex);
|
||||||
free(entry->lib);
|
free(entry->lib);
|
||||||
}
|
}
|
||||||
pw_array_clear(&core->factory_lib);
|
pw_array_clear(&context->factory_lib);
|
||||||
|
|
||||||
pw_map_clear(&core->globals);
|
pw_map_clear(&context->globals);
|
||||||
|
|
||||||
free(core);
|
free(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
void *pw_core_get_user_data(struct pw_core *core)
|
void *pw_context_get_user_data(struct pw_context *context)
|
||||||
{
|
{
|
||||||
return core->user_data;
|
return context->user_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
const struct pw_core_info *pw_core_get_info(struct pw_core *core)
|
const struct pw_core_info *pw_context_get_info(struct pw_context *context)
|
||||||
{
|
{
|
||||||
return &core->info;
|
return &context->info;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
struct pw_global *pw_core_get_global(struct pw_core *core)
|
struct pw_global *pw_context_get_global(struct pw_context *context)
|
||||||
{
|
{
|
||||||
return core->global;
|
return context->global;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
void pw_core_add_listener(struct pw_core *core,
|
void pw_context_add_listener(struct pw_context *context,
|
||||||
struct spa_hook *listener,
|
struct spa_hook *listener,
|
||||||
const struct pw_core_events *events,
|
const struct pw_context_events *events,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
spa_hook_list_append(&core->listener_list, listener, events, data);
|
spa_hook_list_append(&context->listener_list, listener, events, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
const struct spa_support *pw_core_get_support(struct pw_core *core, uint32_t *n_support)
|
const struct spa_support *pw_context_get_support(struct pw_context *context, uint32_t *n_support)
|
||||||
{
|
{
|
||||||
*n_support = core->n_support;
|
*n_support = context->n_support;
|
||||||
return core->support;
|
return context->support;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
struct pw_loop *pw_core_get_main_loop(struct pw_core *core)
|
struct pw_loop *pw_context_get_main_loop(struct pw_context *context)
|
||||||
{
|
{
|
||||||
return core->main_loop;
|
return context->main_loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
const struct pw_properties *pw_core_get_properties(struct pw_core *core)
|
const struct pw_properties *pw_context_get_properties(struct pw_context *context)
|
||||||
{
|
{
|
||||||
return core->properties;
|
return context->properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Update core properties
|
/** Update context properties
|
||||||
*
|
*
|
||||||
* \param core a core
|
* \param context a context
|
||||||
* \param dict properties to update
|
* \param dict properties to update
|
||||||
*
|
*
|
||||||
* Update the core object with the given properties
|
* Update the context object with the given properties
|
||||||
*
|
*
|
||||||
* \memberof pw_core
|
* \memberof pw_context
|
||||||
*/
|
*/
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
int pw_core_update_properties(struct pw_core *core, const struct spa_dict *dict)
|
int pw_context_update_properties(struct pw_context *context, const struct spa_dict *dict)
|
||||||
{
|
{
|
||||||
struct pw_resource *resource;
|
struct pw_resource *resource;
|
||||||
int changed;
|
int changed;
|
||||||
|
|
||||||
changed = pw_properties_update(core->properties, dict);
|
changed = pw_properties_update(context->properties, dict);
|
||||||
core->info.props = &core->properties->dict;
|
context->info.props = &context->properties->dict;
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: updated %d properties", core, changed);
|
pw_log_debug(NAME" %p: updated %d properties", context, changed);
|
||||||
|
|
||||||
if (!changed)
|
if (!changed)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
core->info.change_mask = PW_CORE_CHANGE_MASK_PROPS;
|
context->info.change_mask = PW_CORE_CHANGE_MASK_PROPS;
|
||||||
|
|
||||||
pw_core_emit_info_changed(core, &core->info);
|
pw_context_emit_info_changed(context, &context->info);
|
||||||
|
|
||||||
if (core->global)
|
if (context->global)
|
||||||
spa_list_for_each(resource, &core->global->resource_list, link)
|
spa_list_for_each(resource, &context->global->resource_list, link)
|
||||||
pw_core_resource_info(resource, &core->info);
|
pw_core_resource_info(resource, &context->info);
|
||||||
|
|
||||||
core->info.change_mask = 0;
|
context->info.change_mask = 0;
|
||||||
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
int pw_core_for_each_global(struct pw_core *core,
|
int pw_context_for_each_global(struct pw_context *context,
|
||||||
int (*callback) (void *data, struct pw_global *global),
|
int (*callback) (void *data, struct pw_global *global),
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
struct pw_global *g, *t;
|
struct pw_global *g, *t;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
spa_list_for_each_safe(g, t, &core->global_list, link) {
|
spa_list_for_each_safe(g, t, &context->global_list, link) {
|
||||||
if (core->current_client &&
|
if (context->current_client &&
|
||||||
!PW_PERM_IS_R(pw_global_get_permissions(g, core->current_client)))
|
!PW_PERM_IS_R(pw_global_get_permissions(g, context->current_client)))
|
||||||
continue;
|
continue;
|
||||||
if ((res = callback(data, g)) != 0)
|
if ((res = callback(data, g)) != 0)
|
||||||
return res;
|
return res;
|
||||||
|
|
@ -812,18 +812,18 @@ int pw_core_for_each_global(struct pw_core *core,
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
struct pw_global *pw_core_find_global(struct pw_core *core, uint32_t id)
|
struct pw_global *pw_context_find_global(struct pw_context *context, uint32_t id)
|
||||||
{
|
{
|
||||||
struct pw_global *global;
|
struct pw_global *global;
|
||||||
|
|
||||||
global = pw_map_lookup(&core->globals, id);
|
global = pw_map_lookup(&context->globals, id);
|
||||||
if (global == NULL) {
|
if (global == NULL) {
|
||||||
errno = ENOENT;
|
errno = ENOENT;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (core->current_client &&
|
if (context->current_client &&
|
||||||
!PW_PERM_IS_R(pw_global_get_permissions(global, core->current_client))) {
|
!PW_PERM_IS_R(pw_global_get_permissions(global, context->current_client))) {
|
||||||
errno = EACCES;
|
errno = EACCES;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -832,7 +832,7 @@ struct pw_global *pw_core_find_global(struct pw_core *core, uint32_t id)
|
||||||
|
|
||||||
/** Find a port to link with
|
/** Find a port to link with
|
||||||
*
|
*
|
||||||
* \param core a core
|
* \param context a context
|
||||||
* \param other_port a port to find a link with
|
* \param other_port a port to find a link with
|
||||||
* \param id the id of a port or SPA_ID_INVALID
|
* \param id the id of a port or SPA_ID_INVALID
|
||||||
* \param props extra properties
|
* \param props extra properties
|
||||||
|
|
@ -841,9 +841,9 @@ struct pw_global *pw_core_find_global(struct pw_core *core, uint32_t id)
|
||||||
* \param[out] error an error when something is wrong
|
* \param[out] error an error when something is wrong
|
||||||
* \return a port that can be used to link to \a otherport or NULL on error
|
* \return a port that can be used to link to \a otherport or NULL on error
|
||||||
*
|
*
|
||||||
* \memberof pw_core
|
* \memberof pw_context
|
||||||
*/
|
*/
|
||||||
struct pw_port *pw_core_find_port(struct pw_core *core,
|
struct pw_port *pw_context_find_port(struct pw_context *context,
|
||||||
struct pw_port *other_port,
|
struct pw_port *other_port,
|
||||||
uint32_t id,
|
uint32_t id,
|
||||||
struct pw_properties *props,
|
struct pw_properties *props,
|
||||||
|
|
@ -857,24 +857,24 @@ struct pw_port *pw_core_find_port(struct pw_core *core,
|
||||||
|
|
||||||
have_id = id != SPA_ID_INVALID;
|
have_id = id != SPA_ID_INVALID;
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: id:%u", core, id);
|
pw_log_debug(NAME" %p: id:%u", context, id);
|
||||||
|
|
||||||
spa_list_for_each(n, &core->node_list, link) {
|
spa_list_for_each(n, &context->node_list, link) {
|
||||||
if (n->global == NULL)
|
if (n->global == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (other_port->node == n)
|
if (other_port->node == n)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (core->current_client &&
|
if (context->current_client &&
|
||||||
!PW_PERM_IS_R(pw_global_get_permissions(n->global, core->current_client)))
|
!PW_PERM_IS_R(pw_global_get_permissions(n->global, context->current_client)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: node id:%d", core, n->global->id);
|
pw_log_debug(NAME" %p: node id:%d", context, n->global->id);
|
||||||
|
|
||||||
if (have_id) {
|
if (have_id) {
|
||||||
if (n->global->id == id) {
|
if (n->global->id == id) {
|
||||||
pw_log_debug(NAME" %p: id:%u matches node %p", core, id, n);
|
pw_log_debug(NAME" %p: id:%u matches node %p", context, id, n);
|
||||||
|
|
||||||
best =
|
best =
|
||||||
pw_node_find_port(n,
|
pw_node_find_port(n,
|
||||||
|
|
@ -903,7 +903,7 @@ struct pw_port *pw_core_find_port(struct pw_core *core,
|
||||||
pout = other_port;
|
pout = other_port;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pw_core_find_format(core,
|
if (pw_context_find_format(context,
|
||||||
pout,
|
pout,
|
||||||
pin,
|
pin,
|
||||||
props,
|
props,
|
||||||
|
|
@ -927,7 +927,7 @@ struct pw_port *pw_core_find_port(struct pw_core *core,
|
||||||
|
|
||||||
/** Find a common format between two ports
|
/** Find a common format between two ports
|
||||||
*
|
*
|
||||||
* \param core a core object
|
* \param context a context object
|
||||||
* \param output an output port
|
* \param output an output port
|
||||||
* \param input an input port
|
* \param input an input port
|
||||||
* \param props extra properties
|
* \param props extra properties
|
||||||
|
|
@ -939,9 +939,9 @@ struct pw_port *pw_core_find_port(struct pw_core *core,
|
||||||
* Find a common format between the given ports. The format will
|
* Find a common format between the given ports. The format will
|
||||||
* be restricted to a subset given with the format filters.
|
* be restricted to a subset given with the format filters.
|
||||||
*
|
*
|
||||||
* \memberof pw_core
|
* \memberof pw_context
|
||||||
*/
|
*/
|
||||||
int pw_core_find_format(struct pw_core *core,
|
int pw_context_find_format(struct pw_context *context,
|
||||||
struct pw_port *output,
|
struct pw_port *output,
|
||||||
struct pw_port *input,
|
struct pw_port *input,
|
||||||
struct pw_properties *props,
|
struct pw_properties *props,
|
||||||
|
|
@ -961,7 +961,7 @@ int pw_core_find_format(struct pw_core *core,
|
||||||
out_state = output->state;
|
out_state = output->state;
|
||||||
in_state = input->state;
|
in_state = input->state;
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: finding best format %d %d", core, out_state, in_state);
|
pw_log_debug(NAME" %p: finding best format %d %d", context, out_state, in_state);
|
||||||
|
|
||||||
/* when a port is configured but the node is idle, we can reconfigure with a different format */
|
/* when a port is configured but the node is idle, we can reconfigure with a different format */
|
||||||
if (out_state > PW_PORT_STATE_CONFIGURE && output->node->info.state == PW_NODE_STATE_IDLE)
|
if (out_state > PW_PORT_STATE_CONFIGURE && output->node->info.state == PW_NODE_STATE_IDLE)
|
||||||
|
|
@ -969,7 +969,7 @@ int pw_core_find_format(struct pw_core *core,
|
||||||
if (in_state > PW_PORT_STATE_CONFIGURE && input->node->info.state == PW_NODE_STATE_IDLE)
|
if (in_state > PW_PORT_STATE_CONFIGURE && input->node->info.state == PW_NODE_STATE_IDLE)
|
||||||
in_state = PW_PORT_STATE_CONFIGURE;
|
in_state = PW_PORT_STATE_CONFIGURE;
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: states %d %d", core, out_state, in_state);
|
pw_log_debug(NAME" %p: states %d %d", context, out_state, in_state);
|
||||||
|
|
||||||
if (in_state == PW_PORT_STATE_CONFIGURE && out_state > PW_PORT_STATE_CONFIGURE) {
|
if (in_state == PW_PORT_STATE_CONFIGURE && out_state > PW_PORT_STATE_CONFIGURE) {
|
||||||
/* only input needs format */
|
/* only input needs format */
|
||||||
|
|
@ -984,7 +984,7 @@ int pw_core_find_format(struct pw_core *core,
|
||||||
asprintf(error, "no output formats");
|
asprintf(error, "no output formats");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
pw_log_debug(NAME" %p: Got output format:", core);
|
pw_log_debug(NAME" %p: Got output format:", context);
|
||||||
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
||||||
spa_debug_format(2, NULL, filter);
|
spa_debug_format(2, NULL, filter);
|
||||||
|
|
||||||
|
|
@ -1011,7 +1011,7 @@ int pw_core_find_format(struct pw_core *core,
|
||||||
asprintf(error, "no input format");
|
asprintf(error, "no input format");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
pw_log_debug(NAME" %p: Got input format:", core);
|
pw_log_debug(NAME" %p: Got input format:", context);
|
||||||
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
||||||
spa_debug_format(2, NULL, filter);
|
spa_debug_format(2, NULL, filter);
|
||||||
|
|
||||||
|
|
@ -1028,7 +1028,7 @@ int pw_core_find_format(struct pw_core *core,
|
||||||
} else if (in_state == PW_PORT_STATE_CONFIGURE && out_state == PW_PORT_STATE_CONFIGURE) {
|
} else if (in_state == PW_PORT_STATE_CONFIGURE && out_state == PW_PORT_STATE_CONFIGURE) {
|
||||||
again:
|
again:
|
||||||
/* both ports need a format */
|
/* both ports need a format */
|
||||||
pw_log_debug(NAME" %p: do enum input %d", core, iidx);
|
pw_log_debug(NAME" %p: do enum input %d", context, iidx);
|
||||||
spa_pod_builder_init(&fb, fbuf, sizeof(fbuf));
|
spa_pod_builder_init(&fb, fbuf, sizeof(fbuf));
|
||||||
if ((res = spa_node_port_enum_params_sync(input->node->node,
|
if ((res = spa_node_port_enum_params_sync(input->node->node,
|
||||||
input->direction, input->port_id,
|
input->direction, input->port_id,
|
||||||
|
|
@ -1044,7 +1044,7 @@ int pw_core_find_format(struct pw_core *core,
|
||||||
asprintf(error, "no more input formats");
|
asprintf(error, "no more input formats");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
pw_log_debug(NAME" %p: enum output %d with filter: %p", core, oidx, filter);
|
pw_log_debug(NAME" %p: enum output %d with filter: %p", context, oidx, filter);
|
||||||
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
||||||
spa_debug_format(2, NULL, filter);
|
spa_debug_format(2, NULL, filter);
|
||||||
|
|
||||||
|
|
@ -1060,7 +1060,7 @@ int pw_core_find_format(struct pw_core *core,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: Got filtered:", core);
|
pw_log_debug(NAME" %p: Got filtered:", context);
|
||||||
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
||||||
spa_debug_format(2, NULL, *format);
|
spa_debug_format(2, NULL, *format);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1078,21 +1078,21 @@ error:
|
||||||
|
|
||||||
/** Find a factory by name
|
/** Find a factory by name
|
||||||
*
|
*
|
||||||
* \param core the core object
|
* \param context the context object
|
||||||
* \param name the name of the factory to find
|
* \param name the name of the factory to find
|
||||||
*
|
*
|
||||||
* Find in the list of factories registered in \a core for one with
|
* Find in the list of factories registered in \a context for one with
|
||||||
* the given \a name.
|
* the given \a name.
|
||||||
*
|
*
|
||||||
* \memberof pw_core
|
* \memberof pw_context
|
||||||
*/
|
*/
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
struct pw_factory *pw_core_find_factory(struct pw_core *core,
|
struct pw_factory *pw_context_find_factory(struct pw_context *context,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
struct pw_factory *factory;
|
struct pw_factory *factory;
|
||||||
|
|
||||||
spa_list_for_each(factory, &core->factory_list, link) {
|
spa_list_for_each(factory, &context->factory_list, link) {
|
||||||
if (strcmp(factory->info.name, name) == 0)
|
if (strcmp(factory->info.name, name) == 0)
|
||||||
return factory;
|
return factory;
|
||||||
}
|
}
|
||||||
|
|
@ -1162,7 +1162,7 @@ static int collect_nodes(struct pw_node *driver)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pw_core_recalc_graph(struct pw_core *core)
|
int pw_context_recalc_graph(struct pw_context *context)
|
||||||
{
|
{
|
||||||
struct pw_node *n, *s, *target;
|
struct pw_node *n, *s, *target;
|
||||||
|
|
||||||
|
|
@ -1172,7 +1172,7 @@ int pw_core_recalc_graph(struct pw_core *core)
|
||||||
* and if they have active slaves, we can use them to schedule
|
* and if they have active slaves, we can use them to schedule
|
||||||
* the unassigned nodes. */
|
* the unassigned nodes. */
|
||||||
target = NULL;
|
target = NULL;
|
||||||
spa_list_for_each(n, &core->driver_list, driver_link) {
|
spa_list_for_each(n, &context->driver_list, driver_link) {
|
||||||
uint32_t active_slaves;
|
uint32_t active_slaves;
|
||||||
|
|
||||||
if (n->active && !n->visited)
|
if (n->active && !n->visited)
|
||||||
|
|
@ -1187,12 +1187,12 @@ int pw_core_recalc_graph(struct pw_core *core)
|
||||||
active_slaves = 0;
|
active_slaves = 0;
|
||||||
spa_list_for_each(s, &n->slave_list, slave_link) {
|
spa_list_for_each(s, &n->slave_list, slave_link) {
|
||||||
pw_log_info(NAME" %p: driver %p: slave %p %s: %d",
|
pw_log_info(NAME" %p: driver %p: slave %p %s: %d",
|
||||||
core, n, s, s->name, s->active);
|
context, n, s, s->name, s->active);
|
||||||
if (s != n && s->active)
|
if (s != n && s->active)
|
||||||
active_slaves++;
|
active_slaves++;
|
||||||
}
|
}
|
||||||
pw_log_info(NAME" %p: driver %p active slaves %d",
|
pw_log_info(NAME" %p: driver %p active slaves %d",
|
||||||
core, n, active_slaves);
|
context, n, active_slaves);
|
||||||
|
|
||||||
/* if the master has active slaves, it is a target for our
|
/* if the master has active slaves, it is a target for our
|
||||||
* unassigned nodes */
|
* unassigned nodes */
|
||||||
|
|
@ -1205,10 +1205,10 @@ int pw_core_recalc_graph(struct pw_core *core)
|
||||||
/* now go through all available nodes. The ones we didn't visit
|
/* now go through all available nodes. The ones we didn't visit
|
||||||
* in collect_nodes() are not linked to any master. We assign them
|
* in collect_nodes() are not linked to any master. We assign them
|
||||||
* to an active master */
|
* to an active master */
|
||||||
spa_list_for_each(n, &core->node_list, link) {
|
spa_list_for_each(n, &context->node_list, link) {
|
||||||
if (!n->visited) {
|
if (!n->visited) {
|
||||||
|
|
||||||
pw_log_info(NAME" %p: unassigned node %p: '%s' %d %d", core,
|
pw_log_info(NAME" %p: unassigned node %p: '%s' %d %d", context,
|
||||||
n, n->name, n->active, n->want_driver);
|
n, n->name, n->active, n->want_driver);
|
||||||
|
|
||||||
if (!n->want_driver)
|
if (!n->want_driver)
|
||||||
|
|
@ -1226,54 +1226,54 @@ int pw_core_recalc_graph(struct pw_core *core)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* assign final quantum and debug masters and slaves */
|
/* assign final quantum and debug masters and slaves */
|
||||||
spa_list_for_each(n, &core->driver_list, driver_link) {
|
spa_list_for_each(n, &context->driver_list, driver_link) {
|
||||||
if (!n->master)
|
if (!n->master)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (n->rt.position && n->quantum_current != n->rt.position->clock.duration)
|
if (n->rt.position && n->quantum_current != n->rt.position->clock.duration)
|
||||||
n->rt.position->clock.duration = n->quantum_current;
|
n->rt.position->clock.duration = n->quantum_current;
|
||||||
|
|
||||||
pw_log_info(NAME" %p: master %p quantum:%u '%s'", core, n,
|
pw_log_info(NAME" %p: master %p quantum:%u '%s'", context, n,
|
||||||
n->quantum_current, n->name);
|
n->quantum_current, n->name);
|
||||||
|
|
||||||
spa_list_for_each(s, &n->slave_list, slave_link)
|
spa_list_for_each(s, &n->slave_list, slave_link)
|
||||||
pw_log_info(NAME" %p: slave %p: active:%d '%s'",
|
pw_log_info(NAME" %p: slave %p: active:%d '%s'",
|
||||||
core, s, s->active, s->name);
|
context, s, s->active, s->name);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
int pw_core_add_spa_lib(struct pw_core *core,
|
int pw_context_add_spa_lib(struct pw_context *context,
|
||||||
const char *factory_regexp, const char *lib)
|
const char *factory_regexp, const char *lib)
|
||||||
{
|
{
|
||||||
struct factory_entry *entry;
|
struct factory_entry *entry;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
entry = pw_array_add(&core->factory_lib, sizeof(*entry));
|
entry = pw_array_add(&context->factory_lib, sizeof(*entry));
|
||||||
if (entry == NULL)
|
if (entry == NULL)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
if ((err = regcomp(&entry->regex, factory_regexp, REG_EXTENDED | REG_NOSUB)) != 0) {
|
if ((err = regcomp(&entry->regex, factory_regexp, REG_EXTENDED | REG_NOSUB)) != 0) {
|
||||||
char errbuf[1024];
|
char errbuf[1024];
|
||||||
regerror(err, &entry->regex, errbuf, sizeof(errbuf));
|
regerror(err, &entry->regex, errbuf, sizeof(errbuf));
|
||||||
pw_log_error(NAME" %p: can compile regex: %s", core, errbuf);
|
pw_log_error(NAME" %p: can compile regex: %s", context, errbuf);
|
||||||
pw_array_remove(&core->factory_lib, entry);
|
pw_array_remove(&context->factory_lib, entry);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
entry->lib = strdup(lib);
|
entry->lib = strdup(lib);
|
||||||
pw_log_debug(NAME" %p: map factory regex '%s' to '%s", core,
|
pw_log_debug(NAME" %p: map factory regex '%s' to '%s", context,
|
||||||
factory_regexp, lib);
|
factory_regexp, lib);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
const char *pw_core_find_spa_lib(struct pw_core *core, const char *factory_name)
|
const char *pw_context_find_spa_lib(struct pw_context *context, const char *factory_name)
|
||||||
{
|
{
|
||||||
struct factory_entry *entry;
|
struct factory_entry *entry;
|
||||||
|
|
||||||
pw_array_for_each(entry, &core->factory_lib) {
|
pw_array_for_each(entry, &context->factory_lib) {
|
||||||
if (regexec(&entry->regex, factory_name, 0, NULL, 0) == 0)
|
if (regexec(&entry->regex, factory_name, 0, NULL, 0) == 0)
|
||||||
return entry->lib;
|
return entry->lib;
|
||||||
}
|
}
|
||||||
|
|
@ -1281,7 +1281,7 @@ const char *pw_core_find_spa_lib(struct pw_core *core, const char *factory_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
struct spa_handle *pw_core_load_spa_handle(struct pw_core *core,
|
struct spa_handle *pw_context_load_spa_handle(struct pw_context *context,
|
||||||
const char *factory_name,
|
const char *factory_name,
|
||||||
const struct spa_dict *info)
|
const struct spa_dict *info)
|
||||||
{
|
{
|
||||||
|
|
@ -1290,19 +1290,19 @@ struct spa_handle *pw_core_load_spa_handle(struct pw_core *core,
|
||||||
uint32_t n_support;
|
uint32_t n_support;
|
||||||
struct spa_handle *handle;
|
struct spa_handle *handle;
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: load factory %s", core, factory_name);
|
pw_log_debug(NAME" %p: load factory %s", context, factory_name);
|
||||||
|
|
||||||
lib = pw_core_find_spa_lib(core, factory_name);
|
lib = pw_context_find_spa_lib(context, factory_name);
|
||||||
if (lib == NULL && info != NULL)
|
if (lib == NULL && info != NULL)
|
||||||
lib = spa_dict_lookup(info, SPA_KEY_LIBRARY_NAME);
|
lib = spa_dict_lookup(info, SPA_KEY_LIBRARY_NAME);
|
||||||
if (lib == NULL) {
|
if (lib == NULL) {
|
||||||
pw_log_warn(NAME" %p: no library for %s: %m",
|
pw_log_warn(NAME" %p: no library for %s: %m",
|
||||||
core, factory_name);
|
context, factory_name);
|
||||||
errno = ENOENT;
|
errno = ENOENT;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
support = pw_core_get_support(core, &n_support);
|
support = pw_context_get_support(context, &n_support);
|
||||||
|
|
||||||
handle = pw_load_spa_handle(lib, factory_name,
|
handle = pw_load_spa_handle(lib, factory_name,
|
||||||
info, n_support, support);
|
info, n_support, support);
|
||||||
|
|
@ -1311,19 +1311,19 @@ struct spa_handle *pw_core_load_spa_handle(struct pw_core *core,
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
int pw_core_register_export_type(struct pw_core *core, struct pw_export_type *type)
|
int pw_context_register_export_type(struct pw_context *context, struct pw_export_type *type)
|
||||||
{
|
{
|
||||||
pw_log_debug("core %p: Add export type %d/%s to core", core, type->type,
|
pw_log_debug("context %p: Add export type %d/%s to context", context, type->type,
|
||||||
spa_debug_type_find_name(pw_type_info(), type->type));
|
spa_debug_type_find_name(pw_type_info(), type->type));
|
||||||
spa_list_append(&core->export_list, &type->link);
|
spa_list_append(&context->export_list, &type->link);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
const struct pw_export_type *pw_core_find_export_type(struct pw_core *core, uint32_t type)
|
const struct pw_export_type *pw_context_find_export_type(struct pw_context *context, uint32_t type)
|
||||||
{
|
{
|
||||||
const struct pw_export_type *t;
|
const struct pw_export_type *t;
|
||||||
spa_list_for_each(t, &core->export_list, link) {
|
spa_list_for_each(t, &context->export_list, link) {
|
||||||
if (t->type == type)
|
if (t->type == type)
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
@ -22,8 +22,8 @@
|
||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PIPEWIRE_CORE_H
|
#ifndef PIPEWIRE_CONTEXT_H
|
||||||
#define PIPEWIRE_CORE_H
|
#define PIPEWIRE_CONTEXT_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
@ -32,15 +32,15 @@ extern "C" {
|
||||||
#include <spa/utils/defs.h>
|
#include <spa/utils/defs.h>
|
||||||
#include <spa/utils/hook.h>
|
#include <spa/utils/hook.h>
|
||||||
|
|
||||||
/** \class pw_core
|
/** \class pw_context
|
||||||
*
|
*
|
||||||
* \brief the core PipeWire object
|
* \brief the PipeWire context
|
||||||
*
|
*
|
||||||
* The core object manages all available resources.
|
* The context object manages all available resources.
|
||||||
*
|
*
|
||||||
* See \ref page_core_api
|
* See \ref page_context_api
|
||||||
*/
|
*/
|
||||||
struct pw_core;
|
struct pw_context;
|
||||||
|
|
||||||
#include <pipewire/client.h>
|
#include <pipewire/client.h>
|
||||||
#include <pipewire/introspect.h>
|
#include <pipewire/introspect.h>
|
||||||
|
|
@ -51,11 +51,11 @@ struct pw_core;
|
||||||
#include <pipewire/factory.h>
|
#include <pipewire/factory.h>
|
||||||
#include <pipewire/properties.h>
|
#include <pipewire/properties.h>
|
||||||
|
|
||||||
/** \page page_core_api Core API
|
/** \page page_context_api Core API
|
||||||
*
|
*
|
||||||
* \section page_core_overview Overview
|
* \section page_context_overview Overview
|
||||||
*
|
*
|
||||||
* \subpage page_core
|
* \subpage page_context
|
||||||
*
|
*
|
||||||
* \subpage page_global
|
* \subpage page_global
|
||||||
*
|
*
|
||||||
|
|
@ -70,24 +70,24 @@ struct pw_core;
|
||||||
* \subpage page_link
|
* \subpage page_link
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \page page_core Core
|
/** \page page_context Context
|
||||||
*
|
*
|
||||||
* \section page_core_overview Overview
|
* \section page_context_overview Overview
|
||||||
*
|
*
|
||||||
* The core object is a singleton object that manages the state and
|
* The context object is an object that manages the state and
|
||||||
* resources of a PipeWire instance.
|
* resources of a PipeWire instance.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** core events emited by the core object added with \ref pw_core_add_listener */
|
/** context events emited by the context object added with \ref pw_context_add_listener */
|
||||||
struct pw_core_events {
|
struct pw_context_events {
|
||||||
#define PW_VERSION_CORE_EVENTS 0
|
#define PW_VERSION_CONTEXT_EVENTS 0
|
||||||
uint32_t version;
|
uint32_t version;
|
||||||
|
|
||||||
/** The core is being destroyed */
|
/** The context is being destroyed */
|
||||||
void (*destroy) (void *data);
|
void (*destroy) (void *data);
|
||||||
/** The core is being freed */
|
/** The context is being freed */
|
||||||
void (*free) (void *data);
|
void (*free) (void *data);
|
||||||
/** The core info changed, use \ref pw_core_get_info() to get the updated info */
|
/** The context info changed, use \ref pw_context_get_info() to get the updated info */
|
||||||
void (*info_changed) (void *data, const struct pw_core_info *info);
|
void (*info_changed) (void *data, const struct pw_core_info *info);
|
||||||
/** a new client object is added */
|
/** a new client object is added */
|
||||||
void (*check_access) (void *data, struct pw_client *client);
|
void (*check_access) (void *data, struct pw_client *client);
|
||||||
|
|
@ -97,65 +97,65 @@ struct pw_core_events {
|
||||||
void (*global_removed) (void *data, struct pw_global *global);
|
void (*global_removed) (void *data, struct pw_global *global);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Make a new core object for a given main_loop. Ownership of the properties is taken */
|
/** Make a new context object for a given main_loop. Ownership of the properties is taken */
|
||||||
struct pw_core * pw_core_new(struct pw_loop *main_loop, /**< a main loop to run in */
|
struct pw_context * pw_context_new(struct pw_loop *main_loop, /**< a main loop to run in */
|
||||||
struct pw_properties *props, /**< extra properties */
|
struct pw_properties *props, /**< extra properties */
|
||||||
size_t user_data_size /**< extra user data size */);
|
size_t user_data_size /**< extra user data size */);
|
||||||
|
|
||||||
/** destroy a core object, all resources except the main_loop will be destroyed */
|
/** destroy a context object, all resources except the main_loop will be destroyed */
|
||||||
void pw_core_destroy(struct pw_core *core);
|
void pw_context_destroy(struct pw_context *context);
|
||||||
|
|
||||||
/** Get the core user data */
|
/** Get the context user data */
|
||||||
void *pw_core_get_user_data(struct pw_core *core);
|
void *pw_context_get_user_data(struct pw_context *context);
|
||||||
|
|
||||||
/** Add a new event listener to a core */
|
/** Add a new event listener to a context */
|
||||||
void pw_core_add_listener(struct pw_core *core,
|
void pw_context_add_listener(struct pw_context *context,
|
||||||
struct spa_hook *listener,
|
struct spa_hook *listener,
|
||||||
const struct pw_core_events *events,
|
const struct pw_context_events *events,
|
||||||
void *data);
|
void *data);
|
||||||
|
|
||||||
/** Get the core info object */
|
/** Get the context info object */
|
||||||
const struct pw_core_info *pw_core_get_info(struct pw_core *core);
|
const struct pw_core_info *pw_context_get_info(struct pw_context *context);
|
||||||
|
|
||||||
/** Get the core global object */
|
/** Get the context global object */
|
||||||
struct pw_global *pw_core_get_global(struct pw_core *core);
|
struct pw_global *pw_context_get_global(struct pw_context *context);
|
||||||
|
|
||||||
/** Get the core properties */
|
/** Get the context properties */
|
||||||
const struct pw_properties *pw_core_get_properties(struct pw_core *core);
|
const struct pw_properties *pw_context_get_properties(struct pw_context *context);
|
||||||
|
|
||||||
/** Update the core properties */
|
/** Update the context properties */
|
||||||
int pw_core_update_properties(struct pw_core *core, const struct spa_dict *dict);
|
int pw_context_update_properties(struct pw_context *context, const struct spa_dict *dict);
|
||||||
|
|
||||||
/** Get the core support objects */
|
/** Get the context support objects */
|
||||||
const struct spa_support *pw_core_get_support(struct pw_core *core, uint32_t *n_support);
|
const struct spa_support *pw_context_get_support(struct pw_context *context, uint32_t *n_support);
|
||||||
|
|
||||||
/** get the core main loop */
|
/** get the context main loop */
|
||||||
struct pw_loop *pw_core_get_main_loop(struct pw_core *core);
|
struct pw_loop *pw_context_get_main_loop(struct pw_context *context);
|
||||||
|
|
||||||
/** Iterate the globals of the core. The callback should return
|
/** Iterate the globals of the context. The callback should return
|
||||||
* 0 to fetch the next item, any other value stops the iteration and returns
|
* 0 to fetch the next item, any other value stops the iteration and returns
|
||||||
* the value. When all callbacks return 0, this function returns 0 when all
|
* the value. When all callbacks return 0, this function returns 0 when all
|
||||||
* globals are iterated. */
|
* globals are iterated. */
|
||||||
int pw_core_for_each_global(struct pw_core *core, /**< the core */
|
int pw_context_for_each_global(struct pw_context *context, /**< the context */
|
||||||
int (*callback) (void *data, struct pw_global *global),
|
int (*callback) (void *data, struct pw_global *global),
|
||||||
void *data);
|
void *data);
|
||||||
|
|
||||||
/** Find a core global by id */
|
/** Find a context global by id */
|
||||||
struct pw_global *pw_core_find_global(struct pw_core *core, /**< the core */
|
struct pw_global *pw_context_find_global(struct pw_context *context, /**< the context */
|
||||||
uint32_t id /**< the global id */);
|
uint32_t id /**< the global id */);
|
||||||
|
|
||||||
/** Find a factory by name */
|
/** Find a factory by name */
|
||||||
struct pw_factory *
|
struct pw_factory *
|
||||||
pw_core_find_factory(struct pw_core *core /**< the core */,
|
pw_context_find_factory(struct pw_context *context /**< the context */,
|
||||||
const char *name /**< the factory name */);
|
const char *name /**< the factory name */);
|
||||||
|
|
||||||
/** add a spa library for the given factory_name regex */
|
/** add a spa library for the given factory_name regex */
|
||||||
int pw_core_add_spa_lib(struct pw_core *core, const char *factory_regex, const char *lib);
|
int pw_context_add_spa_lib(struct pw_context *context, const char *factory_regex, const char *lib);
|
||||||
|
|
||||||
/** find the library name for a spa factory */
|
/** find the library name for a spa factory */
|
||||||
const char * pw_core_find_spa_lib(struct pw_core *core, const char *factory_name);
|
const char * pw_context_find_spa_lib(struct pw_context *context, const char *factory_name);
|
||||||
|
|
||||||
struct spa_handle *pw_core_load_spa_handle(struct pw_core *core,
|
struct spa_handle *pw_context_load_spa_handle(struct pw_context *context,
|
||||||
const char *factory_name,
|
const char *factory_name,
|
||||||
const struct spa_dict *info);
|
const struct spa_dict *info);
|
||||||
|
|
||||||
|
|
@ -169,14 +169,14 @@ struct pw_export_type {
|
||||||
size_t user_data_size);
|
size_t user_data_size);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** register a type that can be exported on a core_proxy. This is usually used by
|
/** register a type that can be exported on a context_proxy. This is usually used by
|
||||||
* extension modules */
|
* extension modules */
|
||||||
int pw_core_register_export_type(struct pw_core *core, struct pw_export_type *type);
|
int pw_context_register_export_type(struct pw_context *context, struct pw_export_type *type);
|
||||||
/** find information about registered export type */
|
/** find information about registered export type */
|
||||||
const struct pw_export_type *pw_core_find_export_type(struct pw_core *core, uint32_t type);
|
const struct pw_export_type *pw_context_find_export_type(struct pw_context *context, uint32_t type);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* PIPEWIRE_CORE_H */
|
#endif /* PIPEWIRE_CONTEXT_H */
|
||||||
|
|
@ -37,7 +37,7 @@ struct impl {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pw_control *
|
struct pw_control *
|
||||||
pw_control_new(struct pw_core *core,
|
pw_control_new(struct pw_context *context,
|
||||||
struct pw_port *port,
|
struct pw_port *port,
|
||||||
uint32_t id, uint32_t size,
|
uint32_t id, uint32_t size,
|
||||||
size_t user_data_size)
|
size_t user_data_size)
|
||||||
|
|
@ -69,7 +69,7 @@ pw_control_new(struct pw_core *core,
|
||||||
pw_log_debug(NAME" %p: new %s %d", this,
|
pw_log_debug(NAME" %p: new %s %d", this,
|
||||||
spa_debug_type_find_name(spa_type_io, this->id), direction);
|
spa_debug_type_find_name(spa_type_io, this->id), direction);
|
||||||
|
|
||||||
this->core = core;
|
this->context = context;
|
||||||
this->port = port;
|
this->port = port;
|
||||||
this->direction = direction;
|
this->direction = direction;
|
||||||
|
|
||||||
|
|
@ -80,7 +80,7 @@ pw_control_new(struct pw_core *core,
|
||||||
|
|
||||||
spa_hook_list_init(&this->listener_list);
|
spa_hook_list_init(&this->listener_list);
|
||||||
|
|
||||||
spa_list_append(&core->control_list[direction], &this->link);
|
spa_list_append(&context->control_list[direction], &this->link);
|
||||||
if (port) {
|
if (port) {
|
||||||
spa_list_append(&port->control_list[direction], &this->port_link);
|
spa_list_append(&port->control_list[direction], &this->port_link);
|
||||||
pw_port_emit_control_added(port, this);
|
pw_port_emit_control_added(port, this);
|
||||||
|
|
@ -185,7 +185,7 @@ int pw_control_add_link(struct pw_control *control, uint32_t cmix,
|
||||||
size = SPA_MAX(control->size, other->size);
|
size = SPA_MAX(control->size, other->size);
|
||||||
|
|
||||||
if (impl->mem == NULL) {
|
if (impl->mem == NULL) {
|
||||||
impl->mem = pw_mempool_alloc(control->core->pool,
|
impl->mem = pw_mempool_alloc(control->context->pool,
|
||||||
PW_MEMBLOCK_FLAG_READWRITE |
|
PW_MEMBLOCK_FLAG_READWRITE |
|
||||||
PW_MEMBLOCK_FLAG_SEAL |
|
PW_MEMBLOCK_FLAG_SEAL |
|
||||||
PW_MEMBLOCK_FLAG_MAP,
|
PW_MEMBLOCK_FLAG_MAP,
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
struct pw_control;
|
struct pw_control;
|
||||||
|
|
||||||
#include <pipewire/core.h>
|
#include <pipewire/context.h>
|
||||||
#include <pipewire/introspect.h>
|
#include <pipewire/introspect.h>
|
||||||
#include <pipewire/node.h>
|
#include <pipewire/node.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -129,9 +129,9 @@ static const struct pw_core_proxy_events core_events = {
|
||||||
};
|
};
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
struct pw_core *pw_core_proxy_get_core(struct pw_core_proxy *core_proxy)
|
struct pw_context *pw_core_proxy_get_context(struct pw_core_proxy *core_proxy)
|
||||||
{
|
{
|
||||||
return core_proxy->core;
|
return core_proxy->context;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
|
|
@ -245,7 +245,7 @@ struct pw_proxy *pw_core_proxy_export(struct pw_core_proxy *core_proxy,
|
||||||
const struct pw_export_type *t;
|
const struct pw_export_type *t;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
t = pw_core_find_export_type(core_proxy->core, type);
|
t = pw_context_find_export_type(core_proxy->context, type);
|
||||||
if (t == NULL) {
|
if (t == NULL) {
|
||||||
res = -EPROTO;
|
res = -EPROTO;
|
||||||
goto error_export_type;
|
goto error_export_type;
|
||||||
|
|
@ -272,7 +272,7 @@ exit:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct pw_core_proxy *core_proxy_new(struct pw_core *core,
|
static struct pw_core_proxy *core_proxy_new(struct pw_context *context,
|
||||||
struct pw_properties *properties, size_t user_data_size)
|
struct pw_properties *properties, size_t user_data_size)
|
||||||
{
|
{
|
||||||
struct pw_core_proxy *p;
|
struct pw_core_proxy *p;
|
||||||
|
|
@ -292,10 +292,10 @@ static struct pw_core_proxy *core_proxy_new(struct pw_core *core,
|
||||||
if (properties == NULL)
|
if (properties == NULL)
|
||||||
goto error_properties;
|
goto error_properties;
|
||||||
|
|
||||||
pw_fill_connect_properties(core, properties);
|
pw_fill_connect_properties(context, properties);
|
||||||
|
|
||||||
p->proxy.core_proxy = p;
|
p->proxy.core_proxy = p;
|
||||||
p->core = core;
|
p->context = context;
|
||||||
p->properties = properties;
|
p->properties = properties;
|
||||||
p->pool = pw_mempool_new(NULL);
|
p->pool = pw_mempool_new(NULL);
|
||||||
p->core_proxy = p;
|
p->core_proxy = p;
|
||||||
|
|
@ -308,17 +308,13 @@ static struct pw_core_proxy *core_proxy_new(struct pw_core *core,
|
||||||
spa_list_init(&p->filter_list);
|
spa_list_init(&p->filter_list);
|
||||||
|
|
||||||
if ((protocol_name = pw_properties_get(properties, PW_KEY_PROTOCOL)) == NULL) {
|
if ((protocol_name = pw_properties_get(properties, PW_KEY_PROTOCOL)) == NULL) {
|
||||||
if ((protocol_name = pw_properties_get(core->properties, PW_KEY_PROTOCOL)) == NULL) {
|
if ((protocol_name = pw_properties_get(context->properties, PW_KEY_PROTOCOL)) == NULL) {
|
||||||
protocol_name = PW_TYPE_INFO_PROTOCOL_Native;
|
protocol_name = PW_TYPE_INFO_PROTOCOL_Native;
|
||||||
if ((protocol = pw_core_find_protocol(core, protocol_name)) == NULL) {
|
|
||||||
res = -ENOTSUP;
|
|
||||||
goto error_protocol;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (protocol == NULL)
|
if (protocol == NULL)
|
||||||
protocol = pw_core_find_protocol(core, protocol_name);
|
protocol = pw_context_find_protocol(context, protocol_name);
|
||||||
if (protocol == NULL) {
|
if (protocol == NULL) {
|
||||||
res = -ENOTSUP;
|
res = -ENOTSUP;
|
||||||
goto error_protocol;
|
goto error_protocol;
|
||||||
|
|
@ -346,7 +342,7 @@ static struct pw_core_proxy *core_proxy_new(struct pw_core *core,
|
||||||
pw_core_proxy_hello(p, PW_VERSION_CORE_PROXY);
|
pw_core_proxy_hello(p, PW_VERSION_CORE_PROXY);
|
||||||
pw_client_proxy_update_properties(p->client_proxy, &p->properties->dict);
|
pw_client_proxy_update_properties(p->client_proxy, &p->properties->dict);
|
||||||
|
|
||||||
spa_list_append(&core->core_proxy_list, &p->link);
|
spa_list_append(&context->core_proxy_list, &p->link);
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
|
|
||||||
|
|
@ -376,13 +372,13 @@ exit_cleanup:
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
struct pw_core_proxy *
|
struct pw_core_proxy *
|
||||||
pw_core_connect(struct pw_core *core, struct pw_properties *properties,
|
pw_context_connect(struct pw_context *context, struct pw_properties *properties,
|
||||||
size_t user_data_size)
|
size_t user_data_size)
|
||||||
{
|
{
|
||||||
struct pw_core_proxy *core_proxy;
|
struct pw_core_proxy *core_proxy;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
core_proxy = core_proxy_new(core, properties, user_data_size);
|
core_proxy = core_proxy_new(context, properties, user_data_size);
|
||||||
if (core_proxy == NULL)
|
if (core_proxy == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
@ -401,13 +397,13 @@ error_free:
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
struct pw_core_proxy *
|
struct pw_core_proxy *
|
||||||
pw_core_connect_fd(struct pw_core *core, int fd, struct pw_properties *properties,
|
pw_context_connect_fd(struct pw_context *context, int fd, struct pw_properties *properties,
|
||||||
size_t user_data_size)
|
size_t user_data_size)
|
||||||
{
|
{
|
||||||
struct pw_core_proxy *core_proxy;
|
struct pw_core_proxy *core_proxy;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
core_proxy = core_proxy_new(core, properties, user_data_size);
|
core_proxy = core_proxy_new(context, properties, user_data_size);
|
||||||
if (core_proxy == NULL)
|
if (core_proxy == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
@ -424,7 +420,7 @@ error_free:
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
struct pw_core_proxy *
|
struct pw_core_proxy *
|
||||||
pw_core_connect_self(struct pw_core *core, struct pw_properties *properties,
|
pw_context_connect_self(struct pw_context *context, struct pw_properties *properties,
|
||||||
size_t user_data_size)
|
size_t user_data_size)
|
||||||
{
|
{
|
||||||
const struct pw_core_info *info;
|
const struct pw_core_info *info;
|
||||||
|
|
@ -434,10 +430,10 @@ pw_core_connect_self(struct pw_core *core, struct pw_properties *properties,
|
||||||
if (properties == NULL)
|
if (properties == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
info = pw_core_get_info(core);
|
info = pw_context_get_info(context);
|
||||||
pw_properties_set(properties, PW_KEY_REMOTE_NAME, info->name);
|
pw_properties_set(properties, PW_KEY_REMOTE_NAME, info->name);
|
||||||
|
|
||||||
return pw_core_connect(core, properties, user_data_size);
|
return pw_context_connect(context, properties, user_data_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ extern "C" {
|
||||||
|
|
||||||
#include <spa/utils/hook.h>
|
#include <spa/utils/hook.h>
|
||||||
|
|
||||||
#include <pipewire/core.h>
|
#include <pipewire/context.h>
|
||||||
#include <pipewire/properties.h>
|
#include <pipewire/properties.h>
|
||||||
#include <pipewire/node.h>
|
#include <pipewire/node.h>
|
||||||
#include <pipewire/proxy.h>
|
#include <pipewire/proxy.h>
|
||||||
|
|
@ -39,7 +39,7 @@ extern "C" {
|
||||||
/** Connect to a PipeWire instance \memberof pw_core_proxy
|
/** Connect to a PipeWire instance \memberof pw_core_proxy
|
||||||
* \return a pw_core_proxy on success or NULL with errno set on error */
|
* \return a pw_core_proxy on success or NULL with errno set on error */
|
||||||
struct pw_core_proxy *
|
struct pw_core_proxy *
|
||||||
pw_core_connect(struct pw_core *core, /**< a \ref pw_core */
|
pw_context_connect(struct pw_context *context, /**< a \ref pw_context */
|
||||||
struct pw_properties *properties, /**< optional properties, ownership of
|
struct pw_properties *properties, /**< optional properties, ownership of
|
||||||
* the properties is taken.*/
|
* the properties is taken.*/
|
||||||
size_t user_data_size /**< extra user data size */);
|
size_t user_data_size /**< extra user data size */);
|
||||||
|
|
@ -49,7 +49,7 @@ pw_core_connect(struct pw_core *core, /**< a \ref pw_core */
|
||||||
* automatically on disconnect or error.
|
* automatically on disconnect or error.
|
||||||
* \return a pw_core_proxy on success or NULL with errno set on error */
|
* \return a pw_core_proxy on success or NULL with errno set on error */
|
||||||
struct pw_core_proxy *
|
struct pw_core_proxy *
|
||||||
pw_core_connect_fd(struct pw_core *core, /**< a \ref pw_core */
|
pw_context_connect_fd(struct pw_context *context, /**< a \ref pw_context */
|
||||||
int fd, /**< an fd */
|
int fd, /**< an fd */
|
||||||
struct pw_properties *properties, /**< optional properties, ownership of
|
struct pw_properties *properties, /**< optional properties, ownership of
|
||||||
* the properties is taken.*/
|
* the properties is taken.*/
|
||||||
|
|
@ -58,7 +58,7 @@ pw_core_connect_fd(struct pw_core *core, /**< a \ref pw_core */
|
||||||
/** Connect to a given PipeWire instance \memberof pw_core_proxy
|
/** Connect to a given PipeWire instance \memberof pw_core_proxy
|
||||||
* \return a pw_core_proxy on success or NULL with errno set on error */
|
* \return a pw_core_proxy on success or NULL with errno set on error */
|
||||||
struct pw_core_proxy *
|
struct pw_core_proxy *
|
||||||
pw_core_connect_self(struct pw_core *core, /**< a \ref pw_core to connect to */
|
pw_context_connect_self(struct pw_context *context, /**< a \ref pw_context to connect to */
|
||||||
struct pw_properties *properties, /**< optional properties, ownership of
|
struct pw_properties *properties, /**< optional properties, ownership of
|
||||||
* the properties is taken.*/
|
* the properties is taken.*/
|
||||||
size_t user_data_size /**< extra user data size */);
|
size_t user_data_size /**< extra user data size */);
|
||||||
|
|
@ -77,8 +77,8 @@ void *pw_core_proxy_get_user_data(struct pw_core_proxy *core_proxy);
|
||||||
/** Get the client proxy */
|
/** Get the client proxy */
|
||||||
struct pw_client_proxy * pw_core_proxy_get_client_proxy(struct pw_core_proxy *proxy);
|
struct pw_client_proxy * pw_core_proxy_get_client_proxy(struct pw_core_proxy *proxy);
|
||||||
|
|
||||||
/** Get the core object used to created this core_proxy */
|
/** Get the context object used to created this core_proxy */
|
||||||
struct pw_core * pw_core_proxy_get_core(struct pw_core_proxy *proxy);
|
struct pw_context * pw_core_proxy_get_context(struct pw_core_proxy *proxy);
|
||||||
|
|
||||||
/** Get properties from the core_proxy */
|
/** Get properties from the core_proxy */
|
||||||
const struct pw_properties *pw_core_proxy_get_properties(struct pw_core_proxy *proxy);
|
const struct pw_properties *pw_core_proxy_get_properties(struct pw_core_proxy *proxy);
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ static void check_properties(struct pw_device *device)
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
struct pw_device *pw_device_new(struct pw_core *core,
|
struct pw_device *pw_device_new(struct pw_context *context,
|
||||||
struct pw_properties *properties,
|
struct pw_properties *properties,
|
||||||
size_t user_data_size)
|
size_t user_data_size)
|
||||||
{
|
{
|
||||||
|
|
@ -147,7 +147,7 @@ struct pw_device *pw_device_new(struct pw_core *core,
|
||||||
goto error_free;
|
goto error_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->core = core;
|
this->context = context;
|
||||||
this->properties = properties;
|
this->properties = properties;
|
||||||
|
|
||||||
this->info.props = &properties->dict;
|
this->info.props = &properties->dict;
|
||||||
|
|
@ -405,7 +405,7 @@ SPA_EXPORT
|
||||||
int pw_device_register(struct pw_device *device,
|
int pw_device_register(struct pw_device *device,
|
||||||
struct pw_properties *properties)
|
struct pw_properties *properties)
|
||||||
{
|
{
|
||||||
struct pw_core *core = device->core;
|
struct pw_context *context = device->context;
|
||||||
struct object_data *od;
|
struct object_data *od;
|
||||||
const char *keys[] = {
|
const char *keys[] = {
|
||||||
PW_KEY_OBJECT_PATH,
|
PW_KEY_OBJECT_PATH,
|
||||||
|
|
@ -430,7 +430,7 @@ int pw_device_register(struct pw_device *device,
|
||||||
|
|
||||||
pw_properties_update_keys(properties, &device->properties->dict, keys);
|
pw_properties_update_keys(properties, &device->properties->dict, keys);
|
||||||
|
|
||||||
device->global = pw_global_new(core,
|
device->global = pw_global_new(context,
|
||||||
PW_TYPE_INTERFACE_Device,
|
PW_TYPE_INTERFACE_Device,
|
||||||
PW_VERSION_DEVICE_PROXY,
|
PW_VERSION_DEVICE_PROXY,
|
||||||
properties,
|
properties,
|
||||||
|
|
@ -439,7 +439,7 @@ int pw_device_register(struct pw_device *device,
|
||||||
if (device->global == NULL)
|
if (device->global == NULL)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
spa_list_append(&core->device_list, &device->link);
|
spa_list_append(&context->device_list, &device->link);
|
||||||
device->registered = true;
|
device->registered = true;
|
||||||
|
|
||||||
device->info.id = device->global->id;
|
device->info.id = device->global->id;
|
||||||
|
|
@ -534,7 +534,7 @@ static void device_info(void *data, const struct spa_device_info *info)
|
||||||
static void device_add_object(struct pw_device *device, uint32_t id,
|
static void device_add_object(struct pw_device *device, uint32_t id,
|
||||||
const struct spa_device_object_info *info)
|
const struct spa_device_object_info *info)
|
||||||
{
|
{
|
||||||
struct pw_core *core = device->core;
|
struct pw_context *context = device->context;
|
||||||
struct spa_handle *handle;
|
struct spa_handle *handle;
|
||||||
struct pw_properties *props;
|
struct pw_properties *props;
|
||||||
int res;
|
int res;
|
||||||
|
|
@ -546,7 +546,7 @@ static void device_add_object(struct pw_device *device, uint32_t id,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle = pw_core_load_spa_handle(core, info->factory_name, info->props);
|
handle = pw_context_load_spa_handle(context, info->factory_name, info->props);
|
||||||
if (handle == NULL) {
|
if (handle == NULL) {
|
||||||
pw_log_warn(NAME" %p: can't load handle %s: %m",
|
pw_log_warn(NAME" %p: can't load handle %s: %m",
|
||||||
device, info->factory_name);
|
device, info->factory_name);
|
||||||
|
|
@ -567,7 +567,7 @@ static void device_add_object(struct pw_device *device, uint32_t id,
|
||||||
case SPA_TYPE_INTERFACE_Node:
|
case SPA_TYPE_INTERFACE_Node:
|
||||||
{
|
{
|
||||||
struct pw_node *node;
|
struct pw_node *node;
|
||||||
node = pw_node_new(core, props, sizeof(struct object_data));
|
node = pw_node_new(context, props, sizeof(struct object_data));
|
||||||
|
|
||||||
od = pw_node_get_user_data(node);
|
od = pw_node_get_user_data(node);
|
||||||
od->object = node;
|
od->object = node;
|
||||||
|
|
@ -578,7 +578,7 @@ static void device_add_object(struct pw_device *device, uint32_t id,
|
||||||
case SPA_TYPE_INTERFACE_Device:
|
case SPA_TYPE_INTERFACE_Device:
|
||||||
{
|
{
|
||||||
struct pw_device *dev;
|
struct pw_device *dev;
|
||||||
dev = pw_device_new(core, props, sizeof(struct object_data));
|
dev = pw_device_new(context, props, sizeof(struct object_data));
|
||||||
|
|
||||||
od = pw_device_get_user_data(dev);
|
od = pw_device_get_user_data(dev);
|
||||||
od->object = dev;
|
od->object = dev;
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ struct pw_device;
|
||||||
|
|
||||||
#include <spa/monitor/device.h>
|
#include <spa/monitor/device.h>
|
||||||
|
|
||||||
#include <pipewire/core.h>
|
#include <pipewire/context.h>
|
||||||
#include <pipewire/global.h>
|
#include <pipewire/global.h>
|
||||||
#include <pipewire/properties.h>
|
#include <pipewire/properties.h>
|
||||||
#include <pipewire/resource.h>
|
#include <pipewire/resource.h>
|
||||||
|
|
@ -65,7 +65,7 @@ struct pw_device_events {
|
||||||
void (*info_changed) (void *data, const struct pw_device_info *info);
|
void (*info_changed) (void *data, const struct pw_device_info *info);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pw_device *pw_device_new(struct pw_core *core,
|
struct pw_device *pw_device_new(struct pw_context *context,
|
||||||
struct pw_properties *properties,
|
struct pw_properties *properties,
|
||||||
size_t user_data_size);
|
size_t user_data_size);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ struct resource_data {
|
||||||
};
|
};
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
struct pw_factory *pw_factory_new(struct pw_core *core,
|
struct pw_factory *pw_factory_new(struct pw_context *context,
|
||||||
const char *name,
|
const char *name,
|
||||||
uint32_t type,
|
uint32_t type,
|
||||||
uint32_t version,
|
uint32_t version,
|
||||||
|
|
@ -62,7 +62,7 @@ struct pw_factory *pw_factory_new(struct pw_core *core,
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
};
|
};
|
||||||
|
|
||||||
this->core = core;
|
this->context = context;
|
||||||
this->properties = properties;
|
this->properties = properties;
|
||||||
|
|
||||||
this->info.name = strdup(name);
|
this->info.name = strdup(name);
|
||||||
|
|
@ -197,7 +197,7 @@ SPA_EXPORT
|
||||||
int pw_factory_register(struct pw_factory *factory,
|
int pw_factory_register(struct pw_factory *factory,
|
||||||
struct pw_properties *properties)
|
struct pw_properties *properties)
|
||||||
{
|
{
|
||||||
struct pw_core *core = factory->core;
|
struct pw_context *context = factory->context;
|
||||||
const char *keys[] = {
|
const char *keys[] = {
|
||||||
PW_KEY_MODULE_ID,
|
PW_KEY_MODULE_ID,
|
||||||
NULL
|
NULL
|
||||||
|
|
@ -218,7 +218,7 @@ int pw_factory_register(struct pw_factory *factory,
|
||||||
spa_debug_type_find_name(pw_type_info(), factory->info.type));
|
spa_debug_type_find_name(pw_type_info(), factory->info.type));
|
||||||
pw_properties_setf(properties, PW_KEY_FACTORY_TYPE_VERSION, "%d", factory->info.version);
|
pw_properties_setf(properties, PW_KEY_FACTORY_TYPE_VERSION, "%d", factory->info.version);
|
||||||
|
|
||||||
factory->global = pw_global_new(core,
|
factory->global = pw_global_new(context,
|
||||||
PW_TYPE_INTERFACE_Factory,
|
PW_TYPE_INTERFACE_Factory,
|
||||||
PW_VERSION_FACTORY_PROXY,
|
PW_VERSION_FACTORY_PROXY,
|
||||||
properties,
|
properties,
|
||||||
|
|
@ -227,7 +227,7 @@ int pw_factory_register(struct pw_factory *factory,
|
||||||
if (factory->global == NULL)
|
if (factory->global == NULL)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
spa_list_append(&core->factory_list, &factory->link);
|
spa_list_append(&context->factory_list, &factory->link);
|
||||||
factory->registered = true;
|
factory->registered = true;
|
||||||
|
|
||||||
factory->info.id = factory->global->id;
|
factory->info.id = factory->global->id;
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
struct pw_factory;
|
struct pw_factory;
|
||||||
|
|
||||||
#include <pipewire/core.h>
|
#include <pipewire/context.h>
|
||||||
#include <pipewire/client.h>
|
#include <pipewire/client.h>
|
||||||
#include <pipewire/global.h>
|
#include <pipewire/global.h>
|
||||||
#include <pipewire/properties.h>
|
#include <pipewire/properties.h>
|
||||||
|
|
@ -69,7 +69,7 @@ struct pw_factory_implementation {
|
||||||
uint32_t new_id);
|
uint32_t new_id);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pw_factory *pw_factory_new(struct pw_core *core,
|
struct pw_factory *pw_factory_new(struct pw_context *context,
|
||||||
const char *name,
|
const char *name,
|
||||||
uint32_t type,
|
uint32_t type,
|
||||||
uint32_t version,
|
uint32_t version,
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ struct queue {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct data {
|
struct data {
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
struct spa_hook filter_listener;
|
struct spa_hook filter_listener;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -113,7 +113,7 @@ struct filter {
|
||||||
|
|
||||||
const char *path;
|
const char *path;
|
||||||
|
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
|
|
||||||
enum pw_filter_flags flags;
|
enum pw_filter_flags flags;
|
||||||
|
|
||||||
|
|
@ -341,7 +341,7 @@ static int impl_send_command(void *object, const struct spa_command *command)
|
||||||
switch (SPA_NODE_COMMAND_ID(command)) {
|
switch (SPA_NODE_COMMAND_ID(command)) {
|
||||||
case SPA_NODE_COMMAND_Suspend:
|
case SPA_NODE_COMMAND_Suspend:
|
||||||
case SPA_NODE_COMMAND_Pause:
|
case SPA_NODE_COMMAND_Pause:
|
||||||
pw_loop_invoke(impl->core->main_loop,
|
pw_loop_invoke(impl->context->main_loop,
|
||||||
NULL, 0, NULL, 0, false, impl);
|
NULL, 0, NULL, 0, false, impl);
|
||||||
if (filter->state == PW_FILTER_STATE_STREAMING) {
|
if (filter->state == PW_FILTER_STATE_STREAMING) {
|
||||||
pw_log_debug(NAME" %p: pause", filter);
|
pw_log_debug(NAME" %p: pause", filter);
|
||||||
|
|
@ -558,7 +558,7 @@ static int map_data(struct filter *impl, struct spa_data *data, int prot)
|
||||||
void *ptr;
|
void *ptr;
|
||||||
struct pw_map_range range;
|
struct pw_map_range range;
|
||||||
|
|
||||||
pw_map_range_init(&range, data->mapoffset, data->maxsize, impl->core->sc_pagesize);
|
pw_map_range_init(&range, data->mapoffset, data->maxsize, impl->context->sc_pagesize);
|
||||||
|
|
||||||
ptr = mmap(NULL, range.size, prot, MAP_SHARED, data->fd, range.offset);
|
ptr = mmap(NULL, range.size, prot, MAP_SHARED, data->fd, range.offset);
|
||||||
if (ptr == MAP_FAILED) {
|
if (ptr == MAP_FAILED) {
|
||||||
|
|
@ -576,7 +576,7 @@ static int unmap_data(struct filter *impl, struct spa_data *data)
|
||||||
{
|
{
|
||||||
struct pw_map_range range;
|
struct pw_map_range range;
|
||||||
|
|
||||||
pw_map_range_init(&range, data->mapoffset, data->maxsize, impl->core->sc_pagesize);
|
pw_map_range_init(&range, data->mapoffset, data->maxsize, impl->context->sc_pagesize);
|
||||||
|
|
||||||
if (munmap(SPA_MEMBER(data->data, -range.start, void), range.size) < 0)
|
if (munmap(SPA_MEMBER(data->data, -range.start, void), range.size) < 0)
|
||||||
pw_log_warn(NAME" %p: failed to unmap: %m", impl);
|
pw_log_warn(NAME" %p: failed to unmap: %m", impl);
|
||||||
|
|
@ -733,7 +733,7 @@ static void call_process(struct filter *impl)
|
||||||
do_call_process(NULL, false, 1, NULL, 0, impl);
|
do_call_process(NULL, false, 1, NULL, 0, impl);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pw_loop_invoke(impl->core->main_loop,
|
pw_loop_invoke(impl->context->main_loop,
|
||||||
do_call_process, 1, NULL, 0, false, impl);
|
do_call_process, 1, NULL, 0, false, impl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -752,7 +752,7 @@ do_call_drained(struct spa_loop *loop,
|
||||||
|
|
||||||
static void call_drained(struct filter *impl)
|
static void call_drained(struct filter *impl)
|
||||||
{
|
{
|
||||||
pw_loop_invoke(impl->core->main_loop,
|
pw_loop_invoke(impl->context->main_loop,
|
||||||
do_call_drained, 1, NULL, 0, false, impl);
|
do_call_drained, 1, NULL, 0, false, impl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -896,7 +896,7 @@ static const struct pw_core_proxy_events core_events = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct filter *
|
static struct filter *
|
||||||
filter_new(struct pw_core *core, const char *name,
|
filter_new(struct pw_context *context, const char *name,
|
||||||
struct pw_properties *props, const struct pw_properties *extra)
|
struct pw_properties *props, const struct pw_properties *extra)
|
||||||
{
|
{
|
||||||
struct filter *impl;
|
struct filter *impl;
|
||||||
|
|
@ -946,7 +946,7 @@ filter_new(struct pw_core *core, const char *name,
|
||||||
|
|
||||||
this->state = PW_FILTER_STATE_UNCONNECTED;
|
this->state = PW_FILTER_STATE_UNCONNECTED;
|
||||||
|
|
||||||
impl->core = core;
|
impl->context = context;
|
||||||
|
|
||||||
return impl;
|
return impl;
|
||||||
|
|
||||||
|
|
@ -965,9 +965,9 @@ struct pw_filter * pw_filter_new(struct pw_core_proxy *core_proxy, const char *n
|
||||||
{
|
{
|
||||||
struct filter *impl;
|
struct filter *impl;
|
||||||
struct pw_filter *this;
|
struct pw_filter *this;
|
||||||
struct pw_core *core = core_proxy->core;
|
struct pw_context *context = core_proxy->context;
|
||||||
|
|
||||||
impl = filter_new(core, name, props, core_proxy->properties);
|
impl = filter_new(context, name, props, core_proxy->properties);
|
||||||
if (impl == NULL)
|
if (impl == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
@ -990,7 +990,7 @@ pw_filter_new_simple(struct pw_loop *loop,
|
||||||
{
|
{
|
||||||
struct pw_filter *this;
|
struct pw_filter *this;
|
||||||
struct filter *impl;
|
struct filter *impl;
|
||||||
struct pw_core *core;
|
struct pw_context *context;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
if (props == NULL)
|
if (props == NULL)
|
||||||
|
|
@ -998,11 +998,11 @@ pw_filter_new_simple(struct pw_loop *loop,
|
||||||
if (props == NULL)
|
if (props == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
core = pw_core_new(loop, NULL, 0);
|
context = pw_context_new(loop, NULL, 0);
|
||||||
|
|
||||||
pw_fill_connect_properties(core, props);
|
pw_fill_connect_properties(context, props);
|
||||||
|
|
||||||
impl = filter_new(core, name, props, props);
|
impl = filter_new(context, name, props, props);
|
||||||
if (impl == NULL) {
|
if (impl == NULL) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
goto error_cleanup;
|
goto error_cleanup;
|
||||||
|
|
@ -1010,13 +1010,13 @@ pw_filter_new_simple(struct pw_loop *loop,
|
||||||
|
|
||||||
this = &impl->this;
|
this = &impl->this;
|
||||||
|
|
||||||
impl->data.core = core;
|
impl->data.context = context;
|
||||||
pw_filter_add_listener(this, &impl->data.filter_listener, events, data);
|
pw_filter_add_listener(this, &impl->data.filter_listener, events, data);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
error_cleanup:
|
error_cleanup:
|
||||||
pw_core_destroy(core);
|
pw_context_destroy(context);
|
||||||
errno = -res;
|
errno = -res;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -1064,8 +1064,8 @@ void pw_filter_destroy(struct pw_filter *filter)
|
||||||
|
|
||||||
free(filter->name);
|
free(filter->name);
|
||||||
|
|
||||||
if (impl->data.core)
|
if (impl->data.context)
|
||||||
pw_core_destroy(impl->data.core);
|
pw_context_destroy(impl->data.context);
|
||||||
|
|
||||||
free(impl);
|
free(impl);
|
||||||
}
|
}
|
||||||
|
|
@ -1184,7 +1184,7 @@ pw_filter_connect(struct pw_filter *filter,
|
||||||
filter_set_state(filter, PW_FILTER_STATE_CONNECTING, NULL);
|
filter_set_state(filter, PW_FILTER_STATE_CONNECTING, NULL);
|
||||||
|
|
||||||
if (filter->core_proxy == NULL) {
|
if (filter->core_proxy == NULL) {
|
||||||
filter->core_proxy = pw_core_connect(impl->core,
|
filter->core_proxy = pw_context_connect(impl->context,
|
||||||
pw_properties_copy(filter->properties), 0);
|
pw_properties_copy(filter->properties), 0);
|
||||||
if (filter->core_proxy == NULL) {
|
if (filter->core_proxy == NULL) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
|
|
@ -1481,7 +1481,7 @@ static inline int call_trigger(struct filter *impl)
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
if (SPA_FLAG_IS_SET(impl->flags, PW_FILTER_FLAG_DRIVER)) {
|
if (SPA_FLAG_IS_SET(impl->flags, PW_FILTER_FLAG_DRIVER)) {
|
||||||
res = pw_loop_invoke(impl->core->data_loop,
|
res = pw_loop_invoke(impl->context->data_loop,
|
||||||
do_process, 1, NULL, 0, false, impl);
|
do_process, 1, NULL, 0, false, impl);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|
@ -1580,7 +1580,7 @@ SPA_EXPORT
|
||||||
int pw_filter_flush(struct pw_filter *filter, bool drain)
|
int pw_filter_flush(struct pw_filter *filter, bool drain)
|
||||||
{
|
{
|
||||||
struct filter *impl = SPA_CONTAINER_OF(filter, struct filter, this);
|
struct filter *impl = SPA_CONTAINER_OF(filter, struct filter, this);
|
||||||
pw_loop_invoke(impl->core->data_loop,
|
pw_loop_invoke(impl->context->data_loop,
|
||||||
drain ? do_drain : do_flush, 1, NULL, 0, true, impl);
|
drain ? do_drain : do_flush, 1, NULL, 0, true, impl);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ uint32_t pw_global_get_permissions(struct pw_global *global, struct pw_client *c
|
||||||
|
|
||||||
/** Create a new global
|
/** Create a new global
|
||||||
*
|
*
|
||||||
* \param core a core object
|
* \param context a context object
|
||||||
* \param type the type of the global
|
* \param type the type of the global
|
||||||
* \param version the version of the type
|
* \param version the version of the type
|
||||||
* \param properties extra properties
|
* \param properties extra properties
|
||||||
|
|
@ -66,7 +66,7 @@ uint32_t pw_global_get_permissions(struct pw_global *global, struct pw_client *c
|
||||||
*/
|
*/
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
struct pw_global *
|
struct pw_global *
|
||||||
pw_global_new(struct pw_core *core,
|
pw_global_new(struct pw_context *context,
|
||||||
uint32_t type,
|
uint32_t type,
|
||||||
uint32_t version,
|
uint32_t version,
|
||||||
struct pw_properties *properties,
|
struct pw_properties *properties,
|
||||||
|
|
@ -90,13 +90,13 @@ pw_global_new(struct pw_core *core,
|
||||||
|
|
||||||
this = &impl->this;
|
this = &impl->this;
|
||||||
|
|
||||||
this->core = core;
|
this->context = context;
|
||||||
this->type = type;
|
this->type = type;
|
||||||
this->version = version;
|
this->version = version;
|
||||||
this->func = func;
|
this->func = func;
|
||||||
this->object = object;
|
this->object = object;
|
||||||
this->properties = properties;
|
this->properties = properties;
|
||||||
this->id = pw_map_insert_new(&core->globals, this);
|
this->id = pw_map_insert_new(&context->globals, this);
|
||||||
if (this->id == SPA_ID_INVALID) {
|
if (this->id == SPA_ID_INVALID) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
pw_log_error(NAME" %p: can't allocate new id: %m", this);
|
pw_log_error(NAME" %p: can't allocate new id: %m", this);
|
||||||
|
|
@ -121,7 +121,7 @@ error_cleanup:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** register a global to the core registry
|
/** register a global to the context registry
|
||||||
*
|
*
|
||||||
* \param global a global to add
|
* \param global a global to add
|
||||||
* \return 0 on success < 0 errno value on failure
|
* \return 0 on success < 0 errno value on failure
|
||||||
|
|
@ -133,15 +133,15 @@ int pw_global_register(struct pw_global *global)
|
||||||
{
|
{
|
||||||
struct impl *impl = SPA_CONTAINER_OF(global, struct impl, this);
|
struct impl *impl = SPA_CONTAINER_OF(global, struct impl, this);
|
||||||
struct pw_resource *registry;
|
struct pw_resource *registry;
|
||||||
struct pw_core *core = global->core;
|
struct pw_context *context = global->context;
|
||||||
|
|
||||||
if (impl->registered)
|
if (impl->registered)
|
||||||
return -EEXIST;
|
return -EEXIST;
|
||||||
|
|
||||||
spa_list_append(&core->global_list, &global->link);
|
spa_list_append(&context->global_list, &global->link);
|
||||||
impl->registered = true;
|
impl->registered = true;
|
||||||
|
|
||||||
spa_list_for_each(registry, &core->registry_resource_list, link) {
|
spa_list_for_each(registry, &context->registry_resource_list, link) {
|
||||||
uint32_t permissions = pw_global_get_permissions(global, registry->client);
|
uint32_t permissions = pw_global_get_permissions(global, registry->client);
|
||||||
pw_log_debug("registry %p: global %d %08x", registry, global->id, permissions);
|
pw_log_debug("registry %p: global %d %08x", registry, global->id, permissions);
|
||||||
if (PW_PERM_IS_R(permissions))
|
if (PW_PERM_IS_R(permissions))
|
||||||
|
|
@ -154,7 +154,7 @@ int pw_global_register(struct pw_global *global)
|
||||||
}
|
}
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: registered %u", global, global->id);
|
pw_log_debug(NAME" %p: registered %u", global, global->id);
|
||||||
pw_core_emit_global_added(core, global);
|
pw_context_emit_global_added(context, global);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -162,13 +162,13 @@ int pw_global_register(struct pw_global *global)
|
||||||
static int global_unregister(struct pw_global *global)
|
static int global_unregister(struct pw_global *global)
|
||||||
{
|
{
|
||||||
struct impl *impl = SPA_CONTAINER_OF(global, struct impl, this);
|
struct impl *impl = SPA_CONTAINER_OF(global, struct impl, this);
|
||||||
struct pw_core *core = global->core;
|
struct pw_context *context = global->context;
|
||||||
struct pw_resource *resource;
|
struct pw_resource *resource;
|
||||||
|
|
||||||
if (!impl->registered)
|
if (!impl->registered)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
spa_list_for_each(resource, &core->registry_resource_list, link) {
|
spa_list_for_each(resource, &context->registry_resource_list, link) {
|
||||||
uint32_t permissions = pw_global_get_permissions(global, resource->client);
|
uint32_t permissions = pw_global_get_permissions(global, resource->client);
|
||||||
pw_log_debug("registry %p: global %d %08x", resource, global->id, permissions);
|
pw_log_debug("registry %p: global %d %08x", resource, global->id, permissions);
|
||||||
if (PW_PERM_IS_R(permissions))
|
if (PW_PERM_IS_R(permissions))
|
||||||
|
|
@ -176,19 +176,19 @@ static int global_unregister(struct pw_global *global)
|
||||||
}
|
}
|
||||||
|
|
||||||
spa_list_remove(&global->link);
|
spa_list_remove(&global->link);
|
||||||
pw_map_remove(&core->globals, global->id);
|
pw_map_remove(&context->globals, global->id);
|
||||||
impl->registered = false;
|
impl->registered = false;
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: unregistered %u", global, global->id);
|
pw_log_debug(NAME" %p: unregistered %u", global, global->id);
|
||||||
pw_core_emit_global_removed(core, global);
|
pw_context_emit_global_removed(context, global);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
struct pw_core *pw_global_get_core(struct pw_global *global)
|
struct pw_context *pw_global_get_context(struct pw_global *global)
|
||||||
{
|
{
|
||||||
return global->core;
|
return global->context;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
|
|
@ -284,7 +284,7 @@ SPA_EXPORT
|
||||||
int pw_global_update_permissions(struct pw_global *global, struct pw_client *client,
|
int pw_global_update_permissions(struct pw_global *global, struct pw_client *client,
|
||||||
uint32_t old_permissions, uint32_t new_permissions)
|
uint32_t old_permissions, uint32_t new_permissions)
|
||||||
{
|
{
|
||||||
struct pw_core *core = global->core;
|
struct pw_context *context = global->context;
|
||||||
struct pw_resource *resource, *t;
|
struct pw_resource *resource, *t;
|
||||||
bool do_hide, do_show;
|
bool do_hide, do_show;
|
||||||
|
|
||||||
|
|
@ -296,7 +296,7 @@ int pw_global_update_permissions(struct pw_global *global, struct pw_client *cli
|
||||||
|
|
||||||
pw_global_emit_permissions_changed(global, client, old_permissions, new_permissions);
|
pw_global_emit_permissions_changed(global, client, old_permissions, new_permissions);
|
||||||
|
|
||||||
spa_list_for_each(resource, &core->registry_resource_list, link) {
|
spa_list_for_each(resource, &context->registry_resource_list, link) {
|
||||||
if (resource->client != client)
|
if (resource->client != client)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -321,7 +321,7 @@ int pw_global_update_permissions(struct pw_global *global, struct pw_client *cli
|
||||||
if (resource->client != client)
|
if (resource->client != client)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* don't ever destroy the core resource */
|
/* don't ever destroy the context resource */
|
||||||
if (!PW_PERM_IS_R(new_permissions) && global->id != 0)
|
if (!PW_PERM_IS_R(new_permissions) && global->id != 0)
|
||||||
pw_resource_destroy(resource);
|
pw_resource_destroy(resource);
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ extern "C" {
|
||||||
/** \page page_global Global
|
/** \page page_global Global
|
||||||
*
|
*
|
||||||
* Global objects represent resources that are available on the PipeWire
|
* Global objects represent resources that are available on the PipeWire
|
||||||
* core and are accessible to remote clients.
|
* context and are accessible to remote clients.
|
||||||
* Globals come and go when devices or other resources become available for
|
* Globals come and go when devices or other resources become available for
|
||||||
* clients.
|
* clients.
|
||||||
*
|
*
|
||||||
|
|
@ -53,7 +53,7 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
struct pw_global;
|
struct pw_global;
|
||||||
|
|
||||||
#include <pipewire/core.h>
|
#include <pipewire/context.h>
|
||||||
#include <pipewire/client.h>
|
#include <pipewire/client.h>
|
||||||
#include <pipewire/properties.h>
|
#include <pipewire/properties.h>
|
||||||
|
|
||||||
|
|
@ -81,14 +81,14 @@ struct pw_global_events {
|
||||||
|
|
||||||
/** Create a new global object */
|
/** Create a new global object */
|
||||||
struct pw_global *
|
struct pw_global *
|
||||||
pw_global_new(struct pw_core *core, /**< the core */
|
pw_global_new(struct pw_context *context, /**< the context */
|
||||||
uint32_t type, /**< the interface type of the global */
|
uint32_t type, /**< the interface type of the global */
|
||||||
uint32_t version, /**< the interface version of the global */
|
uint32_t version, /**< the interface version of the global */
|
||||||
struct pw_properties *properties, /**< extra properties */
|
struct pw_properties *properties, /**< extra properties */
|
||||||
pw_global_bind_func_t func, /**< function to bind */
|
pw_global_bind_func_t func, /**< function to bind */
|
||||||
void *object /**< global object */);
|
void *object /**< global object */);
|
||||||
|
|
||||||
/** Register a global object to the core registry */
|
/** Register a global object to the context registry */
|
||||||
int pw_global_register(struct pw_global *global);
|
int pw_global_register(struct pw_global *global);
|
||||||
|
|
||||||
/** Add an event listener on the global */
|
/** Add an event listener on the global */
|
||||||
|
|
@ -100,8 +100,8 @@ void pw_global_add_listener(struct pw_global *global,
|
||||||
/** Get the permissions of the global for a given client */
|
/** Get the permissions of the global for a given client */
|
||||||
uint32_t pw_global_get_permissions(struct pw_global *global, struct pw_client *client);
|
uint32_t pw_global_get_permissions(struct pw_global *global, struct pw_client *client);
|
||||||
|
|
||||||
/** Get the core object of this global */
|
/** Get the context object of this global */
|
||||||
struct pw_core *pw_global_get_core(struct pw_global *global);
|
struct pw_context *pw_global_get_context(struct pw_global *global);
|
||||||
|
|
||||||
/** Get the global type */
|
/** Get the global type */
|
||||||
uint32_t pw_global_get_type(struct pw_global *global);
|
uint32_t pw_global_get_type(struct pw_global *global);
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,7 @@ static int do_negotiate(struct pw_link *this)
|
||||||
output = this->output;
|
output = this->output;
|
||||||
|
|
||||||
/* find a common format for the ports */
|
/* find a common format for the ports */
|
||||||
if ((res = pw_core_find_format(this->core,
|
if ((res = pw_context_find_format(this->context,
|
||||||
output, input, NULL, 0, NULL,
|
output, input, NULL, 0, NULL,
|
||||||
&format, &b, &error)) < 0)
|
&format, &b, &error)) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
@ -453,7 +453,7 @@ static int do_allocation(struct pw_link *this)
|
||||||
flags |= SPA_NODE_BUFFERS_FLAG_ALLOC;
|
flags |= SPA_NODE_BUFFERS_FLAG_ALLOC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((res = pw_buffers_negotiate(this->core, alloc_flags,
|
if ((res = pw_buffers_negotiate(this->context, alloc_flags,
|
||||||
output->node->node, output->port_id,
|
output->node->node, output->port_id,
|
||||||
input->node->node, input->port_id,
|
input->node->node, input->port_id,
|
||||||
&output->buffers)) < 0) {
|
&output->buffers)) < 0) {
|
||||||
|
|
@ -987,7 +987,7 @@ static void try_unlink_controls(struct impl *impl, struct pw_port *output, struc
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
check_permission(struct pw_core *core,
|
check_permission(struct pw_context *context,
|
||||||
struct pw_port *output,
|
struct pw_port *output,
|
||||||
struct pw_port *input,
|
struct pw_port *input,
|
||||||
struct pw_properties *properties)
|
struct pw_properties *properties)
|
||||||
|
|
@ -1005,7 +1005,7 @@ static void permissions_changed(struct pw_link *this, struct pw_port *other,
|
||||||
new &= perm;
|
new &= perm;
|
||||||
pw_log_debug(NAME" %p: permissions changed %08x -> %08x", this, old, new);
|
pw_log_debug(NAME" %p: permissions changed %08x -> %08x", this, old, new);
|
||||||
|
|
||||||
if (check_permission(this->core, this->output, this->input, this->properties) < 0) {
|
if (check_permission(this->context, this->output, this->input, this->properties) < 0) {
|
||||||
pw_link_destroy(this);
|
pw_link_destroy(this);
|
||||||
} else {
|
} else {
|
||||||
pw_global_update_permissions(this->global, client, old, new);
|
pw_global_update_permissions(this->global, client, old, new);
|
||||||
|
|
@ -1037,7 +1037,7 @@ static const struct pw_global_events input_global_events = {
|
||||||
};
|
};
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
struct pw_link *pw_link_new(struct pw_core *core,
|
struct pw_link *pw_link_new(struct pw_context *context,
|
||||||
struct pw_port *output,
|
struct pw_port *output,
|
||||||
struct pw_port *input,
|
struct pw_port *input,
|
||||||
struct spa_pod *format_filter,
|
struct spa_pod *format_filter,
|
||||||
|
|
@ -1060,7 +1060,7 @@ struct pw_link *pw_link_new(struct pw_core *core,
|
||||||
if (pw_link_find(output, input))
|
if (pw_link_find(output, input))
|
||||||
goto error_link_exists;
|
goto error_link_exists;
|
||||||
|
|
||||||
if (check_permission(core, output, input, properties) < 0)
|
if (check_permission(context, output, input, properties) < 0)
|
||||||
goto error_link_not_allowed;
|
goto error_link_not_allowed;
|
||||||
|
|
||||||
output_node = output->node;
|
output_node = output->node;
|
||||||
|
|
@ -1082,9 +1082,9 @@ struct pw_link *pw_link_new(struct pw_core *core,
|
||||||
if (user_data_size > 0)
|
if (user_data_size > 0)
|
||||||
this->user_data = SPA_MEMBER(impl, sizeof(struct impl), void);
|
this->user_data = SPA_MEMBER(impl, sizeof(struct impl), void);
|
||||||
|
|
||||||
impl->work = pw_work_queue_new(core->main_loop);
|
impl->work = pw_work_queue_new(context->main_loop);
|
||||||
|
|
||||||
this->core = core;
|
this->context = context;
|
||||||
this->properties = properties;
|
this->properties = properties;
|
||||||
this->info.state = PW_LINK_STATE_INIT;
|
this->info.state = PW_LINK_STATE_INIT;
|
||||||
|
|
||||||
|
|
@ -1149,7 +1149,7 @@ struct pw_link *pw_link_new(struct pw_core *core,
|
||||||
|
|
||||||
pw_node_emit_peer_added(output_node, input_node);
|
pw_node_emit_peer_added(output_node, input_node);
|
||||||
|
|
||||||
pw_core_recalc_graph(core);
|
pw_context_recalc_graph(context);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
|
|
@ -1202,7 +1202,7 @@ SPA_EXPORT
|
||||||
int pw_link_register(struct pw_link *link,
|
int pw_link_register(struct pw_link *link,
|
||||||
struct pw_properties *properties)
|
struct pw_properties *properties)
|
||||||
{
|
{
|
||||||
struct pw_core *core = link->core;
|
struct pw_context *context = link->context;
|
||||||
struct pw_node *output_node, *input_node;
|
struct pw_node *output_node, *input_node;
|
||||||
const char *keys[] = {
|
const char *keys[] = {
|
||||||
PW_KEY_OBJECT_PATH,
|
PW_KEY_OBJECT_PATH,
|
||||||
|
|
@ -1233,7 +1233,7 @@ int pw_link_register(struct pw_link *link,
|
||||||
pw_properties_setf(properties, PW_KEY_LINK_OUTPUT_PORT, "%d", link->info.output_port_id);
|
pw_properties_setf(properties, PW_KEY_LINK_OUTPUT_PORT, "%d", link->info.output_port_id);
|
||||||
pw_properties_setf(properties, PW_KEY_LINK_INPUT_PORT, "%d", link->info.input_port_id);
|
pw_properties_setf(properties, PW_KEY_LINK_INPUT_PORT, "%d", link->info.input_port_id);
|
||||||
|
|
||||||
link->global = pw_global_new(core,
|
link->global = pw_global_new(context,
|
||||||
PW_TYPE_INTERFACE_Link,
|
PW_TYPE_INTERFACE_Link,
|
||||||
PW_VERSION_LINK_PROXY,
|
PW_VERSION_LINK_PROXY,
|
||||||
properties,
|
properties,
|
||||||
|
|
@ -1242,7 +1242,7 @@ int pw_link_register(struct pw_link *link,
|
||||||
if (link->global == NULL)
|
if (link->global == NULL)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
spa_list_append(&core->link_list, &link->link);
|
spa_list_append(&context->link_list, &link->link);
|
||||||
link->registered = true;
|
link->registered = true;
|
||||||
|
|
||||||
link->info.id = link->global->id;
|
link->info.id = link->global->id;
|
||||||
|
|
@ -1301,7 +1301,7 @@ void pw_link_destroy(struct pw_link *link)
|
||||||
|
|
||||||
pw_properties_free(link->properties);
|
pw_properties_free(link->properties);
|
||||||
|
|
||||||
pw_core_recalc_graph(link->core);
|
pw_context_recalc_graph(link->context);
|
||||||
|
|
||||||
free(link->info.format);
|
free(link->info.format);
|
||||||
free(impl);
|
free(impl);
|
||||||
|
|
@ -1329,9 +1329,9 @@ struct pw_link *pw_link_find(struct pw_port *output_port, struct pw_port *input_
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
struct pw_core *pw_link_get_core(struct pw_link *link)
|
struct pw_context *pw_link_get_context(struct pw_link *link)
|
||||||
{
|
{
|
||||||
return link->core;
|
return link->context;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
struct pw_link;
|
struct pw_link;
|
||||||
|
|
||||||
#include <pipewire/core.h>
|
#include <pipewire/context.h>
|
||||||
#include <pipewire/introspect.h>
|
#include <pipewire/introspect.h>
|
||||||
#include <pipewire/port.h>
|
#include <pipewire/port.h>
|
||||||
|
|
||||||
|
|
@ -80,7 +80,7 @@ struct pw_link_events {
|
||||||
/** Make a new link between two ports \memberof pw_link
|
/** Make a new link between two ports \memberof pw_link
|
||||||
* \return a newly allocated link */
|
* \return a newly allocated link */
|
||||||
struct pw_link *
|
struct pw_link *
|
||||||
pw_link_new(struct pw_core *core, /**< the core object */
|
pw_link_new(struct pw_context *context, /**< the context object */
|
||||||
struct pw_port *output, /**< an output port */
|
struct pw_port *output, /**< an output port */
|
||||||
struct pw_port *input, /**< an input port */
|
struct pw_port *input, /**< an input port */
|
||||||
struct spa_pod *format_filter, /**< an optional format filter */
|
struct spa_pod *format_filter, /**< an optional format filter */
|
||||||
|
|
@ -100,8 +100,8 @@ void pw_link_add_listener(struct pw_link *link,
|
||||||
int pw_link_register(struct pw_link *link, /**< the link to register */
|
int pw_link_register(struct pw_link *link, /**< the link to register */
|
||||||
struct pw_properties *properties /**< extra properties */);
|
struct pw_properties *properties /**< extra properties */);
|
||||||
|
|
||||||
/** Get the core of a link */
|
/** Get the context of a link */
|
||||||
struct pw_core *pw_link_get_core(struct pw_link *link);
|
struct pw_context *pw_link_get_context(struct pw_link *link);
|
||||||
|
|
||||||
/** Get the user_data of a link, the size of the memory is given when
|
/** Get the user_data of a link, the size of the memory is given when
|
||||||
* constructing the link */
|
* constructing the link */
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ pipewire_headers = [
|
||||||
'buffers.h',
|
'buffers.h',
|
||||||
'client.h',
|
'client.h',
|
||||||
'control.h',
|
'control.h',
|
||||||
'core.h',
|
'context.h',
|
||||||
'data-loop.h',
|
'data-loop.h',
|
||||||
'device.h',
|
'device.h',
|
||||||
'filter.h',
|
'filter.h',
|
||||||
|
|
@ -39,7 +39,7 @@ pipewire_sources = [
|
||||||
'buffers.c',
|
'buffers.c',
|
||||||
'client.c',
|
'client.c',
|
||||||
'control.c',
|
'control.c',
|
||||||
'core.c',
|
'context.c',
|
||||||
'data-loop.c',
|
'data-loop.c',
|
||||||
'device.c',
|
'device.c',
|
||||||
'filter.c',
|
'filter.c',
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ static const struct pw_global_events global_events = {
|
||||||
|
|
||||||
/** Load a module
|
/** Load a module
|
||||||
*
|
*
|
||||||
* \param core a \ref pw_core
|
* \param context a \ref pw_context
|
||||||
* \param name name of the module to load
|
* \param name name of the module to load
|
||||||
* \param args A string with arguments for the module
|
* \param args A string with arguments for the module
|
||||||
* \param[out] error Return location for an error string, or NULL
|
* \param[out] error Return location for an error string, or NULL
|
||||||
|
|
@ -177,7 +177,7 @@ static const struct pw_global_events global_events = {
|
||||||
*/
|
*/
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
struct pw_module *
|
struct pw_module *
|
||||||
pw_module_load(struct pw_core *core,
|
pw_module_load(struct pw_context *context,
|
||||||
const char *name, const char *args,
|
const char *name, const char *args,
|
||||||
struct pw_properties *properties)
|
struct pw_properties *properties)
|
||||||
{
|
{
|
||||||
|
|
@ -234,7 +234,7 @@ pw_module_load(struct pw_core *core,
|
||||||
hnd = NULL;
|
hnd = NULL;
|
||||||
|
|
||||||
this = &impl->this;
|
this = &impl->this;
|
||||||
this->core = core;
|
this->context = context;
|
||||||
this->properties = properties;
|
this->properties = properties;
|
||||||
properties = NULL;
|
properties = NULL;
|
||||||
|
|
||||||
|
|
@ -247,7 +247,7 @@ pw_module_load(struct pw_core *core,
|
||||||
filename = NULL;
|
filename = NULL;
|
||||||
this->info.args = args ? strdup(args) : NULL;
|
this->info.args = args ? strdup(args) : NULL;
|
||||||
|
|
||||||
this->global = pw_global_new(core,
|
this->global = pw_global_new(context,
|
||||||
PW_TYPE_INTERFACE_Module,
|
PW_TYPE_INTERFACE_Module,
|
||||||
PW_VERSION_MODULE_PROXY,
|
PW_VERSION_MODULE_PROXY,
|
||||||
pw_properties_new(
|
pw_properties_new(
|
||||||
|
|
@ -259,7 +259,7 @@ pw_module_load(struct pw_core *core,
|
||||||
if (this->global == NULL)
|
if (this->global == NULL)
|
||||||
goto error_no_global;
|
goto error_no_global;
|
||||||
|
|
||||||
spa_list_append(&core->module_list, &this->link);
|
spa_list_append(&context->module_list, &this->link);
|
||||||
|
|
||||||
this->info.id = this->global->id;
|
this->info.id = this->global->id;
|
||||||
pw_properties_setf(this->properties, PW_KEY_OBJECT_ID, "%d", this->info.id);
|
pw_properties_setf(this->properties, PW_KEY_OBJECT_ID, "%d", this->info.id);
|
||||||
|
|
@ -351,10 +351,10 @@ void pw_module_destroy(struct pw_module *module)
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
struct pw_core *
|
struct pw_context *
|
||||||
pw_module_get_core(struct pw_module *module)
|
pw_module_get_context(struct pw_module *module)
|
||||||
{
|
{
|
||||||
return module->core;
|
return module->context;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ extern "C" {
|
||||||
|
|
||||||
#include <spa/utils/hook.h>
|
#include <spa/utils/hook.h>
|
||||||
|
|
||||||
#include <pipewire/core.h>
|
#include <pipewire/context.h>
|
||||||
|
|
||||||
#define PIPEWIRE_SYMBOL_MODULE_INIT "pipewire__module_init"
|
#define PIPEWIRE_SYMBOL_MODULE_INIT "pipewire__module_init"
|
||||||
#define PIPEWIRE_MODULE_PREFIX "libpipewire-"
|
#define PIPEWIRE_MODULE_PREFIX "libpipewire-"
|
||||||
|
|
@ -74,13 +74,13 @@ struct pw_module_events {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pw_module *
|
struct pw_module *
|
||||||
pw_module_load(struct pw_core *core,
|
pw_module_load(struct pw_context *context,
|
||||||
const char *name, /**< name of the module */
|
const char *name, /**< name of the module */
|
||||||
const char *args /**< arguments of the module */,
|
const char *args /**< arguments of the module */,
|
||||||
struct pw_properties *properties /**< extra global properties */);
|
struct pw_properties *properties /**< extra global properties */);
|
||||||
|
|
||||||
/** Get the core of a module */
|
/** Get the context of a module */
|
||||||
struct pw_core * pw_module_get_core(struct pw_module *module);
|
struct pw_context * pw_module_get_context(struct pw_module *module);
|
||||||
|
|
||||||
/** Get the global of a module */
|
/** Get the global of a module */
|
||||||
struct pw_global * pw_module_get_global(struct pw_module *module);
|
struct pw_global * pw_module_get_global(struct pw_module *module);
|
||||||
|
|
|
||||||
|
|
@ -548,11 +548,11 @@ static const struct pw_global_events global_events = {
|
||||||
.destroy = global_destroy,
|
.destroy = global_destroy,
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline void insert_driver(struct pw_core *core, struct pw_node *node)
|
static inline void insert_driver(struct pw_context *context, struct pw_node *node)
|
||||||
{
|
{
|
||||||
struct pw_node *n, *t;
|
struct pw_node *n, *t;
|
||||||
|
|
||||||
spa_list_for_each_safe(n, t, &core->driver_list, driver_link) {
|
spa_list_for_each_safe(n, t, &context->driver_list, driver_link) {
|
||||||
if (n->priority_master < node->priority_master)
|
if (n->priority_master < node->priority_master)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -563,7 +563,7 @@ SPA_EXPORT
|
||||||
int pw_node_register(struct pw_node *this,
|
int pw_node_register(struct pw_node *this,
|
||||||
struct pw_properties *properties)
|
struct pw_properties *properties)
|
||||||
{
|
{
|
||||||
struct pw_core *core = this->core;
|
struct pw_context *context = this->context;
|
||||||
struct pw_port *port;
|
struct pw_port *port;
|
||||||
const char *keys[] = {
|
const char *keys[] = {
|
||||||
PW_KEY_OBJECT_PATH,
|
PW_KEY_OBJECT_PATH,
|
||||||
|
|
@ -594,7 +594,7 @@ int pw_node_register(struct pw_node *this,
|
||||||
|
|
||||||
pw_properties_update_keys(properties, &this->properties->dict, keys);
|
pw_properties_update_keys(properties, &this->properties->dict, keys);
|
||||||
|
|
||||||
this->global = pw_global_new(core,
|
this->global = pw_global_new(context,
|
||||||
PW_TYPE_INTERFACE_Node,
|
PW_TYPE_INTERFACE_Node,
|
||||||
PW_VERSION_NODE_PROXY,
|
PW_VERSION_NODE_PROXY,
|
||||||
properties,
|
properties,
|
||||||
|
|
@ -603,9 +603,9 @@ int pw_node_register(struct pw_node *this,
|
||||||
if (this->global == NULL)
|
if (this->global == NULL)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
spa_list_append(&core->node_list, &this->link);
|
spa_list_append(&context->node_list, &this->link);
|
||||||
if (this->driver)
|
if (this->driver)
|
||||||
insert_driver(core, this);
|
insert_driver(context, this);
|
||||||
this->registered = true;
|
this->registered = true;
|
||||||
|
|
||||||
this->rt.activation->position.clock.id = this->global->id;
|
this->rt.activation->position.clock.id = this->global->id;
|
||||||
|
|
@ -624,7 +624,7 @@ int pw_node_register(struct pw_node *this,
|
||||||
spa_list_for_each(port, &this->output_ports, link)
|
spa_list_for_each(port, &this->output_ports, link)
|
||||||
pw_port_register(port, NULL);
|
pw_port_register(port, NULL);
|
||||||
|
|
||||||
pw_core_recalc_graph(core);
|
pw_context_recalc_graph(context);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
@ -755,7 +755,7 @@ static void check_properties(struct pw_node *node)
|
||||||
node->driver = driver;
|
node->driver = driver;
|
||||||
if (node->registered) {
|
if (node->registered) {
|
||||||
if (driver)
|
if (driver)
|
||||||
insert_driver(node->core, node);
|
insert_driver(node->context, node);
|
||||||
else
|
else
|
||||||
spa_list_remove(&node->driver_link);
|
spa_list_remove(&node->driver_link);
|
||||||
}
|
}
|
||||||
|
|
@ -779,7 +779,7 @@ static void check_properties(struct pw_node *node)
|
||||||
pw_log_debug(NAME" %p: driver:%d recalc:%d", node, node->driver, do_recalc);
|
pw_log_debug(NAME" %p: driver:%d recalc:%d", node, node->driver, do_recalc);
|
||||||
|
|
||||||
if (do_recalc)
|
if (do_recalc)
|
||||||
pw_core_recalc_graph(node->core);
|
pw_context_recalc_graph(node->context);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dump_states(struct pw_node *driver)
|
static void dump_states(struct pw_node *driver)
|
||||||
|
|
@ -808,7 +808,7 @@ static inline int resume_node(struct pw_node *this, int status)
|
||||||
struct pw_node_target *t;
|
struct pw_node_target *t;
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
struct pw_node_activation *activation = this->rt.activation;
|
struct pw_node_activation *activation = this->rt.activation;
|
||||||
struct spa_system *data_system = this->core->data_system;
|
struct spa_system *data_system = this->context->data_system;
|
||||||
uint64_t nsec;
|
uint64_t nsec;
|
||||||
|
|
||||||
spa_system_clock_gettime(data_system, CLOCK_MONOTONIC, &ts);
|
spa_system_clock_gettime(data_system, CLOCK_MONOTONIC, &ts);
|
||||||
|
|
@ -853,7 +853,7 @@ static inline int process_node(void *data)
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
struct pw_port *p;
|
struct pw_port *p;
|
||||||
struct pw_node_activation *a = this->rt.activation;
|
struct pw_node_activation *a = this->rt.activation;
|
||||||
struct spa_system *data_system = this->core->data_system;
|
struct spa_system *data_system = this->context->data_system;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
spa_system_clock_gettime(data_system, CLOCK_MONOTONIC, &ts);
|
spa_system_clock_gettime(data_system, CLOCK_MONOTONIC, &ts);
|
||||||
|
|
@ -905,7 +905,7 @@ static inline int process_node(void *data)
|
||||||
static void node_on_fd_events(struct spa_source *source)
|
static void node_on_fd_events(struct spa_source *source)
|
||||||
{
|
{
|
||||||
struct pw_node *this = source->data;
|
struct pw_node *this = source->data;
|
||||||
struct spa_system *data_system = this->core->data_system;
|
struct spa_system *data_system = this->context->data_system;
|
||||||
|
|
||||||
if (source->rmask & (SPA_IO_ERR | SPA_IO_HUP)) {
|
if (source->rmask & (SPA_IO_ERR | SPA_IO_HUP)) {
|
||||||
pw_log_warn(NAME" %p: got socket error %08x", this, source->rmask);
|
pw_log_warn(NAME" %p: got socket error %08x", this, source->rmask);
|
||||||
|
|
@ -943,14 +943,14 @@ static void reset_position(struct spa_io_position *pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
struct pw_node *pw_node_new(struct pw_core *core,
|
struct pw_node *pw_node_new(struct pw_context *context,
|
||||||
struct pw_properties *properties,
|
struct pw_properties *properties,
|
||||||
size_t user_data_size)
|
size_t user_data_size)
|
||||||
{
|
{
|
||||||
struct impl *impl;
|
struct impl *impl;
|
||||||
struct pw_node *this;
|
struct pw_node *this;
|
||||||
size_t size;
|
size_t size;
|
||||||
struct spa_system *data_system = core->data_system;
|
struct spa_system *data_system = context->data_system;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
impl = calloc(1, sizeof(struct impl) + user_data_size);
|
impl = calloc(1, sizeof(struct impl) + user_data_size);
|
||||||
|
|
@ -960,7 +960,7 @@ struct pw_node *pw_node_new(struct pw_core *core,
|
||||||
}
|
}
|
||||||
|
|
||||||
this = &impl->this;
|
this = &impl->this;
|
||||||
this->core = core;
|
this->context = context;
|
||||||
|
|
||||||
if (user_data_size > 0)
|
if (user_data_size > 0)
|
||||||
this->user_data = SPA_MEMBER(impl, sizeof(struct impl), void);
|
this->user_data = SPA_MEMBER(impl, sizeof(struct impl), void);
|
||||||
|
|
@ -987,7 +987,7 @@ struct pw_node *pw_node_new(struct pw_core *core,
|
||||||
|
|
||||||
size = sizeof(struct pw_node_activation);
|
size = sizeof(struct pw_node_activation);
|
||||||
|
|
||||||
this->activation = pw_mempool_alloc(this->core->pool,
|
this->activation = pw_mempool_alloc(this->context->pool,
|
||||||
PW_MEMBLOCK_FLAG_READWRITE |
|
PW_MEMBLOCK_FLAG_READWRITE |
|
||||||
PW_MEMBLOCK_FLAG_SEAL |
|
PW_MEMBLOCK_FLAG_SEAL |
|
||||||
PW_MEMBLOCK_FLAG_MAP,
|
PW_MEMBLOCK_FLAG_MAP,
|
||||||
|
|
@ -997,13 +997,13 @@ struct pw_node *pw_node_new(struct pw_core *core,
|
||||||
goto error_clean;
|
goto error_clean;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl->work = pw_work_queue_new(this->core->main_loop);
|
impl->work = pw_work_queue_new(this->context->main_loop);
|
||||||
if (impl->work == NULL) {
|
if (impl->work == NULL) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
goto error_clean;
|
goto error_clean;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->data_loop = core->data_loop;
|
this->data_loop = context->data_loop;
|
||||||
|
|
||||||
spa_list_init(&this->slave_list);
|
spa_list_init(&this->slave_list);
|
||||||
|
|
||||||
|
|
@ -1045,7 +1045,7 @@ error_clean:
|
||||||
if (this->activation)
|
if (this->activation)
|
||||||
pw_memblock_unref(this->activation);
|
pw_memblock_unref(this->activation);
|
||||||
if (this->source.fd != -1)
|
if (this->source.fd != -1)
|
||||||
spa_system_close(this->core->data_system, this->source.fd);
|
spa_system_close(this->context->data_system, this->source.fd);
|
||||||
free(impl);
|
free(impl);
|
||||||
error_exit:
|
error_exit:
|
||||||
if (properties)
|
if (properties)
|
||||||
|
|
@ -1067,9 +1067,9 @@ void * pw_node_get_user_data(struct pw_node *node)
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
struct pw_core * pw_node_get_core(struct pw_node *node)
|
struct pw_context * pw_node_get_context(struct pw_node *node)
|
||||||
{
|
{
|
||||||
return node->core;
|
return node->context;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
|
|
@ -1532,7 +1532,7 @@ void pw_node_destroy(struct pw_node *node)
|
||||||
pw_global_destroy(node->global);
|
pw_global_destroy(node->global);
|
||||||
}
|
}
|
||||||
|
|
||||||
pw_core_recalc_graph(node->core);
|
pw_context_recalc_graph(node->context);
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: free", node);
|
pw_log_debug(NAME" %p: free", node);
|
||||||
pw_node_emit_free(node);
|
pw_node_emit_free(node);
|
||||||
|
|
@ -1548,7 +1548,7 @@ void pw_node_destroy(struct pw_node *node)
|
||||||
|
|
||||||
clear_info(node);
|
clear_info(node);
|
||||||
|
|
||||||
spa_system_close(node->core->data_system, node->source.fd);
|
spa_system_close(node->context->data_system, node->source.fd);
|
||||||
free(impl);
|
free(impl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1831,7 +1831,7 @@ int pw_node_set_active(struct pw_node *node, bool active)
|
||||||
node_activate(node);
|
node_activate(node);
|
||||||
|
|
||||||
if (node->registered)
|
if (node->registered)
|
||||||
pw_core_recalc_graph(node->core);
|
pw_context_recalc_graph(node->context);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ struct pw_node;
|
||||||
#include <spa/node/node.h>
|
#include <spa/node/node.h>
|
||||||
#include <spa/node/event.h>
|
#include <spa/node/event.h>
|
||||||
|
|
||||||
#include <pipewire/core.h>
|
#include <pipewire/context.h>
|
||||||
#include <pipewire/global.h>
|
#include <pipewire/global.h>
|
||||||
#include <pipewire/introspect.h>
|
#include <pipewire/introspect.h>
|
||||||
#include <pipewire/port.h>
|
#include <pipewire/port.h>
|
||||||
|
|
@ -102,7 +102,7 @@ struct pw_node_events {
|
||||||
|
|
||||||
/** Create a new node \memberof pw_node */
|
/** Create a new node \memberof pw_node */
|
||||||
struct pw_node *
|
struct pw_node *
|
||||||
pw_node_new(struct pw_core *core, /**< the core */
|
pw_node_new(struct pw_context *context, /**< the context */
|
||||||
struct pw_properties *properties, /**< extra properties */
|
struct pw_properties *properties, /**< extra properties */
|
||||||
size_t user_data_size /**< user data size */);
|
size_t user_data_size /**< user data size */);
|
||||||
|
|
||||||
|
|
@ -119,8 +119,8 @@ const struct pw_node_info *pw_node_get_info(struct pw_node *node);
|
||||||
/** Get node user_data. The size of the memory was given in \ref pw_node_new */
|
/** Get node user_data. The size of the memory was given in \ref pw_node_new */
|
||||||
void * pw_node_get_user_data(struct pw_node *node);
|
void * pw_node_get_user_data(struct pw_node *node);
|
||||||
|
|
||||||
/** Get the core of this node */
|
/** Get the context of this node */
|
||||||
struct pw_core *pw_node_get_core(struct pw_node *node);
|
struct pw_context *pw_node_get_context(struct pw_node *node);
|
||||||
|
|
||||||
/** Get the global of this node */
|
/** Get the global of this node */
|
||||||
struct pw_global *pw_node_get_global(struct pw_node *node);
|
struct pw_global *pw_node_get_global(struct pw_node *node);
|
||||||
|
|
|
||||||
|
|
@ -504,7 +504,7 @@ const char *pw_get_client_name(void)
|
||||||
* \memberof pw_pipewire
|
* \memberof pw_pipewire
|
||||||
*/
|
*/
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
void pw_fill_connect_properties(struct pw_core *core, struct pw_properties *properties)
|
void pw_fill_connect_properties(struct pw_context *context, struct pw_properties *properties)
|
||||||
{
|
{
|
||||||
const char *val;
|
const char *val;
|
||||||
|
|
||||||
|
|
@ -534,10 +534,10 @@ void pw_fill_connect_properties(struct pw_core *core, struct pw_properties *prop
|
||||||
pw_properties_set(properties, PW_KEY_WINDOW_X11_DISPLAY,
|
pw_properties_set(properties, PW_KEY_WINDOW_X11_DISPLAY,
|
||||||
getenv("DISPLAY"));
|
getenv("DISPLAY"));
|
||||||
}
|
}
|
||||||
pw_properties_set(properties, PW_KEY_CORE_VERSION, core->info.version);
|
pw_properties_set(properties, PW_KEY_CORE_VERSION, context->info.version);
|
||||||
pw_properties_set(properties, PW_KEY_CORE_NAME, core->info.name);
|
pw_properties_set(properties, PW_KEY_CORE_NAME, context->info.name);
|
||||||
|
|
||||||
if ((val = pw_properties_get(core->properties, PW_KEY_CORE_DAEMON)))
|
if ((val = pw_properties_get(context->properties, PW_KEY_CORE_DAEMON)))
|
||||||
pw_properties_set(properties, PW_KEY_CORE_DAEMON, val);
|
pw_properties_set(properties, PW_KEY_CORE_DAEMON, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -549,7 +549,7 @@ void pw_fill_connect_properties(struct pw_core *core, struct pw_properties *prop
|
||||||
* \memberof pw_pipewire
|
* \memberof pw_pipewire
|
||||||
*/
|
*/
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
void pw_fill_stream_properties(struct pw_core *core, struct pw_properties *properties)
|
void pw_fill_stream_properties(struct pw_context *context, struct pw_properties *properties)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ extern "C" {
|
||||||
#include <spa/support/plugin.h>
|
#include <spa/support/plugin.h>
|
||||||
|
|
||||||
#include <pipewire/client.h>
|
#include <pipewire/client.h>
|
||||||
#include <pipewire/core.h>
|
#include <pipewire/context.h>
|
||||||
#include <pipewire/device.h>
|
#include <pipewire/device.h>
|
||||||
#include <pipewire/interfaces.h>
|
#include <pipewire/interfaces.h>
|
||||||
#include <pipewire/introspect.h>
|
#include <pipewire/introspect.h>
|
||||||
|
|
@ -62,8 +62,8 @@ extern "C" {
|
||||||
* This document describes the API for the PipeWire multimedia framework.
|
* This document describes the API for the PipeWire multimedia framework.
|
||||||
* The API consists of two parts:
|
* The API consists of two parts:
|
||||||
*
|
*
|
||||||
* \li The core API and tools to build new modules (See
|
* \li The context API and tools to build new modules (See
|
||||||
* \subpage page_core_api)
|
* \subpage page_context_api)
|
||||||
* \li The remote API (See \subpage page_remote_api)
|
* \li The remote API (See \subpage page_remote_api)
|
||||||
*
|
*
|
||||||
* \section sec_errors Error reporting
|
* \section sec_errors Error reporting
|
||||||
|
|
@ -129,10 +129,10 @@ const char *
|
||||||
pw_get_client_name(void);
|
pw_get_client_name(void);
|
||||||
|
|
||||||
void
|
void
|
||||||
pw_fill_connect_properties(struct pw_core *core, struct pw_properties *properties);
|
pw_fill_connect_properties(struct pw_context *context, struct pw_properties *properties);
|
||||||
|
|
||||||
void
|
void
|
||||||
pw_fill_stream_properties(struct pw_core *core, struct pw_properties *properties);
|
pw_fill_stream_properties(struct pw_context *context, struct pw_properties *properties);
|
||||||
|
|
||||||
enum pw_direction
|
enum pw_direction
|
||||||
pw_direction_reverse(enum pw_direction direction);
|
pw_direction_reverse(enum pw_direction direction);
|
||||||
|
|
|
||||||
|
|
@ -538,7 +538,7 @@ static int setup_mixer(struct pw_port *port, const struct spa_pod *param)
|
||||||
}
|
}
|
||||||
|
|
||||||
items[0] = SPA_DICT_ITEM_INIT(SPA_KEY_LIBRARY_NAME, fallback_lib);
|
items[0] = SPA_DICT_ITEM_INIT(SPA_KEY_LIBRARY_NAME, fallback_lib);
|
||||||
handle = pw_core_load_spa_handle(port->node->core, factory_name,
|
handle = pw_context_load_spa_handle(port->node->context, factory_name,
|
||||||
&SPA_DICT_INIT_ARRAY(items));
|
&SPA_DICT_INIT_ARRAY(items));
|
||||||
if (handle == NULL)
|
if (handle == NULL)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
@ -645,7 +645,7 @@ static int check_param_io(void *data, int seq, uint32_t id,
|
||||||
switch (pid) {
|
switch (pid) {
|
||||||
case SPA_IO_Control:
|
case SPA_IO_Control:
|
||||||
case SPA_IO_Notify:
|
case SPA_IO_Notify:
|
||||||
pw_control_new(node->core, port, pid, psize, 0);
|
pw_control_new(node->context, port, pid, psize, 0);
|
||||||
SPA_FLAG_SET(port->flags, PW_PORT_FLAG_CONTROL);
|
SPA_FLAG_SET(port->flags, PW_PORT_FLAG_CONTROL);
|
||||||
break;
|
break;
|
||||||
case SPA_IO_Buffers:
|
case SPA_IO_Buffers:
|
||||||
|
|
@ -804,7 +804,7 @@ int pw_port_register(struct pw_port *port,
|
||||||
pw_properties_setf(properties, PW_KEY_NODE_ID, "%d", node->global->id);
|
pw_properties_setf(properties, PW_KEY_NODE_ID, "%d", node->global->id);
|
||||||
pw_properties_update_keys(properties, &port->properties->dict, keys);
|
pw_properties_update_keys(properties, &port->properties->dict, keys);
|
||||||
|
|
||||||
port->global = pw_global_new(node->core,
|
port->global = pw_global_new(node->context,
|
||||||
PW_TYPE_INTERFACE_Port,
|
PW_TYPE_INTERFACE_Port,
|
||||||
PW_VERSION_PORT_PROXY,
|
PW_VERSION_PORT_PROXY,
|
||||||
properties,
|
properties,
|
||||||
|
|
@ -1215,7 +1215,7 @@ static int negotiate_mixer_buffers(struct pw_port *port, uint32_t flags,
|
||||||
|
|
||||||
pw_buffers_clear(&port->mix_buffers);
|
pw_buffers_clear(&port->mix_buffers);
|
||||||
|
|
||||||
if ((res = pw_buffers_negotiate(node->core, alloc_flags,
|
if ((res = pw_buffers_negotiate(node->context, alloc_flags,
|
||||||
port->mix, 0,
|
port->mix, 0,
|
||||||
node->node, port->port_id,
|
node->node, port->port_id,
|
||||||
&port->mix_buffers)) < 0) {
|
&port->mix_buffers)) < 0) {
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue