pipewire/src/daemon/main.c

61 lines
1.6 KiB
C
Raw Normal View History

2017-05-23 19:15:33 +02:00
/* PipeWire
2015-04-16 16:58:33 +02:00
* Copyright (C) 2015 Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
2017-07-11 15:57:20 +02:00
#include <pipewire/pipewire.h>
#include <pipewire/core.h>
#include <pipewire/module.h>
2015-04-16 16:58:33 +02:00
#include "daemon-config.h"
2017-05-26 08:05:01 +02:00
int main(int argc, char *argv[])
2015-04-16 16:58:33 +02:00
{
2017-05-26 08:05:01 +02:00
struct pw_core *core;
struct pw_main_loop *loop;
struct pw_daemon_config *config;
char *err = NULL;
struct pw_properties *props;
2017-05-26 08:05:01 +02:00
pw_init(&argc, &argv);
/* parse configuration */
config = pw_daemon_config_new();
if (!pw_daemon_config_load(config, &err)) {
pw_log_error("failed to parse config: %s", err);
free(err);
return -1;
}
props = pw_properties_new("pipewire.core.name", "pipewire-0",
"pipewire.daemon", "1", NULL);
loop = pw_main_loop_new(props);
core = pw_core_new(pw_main_loop_get_loop(loop), props);
2017-05-26 08:05:01 +02:00
pw_daemon_config_run_commands(config, core);
2015-04-16 16:58:33 +02:00
2017-05-26 08:05:01 +02:00
pw_main_loop_run(loop);
2015-04-16 16:58:33 +02:00
2017-05-26 08:05:01 +02:00
pw_main_loop_destroy(loop);
2017-05-26 08:05:01 +02:00
pw_core_destroy(core);
2015-04-16 16:58:33 +02:00
2017-05-26 08:05:01 +02:00
return 0;
2015-04-16 16:58:33 +02:00
}