Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Librem5
debs
callaudiod
Commits
ea3d21d5
Commit
ea3d21d5
authored
Oct 13, 2020
by
Arnaud Ferraris
Browse files
tools: add helper command-line tool for easy testing
parent
f17258ff
Changes
3
Hide whitespace changes
Inline
Side-by-side
meson.build
View file @
ea3d21d5
...
...
@@ -57,3 +57,4 @@ config_h = configure_file (
subdir
(
'data'
)
subdir
(
'libcallaudio'
)
subdir
(
'src'
)
subdir
(
'tools'
)
tools/callaudiocli.c
0 → 100644
View file @
ea3d21d5
/*
* Copyright (C) 2019 Purism SPC
* Copyright (C) 2020 Arnaud Ferraris <arnaud.ferraris@gmail.com>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include
"libcallaudio.h"
#include
<glib.h>
int
main
(
int
argc
,
char
*
argv
[
0
])
{
g_autoptr
(
GOptionContext
)
opt_context
=
NULL
;
g_autoptr
(
GError
)
err
=
NULL
;
int
mode
=
-
1
;
int
speaker
=
-
1
;
int
mic
=
-
1
;
const
GOptionEntry
options
[]
=
{
{
"select-mode"
,
'm'
,
0
,
G_OPTION_ARG_INT
,
&
mode
,
"Select mode"
,
NULL
},
{
"enable-speaker"
,
's'
,
0
,
G_OPTION_ARG_INT
,
&
speaker
,
"Enable speaker"
,
NULL
},
{
"mute-mic"
,
'u'
,
0
,
G_OPTION_ARG_INT
,
&
mic
,
"Mute microphone"
,
NULL
},
{
NULL
,
0
,
0
,
G_OPTION_ARG_NONE
,
NULL
,
NULL
,
NULL
}
};
opt_context
=
g_option_context_new
(
"- A helper tool for callaudiod"
);
g_option_context_add_main_entries
(
opt_context
,
options
,
NULL
);
if
(
!
g_option_context_parse
(
opt_context
,
&
argc
,
&
argv
,
&
err
))
{
g_warning
(
"%s"
,
err
->
message
);
return
1
;
}
if
(
!
call_audio_init
(
&
err
))
{
g_print
(
"Failed to init libcallaudio: %s
\n
"
,
err
->
message
);
return
1
;
}
if
(
mode
==
CALL_AUDIO_MODE_DEFAULT
||
mode
==
CALL_AUDIO_MODE_CALL
)
call_audio_select_mode
(
mode
);
if
(
speaker
==
0
||
speaker
==
1
)
call_audio_enable_speaker
((
gboolean
)
speaker
);
if
(
mic
==
0
||
mic
==
1
)
call_audio_mute_mic
((
gboolean
)
mic
);
call_audio_deinit
();
return
0
;
}
tools/meson.build
0 → 100644
View file @
ea3d21d5
callaudiocli_sources
=
[
'callaudiocli.c'
,
]
callaudiocli_deps
=
[
libcallaudio_dep
,
dependency
(
'gobject-2.0'
),
dependency
(
'gio-unix-2.0'
),
]
executable
(
'callaudiocli'
,
callaudiocli_sources
,
dependencies
:
callaudiocli_deps
,
install
:
true
,
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment