blob: 6776472350027b4f54c4e986f7044d1250f8f963 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
/*
* Copyright (C) 2022,2023 Konsulko Group
*
* SPDX-License-Identifier: Apache-2.0
*/
//#include <unistd.h>
//#include <signal.h>
#include <glib.h>
#include <glib-unix.h>
#include <systemd/sd-daemon.h>
#include "AudiomixerService.h"
static gboolean quit_cb(gpointer user_data)
{
GMainLoop *loop = (GMainLoop*) user_data;
g_info("Quitting...");
if (loop)
g_idle_add(G_SOURCE_FUNC(g_main_loop_quit), loop);
else
exit(0);
return G_SOURCE_REMOVE;
}
int main(int argc, char** argv)
{
GMainLoop *loop = NULL;
loop = g_main_loop_new(NULL, FALSE);
if (!loop) {
std::cerr << "Could not create GLib event loop" << std::endl;
exit(1);
}
KuksaConfig config("agl-service-audiomixer");
g_unix_signal_add(SIGTERM, quit_cb, (gpointer) loop);
g_unix_signal_add(SIGINT, quit_cb, (gpointer) loop);
AudiomixerService service(config, loop);
sd_notify(0, "READY=1");
g_main_loop_run(loop);
// Clean up
g_main_loop_unref(loop);
return 0;
}
|