File callaudiod-0.1.9.obscpio of Package callaudiod
07070100000000000081A400000000000000000000000164632D590000011C000000000000000000000000000000000000001F00000000callaudiod-0.1.9/.editorconfigroot = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
[meson.build]
indent_size = 2
tab_size = 2
indent_style = space
[*.{c,h}]
indent_size = 4
tab_size = 4
indent_style = space
max_line_length = 80
[*.xml]
indent_size = 2
tab_size = 2
indent_style = space
07070100000001000041ED00000000000000000000000264632D5900000000000000000000000000000000000000000000001C00000000callaudiod-0.1.9/.gitlab-ci07070100000002000041ED00000000000000000000000264632D5900000000000000000000000000000000000000000000002300000000callaudiod-0.1.9/.gitlab-ci/debian07070100000003000081A400000000000000000000000164632D5900000026000000000000000000000000000000000000003600000000callaudiod-0.1.9/.gitlab-ci/debian/callaudiod.install/usr/bin/callaudiod
/usr/share/dbus-1
07070100000004000081A400000000000000000000000164632D590000007F000000000000000000000000000000000000002D00000000callaudiod-0.1.9/.gitlab-ci/debian/changelogcallaudiod (@@VERSION@@~ci-1) unstable; urgency=medium
* CI build
-- CI <ci@example.org> Thu, 01 Jan 1970 00:00:00 +0000
07070100000005000081A400000000000000000000000164632D5900000BDB000000000000000000000000000000000000002B00000000callaudiod-0.1.9/.gitlab-ci/debian/controlSource: callaudiod
Section: comm
Priority: optional
Maintainer: DebianOnMobile Maintainers <debian-on-mobile-maintainers@alioth-lists.debian.net>
Uploaders: Arnaud Ferraris <arnaud.ferraris@gmail.com>
Build-Depends:
dbus,
debhelper-compat (= 13),
gtk-doc-tools,
jq,
libasound2-dev,
libglib2.0-dev,
libpulse-dev,
meson,
pkg-config,
Standards-Version: 4.5.0
Homepage: https://gitlab.com/mobian1/callaudiod
Vcs-Git: https://salsa.debian.org/DebianOnMobile-team/callaudiod.git
Vcs-Browser: https://salsa.debian.org/DebianOnMobile-team/callaudiod
Rules-Requires-Root: no
Package: callaudiod
Architecture: any
Depends:
${misc:Depends},
${shlibs:Depends},
pulseaudio,
Description: Call audio routing daemon
callaudiod is a daemon for dealing with audio routing during phone calls.
It provides a D-Bus interface allowing other programs to:
* switch audio profiles
* output audio to the speaker or back to its original port
* mute the microphone
.
This package contains the daemon and D-Bus interface definition.
Package: libcallaudio-0-1
Architecture: any
Multi-Arch: same
Section: libs
Depends:
${misc:Depends},
${shlibs:Depends},
Description: Library for audio routing during voice calls
callaudiod is a daemon for dealing with audio routing during phone calls.
It provides a D-Bus interface allowing other programs to:
* switch audio profiles
* output audio to the speaker or back to its original port
* mute the microphone
.
This package contains the shared libraries for applications interfacing with
callaudiod.
Package: libcallaudio-dev
Architecture: any
Multi-Arch: same
Section: libdevel
Depends:
libcallaudio-0-1 (= ${binary:Version}),
libglib2.0-dev,
${misc:Depends},
${shlibs:Depends},
Description: Development files for libcallaudio
callaudiod is a daemon for dealing with audio routing during phone calls.
It provides a D-Bus interface allowing other programs to:
* switch audio profiles
* output audio to the speaker or back to its original port
* mute the microphone
.
This package contains development files to use when writing applications that
interface with callaudiod.
Package: libcallaudio-doc
Architecture: all
Section: doc
Depends:
${misc:Depends}
Suggests: devhelp
Description: Documentation for libcallaudio's API
callaudiod is a daemon for dealing with audio routing during phone calls.
It provides a D-Bus interface allowing other programs to:
* switch audio profiles
* output audio to the speaker or back to its original port
* mute the microphone
.
This package contains the API documentation.
Package: libcallaudio-tools
Architecture: any
Depends:
${misc:Depends},
${shlibs:Depends},
Description: Helper tools for libcallaudio
callaudiod is a daemon for dealing with audio routing during phone calls.
It provides a D-Bus interface allowing other programs to:
* switch audio profiles
* output audio to the speaker or back to its original port
* mute the microphone
.
This package contains helper tools for libcallaudio.
07070100000006000081A400000000000000000000000164632D5900000828000000000000000000000000000000000000002D00000000callaudiod-0.1.9/.gitlab-ci/debian/copyrightFormat: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: callaudiod
Upstream-Contact: Arnaud Ferraris <arnaud.ferraris@gmail.com>
Source: https://gitlab.com/mobian1/callaudiod
Files: *
Copyright:
2018, 2019, 2020 Purism SPC
2020 Arnaud Ferraris <arnaud.ferraris@gmail.com>
License: LGPL-2.1-or-later
Files:
src/*
tools/*
Copyright:
2018, 2019, 2020 Purism SPC
2020 Arnaud Ferraris <arnaud.ferraris@gmail.com>
License: GPL-3.0-or-later
License: LGPL-2.1-or-later
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
.
This package 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 Lesser General Public License for more details.
.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU Lesser General
Public License version 3 can be found in "/usr/share/common-licenses/LGPL-2.1".
License: GPL-3.0-or-later
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
.
This package 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 General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
07070100000007000081A400000000000000000000000164632D590000001F000000000000000000000000000000000000003C00000000callaudiod-0.1.9/.gitlab-ci/debian/libcallaudio-0-1.install/usr/lib/*/libcallaudio-*.so.0
07070100000008000081A400000000000000000000000164632D59000008FE000000000000000000000000000000000000003C00000000callaudiod-0.1.9/.gitlab-ci/debian/libcallaudio-0-1.symbolslibcallaudio-0.1.so.0 libcallaudio-0-1 #MINVER#
* Build-Depends-Package: libcallaudio-dev
LIBCALLAUDIO_0_0_0@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_dbus_call_audio_call_enable_speaker@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_dbus_call_audio_call_enable_speaker_finish@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_dbus_call_audio_call_enable_speaker_sync@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_dbus_call_audio_call_mute_mic@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_dbus_call_audio_call_mute_mic_finish@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_dbus_call_audio_call_mute_mic_sync@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_dbus_call_audio_call_select_mode@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_dbus_call_audio_call_select_mode_finish@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_dbus_call_audio_call_select_mode_sync@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_dbus_call_audio_complete_enable_speaker@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_dbus_call_audio_complete_mute_mic@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_dbus_call_audio_complete_select_mode@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_dbus_call_audio_get_type@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_dbus_call_audio_interface_info@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_dbus_call_audio_override_properties@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_dbus_call_audio_proxy_get_type@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_dbus_call_audio_proxy_new@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_dbus_call_audio_proxy_new_finish@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_dbus_call_audio_proxy_new_for_bus@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_dbus_call_audio_proxy_new_for_bus_finish@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_dbus_call_audio_proxy_new_for_bus_sync@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_dbus_call_audio_proxy_new_sync@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_dbus_call_audio_skeleton_get_type@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_dbus_call_audio_skeleton_new@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_deinit@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_enable_speaker@LIBCALLAUDIO_0_0_0 0.0.4
call_audio_enable_speaker_async@LIBCALLAUDIO_0_0_0 0.0.5
call_audio_is_inited@LIBCALLAUDIO_0_0_0 0.0.4
call_audio_init@LIBCALLAUDIO_0_0_0 0.0.1
call_audio_mute_mic@LIBCALLAUDIO_0_0_0 0.0.4
call_audio_mute_mic_async@LIBCALLAUDIO_0_0_0 0.0.5
call_audio_select_mode@LIBCALLAUDIO_0_0_0 0.0.4
call_audio_select_mode_async@LIBCALLAUDIO_0_0_0 0.0.5
07070100000009000081A400000000000000000000000164632D5900000051000000000000000000000000000000000000003C00000000callaudiod-0.1.9/.gitlab-ci/debian/libcallaudio-dev.install/usr/include
/usr/lib/*/libcallaudio-*.so
/usr/lib/*/pkgconfig/libcallaudio-*.pc
0707010000000A000081A400000000000000000000000164632D5900000013000000000000000000000000000000000000003C00000000callaudiod-0.1.9/.gitlab-ci/debian/libcallaudio-doc.install/usr/share/gtk-doc
0707010000000B000081A400000000000000000000000164632D5900000016000000000000000000000000000000000000003E00000000callaudiod-0.1.9/.gitlab-ci/debian/libcallaudio-tools.install/usr/bin/callaudiocli
0707010000000C000081ED00000000000000000000000164632D59000000A9000000000000000000000000000000000000002900000000callaudiod-0.1.9/.gitlab-ci/debian/rules#!/usr/bin/make -f
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
%:
dh $@ --builddirectory=_build
override_dh_auto_configure:
dh_auto_configure -- -Dgtk_doc=true
0707010000000D000041ED00000000000000000000000264632D5900000000000000000000000000000000000000000000002A00000000callaudiod-0.1.9/.gitlab-ci/debian/source0707010000000E000081A400000000000000000000000164632D590000000C000000000000000000000000000000000000003100000000callaudiod-0.1.9/.gitlab-ci/debian/source/format3.0 (quilt)
0707010000000F000081A400000000000000000000000164632D59000000C7000000000000000000000000000000000000002900000000callaudiod-0.1.9/.gitlab-ci/debian/watchversion=4
opts=filenamemangle=s/.*\/archive\/(\d\S+)\/callaudiod.*\.tar\.gz/callaudiod-$1\.tar\.gz/g \
https://gitlab.com/mobian1/callaudiod/tags?sort=updated_desc .*/archive/(\d\S+)/.*\.tar\.gz.*
07070100000010000081A400000000000000000000000164632D590000894B000000000000000000000000000000000000001900000000callaudiod-0.1.9/COPYING GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
07070100000011000081A400000000000000000000000164632D5900000362000000000000000000000000000000000000001B00000000callaudiod-0.1.9/README.md# callaudiod - Call audio routing daemon
`callaudiod` is a daemon for dealing with audio routing during phone calls.
It provides a D-Bus interface allowing other programs to:
* switch audio profiles
* output audio to the speaker or back to its original port
* mute the microphone
## Dependencies
`callaudiod` requires the following development libraries:
- libasound2-dev
- libglib2.0-dev
- libpulse-dev
## Building
`callaudiod` uses meson as its build system. Building and installing
`callaudiod` is as simple as running the following commands:
```
$ meson ../callaudiod-build
$ ninja -C ../callaudiod-build
# ninja -C ../callaudiod-build install
```
## Running
`callaudiod` is usually run as a systemd user service, but can also be manually
started from the command-line:
```
$ callaudiod
```
## License
`callaudiod` is licensed under the GPLv3+.
07070100000012000041ED00000000000000000000000264632D5900000000000000000000000000000000000000000000001600000000callaudiod-0.1.9/data07070100000013000081A400000000000000000000000164632D590000042D000000000000000000000000000000000000002200000000callaudiod-0.1.9/data/meson.build#
# Copyright (C) 2019 Purism SPC
# Copyright (C) 2020 Arnaud Ferraris <arnaud.ferraris@gmail.com>
#
# SPDX-License-Identifier: LGPL-2.1-or-later
#
gnome = import('gnome')
# DBus server interface
dbus_prefix = 'org.mobian_project.'
dbus_namespace = 'CallAudioDbus'
generated_dbus_sources = []
dbus_interfaces = [ 'org.mobian_project.CallAudio.xml' ]
generated_dbus_sources += gnome.gdbus_codegen('callaudio-dbus',
sources : dbus_interfaces,
object_manager : false,
docbook : 'libcallaudio',
interface_prefix : dbus_prefix,
install_header : false,
namespace : dbus_namespace)
dbus_header_dir = meson.current_build_dir()
dbus_inc = include_directories('.')
install_data(dbus_interfaces, install_dir: ifacedir)
# systemd service file
service_data = configuration_data()
service_data.set('bindir', bindir)
service_file = 'org.mobian_project.CallAudio.service'
configure_file(
input : service_file + '.in',
output : service_file,
configuration : service_data,
install : true,
install_dir: servicedir,
)
07070100000014000081A400000000000000000000000164632D590000004B000000000000000000000000000000000000003E00000000callaudiod-0.1.9/data/org.mobian_project.CallAudio.service.in[D-BUS Service]
Name=org.mobian_project.CallAudio
Exec=@bindir@/callaudiod
07070100000015000081A400000000000000000000000164632D59000006A9000000000000000000000000000000000000003700000000callaudiod-0.1.9/data/org.mobian_project.CallAudio.xml<?xml version="1.0" encoding="UTF-8" ?>
<node>
<!-- org.mobian_project.CallAudio
@short_description: call related audio interface
This D-Bus interface is used to select audio modes
and access other related audio functionality in
a mobile phone context.
-->
<interface name="org.mobian_project.CallAudio">
<!--
SelectMode:
@mode: 0 = default audio mode, 1 = voice call mode
@success: operation status
Sets the audio routing configuration according to the @mode
parameter.
If @mode isn't an authorized value,
#org.freedesktop.DBus.Error.InvalidArgs error is returned.
-->
<method name="SelectMode">
<arg direction="in" name="mode" type="u"/>
<arg direction="out" name="success" type="b"/>
</method>
<!--
AudioMode:
0 = default audio mode, 1 = voice call mode, 255 = unknown
-->
<property name="AudioMode" type="u" access="read"/>
<method name="EnableSpeaker">
<arg direction="in" name="enable" type="b"/>
<arg direction="out" name="success" type="b"/>
</method>
<!--
SpeakerState:
0 = off, 1 = on, 255 = unknown
all other values should be considered the same as 'unknown'
-->
<property name="SpeakerState" type="u" access="read"/>
<method name="MuteMic">
<arg direction="in" name="mute" type="b"/>
<arg direction="out" name="success" type="b"/>
</method>
<!--
MicState:
0 = off, 1 = on, 255 = unknown
all other values should be considered the same as 'unknown'
-->
<property name="MicState" type="u" access="read"/>
</interface>
</node>
07070100000016000041ED00000000000000000000000264632D5900000000000000000000000000000000000000000000001500000000callaudiod-0.1.9/doc07070100000017000081A400000000000000000000000164632D59000006C1000000000000000000000000000000000000002B00000000callaudiod-0.1.9/doc/libcallaudio-docs.xml<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
[
<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY % gtkdocentities SYSTEM "xml/gtkdocentities.ent">
%gtkdocentities;
]>
<book id="index">
<bookinfo>
<title>&package_name; Reference Manual</title>
<releaseinfo>
<para>This document is the API reference for &package_name; &package_version;</para>
<para>
<ulink type="http" url="&package_url;">Libcallaudio</ulink> is a library to allow
setting audio call (f.e. mobile phone environment) related settings by your application.
</para>
<para>
If you find any issues in this API reference, please report it using
<ulink type="http" url="&package_bugreport;">the bugtracker</ulink>.
</para>
</releaseinfo>
<copyright>
<year>2020</year>
<holder>Arnaud Ferraris</holder>
</copyright>
</bookinfo>
<xi:include href="overview.xml"/>
<part>
<title>API Reference</title>
<chapter id="core-api">
<title>Core API</title>
<xi:include href="xml/libcallaudio.xml"/>
</chapter>
<chapter id="dbus-interface">
<title>DBus Interface</title>
<xi:include href="../data/libcallaudio-org.mobian_project.CallAudio.xml"/>
</chapter>
</part>
<index id="api-index-full">
<title>API Index</title>
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
</index>
<index id="annotations-glossary">
<title>Annotations glossary</title>
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
</index>
</book>
07070100000018000081A400000000000000000000000164632D590000057B000000000000000000000000000000000000002100000000callaudiod-0.1.9/doc/meson.buildif get_option('gtk_doc')
subdir('xml')
private_headers = [
]
content_files = [
'overview.xml',
]
glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix')
glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
docpath = join_paths(get_option('datadir'), 'gtk-doc', 'html')
gnome.gtkdoc('libcallaudio',
main_xml: 'libcallaudio-docs.xml',
src_dir: [
join_paths(meson.source_root(), 'libcallaudio'),
join_paths(meson.build_root(), 'libcallaudio'),
join_paths(meson.build_root(), 'data'),
],
dependencies: libcallaudio_dep,
gobject_typesfile: 'libcallaudio.types',
scan_args: [
'--rebuild-types',
'--ignore-headers=' + ' '.join(private_headers),
],
fixxref_args: [
'--html-dir=@0@'.format(docpath),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gi')),
],
install_dir: 'libcallaudio',
content_files: content_files,
install: true)
endif
07070100000019000081A400000000000000000000000164632D5900000820000000000000000000000000000000000000002200000000callaudiod-0.1.9/doc/overview.xml<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY % gtkdocentities SYSTEM "xml/gtkdocentities.ent">
%gtkdocentities;
]>
<part>
<title>Libcallaudio Overview</title>
<chapter>
<title>Introduction</title>
<para>
The purpose of libcallaudio is to make it simple for other applications
to control audio routing and other audio related settings in
mobile phone scenarios.
</para>
<para>
&package; provides synchronous and asynchronous APIs to switch
audio profiles, change between the earpiece and the speakers
and mute the microphone.
</para>
</chapter>
<chapter>
<title>Compiling libcallaudio applications</title>
<simplesect>
<title>Using pkg-config</title>
<para> Like other GNOME libraries,
<application>&package_string;</application> uses
<application>pkg-config</application> to provide compiler options. The
package name is
"<literal>&package_ver_str;</literal>". So in
your <literal>configure.ac</literal> script, you might specify something
like: </para>
<informalexample><programlisting>
PKG_CHECK_MODULES(LIBFEEDBACK, [&package_string;-&package_api_version;])
AC_SUBST(LIBFEEDBACK_CFLAGS)
AC_SUBST(LIBFEEDBACK_LIBS)
</programlisting></informalexample>
</simplesect>
<simplesect>
<title>Using Meson/Ninja</title>
<para>
If using Meson/Ninja use a <literal>dependency('&package_string;-&package_api_version;')
</literal> dependency.
</para>
<para>
The "<literal>&package_api_version;</literal>" in the package name is the "API version"
(indicating "the version of the <application>&package_string;</application> API
that first appeared in version &package_api_version;") and is essentially just part of
the package name.
</para>
</simplesect>
</chapter>
</part>
0707010000001A000041ED00000000000000000000000264632D5900000000000000000000000000000000000000000000001900000000callaudiod-0.1.9/doc/xml0707010000001B000081A400000000000000000000000164632D590000021E000000000000000000000000000000000000002F00000000callaudiod-0.1.9/doc/xml/gtkdocentities.ent.in<!ENTITY package "@PACKAGE@">
<!ENTITY package_bugreport "@PACKAGE_BUGREPORT@">
<!ENTITY package_name "@PACKAGE_NAME@">
<!ENTITY package_string "@PACKAGE_STRING@">
<!ENTITY package_tarname "@PACKAGE_TARNAME@">
<!ENTITY package_url "@PACKAGE_URL@">
<!ENTITY package_version "@PACKAGE_VERSION@">
<!ENTITY package_api_version "@PACKAGE_API_VERSION@">
<!ENTITY package_ver_str "@PACKAGE_STRING@-@PACKAGE_API_VERSION@">
<!ENTITY callaudio_daemon "<ulink url='https://gitlab.com/mobian1/callaudiod/blob/master/README.md'>Callaudio Daemon</ulink>">
0707010000001C000081A400000000000000000000000164632D5900000256000000000000000000000000000000000000002500000000callaudiod-0.1.9/doc/xml/meson.buildent_conf = configuration_data()
ent_conf.set('PACKAGE', 'libcallaudio')
ent_conf.set('PACKAGE_BUGREPORT', 'https://gitlab.com/mobian1/callaudiod/issues')
ent_conf.set('PACKAGE_NAME', 'libcallaudio')
ent_conf.set('PACKAGE_STRING', 'libcallaudio')
ent_conf.set('PACKAGE_TARNAME', 'libcallaudio-' + meson.project_version())
ent_conf.set('PACKAGE_URL', 'https://gitlab.com/mobian1/callaudiod')
ent_conf.set('PACKAGE_VERSION', meson.project_version())
ent_conf.set('PACKAGE_API_VERSION', apiversion)
configure_file(input: 'gtkdocentities.ent.in', output: 'gtkdocentities.ent', configuration: ent_conf)
0707010000001D000041ED00000000000000000000000264632D5900000000000000000000000000000000000000000000001E00000000callaudiod-0.1.9/libcallaudio0707010000001E000081A400000000000000000000000164632D5900002DB2000000000000000000000000000000000000002D00000000callaudiod-0.1.9/libcallaudio/libcallaudio.c/*
* Copyright (C) 2020 Purism SPC
* Copyright (C) 2020 Arnaud Ferraris <arnaud.ferraris@gmail.com>
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "libcallaudio.h"
#include "callaudiod.h"
#include "callaudio-dbus.h"
/**
* SECTION:libcallaudio
* @Short_description: Call audio control library
* @Title: libcallaudio
*
* To use the library call #call_audio_init().
* After initializing the library you can send audio routing requests using the
* library functions.
* When your application finishes call #call_audio_deinit() to free resources:
*
* |[<!-- language="C" -->
* #include <libcallaudio.h>
*
* int main(void)
* {
* g_autoptr(GError) err = NULL;
* if (call_audio_init(&err)) {
* g_error("%s", err->message);
* }
* ...
* call_audio_deinit();
* return 0;
* }
* ]|
*/
static CallAudioDbusCallAudio *_proxy;
static gboolean _initted;
typedef struct _CallAudioAsyncData {
CallAudioCallback cb;
gpointer user_data;
} CallAudioAsyncData;
/**
* call_audio_init:
* @error: Error information
*
* Initialize libcallaudio. This must be called before any other functions.
*
* Returns: %TRUE if successful, or %FALSE on error.
*/
gboolean call_audio_init(GError **error)
{
if (_initted)
return TRUE;
_proxy = call_audio_dbus_call_audio_proxy_new_for_bus_sync(
CALLAUDIO_DBUS_TYPE,
G_DBUS_PROXY_FLAGS_NONE,
CALLAUDIO_DBUS_NAME,
CALLAUDIO_DBUS_PATH, NULL, error);
if (!_proxy)
return FALSE;
g_object_add_weak_pointer(G_OBJECT(_proxy), (gpointer *)&_proxy);
_initted = TRUE;
return TRUE;
}
/**
* call_audio_is_inited:
*
* Query whether libcallaudio has been initialized before. This can be used to
* ensure library calls will perform actual actions.
*
* Returns: %TRUE if libcallaudio has been initialized, %FALSE otherwise.
*/
gboolean call_audio_is_inited(void)
{
return _initted;
}
/**
* call_audio_deinit:
*
* Uninitialize the library when no longer used. Usually called
* on program shutdown.
*/
void call_audio_deinit(void)
{
_initted = FALSE;
g_clear_object(&_proxy);
}
static void select_mode_done(GObject *object, GAsyncResult *result, gpointer data)
{
CallAudioDbusCallAudio *proxy = CALL_AUDIO_DBUS_CALL_AUDIO(object);
CallAudioAsyncData *async_data = data;
GError *error = NULL;
gboolean success = FALSE;
gboolean ret;
g_return_if_fail(CALL_AUDIO_DBUS_IS_CALL_AUDIO(proxy));
ret = call_audio_dbus_call_audio_call_select_mode_finish(proxy, &success,
result, &error);
if (!ret)
g_warning("SelectMode DBus method invocation failed: %s", error->message);
else if (!success)
g_warning("SelectMode unsuccessful");
g_debug("%s: D-bus call returned %d (success=%d)", __func__, ret, success);
if (async_data && async_data->cb)
async_data->cb(success, error, async_data->user_data);
g_free(async_data);
}
/**
* call_audio_select_mode_async:
* @mode: Audio mode to select
* @cb: Function to be called when operation completes
* @data: User data to be passed to the callback function after completion. This
* data is owned by the caller, which is responsible for freeing it.
*
* Select the audio mode to use.
*/
gboolean call_audio_select_mode_async(CallAudioMode mode,
CallAudioCallback cb,
gpointer data)
{
CallAudioAsyncData *async_data = g_new0(CallAudioAsyncData, 1);
if (!_initted || !async_data)
return FALSE;
async_data->cb = cb;
async_data->user_data = data;
call_audio_dbus_call_audio_call_select_mode(_proxy, mode, NULL,
select_mode_done, async_data);
return TRUE;
}
/**
* call_audio_select_mode:
* @mode: Audio mode to select
* @error: The error that will be set if the audio mode could not be selected.
*
* Select the audio mode to use. This function is synchronous, and will return
* only once the operation has been executed.
*
* Returns: %TRUE if successful, or %FALSE on error.
*/
gboolean call_audio_select_mode(CallAudioMode mode, GError **error)
{
gboolean success = FALSE;
gboolean ret;
if (!_initted)
return FALSE;
ret = call_audio_dbus_call_audio_call_select_mode_sync(_proxy, mode, &success,
NULL, error);
if (!ret) {
g_warning("SelectMode DBus method invocation failed: %s", (*error)->message);
} else if (!success) {
g_warning("SelectMode (%u) unsuccessful", mode);
g_set_error_literal(error, G_IO_ERROR, G_IO_ERROR_FAILED, "Operation failed");
}
g_debug("SelectMode %s: success=%d", ret ? "succeeded" : "failed", success);
return success;
}
/**
* call_audio_get_audio_mode:
*
* Returns: The selected #CallAudioMode.
*/
CallAudioMode call_audio_get_audio_mode(void)
{
if (!_initted)
return CALL_AUDIO_MODE_UNKNOWN;
return call_audio_dbus_call_audio_get_audio_mode(_proxy);
}
static void enable_speaker_done(GObject *object, GAsyncResult *result, gpointer data)
{
CallAudioDbusCallAudio *proxy = CALL_AUDIO_DBUS_CALL_AUDIO(object);
CallAudioAsyncData *async_data = data;
GError *error = NULL;
gboolean success = FALSE;
gboolean ret;
g_return_if_fail(CALL_AUDIO_DBUS_IS_CALL_AUDIO(proxy));
ret = call_audio_dbus_call_audio_call_enable_speaker_finish(proxy, &success,
result, &error);
if (!ret)
g_warning("EnableSpeaker DBus method invocation failed: %s", error->message);
else if (!success)
g_warning("EnableSpeaker unsuccessful");
g_debug("%s: D-bus call returned %d (success=%d)", __func__, ret, success);
if (async_data && async_data->cb)
async_data->cb(success, error, async_data->user_data);
g_free(async_data);
}
/**
* call_audio_enable_speaker_async:
* @enable: Desired speaker state
* @cb: Function to be called when operation completes
* @data: User data to be passed to the callback function after completion. This
* data is owned by the caller, which is responsible for freeing it.
*
* Enable or disable speaker output.
*/
gboolean call_audio_enable_speaker_async(gboolean enable,
CallAudioCallback cb,
gpointer data)
{
CallAudioAsyncData *async_data = g_new0(CallAudioAsyncData, 1);
if (!_initted || !async_data)
return FALSE;
async_data->cb = cb;
async_data->user_data = data;
call_audio_dbus_call_audio_call_enable_speaker(_proxy, enable, NULL,
enable_speaker_done, async_data);
return TRUE;
}
/**
* call_audio_get_speaker_state:
*
* Returns: %CALL_AUDIO_SPEAKER_ON if the speaker is on, %CALL_AUDIO_SPEAKER_OFF if it is off or
* %CALL_AUDIO_SPEAKER_UNKNOWN if the state is not known.
*/
CallAudioSpeakerState call_audio_get_speaker_state(void)
{
if (!_initted)
return CALL_AUDIO_SPEAKER_UNKNOWN;
return call_audio_dbus_call_audio_get_speaker_state(_proxy);
}
/**
* call_audio_enable_speaker:
* @enable: Desired speaker state
* @error: The error that will be set if the audio mode could not be selected.
*
* Enable or disable speaker output. This function is synchronous, and will
* return only once the operation has been executed.
*
* Returns: %TRUE if successful, or %FALSE on error.
*/
gboolean call_audio_enable_speaker(gboolean enable, GError **error)
{
gboolean success = FALSE;
gboolean ret;
if (!_initted)
return FALSE;
ret = call_audio_dbus_call_audio_call_enable_speaker_sync(_proxy, enable, &success,
NULL, error);
if (!ret) {
g_warning("EnableSpeaker DBus method invocation failed: %s", (*error)->message);
} else if (!success) {
g_warning("EnableSpeaker (%sable) unsuccessful", enable ? "en" : "dis");
g_set_error_literal(error, G_IO_ERROR, G_IO_ERROR_FAILED, "Operation failed");
}
g_debug("EnableSpeaker %s: success=%d", ret ? "succeeded" : "failed", success);
return success;
}
static void mute_mic_done(GObject *object, GAsyncResult *result, gpointer data)
{
CallAudioDbusCallAudio *proxy = CALL_AUDIO_DBUS_CALL_AUDIO(object);
CallAudioAsyncData *async_data = data;
GError *error = NULL;
gboolean success = FALSE;
gboolean ret;
g_return_if_fail(CALL_AUDIO_DBUS_IS_CALL_AUDIO(proxy));
ret = call_audio_dbus_call_audio_call_mute_mic_finish(proxy, &success,
result, &error);
if (!ret)
g_warning("MuteMic DBus method invocation failed: %s", error->message);
else if (!success)
g_warning("MuteMic unsuccessful");
g_debug("%s: D-bus call returned %d (success=%d)", __func__, ret, success);
if (async_data && async_data->cb)
async_data->cb(success, error, async_data->user_data);
g_free(async_data);
}
/**
* call_audio_mute_mic_async:
* @mute: %TRUE to mute the microphone, or %FALSE to unmute it
* @cb: Function to be called when operation completes
* @data: User data to be passed to the callback function after completion. This
* data is owned by the caller, which is responsible for freeing it.
*
* Mute or unmute microphone.
*/
gboolean call_audio_mute_mic_async(gboolean mute,
CallAudioCallback cb,
gpointer data)
{
CallAudioAsyncData *async_data = g_new0(CallAudioAsyncData, 1);
if (!_initted || !async_data)
return FALSE;
async_data->cb = cb;
async_data->user_data = data;
call_audio_dbus_call_audio_call_mute_mic(_proxy, mute, NULL,
mute_mic_done, async_data);
return TRUE;
}
/**
* call_audio_mute_mic:
* @mute: %TRUE to mute the microphone, or %FALSE to unmute it
* @error: The error that will be set if the audio mode could not be selected.
*
* Mute or unmute microphone. This function is synchronous, and will return
* only once the operation has been executed.
*
* Returns: %TRUE if successful, or %FALSE on error.
*/
gboolean call_audio_mute_mic(gboolean mute, GError **error)
{
gboolean success = FALSE;
gboolean ret;
if (!_initted)
return FALSE;
ret = call_audio_dbus_call_audio_call_mute_mic_sync(_proxy, mute, &success,
NULL, error);
if (!ret) {
g_warning("MuteMic DBus method invocation failed: %s", (*error)->message);
} else if (!success) {
g_warning("MuteMic (%smute) unsuccessful", mute ? "" : "un");
g_set_error_literal(error, G_IO_ERROR, G_IO_ERROR_FAILED, "Operation failed");
}
g_debug("MuteMic %s: success=%d", ret ? "succeeded" : "failed", success);
return success;
}
/**
* call_audio_get_mic_state:
*
* Returns: %CALL_AUDIO_MIC_ON if the microphone is on, %CALL_AUDIO_MIC_OFF if it is off or
* %CALL_AUDIO_MIC_UNKNOWN if the state is not known.
*/
CallAudioMicState call_audio_get_mic_state(void)
{
if (!_initted)
return CALL_AUDIO_MIC_UNKNOWN;
return call_audio_dbus_call_audio_get_mic_state(_proxy);
}
0707010000001F000081A400000000000000000000000164632D5900000946000000000000000000000000000000000000002D00000000callaudiod-0.1.9/libcallaudio/libcallaudio.h/*
* Copyright (C) 2020 Purism SPC
* Copyright (C) 2020 Arnaud Ferraris <arnaud.ferraris@gmail.com>
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#pragma once
#include "libcallaudio-enums.h"
#include <glib.h>
G_BEGIN_DECLS
/**
* CallAudioMode:
* @CALL_AUDIO_MODE_DEFAULT: Default mode (used for music, alarms, ringtones...)
* @CALL_AUDIO_MODE_CALL: Voice call mode
* @CALL_AUDIO_MODE_UNKNOWN: Mode unknown
*
* Enum values to indicate the mode to be selected.
*/
typedef enum {
CALL_AUDIO_MODE_DEFAULT = 0,
CALL_AUDIO_MODE_CALL,
CALL_AUDIO_MODE_UNKNOWN = 255
} CallAudioMode;
/**
* CallAudioSpeakerState:
* @CALL_AUDIO_SPEAKER_OFF: Speaker disabled
* @CALL_AUDIO_SPEAKER_ON: Speaker enabled
* @CALL_AUDIO_SPEAKER_UNKNOWN: Unknown
*/
typedef enum {
CALL_AUDIO_SPEAKER_OFF = 0,
CALL_AUDIO_SPEAKER_ON = 1,
CALL_AUDIO_SPEAKER_UNKNOWN = 255
} CallAudioSpeakerState;
/**
* CallAudioMicState:
* @CALL_AUDIO_MIC_OFF: Mic disabled
* @CALL_AUDIO_MIC_ON: Mic enabled
* @CALL_AUDIO_MIC_UNKNOWN: Unknown
*/
typedef enum {
CALL_AUDIO_MIC_OFF = 0,
CALL_AUDIO_MIC_ON,
CALL_AUDIO_MIC_UNKNOWN = 255
} CallAudioMicState;
typedef void (*CallAudioCallback)(gboolean success,
GError *error,
gpointer data);
gboolean call_audio_init (GError **error);
gboolean call_audio_is_inited(void);
void call_audio_deinit (void);
gboolean call_audio_select_mode (CallAudioMode mode, GError **error);
gboolean call_audio_select_mode_async(CallAudioMode mode,
CallAudioCallback cb,
gpointer data);
CallAudioMode call_audio_get_audio_mode(void);
gboolean call_audio_enable_speaker (gboolean enable, GError **error);
gboolean call_audio_enable_speaker_async(gboolean enable,
CallAudioCallback cb,
gpointer data);
CallAudioSpeakerState call_audio_get_speaker_state(void);
gboolean call_audio_mute_mic (gboolean mute, GError **error);
gboolean call_audio_mute_mic_async(gboolean mute,
CallAudioCallback cb,
gpointer data);
CallAudioMicState call_audio_get_mic_state(void);
G_END_DECLS
07070100000020000081A400000000000000000000000164632D590000003E000000000000000000000000000000000000003000000000callaudiod-0.1.9/libcallaudio/libcallaudio.symsLIBCALLAUDIO_0_0_0 {
global:
call_audio_*;
local:
*;
};
07070100000021000081A400000000000000000000000164632D590000086C000000000000000000000000000000000000002A00000000callaudiod-0.1.9/libcallaudio/meson.build# Shared library and language bindings
libcallaudio_libdir = get_option('libdir')
libcallaudio_header_dir = get_option('includedir') / libname
libcallaudio_link_args = []
libcallaudio_symbols_file = 'libcallaudio.syms'
# Check linker flags
ld_version_script_arg = '-Wl,--version-script,@0@'.format(meson.current_source_dir() / libcallaudio_symbols_file)
if cc.links('int main() { return 0; }', args : ld_version_script_arg, name : 'ld_supports_version_script')
libcallaudio_link_args += [ld_version_script_arg]
endif
libcallaudio_headers = [
'libcallaudio.h',
]
libcallaudio_enum_sources = gnome.mkenums_simple(
'libcallaudio-enums',
sources : libcallaudio_headers,
install_header : true,
install_dir : libcallaudio_header_dir,
)
libcallaudio_sources = [
generated_dbus_sources,
libcallaudio_enum_sources,
libcallaudio_headers,
'libcallaudio.c',
]
libcallaudio_deps = [
dependency('gobject-2.0'),
dependency('gio-unix-2.0'),
]
libcallaudio_c_args = [
'-DG_LOG_DOMAIN="libcallaudio"',
]
libcallaudio_inc = include_directories('.', '../src')
libtype = 'shared_library'
libcallaudio = build_target(
'callaudio-' + apiversion,
libcallaudio_sources,
soversion : 0,
c_args : libcallaudio_c_args,
include_directories : libcallaudio_inc,
dependencies : libcallaudio_deps,
link_args : libcallaudio_link_args,
install : true,
install_dir : libcallaudio_libdir,
target_type : libtype,
)
libcallaudio_dep = declare_dependency(
sources : [generated_dbus_sources, libcallaudio_enum_sources[1]],
link_with : libcallaudio,
dependencies: libcallaudio_deps,
include_directories : libcallaudio_inc,
)
install_headers(libcallaudio_headers, subdir : libname)
pkgconfig = import('pkgconfig')
pkgconfig.generate(
libraries : [libcallaudio],
subdirs : libname,
version : meson.project_version(),
name : 'CallAudio',
filebase : 'libcallaudio-@0@'.format(apiversion),
description : 'call audio library',
requires : 'gio-2.0',
install_dir : join_paths(libcallaudio_libdir, 'pkgconfig'),
)
07070100000022000081A400000000000000000000000164632D5900000A02000000000000000000000000000000000000001D00000000callaudiod-0.1.9/meson.build#
# Copyright (C) 2019 Purism SPC
# Copyright (C) 2020 Arnaud Ferraris <arnaud.ferraris@gmail.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
project (
'callaudiod',
'c',
version : '0.1.9',
license : 'LGPLv3+',
meson_version : '>= 0.50.0',
default_options :
[
'warning_level=1',
'buildtype=debugoptimized',
'c_std=gnu11'
],
)
cc = meson.get_compiler('c')
cc = meson.get_compiler('c')
global_c_args = []
test_c_args = [
'-Wcast-align',
'-Wdate-time',
'-Wdeclaration-after-statement',
['-Werror=format-security', '-Werror=format=2'],
'-Wendif-labels',
'-Werror=incompatible-pointer-types',
'-Werror=missing-declarations',
'-Werror=overflow',
'-Werror=return-type',
'-Werror=shift-count-overflow',
'-Werror=shift-overflow=2',
'-Werror=implicit-fallthrough=3',
'-Wfloat-equal',
'-Wformat-nonliteral',
'-Wformat-security',
'-Winit-self',
'-Wmaybe-uninitialized',
'-Wmissing-field-initializers',
'-Wmissing-include-dirs',
'-Wmissing-noreturn',
'-Wnested-externs',
'-Wno-missing-field-initializers',
'-Wno-sign-compare',
'-Wno-strict-aliasing',
'-Wno-unused-parameter',
'-Wold-style-definition',
'-Wpointer-arith',
'-Wredundant-decls',
'-Wshadow',
'-Wstrict-prototypes',
'-Wswitch-default',
'-Wswitch-enum',
'-Wtype-limits',
'-Wundef',
'-Wunused-function',
]
foreach arg: test_c_args
if cc.has_multi_arguments(arg)
global_c_args += arg
endif
endforeach
add_project_arguments(
global_c_args,
language: 'c'
)
app_name = meson.project_name()
prefix = get_option('prefix')
datadir = get_option('datadir')
sysconfdir = get_option('sysconfdir')
bindir = join_paths(prefix, get_option('bindir'))
libdir = join_paths(prefix, get_option('libdir'))
ifacedir = join_paths(prefix, join_paths(datadir, 'dbus-1', 'interfaces'))
servicedir = join_paths(prefix, join_paths(datadir, 'dbus-1', 'services'))
if datadir.startswith('/')
full_datadir = datadir
else
full_datadir = join_paths(prefix, datadir)
endif
if sysconfdir.startswith('/')
full_sysconfdir = sysconfdir
else
full_sysconfdir = join_paths(prefix, sysconfdir)
endif
apiversion = '0.1'
libname = 'libcallaudio-' + apiversion
config_data = configuration_data()
config_data.set_quoted('APP_DATA_NAME', app_name)
config_data.set_quoted('DATADIR', full_datadir)
config_data.set_quoted('SYSCONFDIR', full_sysconfdir)
config_h = configure_file (
output: 'config.h',
configuration: config_data
)
subdir('data')
subdir('libcallaudio')
subdir('src')
subdir('tools')
subdir('doc')
07070100000023000081A400000000000000000000000164632D5900000083000000000000000000000000000000000000002300000000callaudiod-0.1.9/meson_options.txtoption('gtk_doc',
type: 'boolean', value: false,
description: 'Whether to generate the API reference for Callaudio')
07070100000024000041ED00000000000000000000000264632D5900000000000000000000000000000000000000000000001500000000callaudiod-0.1.9/src07070100000025000081A400000000000000000000000164632D59000013C9000000000000000000000000000000000000002300000000callaudiod-0.1.9/src/cad-manager.c/*
* Copyright (C) 2020 Arnaud Ferraris <arnaud.ferraris@gmail.com>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#define G_LOG_DOMAIN "callaudiod-manager"
#include "callaudiod.h"
#include "cad-manager.h"
#include "cad-pulse.h"
#include "libcallaudio.h"
#include <gio/gio.h>
#include <glib-unix.h>
typedef struct _CadManager {
CallAudioDbusCallAudioSkeleton parent;
} CadManager;
static void cad_manager_call_audio_iface_init(CallAudioDbusCallAudioIface *iface);
G_DEFINE_TYPE_WITH_CODE(CadManager, cad_manager,
CALL_AUDIO_DBUS_TYPE_CALL_AUDIO_SKELETON,
G_IMPLEMENT_INTERFACE(CALL_AUDIO_DBUS_TYPE_CALL_AUDIO,
cad_manager_call_audio_iface_init));
static void complete_command_cb(CadOperation *op)
{
if (!op)
return;
switch (op->type) {
case CAD_OPERATION_SELECT_MODE:
call_audio_dbus_call_audio_complete_select_mode(op->object, op->invocation, op->success);
break;
case CAD_OPERATION_ENABLE_SPEAKER:
call_audio_dbus_call_audio_complete_enable_speaker(op->object, op->invocation, op->success);
break;
case CAD_OPERATION_MUTE_MIC:
call_audio_dbus_call_audio_complete_mute_mic(op->object, op->invocation, op->success);
break;
default:
g_dbus_method_invocation_return_error(op->invocation, G_DBUS_ERROR,
G_DBUS_ERROR_UNKNOWN_METHOD,
"Unknown operation");
g_critical("unknown operation %d", op->type);
break;
}
}
static gboolean cad_manager_handle_select_mode(CallAudioDbusCallAudio *object,
GDBusMethodInvocation *invocation,
guint mode)
{
CadOperation *op;
switch ((CallAudioMode)mode) {
case CALL_AUDIO_MODE_DEFAULT:
case CALL_AUDIO_MODE_CALL:
break;
case CALL_AUDIO_MODE_UNKNOWN:
default:
g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR,
G_DBUS_ERROR_INVALID_ARGS,
"Invalid mode %u", mode);
return TRUE;
}
op = g_new(CadOperation, 1);
op->type = CAD_OPERATION_SELECT_MODE;
op->value = GUINT_TO_POINTER(mode);
op->object = object;
op->invocation = invocation;
op->callback = complete_command_cb;
g_debug("Select mode: %u", mode);
cad_pulse_select_mode(mode, op);
return TRUE;
}
static CallAudioMode
cad_manager_get_audio_mode(CallAudioDbusCallAudio *object)
{
return cad_pulse_get_audio_mode();
}
static gboolean cad_manager_handle_enable_speaker(CallAudioDbusCallAudio *object,
GDBusMethodInvocation *invocation,
gboolean enable)
{
CadOperation *op;
op = g_new(CadOperation, 1);
op->type = CAD_OPERATION_ENABLE_SPEAKER;
op->value = GUINT_TO_POINTER(enable ? CALL_AUDIO_SPEAKER_ON : CALL_AUDIO_SPEAKER_OFF);
op->object = object;
op->invocation = invocation;
op->callback = complete_command_cb;
g_debug("Enable speaker: %d", enable);
cad_pulse_enable_speaker(enable, op);
return TRUE;
}
static CallAudioSpeakerState
cad_manager_get_speaker_state(CallAudioDbusCallAudio *object)
{
return cad_pulse_get_speaker_state();
}
static gboolean cad_manager_handle_mute_mic(CallAudioDbusCallAudio *object,
GDBusMethodInvocation *invocation,
gboolean mute)
{
CadOperation *op;
op = g_new(CadOperation, 1);
op->type = CAD_OPERATION_MUTE_MIC;
op->value = GUINT_TO_POINTER(mute ? CALL_AUDIO_MIC_OFF : CALL_AUDIO_MIC_ON);
op->object = object;
op->invocation = invocation;
op->callback = complete_command_cb;
g_debug("Mute mic: %d", mute);
cad_pulse_mute_mic(mute, op);
return TRUE;
}
static CallAudioMicState
cad_manager_get_mic_state(CallAudioDbusCallAudio *object)
{
return cad_pulse_get_mic_state();
}
static void cad_manager_call_audio_iface_init(CallAudioDbusCallAudioIface *iface)
{
iface->handle_select_mode = cad_manager_handle_select_mode;
iface->get_audio_mode = cad_manager_get_audio_mode;
iface->handle_enable_speaker = cad_manager_handle_enable_speaker;
iface->get_speaker_state = cad_manager_get_speaker_state;
iface->handle_mute_mic = cad_manager_handle_mute_mic;
iface->get_mic_state = cad_manager_get_mic_state;
}
static void cad_manager_class_init(CadManagerClass *klass)
{
}
static void cad_manager_init(CadManager *self)
{
}
CadManager *cad_manager_get_default(void)
{
static CadManager *manager;
if (manager == NULL) {
g_debug("initializing manager...");
manager = g_object_new(CAD_TYPE_MANAGER, NULL);
g_object_add_weak_pointer(G_OBJECT(manager), (gpointer *)&manager);
}
return manager;
}
07070100000026000081A400000000000000000000000164632D59000001C7000000000000000000000000000000000000002300000000callaudiod-0.1.9/src/cad-manager.h/*
* Copyright (C) 2020 Arnaud Ferraris <arnaud.ferraris@gmail.com>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#pragma once
#include "callaudio-dbus.h"
#include "cad-operation.h"
#include <glib-object.h>
G_BEGIN_DECLS
#define CAD_TYPE_MANAGER (cad_manager_get_type())
G_DECLARE_FINAL_TYPE(CadManager, cad_manager, CAD, MANAGER,
CallAudioDbusCallAudioSkeleton);
CadManager *cad_manager_get_default(void);
G_END_DECLS
07070100000027000081A400000000000000000000000164632D59000003A4000000000000000000000000000000000000002500000000callaudiod-0.1.9/src/cad-operation.h/*
* Copyright (C) 2020 Arnaud Ferraris <arnaud.ferraris@gmail.com>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#pragma once
#include "callaudio-dbus.h"
#include <glib-object.h>
/**
* CadOperationType:
* @CAD_OPERATION_SELECT_MODE: Selecting an audio mode (default mode, voice call mode)
* @CAD_OPERATION_ENABLE_SPEAKER: Enable or disable the loudspeaker
* @CAD_OPERATION_MUTE_MIC: Mute or unmute the microphone
*
* Enum values to indicate the operation to be performed.
*/
typedef enum {
CAD_OPERATION_SELECT_MODE = 0,
CAD_OPERATION_ENABLE_SPEAKER,
CAD_OPERATION_MUTE_MIC,
} CadOperationType;
typedef struct _CadOperation CadOperation;
typedef void (*CadOperationCallback)(CadOperation *op);
struct _CadOperation {
CadOperationType type;
gpointer value;
CallAudioDbusCallAudio *object;
GDBusMethodInvocation *invocation;
CadOperationCallback callback;
gboolean success;
};
07070100000028000081A400000000000000000000000164632D5900008A1D000000000000000000000000000000000000002100000000callaudiod-0.1.9/src/cad-pulse.c/*
* Copyright (C) 2018, 2019 Purism SPC
* Copyright (C) 2020 Arnaud Ferraris <arnaud.ferraris@gmail.com>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#define G_LOG_DOMAIN "callaudiod-pulse"
#include "cad-manager.h"
#include "cad-pulse.h"
#include <glib/gi18n.h>
#include <glib-object.h>
#include <pulse/pulseaudio.h>
#include <pulse/glib-mainloop.h>
#include <alsa/use-case.h>
#include <string.h>
#include <stdio.h>
#define APPLICATION_NAME "CallAudio"
#define APPLICATION_ID "org.mobian-project.CallAudio"
#define SINK_CLASS "sound"
#define CARD_FORM_FACTOR "internal"
#define CARD_MODEM_CLASS "modem"
#define CARD_MODEM_NAME "Modem"
struct _CadPulse
{
GObject parent_instance;
GObject *manager;
pa_glib_mainloop *loop;
pa_context *ctx;
int card_id;
int sink_id;
int source_id;
gboolean has_voice_profile;
gchar *speaker_port;
gchar *earpiece_port;
GHashTable *sink_ports;
GHashTable *source_ports;
CallAudioMode audio_mode;
CallAudioSpeakerState speaker_state;
CallAudioMicState mic_state;
};
G_DEFINE_TYPE(CadPulse, cad_pulse, G_TYPE_OBJECT);
typedef struct _CadPulseOperation {
CadPulse *pulse;
CadOperation *op;
guint value;
} CadPulseOperation;
static void pulseaudio_cleanup(CadPulse *self);
static gboolean pulseaudio_connect(CadPulse *self);
static gboolean init_pulseaudio_objects(gpointer data);
/******************************************************************************
* Source management
*
* The following functions take care of monitoring and configuring the default
* source (input)
******************************************************************************/
static const gchar *get_available_source_port(const pa_source_info *source, const gchar *exclude)
{
pa_source_port_info *available_port = NULL;
guint i;
g_debug("looking for available input excluding '%s'", exclude);
for (i = 0; i < source->n_ports; i++) {
pa_source_port_info *port = source->ports[i];
if ((exclude && strcmp(port->name, exclude) == 0) ||
port->available == PA_PORT_AVAILABLE_NO) {
continue;
}
if (!available_port || port->priority > available_port->priority)
available_port = port;
}
if (available_port) {
g_debug("found available input '%s'", available_port->name);
return available_port->name;
}
g_warning("no available input found!");
return NULL;
}
static void change_source_info(pa_context *ctx, const pa_source_info *info, int eol, void *data)
{
CadPulse *self = data;
const gchar *target_port;
pa_operation *op;
gboolean change = FALSE;
guint i;
if (eol != 0)
return;
if (!info) {
g_critical("PA returned no source info (eol=%d)", eol);
return;
}
if (info->index != self->source_id)
return;
for (i = 0; i < info->n_ports; i++) {
pa_source_port_info *port = info->ports[i];
if (port->available != PA_PORT_AVAILABLE_UNKNOWN) {
enum pa_port_available available;
available = GPOINTER_TO_INT(g_hash_table_lookup(self->source_ports, port->name));
if (available != port->available) {
g_hash_table_insert(self->source_ports, g_strdup(port->name),
GINT_TO_POINTER(port->available));
change = TRUE;
}
}
}
if (change) {
target_port = get_available_source_port(info, NULL);
if (target_port) {
op = pa_context_set_source_port_by_index(ctx, self->source_id,
target_port, NULL, NULL);
if (op)
pa_operation_unref(op);
}
}
}
static void process_new_source(CadPulse *self, const pa_source_info *info)
{
const gchar *prop;
int i;
prop = pa_proplist_gets(info->proplist, PA_PROP_DEVICE_CLASS);
if (prop && strcmp(prop, SINK_CLASS) != 0)
return;
if (info->monitor_of_sink != PA_INVALID_INDEX)
return;
if (info->card != self->card_id || self->source_id != -1)
return;
self->source_id = info->index;
if (self->source_ports)
g_hash_table_destroy(self->source_ports);
self->source_ports = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
for (i = 0; i < info->n_ports; i++) {
pa_source_port_info *port = info->ports[i];
if (port->available != PA_PORT_AVAILABLE_UNKNOWN) {
g_hash_table_insert (self->source_ports,
g_strdup(port->name),
GINT_TO_POINTER(port->available));
}
}
g_debug("SOURCE: idx=%u name='%s'", info->index, info->name);
}
static void init_source_info(pa_context *ctx, const pa_source_info *info, int eol, void *data)
{
CadPulse *self = data;
const gchar *target_port;
pa_operation *op;
if (eol != 0)
return;
if (!info) {
g_critical("PA returned no source info (eol=%d)", eol);
return;
}
process_new_source(self, info);
if (self->source_id < 0 || self->source_id != info->index)
return;
op = pa_context_set_default_source(ctx, info->name, NULL, NULL);
if (op)
pa_operation_unref(op);
if (self->mic_state == CALL_AUDIO_MIC_UNKNOWN) {
if (info->mute)
self->mic_state = CALL_AUDIO_MIC_OFF;
else
self->mic_state = CALL_AUDIO_MIC_ON;
g_object_set(self->manager, "mic-state", self->mic_state, NULL);
}
target_port = get_available_source_port(info, NULL);
if (target_port) {
op = pa_context_set_source_port_by_index(ctx, self->source_id,
target_port, NULL, NULL);
if (op)
pa_operation_unref(op);
}
}
/******************************************************************************
* Sink management
*
* The following functions take care of monitoring and configuring the default
* sink (output)
******************************************************************************/
static const gchar *get_available_sink_port(const pa_sink_info *sink, const gchar *exclude)
{
pa_sink_port_info *available_port = NULL;
guint i;
g_debug("looking for available output excluding '%s'", exclude);
for (i = 0; i < sink->n_ports; i++) {
pa_sink_port_info *port = sink->ports[i];
if ((exclude && strcmp(port->name, exclude) == 0) ||
port->available == PA_PORT_AVAILABLE_NO) {
continue;
}
if (!available_port || port->priority > available_port->priority)
available_port = port;
}
if (available_port) {
g_debug("found available output '%s'", available_port->name);
return available_port->name;
}
g_warning("no available output found!");
return NULL;
}
static void change_sink_info(pa_context *ctx, const pa_sink_info *info, int eol, void *data)
{
CadPulse *self = data;
const gchar *target_port;
pa_operation *op;
gboolean change = FALSE;
guint i;
if (eol != 0)
return;
if (!info) {
g_critical("PA returned no sink info (eol=%d)", eol);
return;
}
if (info->index != self->sink_id)
return;
for (i = 0; i < info->n_ports; i++) {
pa_sink_port_info *port = info->ports[i];
if (port->available != PA_PORT_AVAILABLE_UNKNOWN) {
enum pa_port_available available;
available = GPOINTER_TO_INT(g_hash_table_lookup(self->sink_ports, port->name));
if (available != port->available) {
g_hash_table_insert(self->sink_ports, g_strdup(port->name),
GINT_TO_POINTER(port->available));
change = TRUE;
}
}
}
if (change) {
target_port = get_available_sink_port(info, NULL);
if (target_port) {
op = pa_context_set_sink_port_by_index(ctx, self->sink_id,
target_port, NULL, NULL);
if (op)
pa_operation_unref(op);
}
}
}
static void process_new_sink(CadPulse *self, const pa_sink_info *info)
{
const gchar *prop;
guint i;
prop = pa_proplist_gets(info->proplist, PA_PROP_DEVICE_CLASS);
if (prop && strcmp(prop, SINK_CLASS) != 0)
return;
if (info->card != self->card_id || self->sink_id != -1)
return;
self->sink_id = info->index;
if (self->sink_ports)
g_hash_table_destroy(self->sink_ports);
self->sink_ports = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
g_debug("SINK: idx=%u name='%s'", info->index, info->name);
for (i = 0; i < info->n_ports; i++) {
pa_sink_port_info *port = info->ports[i];
switch (port->type) {
case PA_DEVICE_PORT_TYPE_SPEAKER:
if (self->speaker_port) {
if (strcmp(port->name, self->speaker_port) != 0) {
g_free(self->speaker_port);
self->speaker_port = g_strdup(port->name);
}
} else {
self->speaker_port = g_strdup(port->name);
}
break;
case PA_DEVICE_PORT_TYPE_EARPIECE:
case PA_DEVICE_PORT_TYPE_HANDSET:
case PA_DEVICE_PORT_TYPE_HEADPHONES:
if (self->earpiece_port) {
if (strcmp(port->name, self->earpiece_port) != 0) {
g_free(self->earpiece_port);
self->earpiece_port = g_strdup(port->name);
}
} else {
self->earpiece_port = g_strdup(port->name);
}
break;
default:
break;
}
if (port->available != PA_PORT_AVAILABLE_UNKNOWN) {
g_hash_table_insert (self->sink_ports,
g_strdup(port->name),
GINT_TO_POINTER(port->available));
}
}
g_debug("SINK: speaker_port='%s'", self->speaker_port);
g_debug("SINK: earpiece_port='%s'", self->earpiece_port);
}
static void init_sink_info(pa_context *ctx, const pa_sink_info *info, int eol, void *data)
{
CadPulse *self = data;
const gchar *target_port;
pa_operation *op;
if (eol != 0)
return;
if (!info) {
g_critical("PA returned no sink info (eol=%d)", eol);
return;
}
process_new_sink(self, info);
if (self->sink_id < 0 || self->sink_id != info->index)
return;
op = pa_context_set_default_sink(ctx, info->name, NULL, NULL);
if (op)
pa_operation_unref(op);
if (self->speaker_state == CALL_AUDIO_SPEAKER_UNKNOWN) {
self->speaker_state = CALL_AUDIO_SPEAKER_OFF;
switch (self->audio_mode) {
case CALL_AUDIO_MODE_CALL:
if (g_strcmp0(info->active_port->name, self->speaker_port) == 0) {
self->speaker_state = CALL_AUDIO_SPEAKER_ON;
g_object_set(self->manager, "speaker-state", self->speaker_state, NULL);
/*
* callaudiod likely restarted after being killed during a call
* during which the speaker was enabled. End processing here so
* we keep the current routing and don't unexpectedly mess with
* the call setup.
*/
return;
}
break;
case CALL_AUDIO_MODE_UNKNOWN:
/*
* Let's see if we can guess the current mode:
* - if current port is earpiece, we're likely in call mode
* - otherwise we're either in default mode, or call mode with
* speaker enabled. Let's settle for the former as both situations
* are technically equivalent.
*
* Note: this code path is only used when the card doesn't have a
* voice profile, otherwise things are easier to deal with.
*/
if (g_strcmp0(info->active_port->name, self->earpiece_port) == 0) {
self->audio_mode = CALL_AUDIO_MODE_CALL;
g_object_set(self->manager, "audio-mode", self->audio_mode, NULL);
/*
* Don't touch routing as we're likely in the middle of a call,
* see above.
*/
return;
} else {
self->audio_mode = CALL_AUDIO_MODE_DEFAULT;
g_object_set(self->manager, "audio-mode", self->audio_mode, NULL);
}
break;
case CALL_AUDIO_MODE_DEFAULT:
default:
break;
}
g_object_set(self->manager, "speaker-state", self->speaker_state, NULL);
}
target_port = get_available_sink_port(info, NULL);
if (target_port) {
g_debug(" Using sink port '%s'", target_port);
op = pa_context_set_sink_port_by_index(ctx, self->sink_id,
target_port, NULL, NULL);
if (op)
pa_operation_unref(op);
}
}
/******************************************************************************
* Card management
*
* The following functions take care of gathering information about the default
* sound card
******************************************************************************/
static void init_card_info(pa_context *ctx, const pa_card_info *info, int eol, void *data)
{
CadPulse *self = data;
pa_operation *op;
const gchar *prop;
gboolean has_speaker = FALSE;
gboolean has_earpiece = FALSE;
guint i;
if (eol != 0) {
if (self->card_id < 0) {
g_critical("No suitable card found, stopping here...");
}
return;
}
if (!info) {
g_critical("PA returned no card info (eol=%d)", eol);
return;
}
prop = pa_proplist_gets(info->proplist, "alsa.card_name");
g_debug("CARD: prop %s = %s", "alsa.card_name", prop);
if (prop && strstr(prop, CARD_MODEM_NAME) != 0)
return;
prop = pa_proplist_gets(info->proplist, PA_PROP_DEVICE_CLASS);
g_debug("CARD: prop %s = %s", PA_PROP_DEVICE_CLASS, prop);
if (prop && strcmp(prop, CARD_MODEM_CLASS) == 0)
return;
for (i = 0; i < info->n_ports; i++) {
pa_card_port_info *port = info->ports[i];
g_debug("CARD: port %d/%d, name=%s", i, info->n_ports-1, port->name);
switch (port->type) {
case PA_DEVICE_PORT_TYPE_SPEAKER:
has_speaker = TRUE;
break;
case PA_DEVICE_PORT_TYPE_EARPIECE:
case PA_DEVICE_PORT_TYPE_HANDSET:
case PA_DEVICE_PORT_TYPE_HEADPHONES:
has_earpiece = TRUE;
break;
default:
break;
}
}
if (!has_speaker || !has_earpiece) {
g_message("Card '%s' lacks speaker and/or earpiece port, skipping...",
info->name);
return;
}
self->card_id = info->index;
g_debug("CARD: idx=%u name='%s'", info->index, info->name);
for (i = 0; i < info->n_profiles; i++) {
pa_card_profile_info2 *profile = info->profiles2[i];
if (strstr(profile->name, SND_USE_CASE_VERB_VOICECALL) != NULL) {
self->has_voice_profile = TRUE;
if (info->active_profile2 == profile)
self->audio_mode = CALL_AUDIO_MODE_CALL;
else
self->audio_mode = CALL_AUDIO_MODE_DEFAULT;
break;
}
}
// We were able determine the current mode, set the corresponding D-Bus property
if (self->audio_mode != CALL_AUDIO_MODE_UNKNOWN)
g_object_set(self->manager, "audio-mode", self->audio_mode, NULL);
g_debug("CARD: %s voice profile", self->has_voice_profile ? "has" : "doesn't have");
/* Found a suitable card, let's prepare the sink/source */
op = pa_context_get_sink_info_list(self->ctx, init_sink_info, self);
if (op)
pa_operation_unref(op);
op = pa_context_get_source_info_list(self->ctx, init_source_info, self);
if (op)
pa_operation_unref(op);
}
/******************************************************************************
* PulseAudio management
*
* The following functions configure the PulseAudio connection and monitor the
* state of PulseAudio objects
******************************************************************************/
static void init_module_info(pa_context *ctx, const pa_module_info *info, int eol, void *data)
{
pa_operation *op;
if (eol != 0)
return;
if (!info) {
g_critical("PA returned no module info (eol=%d)", eol);
return;
}
g_debug("MODULE: idx=%u name='%s'", info->index, info->name);
if (strcmp(info->name, "module-switch-on-port-available") == 0) {
g_debug("MODULE: unloading '%s'", info->name);
op = pa_context_unload_module(ctx, info->index, NULL, NULL);
if (op)
pa_operation_unref(op);
}
}
static gboolean init_pulseaudio_objects(gpointer data)
{
CadPulse *self = data;
pa_operation *op;
self->card_id = self->sink_id = self->source_id = -1;
self->sink_ports = self->source_ports = NULL;
op = pa_context_get_card_info_list(self->ctx, init_card_info, self);
if (op)
pa_operation_unref(op);
op = pa_context_get_module_info_list(self->ctx, init_module_info, self);
if (op)
pa_operation_unref(op);
return G_SOURCE_REMOVE;
}
static void changed_cb(pa_context *ctx, pa_subscription_event_type_t type, uint32_t idx, void *data)
{
CadPulse *self = data;
pa_subscription_event_type_t kind = type & PA_SUBSCRIPTION_EVENT_TYPE_MASK;
pa_operation *op = NULL;
switch (type & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) {
case PA_SUBSCRIPTION_EVENT_SINK:
if (idx == self->sink_id && kind == PA_SUBSCRIPTION_EVENT_REMOVE) {
g_debug("sink %u removed", idx);
self->sink_id = -1;
g_hash_table_destroy(self->sink_ports);
self->sink_ports = NULL;
} else if (kind == PA_SUBSCRIPTION_EVENT_NEW) {
g_debug("new sink %u", idx);
op = pa_context_get_sink_info_by_index(ctx, idx, init_sink_info, self);
if (op)
pa_operation_unref(op);
}
break;
case PA_SUBSCRIPTION_EVENT_SOURCE:
if (idx == self->source_id && kind == PA_SUBSCRIPTION_EVENT_REMOVE) {
g_debug("source %u removed", idx);
self->source_id = -1;
g_hash_table_destroy(self->source_ports);
self->source_ports = NULL;
} else if (kind == PA_SUBSCRIPTION_EVENT_NEW) {
g_debug("new source %u", idx);
op = pa_context_get_source_info_by_index(ctx, idx, init_source_info, self);
if (op)
pa_operation_unref(op);
}
break;
case PA_SUBSCRIPTION_EVENT_CARD:
if (self->card_id < 0 && kind == PA_SUBSCRIPTION_EVENT_NEW) {
g_debug("card %u added, but no valid card detected yet, retrying...", idx);
g_idle_add(init_pulseaudio_objects, self);
} else if (idx == self->card_id && kind == PA_SUBSCRIPTION_EVENT_CHANGE) {
g_debug("card %u changed", idx);
if (self->sink_id != -1) {
op = pa_context_get_sink_info_by_index(ctx, self->sink_id,
change_sink_info, self);
if (op)
pa_operation_unref(op);
}
if (self->source_id != -1) {
op = pa_context_get_source_info_by_index(ctx, self->source_id,
change_source_info, self);
if (op)
pa_operation_unref(op);
}
}
break;
default:
break;
}
}
static void pulse_state_cb(pa_context *ctx, void *data)
{
CadPulse *self = data;
pa_context_state_t state;
state = pa_context_get_state(ctx);
switch (state) {
case PA_CONTEXT_UNCONNECTED:
case PA_CONTEXT_CONNECTING:
case PA_CONTEXT_AUTHORIZING:
case PA_CONTEXT_SETTING_NAME:
g_debug("PA not ready");
break;
case PA_CONTEXT_FAILED:
g_critical("Error in PulseAudio context: %s", pa_strerror(pa_context_errno(ctx)));
pulseaudio_cleanup(self);
g_idle_add(G_SOURCE_FUNC(pulseaudio_connect), self);
break;
case PA_CONTEXT_TERMINATED:
case PA_CONTEXT_READY:
pa_context_set_subscribe_callback(ctx, changed_cb, self);
pa_context_subscribe(ctx,
PA_SUBSCRIPTION_MASK_SINK | PA_SUBSCRIPTION_MASK_SOURCE | PA_SUBSCRIPTION_MASK_CARD,
NULL, self);
g_debug("PA is ready, initializing cards list");
g_idle_add(init_pulseaudio_objects, self);
break;
default:
g_return_if_reached();
}
}
static void pulseaudio_cleanup(CadPulse *self)
{
if (self->ctx) {
pa_context_disconnect(self->ctx);
pa_context_unref(self->ctx);
self->ctx = NULL;
}
}
static gboolean pulseaudio_connect(CadPulse *self)
{
pa_proplist *props;
int err;
/* Meta data */
props = pa_proplist_new();
g_assert(props != NULL);
err = pa_proplist_sets(props, PA_PROP_APPLICATION_NAME, APPLICATION_NAME);
err = pa_proplist_sets(props, PA_PROP_APPLICATION_ID, APPLICATION_ID);
if (!self->loop)
self->loop = pa_glib_mainloop_new(NULL);
if (!self->loop)
g_error ("Error creating PulseAudio main loop");
if (!self->ctx)
self->ctx = pa_context_new(pa_glib_mainloop_get_api(self->loop), APPLICATION_NAME);
if (!self->ctx)
g_error ("Error creating PulseAudio context");
pa_context_set_state_callback(self->ctx, (pa_context_notify_cb_t)pulse_state_cb, self);
err = pa_context_connect(self->ctx, NULL, PA_CONTEXT_NOFAIL, 0);
if (err < 0)
g_error ("Error connecting to PulseAudio context: %s", pa_strerror(err));
return G_SOURCE_REMOVE;
}
/******************************************************************************
* GObject base functions
******************************************************************************/
static void constructed(GObject *object)
{
GObjectClass *parent_class = g_type_class_peek(G_TYPE_OBJECT);
CadPulse *self = CAD_PULSE(object);
pulseaudio_connect(self);
parent_class->constructed(object);
}
static void dispose(GObject *object)
{
GObjectClass *parent_class = g_type_class_peek(G_TYPE_OBJECT);
CadPulse *self = CAD_PULSE(object);
if (self->speaker_port)
g_free(self->speaker_port);
if (self->earpiece_port)
g_free(self->earpiece_port);
pulseaudio_cleanup(self);
if (self->loop) {
pa_glib_mainloop_free(self->loop);
self->loop = NULL;
}
parent_class->dispose(object);
}
static void cad_pulse_class_init(CadPulseClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS(klass);
object_class->constructed = constructed;
object_class->dispose = dispose;
}
static void cad_pulse_init(CadPulse *self)
{
self->manager = G_OBJECT(cad_manager_get_default());
self->audio_mode = CALL_AUDIO_MODE_UNKNOWN;
self->speaker_state = CALL_AUDIO_SPEAKER_UNKNOWN;
self->mic_state = CALL_AUDIO_MIC_UNKNOWN;
}
CadPulse *cad_pulse_get_default(void)
{
static CadPulse *pulse = NULL;
if (pulse == NULL) {
g_debug("initializing pulseaudio backend...");
pulse = g_object_new(CAD_TYPE_PULSE, NULL);
g_object_add_weak_pointer(G_OBJECT(pulse), (gpointer *)&pulse);
}
return pulse;
}
/******************************************************************************
* Commands management
*
* The following functions handle external requests to switch mode, output port
* or microphone status
******************************************************************************/
static void operation_complete_cb(pa_context *ctx, int success, void *data)
{
CadPulseOperation *operation = data;
g_debug("operation returned %d", success);
if (operation) {
if (operation->op) {
operation->op->success = (gboolean)!!success;
if (operation->op->callback)
operation->op->callback(operation->op);
if (operation->op->success) {
guint new_value = GPOINTER_TO_UINT(operation->value);
switch (operation->op->type) {
case CAD_OPERATION_SELECT_MODE:
if (operation->pulse->audio_mode != new_value) {
operation->pulse->audio_mode = new_value;
g_object_set(operation->pulse->manager, "audio-mode", new_value, NULL);
}
break;
case CAD_OPERATION_ENABLE_SPEAKER:
if (operation->pulse->speaker_state != new_value) {
operation->pulse->speaker_state = new_value;
g_object_set(operation->pulse->manager, "speaker-state", new_value, NULL);
}
break;
case CAD_OPERATION_MUTE_MIC:
/*
* "Mute mic" operation's value is TRUE (1) for muting the mic,
* so ensure mic_state carries the right value.
*/
new_value = new_value ? CALL_AUDIO_MIC_OFF : CALL_AUDIO_MIC_ON;
if (operation->pulse->mic_state != new_value) {
operation->pulse->mic_state = new_value;
g_object_set(operation->pulse->manager, "mic-state", new_value, NULL);
}
break;
default:
break;
}
}
free(operation->op);
}
free(operation);
}
}
static void set_card_profile(pa_context *ctx, const pa_card_info *info, int eol, void *data)
{
CadPulseOperation *operation = data;
pa_card_profile_info2 *profile;
pa_operation *op = NULL;
if (eol != 0)
return;
if (!info) {
g_critical("PA returned no card info (eol=%d)", eol);
return;
}
if (info->index != operation->pulse->card_id)
return;
profile = info->active_profile2;
if (strcmp(profile->name, SND_USE_CASE_VERB_VOICECALL) == 0 && operation->value == 0) {
g_debug("switching to default profile");
op = pa_context_set_card_profile_by_index(ctx, operation->pulse->card_id,
SND_USE_CASE_VERB_HIFI,
operation_complete_cb, operation);
} else if (strcmp(profile->name, SND_USE_CASE_VERB_HIFI) == 0 && operation->value == 1) {
g_debug("switching to voice profile");
op = pa_context_set_card_profile_by_index(ctx, operation->pulse->card_id,
SND_USE_CASE_VERB_VOICECALL,
operation_complete_cb, operation);
}
if (op) {
pa_operation_unref(op);
} else {
g_debug("%s: nothing to be done", __func__);
operation_complete_cb(ctx, 1, operation);
}
}
static void set_output_port(pa_context *ctx, const pa_sink_info *info, int eol, void *data)
{
CadPulseOperation *operation = data;
pa_operation *op = NULL;
const gchar *target_port;
if (eol != 0)
return;
if (!info) {
g_critical("PA returned no sink info (eol=%d)", eol);
return;
}
if (info->card != operation->pulse->card_id || info->index != operation->pulse->sink_id)
return;
if (operation->op && operation->op->type == CAD_OPERATION_SELECT_MODE) {
/*
* When switching to voice call mode, we want to switch to any port
* other than the speaker; this makes sure we use the headphones if they
* are connected, and the earpiece otherwise.
* When switching back to normal mode, the highest priority port is to
* be selected anyway.
*/
if (operation->value == CALL_AUDIO_MODE_CALL)
target_port = get_available_sink_port(info, operation->pulse->speaker_port);
else
target_port = get_available_sink_port(info, NULL);
} else {
/*
* When forcing speaker output, we simply select the speaker port.
* When disabling speaker output, we want the highest priority port
* other than the speaker, so that we use the headphones if connected,
* and the earpiece otherwise.
*/
if (operation->value)
target_port = operation->pulse->speaker_port;
else
target_port = get_available_sink_port(info, operation->pulse->speaker_port);
}
g_debug("active port is '%s', target port is '%s'", info->active_port->name, target_port);
if (target_port && strcmp(info->active_port->name, target_port) != 0) {
g_debug("switching to target port '%s'", target_port);
op = pa_context_set_sink_port_by_index(ctx, operation->pulse->sink_id,
target_port,
operation_complete_cb, operation);
}
if (op) {
pa_operation_unref(op);
} else {
g_debug("%s: nothing to be done", __func__);
operation_complete_cb(ctx, 1, operation);
}
}
/**
* cad_pulse_select_mode:
* @mode:
* @cad_op:
*
*/
void cad_pulse_select_mode(CallAudioMode mode, CadOperation *cad_op)
{
CadPulseOperation *operation = g_new(CadPulseOperation, 1);
pa_operation *op = NULL;
if (!cad_op) {
g_critical("%s: no callaudiod operation", __func__);
goto error;
}
/*
* Make sure cad_op is of the correct type!
*/
g_assert(cad_op->type == CAD_OPERATION_SELECT_MODE);
operation->pulse = cad_pulse_get_default();
operation->op = cad_op;
operation->value = mode;
if (mode != CALL_AUDIO_MODE_CALL) {
/*
* When ending a call, we want to make sure the mic doesn't stay muted
*/
CadOperation *unmute_op = g_new0(CadOperation, 1);
unmute_op->type = CAD_OPERATION_MUTE_MIC;
cad_pulse_mute_mic(FALSE, unmute_op);
/*
* If the card has a dedicated voice profile, disable speaker so it
* doesn't get automatically enabled for next call.
*/
if (operation->pulse->has_voice_profile) {
CadOperation *disable_speaker_op = g_new0(CadOperation, 1);
disable_speaker_op->type = CAD_OPERATION_ENABLE_SPEAKER;
cad_pulse_enable_speaker(FALSE, disable_speaker_op);
}
}
if (operation->pulse->has_voice_profile) {
/*
* The pinephone f.e. has a voice profile
*/
g_debug("card has voice profile, using it");
op = pa_context_get_card_info_by_index(operation->pulse->ctx,
operation->pulse->card_id,
set_card_profile, operation);
} else {
if (operation->pulse->sink_id < 0) {
g_warning("card has no voice profile and no usable sink");
goto error;
}
g_debug("card doesn't have voice profile, switching output port");
op = pa_context_get_sink_info_by_index(operation->pulse->ctx,
operation->pulse->sink_id,
set_output_port, operation);
}
if (op)
pa_operation_unref(op);
return;
error:
if (cad_op) {
cad_op->success = FALSE;
if (cad_op->callback)
cad_op->callback(cad_op);
}
if (operation)
free(operation);
}
void cad_pulse_enable_speaker(gboolean enable, CadOperation *cad_op)
{
CadPulseOperation *operation = g_new(CadPulseOperation, 1);
pa_operation *op = NULL;
if (!cad_op) {
g_critical("%s: no callaudiod operation", __func__);
goto error;
}
/*
* Make sure cad_op is of the correct type!
*/
g_assert(cad_op->type == CAD_OPERATION_ENABLE_SPEAKER);
operation->pulse = cad_pulse_get_default();
if (operation->pulse->sink_id < 0) {
g_warning("card has no usable sink");
goto error;
}
operation->op = cad_op;
operation->value = (guint)enable;
op = pa_context_get_sink_info_by_index(operation->pulse->ctx,
operation->pulse->sink_id,
set_output_port, operation);
if (op)
pa_operation_unref(op);
return;
error:
if (cad_op) {
cad_op->success = FALSE;
if (cad_op->callback)
cad_op->callback(cad_op);
}
if (operation)
free(operation);
}
void cad_pulse_mute_mic(gboolean mute, CadOperation *cad_op)
{
CadPulseOperation *operation = g_new(CadPulseOperation, 1);
pa_operation *op = NULL;
if (!cad_op) {
g_critical("%s: no callaudiod operation", __func__);
goto error;
}
/*
* Make sure cad_op is of the correct type!
*/
g_assert(cad_op->type == CAD_OPERATION_MUTE_MIC);
operation->pulse = cad_pulse_get_default();
if (operation->pulse->source_id < 0) {
g_warning("card has no usable source");
goto error;
}
operation->op = cad_op;
operation->value = (guint)mute;
if (operation->pulse->mic_state == CALL_AUDIO_MIC_OFF && !operation->value) {
g_debug("mic is muted, unmuting...");
op = pa_context_set_source_mute_by_index(operation->pulse->ctx,
operation->pulse->source_id, 0,
operation_complete_cb, operation);
} else if (operation->pulse->mic_state == CALL_AUDIO_MIC_ON && operation->value) {
g_debug("mic is active, muting...");
op = pa_context_set_source_mute_by_index(operation->pulse->ctx,
operation->pulse->source_id, 1,
operation_complete_cb, operation);
}
if (op) {
pa_operation_unref(op);
} else {
g_debug("%s: nothing to be done", __func__);
operation_complete_cb(operation->pulse->ctx, 1, operation);
}
return;
error:
if (cad_op) {
cad_op->success = FALSE;
if (cad_op->callback)
cad_op->callback(cad_op);
}
if (operation)
free(operation);
}
CallAudioMode cad_pulse_get_audio_mode(void)
{
CadPulse *self = cad_pulse_get_default();
return self->audio_mode;
}
CallAudioSpeakerState cad_pulse_get_speaker_state(void)
{
CadPulse *self = cad_pulse_get_default();
return self->speaker_state;
}
CallAudioMicState cad_pulse_get_mic_state(void)
{
CadPulse *self = cad_pulse_get_default();
return self->mic_state;
}
07070100000029000081A400000000000000000000000164632D5900000309000000000000000000000000000000000000002100000000callaudiod-0.1.9/src/cad-pulse.h/*
* Copyright (C) 2018, 2019 Purism SPC
* Copyright (C) 2020 Arnaud Ferraris <arnaud.ferraris@gmail.com>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#pragma once
#include "libcallaudio.h"
#include "cad-operation.h"
#include <glib-object.h>
G_BEGIN_DECLS
#define CAD_TYPE_PULSE (cad_pulse_get_type())
G_DECLARE_FINAL_TYPE(CadPulse, cad_pulse, CAD, PULSE, GObject);
CadPulse *cad_pulse_get_default(void);
void cad_pulse_select_mode(CallAudioMode mode, CadOperation *op);
void cad_pulse_enable_speaker(gboolean enable, CadOperation *op);
void cad_pulse_mute_mic(gboolean mute, CadOperation *op);
CallAudioMode cad_pulse_get_audio_mode(void);
CallAudioSpeakerState cad_pulse_get_speaker_state(void);
CallAudioMicState cad_pulse_get_mic_state(void);
G_END_DECLS
0707010000002A000081A400000000000000000000000164632D590000086D000000000000000000000000000000000000002200000000callaudiod-0.1.9/src/callaudiod.c/*
* Copyright (C) 2019 Purism SPC
* Copyright (C) 2020 Arnaud Ferraris <arnaud.ferraris@gmail.com>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#define G_LOG_DOMAIN "callaudiod"
#include "callaudiod.h"
#include "cad-manager.h"
#include "cad-pulse.h"
#include "config.h"
#include <glib.h>
#include <glib-unix.h>
static GMainLoop *main_loop = NULL;
static gboolean quit_cb(gpointer user_data)
{
g_info("Caught signal, shutting down...");
if (main_loop)
g_idle_add((GSourceFunc)g_main_loop_quit, main_loop);
else
exit(0);
return FALSE;
}
static void bus_acquired_cb(GDBusConnection *connection, const gchar *name,
gpointer user_data)
{
CadManager *manager = cad_manager_get_default();
g_debug("Bus acquired, creating manager...");
g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(manager),
connection, CALLAUDIO_DBUS_PATH, NULL);
}
static void name_acquired_cb(GDBusConnection *connection, const gchar *name,
gpointer user_data)
{
g_debug("Service name '%s' was acquired", name);
}
static void name_lost_cb(GDBusConnection *connection, const gchar *name,
gpointer user_data)
{
if (!name) {
g_warning("Could not get the session bus. Make sure "
"the message bus daemon is running!");
} else {
if (connection)
g_warning("Could not acquire the '%s' service name", name);
else
g_debug("DBus connection close");
}
g_main_loop_quit(main_loop);
}
int main(int argc, char **argv)
{
g_unix_signal_add(SIGTERM, quit_cb, NULL);
g_unix_signal_add(SIGINT, quit_cb, NULL);
main_loop = g_main_loop_new(NULL, FALSE);
// Initialize the PulseAudio backend
cad_pulse_get_default();
g_bus_own_name(CALLAUDIO_DBUS_TYPE, CALLAUDIO_DBUS_NAME,
G_BUS_NAME_OWNER_FLAGS_NONE,
bus_acquired_cb, name_acquired_cb, name_lost_cb,
NULL, NULL);
g_main_loop_run(main_loop);
g_main_loop_unref(main_loop);
return 0;
}
0707010000002B000081A400000000000000000000000164632D590000012F000000000000000000000000000000000000002200000000callaudiod-0.1.9/src/callaudiod.h/*
* Copyright (C) 2020 Arnaud Ferraris <arnaud.ferraris@gmail.com>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#pragma once
#define CALLAUDIO_DBUS_NAME "org.mobian_project.CallAudio"
#define CALLAUDIO_DBUS_PATH "/org/mobian_project/CallAudio"
#define CALLAUDIO_DBUS_TYPE G_BUS_TYPE_SESSION
0707010000002C000081A400000000000000000000000164632D59000002A8000000000000000000000000000000000000002100000000callaudiod-0.1.9/src/meson.build#
# Copyright (C) 2019 Purism SPC
# Copyright (C) 2020 Arnaud Ferraris <arnaud.ferraris@gmail.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
cad_deps = [
dependency('alsa'),
dependency('gobject-2.0'),
dependency('gio-unix-2.0'),
dependency('libpulse'),
dependency('libpulse-mainloop-glib'),
]
executable (
'callaudiod',
config_h,
generated_dbus_sources,
libcallaudio_enum_sources,
[
'callaudiod.c', 'callaudiod.h',
'cad-manager.c', 'cad-manager.h',
'cad-pulse.c', 'cad-pulse.h',
],
dependencies : cad_deps,
include_directories : include_directories('..', '../libcallaudio'),
install : true
)
0707010000002D000041ED00000000000000000000000264632D5900000000000000000000000000000000000000000000001700000000callaudiod-0.1.9/tools0707010000002E000081A400000000000000000000000164632D5900000A17000000000000000000000000000000000000002600000000callaudiod-0.1.9/tools/callaudiocli.c/*
* 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 "libcallaudio-enums.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;
gboolean status = FALSE;
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},
{"status", 'S', 0, G_OPTION_ARG_NONE, &status, "Print status", 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 there's nothing else to be done, print the current status */
if (mode == -1 && speaker == -1 && mic == -1)
status = TRUE;
if (mode == CALL_AUDIO_MODE_DEFAULT || mode == CALL_AUDIO_MODE_CALL) {
if (!call_audio_select_mode(mode, &err)) {
return 1;
}
}
if (speaker == 0 || speaker == 1) {
if (!call_audio_enable_speaker((gboolean)speaker, &err)) {
return 1;
}
}
if (mic == 0 || mic == 1) {
if (!call_audio_mute_mic((gboolean)mic, &err)) {
return 1;
}
}
if (status) {
CallAudioMode audio_mode = call_audio_get_audio_mode();
CallAudioSpeakerState speaker_state = call_audio_get_speaker_state();
CallAudioMicState mic_state = call_audio_get_mic_state();
const char *string_audio = g_enum_to_string(CALL_TYPE_AUDIO_MODE, audio_mode);
const char *string_speaker = g_enum_to_string(CALL_TYPE_AUDIO_SPEAKER_STATE, speaker_state);
const char *string_mic = g_enum_to_string(CALL_TYPE_AUDIO_MIC_STATE, mic_state);
g_print("Selected mode: %s\n"
"Speaker enabled: %s\n"
"Mic muted: %s\n",
string_audio, string_speaker, string_mic);
}
call_audio_deinit ();
return 0;
}
0707010000002F000081A400000000000000000000000164632D5900000104000000000000000000000000000000000000002300000000callaudiod-0.1.9/tools/meson.buildcallaudiocli_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,
)
07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!252 blocks