mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-17 07:00:03 -05:00
Rework dbus handling
Remove the Daemon object and remove all dbus code from the main objects. We can use the signals in a separate module to create and destroy the DBus interfaces. Move the dbus protocol in a module Move the autolink policy to a module
This commit is contained in:
parent
b9e2b1c0e3
commit
dfbfb4c9ee
28 changed files with 1122 additions and 1007 deletions
|
|
@ -179,7 +179,7 @@ pinos_daemon_config_load (PinosDaemonConfig *config,
|
|||
/**
|
||||
* pinos_daemon_config_run_commands:
|
||||
* @config: A #PinosDaemonConfig
|
||||
* @daemon: A #PinosDaemon
|
||||
* @core: A #PinosCore
|
||||
*
|
||||
* Run all commands that have been parsed. The list of commands will be cleared
|
||||
* when this function has been called.
|
||||
|
|
@ -188,14 +188,14 @@ pinos_daemon_config_load (PinosDaemonConfig *config,
|
|||
*/
|
||||
bool
|
||||
pinos_daemon_config_run_commands (PinosDaemonConfig *config,
|
||||
PinosDaemon *daemon)
|
||||
PinosCore *core)
|
||||
{
|
||||
char *err = NULL;
|
||||
bool ret = true;
|
||||
PinosCommand *command, *tmp;
|
||||
|
||||
spa_list_for_each (command, &config->commands, link) {
|
||||
if (!pinos_command_run (command, daemon->core, &err)) {
|
||||
if (!pinos_command_run (command, core, &err)) {
|
||||
pinos_log_warn ("could not run command %s: %s", command->name, err);
|
||||
free (err);
|
||||
ret = false;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <pinos/server/daemon.h>
|
||||
#include <pinos/server/core.h>
|
||||
|
||||
typedef struct _PinosDaemonConfig PinosDaemonConfig;
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ bool pinos_daemon_config_load_file (PinosDaemonConfig *confi
|
|||
bool pinos_daemon_config_load (PinosDaemonConfig *config,
|
||||
char **err);
|
||||
bool pinos_daemon_config_run_commands (PinosDaemonConfig *config,
|
||||
PinosDaemon *daemon);
|
||||
PinosCore *core);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
#include <pinos/client/pinos.h>
|
||||
#include <pinos/server/daemon.h>
|
||||
#include <pinos/server/core.h>
|
||||
#include <pinos/server/module.h>
|
||||
|
||||
#include "daemon-config.h"
|
||||
|
|
@ -27,37 +27,30 @@ int
|
|||
main (int argc, char *argv[])
|
||||
{
|
||||
PinosCore *core;
|
||||
PinosDaemon *daemon;
|
||||
PinosMainLoop *loop;
|
||||
PinosDaemonConfig *config;
|
||||
PinosProperties *props;
|
||||
char *err = NULL;
|
||||
|
||||
pinos_init (&argc, &argv);
|
||||
|
||||
loop = pinos_main_loop_new (NULL);
|
||||
core = pinos_core_new (loop);
|
||||
|
||||
/* parse configuration */
|
||||
config = pinos_daemon_config_new ();
|
||||
if (!pinos_daemon_config_load (config, &err)) {
|
||||
g_error ("failed to parse config: %s", err);
|
||||
free (err);
|
||||
return -1;
|
||||
}
|
||||
|
||||
props = pinos_properties_new ("test", "test", NULL);
|
||||
daemon = pinos_daemon_new (core,
|
||||
props);
|
||||
loop = pinos_main_loop_new ();
|
||||
core = pinos_core_new (loop);
|
||||
|
||||
pinos_daemon_config_run_commands (config, daemon);
|
||||
|
||||
pinos_daemon_start (daemon);
|
||||
pinos_daemon_config_run_commands (config, core);
|
||||
|
||||
pinos_main_loop_run (loop);
|
||||
|
||||
pinos_properties_free (props);
|
||||
pinos_main_loop_destroy (loop);
|
||||
pinos_daemon_destroy (daemon);
|
||||
|
||||
pinos_core_destroy (core);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
load-module libpinos-module-protocol-dbus
|
||||
load-module libpinos-module-spa
|
||||
load-module libpinos-module-autolink
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue