Commit Graph

65 Commits

Author SHA1 Message Date
Alberts Muktupāvels
02cab4d3a3 build: ignore .dirstamp file 2020-04-09 13:53:36 +00:00
Carlos Garnacho
e2be83ee4a build: Bump pulseaudio dependency
We need 12.99.3 in order to avoid deadlocks on Xwayland startup, see
79a8efb45c

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2599
2020-04-09 12:14:25 +02:00
Florian Müllner
ec5cf3e0de mixer-control: Expose stream state
The state can be used to determine whether audio is currently playing
or not, which can be useful information.

https://gitlab.gnome.org/GNOME/libgnome-volume-control/merge_requests/8
2019-11-23 02:42:51 +01:00
Florian Müllner
647e24625a build: Don't limit pulseaudio-fake header to introspection
We'll soon need the types for glib-mkenums as well.

https://gitlab.gnome.org/GNOME/libgnome-volume-control/merge_requests/8
2019-11-23 02:42:51 +01:00
Florian Müllner
43be5d272c build: Drop autotools support
All of gnome-control-center, gnome-settings-daemon and gnome-shell
are meson-only nowadays, so there seems little point in supporting
two build systems.

https://gitlab.gnome.org/GNOME/libgnome-volume-control/merge_requests/9
2019-11-22 19:40:27 +01:00
Florian Müllner
78d3f49f79 ci: Use meson for CI build
All consumers of the submodule switched to meson, except the CI build.
It neither seems useful to maintain a second build system just for that
purpose, nor to test a configuation that isn't used by anybody.

So set up a small fake project that includes gvc as a subproject, and
build that during CI.

https://gitlab.gnome.org/GNOME/libgnome-volume-control/merge_requests/9
2019-11-22 19:37:31 +01:00
Georges Basile Stavracas Neto
468022b708
mixer-control: Use the "emblem-system-symbolic" icon
As suggested by the last round of design review [1], use the
"emblem-system-symbolic" icon with system sounds.

[1] https://gitlab.gnome.org/GNOME/gnome-control-center/issues/548
2019-06-14 15:02:17 -03:00
Robert Ancell
3f457453f0 Add missing guards for inputs to functions 2019-03-18 10:58:36 +13:00
Robert Ancell
b28ae07ae1 Add missing allow-none annotations 2019-03-18 10:58:36 +13:00
Bastien Nocera
0e1b4bdafc ci: Add CI
This just builds the "what-did-you-plugin" test application, but it's
good enough to catch the worst failures.
2019-02-27 14:26:26 +01:00
Andre Klapper
ae1a34aafc Comment invalid <category> in DOAP file to pass git pre-receive hook 2018-12-16 01:22:53 +01:00
Guido Günther
3513d37510 gvc-mixer-ui-device: Trim additional newlines in debug output
GVC logs a lot aready. No need to make it consume more screen space
with additional newlines.
2018-12-07 15:29:16 +01:00
Bastien Nocera
7de39e768e Merge branch 'wip/muktupavels/warnings' into 'master'
Fix build warnings

See merge request GNOME/libgnome-volume-control!2
2018-09-10 10:36:33 +00:00
Alberts Muktupāvels
4e9205d6f3 fix cast-function-type warnings
gvc-mixer-card.c: In function ‘gvc_mixer_card_finalize’:
gvc-mixer-card.c:571:53: warning: cast between incompatible function types from ‘void (*)(GvcMixerCardProfile *)’ {aka ‘void (*)(struct <anonymous> *)’} to ‘void (*)(void *, void *)’ [-Wcast-function-type]
         g_list_foreach (mixer_card->priv->profiles, (GFunc) free_profile, NULL);

gvc-mixer-stream.c: In function ‘gvc_mixer_stream_finalize’:
gvc-mixer-stream.c:1044:52: warning: cast between incompatible function types from ‘void (*)(GvcMixerStreamPort *)’ {aka ‘void (*)(struct <anonymous> *)’} to ‘void (*)(void *, void *)’ [-Wcast-function-type]
         g_list_foreach (mixer_stream->priv->ports, (GFunc) free_port, NULL);
2018-09-10 13:12:48 +03:00
Alberts Muktupāvels
13a4a9a5c2 avoid deprecated g_type_class_add_private 2018-09-09 00:02:41 +03:00
Bastien Nocera
3f30a641ef Merge branch 'wip/fmuellner/remove-rpath' into 'master'
build: Remove bogus rpath

See merge request GNOME/libgnome-volume-control!1
2018-09-07 13:33:22 +00:00
Bastien Nocera
172ccc40bb README: Add README
Closes: #1
2018-09-07 15:31:39 +02:00
Florian Müllner
eeaffe5c3d build: Remove bogus rpath
If anything it should be `pkglibdir`, but as it looks like nobody
lost their volume controls, it's apparently not needed at all.

https://gitlab.gnome.org/GNOME/libgnome-volume-control/merge_requests/1
2018-08-20 14:26:18 +02:00
Iñigo Martínez
6a0ac9ba69 build: Remove config.h template file
The `config.h` can be generated without any template.

This patch removes the template file and modifies the build file
to not make any use of it.

It also removes the variable which holds the generated configuration
file target, as it will not be necessary for any packages building
libgnome-volume-control.

https://bugzilla.gnome.org/show_bug.cgi?id=792948
2018-01-30 13:16:22 +01:00
Iñigo Martínez
ef5d07fa21 build: Remove the include directory variable
The variable which holds the current directory is not necessary
because this is already included when building the library.

However, it might be interessant for any package using the library
to include the directory where headers are present, so the
current directory is appended to the library dependency without
the include directory variable.

https://bugzilla.gnome.org/show_bug.cgi?id=792948
2018-01-30 13:16:06 +01:00
Iñigo Martínez
69eac7d7cc build: Make use of assert function
meson has support for `assert` function, which halts meson's
execution showing a given message when a given condition is false.

This patch takes advantage of this function to slightly improve
meson's build file readibility.

It also removes a duplicated check for `pkglibdir` being set when
introspection is also set, because this check is already done when
a shared library is being created, that is a precondition for
introspection generation.

https://bugzilla.gnome.org/show_bug.cgi?id=792948
2018-01-30 13:15:58 +01:00
Iñigo Martínez
f764bb68e0 build: Do not use headers on library building
Headers are not necessary to be passed to the library compilation
function because the compiler will find them. On the other hand
they are necessary for the proper GIR generation.

This patch splits headers and sources, uses only sources for the
library building and uses both for GIR generation. It also allows
getting both separately.

https://bugzilla.gnome.org/show_bug.cgi?id=792948
2018-01-30 13:15:52 +01:00
Iñigo Martínez
68b7fccda8 build: Remove dependencies' variables
A set of different variables are used to hold dependencies. However,
no individual use of them is done.

This patch removes these variables and holds their objects directly
in the array of dependencies.

https://bugzilla.gnome.org/show_bug.cgi?id=792948
2018-01-30 13:15:45 +01:00
Iñigo Martínez
b4854a80a9 build: Rename build options
Following the meson porting guidelines, this patch renames the build
options. The list of changes is as follows:

- Remove the with prefix from string options.
- The character separator from multi-word options has been changed
  to underscore.

It also changes the introspection and static meson variables to be
consistent with the one used for alsa.

https://bugzilla.gnome.org/show_bug.cgi?id=792948
2018-01-30 13:15:36 +01:00
Iñigo Martínez
67533bffdc build: Make ALSA support optional
ALSA support is not mandatory for libgnome-volume-control, but it
can not be made optional.

This patch makes the ALSA support optional by using an option.

https://bugzilla.gnome.org/show_bug.cgi?id=792919
2018-01-26 10:47:08 +01:00
Robert Ancell
9a2996b362 Fix unused GIR transfer notation on integer values 2017-12-06 13:48:49 +13:00
Robert Ancell
9f671ca77b Fix printf without supplied argument 2017-12-06 13:45:58 +13:00
Dmitry Shachnev
84087213f1 mixer-control: Fix a typo in a debug message
https://bugzilla.gnome.org/show_bug.cgi?id=788565
2017-10-05 23:59:04 +02:00
Florian Müllner
5b97727788 build: Don't include sources either ...
The dependency already specifies the library to link with, no need
to also list the sources used to compile said library.
2017-08-10 19:23:23 +02:00
Florian Müllner
3093bdb077 build: Don't include c_args in dependency
The defines are only relevant for compiling libgvc itself, not for
any consumers of the library. In fact, setting G_LOG_DOMAIN is
likely to conflict with the log domain defined by the including
project ...
2017-07-22 15:15:45 +02:00
Florian Müllner
3f71aac04b build: Fix non-alsa builds
The code only checks whether HAVE_ALSA is defined, not its value,
so defining it to 0 doesn't work as expected ...
2017-07-20 01:23:29 +02:00
Florian Müllner
01e1fde6e5 Add support for building with meson
Allow the module to be included as a meson subproject() in addition
to the existing autotools support. Based heavily on the meson
support in https://git.gnome.org/browse/libgd.

https://bugzilla.gnome.org/show_bug.cgi?id=783207
2017-05-29 19:53:01 +02:00
David Henningsson
ce8e4880ce mixer-control: Fix selecting Bluetooth input when on A2DP profile
When on A2DP profile and a Bluetooth input is selected, we first need to
switch the profile to HFP/HSP, then select the default source to be that
profile. In some cases the latter step was forgotten, because
the variable "profile_swapping_device_id" was reset before it was
supposed to be used.

https://bugzilla.gnome.org/show_bug.cgi?id=736943
2017-04-06 15:06:28 +02:00
Bastien Nocera
d52194fce1 mixer-control: Fix extra reference being leaked
In both cases objects are inserted in hash table by adding an
extra ref, but the existing reference was never removed. Don't
add a reference instead, so we don't end up with a spare one.

Based on patch by Alberts Muktupāvels <alberts.muktupavels@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=765694
2017-04-06 14:34:51 +02:00
Bastien Nocera
25bf3ed75f gvc-mixer-control: Really fix double-free when setting headset
In a28e23d900, we said:
The callbacks will be called repeatedly, once with data, and later
on with eol == 0. Make sure to only free it when we get the eol call
instead of once we've applied the settings.

Whereas the docs say:
When requesting all of these [instances] at once, the callback will be
called multiple times, once for each object. When the list has been
exhausted, the callback will be called without an information structure
and the eol parameter set to a positive value.

If an error occurs, the callback will be invoked without an information
structure and eol set to a negative value.

So, in all, we need to free our callback data when eol is positive, or
negative. So, when it's not 0.

Seems we got lucky in the original commit because the test machine only
had a single soundcard.
2016-04-17 22:27:47 +02:00
Bastien Nocera
8fc9c62a69 tests: Add audio device selection question
So that the test utility mimicks the code in gnome-settings-daemon.
2016-04-17 22:27:26 +02:00
Bastien Nocera
2a117d6024 tests: Add a Makefile for tests
And add a test for the audio device selection feature, added in
GNOME 3.20.
2016-04-17 20:49:55 +02:00
Bastien Nocera
0a500795bd gvc-mixer-control: Fix memory leak on error path
When setting the headset port, make sure to also free the work data
if eol is negative, eg. if the call failed.
2016-02-22 14:06:08 +01:00
Bastien Nocera
a28e23d900 gvc-mixer-control: Fix double-free when setting headset
The callbacks will be called repeatedly, once with data, and later
on with eol == 0. Make sure to only free it when we get the eol call
instead of once we've applied the settings.

Example valgrind output:
==31715== Invalid read of size 8
==31715==    at 0x24529E09: port_status_data_free (gvc-mixer-control.c:2079)
==31715==    by 0x1DB81344: ??? (in /usr/lib64/libpulse.so.0.18.2)
==31715==    by 0x1DDF3FE0: ??? (in /usr/lib64/pulseaudio/libpulsecommon-7.1.so)
==31715==    by 0x1DDF436A: pa_pdispatch_run (in /usr/lib64/pulseaudio/libpulsecommon-7.1.so)
==31715==    by 0x1DB7507D: ??? (in /usr/lib64/libpulse.so.0.18.2)
==31715==    by 0x1DDF6B5E: ??? (in /usr/lib64/pulseaudio/libpulsecommon-7.1.so)
==31715==    by 0x1DDF91BA: ??? (in /usr/lib64/pulseaudio/libpulsecommon-7.1.so)
==31715==    by 0x1DDF9568: ??? (in /usr/lib64/pulseaudio/libpulsecommon-7.1.so)
==31715==    by 0x1DDF9DF9: ??? (in /usr/lib64/pulseaudio/libpulsecommon-7.1.so)
==31715==    by 0x1D96202A: ??? (in /usr/lib64/libpulse-mainloop-glib.so.0.0.5)
==31715==    by 0x7AA7CF9: g_main_dispatch (gmain.c:3154)
==31715==    by 0x7AA7CF9: g_main_context_dispatch (gmain.c:3769)
==31715==    by 0x7AA8057: g_main_context_iterate.isra.29 (gmain.c:3840)
==31715==  Address 0x2bd83480 is 0 bytes inside a block of size 16 free'd
==31715==    at 0x4C2ED6A: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==31715==    by 0x7AAD2AD: g_free (gmem.c:189)
==31715==    by 0x1DB81562: ??? (in /usr/lib64/libpulse.so.0.18.2)
==31715==    by 0x1DDF3FE0: ??? (in /usr/lib64/pulseaudio/libpulsecommon-7.1.so)
==31715==    by 0x1DDF436A: pa_pdispatch_run (in /usr/lib64/pulseaudio/libpulsecommon-7.1.so)
==31715==    by 0x1DB7507D: ??? (in /usr/lib64/libpulse.so.0.18.2)
==31715==    by 0x1DDF6B5E: ??? (in /usr/lib64/pulseaudio/libpulsecommon-7.1.so)
==31715==    by 0x1DDF91BA: ??? (in /usr/lib64/pulseaudio/libpulsecommon-7.1.so)
==31715==    by 0x1DDF9568: ??? (in /usr/lib64/pulseaudio/libpulsecommon-7.1.so)
==31715==    by 0x1DDF9DF9: ??? (in /usr/lib64/pulseaudio/libpulsecommon-7.1.so)
==31715==    by 0x1D96202A: ??? (in /usr/lib64/libpulse-mainloop-glib.so.0.0.5)
==31715==    by 0x7AA7CF9: g_main_dispatch (gmain.c:3154)
==31715==    by 0x7AA7CF9: g_main_context_dispatch (gmain.c:3769)
==31715==  Block was alloc'd at
==31715==    at 0x4C2F9C7: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==31715==    by 0x7AAD1F0: g_malloc0 (gmem.c:124)
==31715==    by 0x2452A39D: gvc_mixer_control_set_port_status_for_headset (gvc-mixer-control.c:2173)
==31715==    by 0x2451BE81: audio_selection_done (gsd-media-keys-manager.c:2489)
==31715==    by 0x7550ED3: emit_signal_instance_in_idle_cb (gdbusconnection.c:3701)
==31715==    by 0x7AA7CF9: g_main_dispatch (gmain.c:3154)
==31715==    by 0x7AA7CF9: g_main_context_dispatch (gmain.c:3769)
==31715==    by 0x7AA8057: g_main_context_iterate.isra.29 (gmain.c:3840)
==31715==    by 0x7AA8371: g_main_loop_run (gmain.c:4034)
==31715==    by 0x5CEA204: gtk_main (gtkmain.c:1246)
==31715==    by 0x403804: main (main.c:434)
2016-02-22 14:06:03 +01:00
Rui Matos
3af25601db gvc-mixer-control: Fix uninitialized variable usage 2016-02-11 18:41:05 +01:00
Bastien Nocera
f3f6812eb9 gvc: Add "what did you plug in" support API
Add "audio-device-selection-needed" which will be emitted when a
headphones, headset or microphone is plugged into a jack socket that
cannot detect which type it was.

Once the user of libgnome-volume-control has asked the user which type
of device this was, they can call gvc_mixer_control_set_headset_port()
to switch the ports for that configuration.

Note that gvc_mixer_control_set_headset_port() supports passing the
card ID, but the detection code only supports a single such device. When
we find hardware that can support > 1 such device, we can test and
implement support without breaking the API.

Based on the original code by David Henningsson <david.henningsson@canonical.com>
for the unity-settings-daemon

https://bugzilla.gnome.org/show_bug.cgi?id=755062
2016-01-17 18:34:07 -02:00
Carlos Silva
d4eda71c49 gvc-mixer-source-output: Update volume and mute status
This commit implements notifying about volume and mute status changes
for source outputs (applications that monitor the microphone, in short).

https://bugzilla.gnome.org/show_bug.cgi?id=760387
2016-01-12 01:31:56 +01:00
Alexander Hofbauer
7e5504db3d Emit a signal for stream-changed
https://bugzilla.gnome.org/show_bug.cgi?id=744140
2015-10-05 15:36:43 +02:00
Alberts Muktupāvels
0a79019088 gvc-mixer-control: fix build warnings
- Fix warning about comparison between signed and unsigned integer
  expressions
- Change variable name 'output' to 'device' to fix warning:
  declaration of 'output' shadows a parameter
- Fix warning about missing default case in switch
2015-09-15 15:45:53 +03:00
Alberts Muktupāvels
84819a350d gvc-mixer-stream: make card-index unsigned int
Card in pa_source_info that is used as card-index is uint32_t so it
is never less then 0. Also index in GvcMixerCard is already unsigned
int that is used to compare with card-index. This fixes build
warning - comparison between signed and unsigned integer expressions.

https://bugzilla.gnome.org/show_bug.cgi?id=752244
2015-09-15 15:35:26 +03:00
Alberts Muktupāvels
b7bce32944 gvc-mixer-ui-device: make stream-id unsigned int
GvcMixerStream id is unsigned int and starts with 1, so we can use
0 as invalid id. This fixes build error/warning - comparison
between signed and unsigned integer expressions.
2015-09-09 14:14:15 +03:00
Alberts Muktupāvels
26ea473077 gvc-mixer-ui-device: fix build warnings 2015-09-09 14:13:03 +03:00
Alberts Muktupāvels
7e2d239a91 remove unneeded *_class_init and *_init declarations 2015-09-09 14:13:00 +03:00
David Henningsson
fac3a900e5 gvc-mixer-control: Fix bluetooth duplicates
Entries are only hidden when available == PA_PORT_AVAILABLE_NO, so if an
entry toggles between PA_PORT_AVAILABLE_YES and
PA_PORT_AVAILABLE_UNKNOWN (Bluetooth headset switching between HSP/HFP
and A2DP for example), this should not result in new entries being created.

https://bugzilla.gnome.org/show_bug.cgi?id=697545
2015-04-01 14:10:14 +02:00
Jasper St. Pierre
e14dbe8aa6 gvc-mixer-ui-device: Fix memory leak 2013-09-04 12:58:28 -04:00