Commit Graph

11 Commits

Author SHA1 Message Date
Jonas Dreßler
10a3c0a766 mixer-control: Support adding and removing card-ports after card was added
With pipewire, card ports are added or removed after the card is visible to us.
This is intended from the pipewire side, as audio routing is dynamic and can
change at any time.

This is the case for Bluetooth devices, where there are multiple ports for
the different profiles available. In case a profile becomes available or
goes unavailable (likely this can happen on connection issues on the Bluetooth
link), the ports will change.

Support this scenario by updating the ports list on card changes, adding new
ports (and creating new respective ui-devices) and removing ports (and removing
the respective ui-devices).

Now that we can add ports after creating the card, this likely means we can
remove handling for portless cards. At least Bluetooth devices nowadays have
ports, but they get them later.
2024-03-12 14:38:27 +01:00
Jonas Dreßler
76bb9e3148 mixer-card: Allow setting profiles on card more than once
With the next commit, we'll start updating card profiles after the initial
creation of the GvcMixerCard, so get gvc_mixer_card_set_profiles() ready and
support replacing the list of profiles instead of only setting it a single
time.
2024-03-07 12:25:19 +01:00
Jonas Dreßler
f75ad37943 mixer-card: Return in set_profile() when profile is already set
When we change the card profile, there's two paths the current profile gets
updated after the change: From _pa_context_set_card_profile_by_index_cb()
and from update_card() in gvc-mixer-control.c. Both call
gvc_mixer_card_set_profile(), and if the profile change was initiated by us,
we might call set_profile() twice. Handle this a bit better in set_profile()
and early-return in case the current profile is already set.
2024-03-07 12:13:35 +01:00
Niels De Graef
87a567eece mixer-card: Improve GObject properties gunk a bit
Keep track of the `GParamSpec`s of the properties. This allows us to use
`g_object_notify_by_pspec()`, which is a bit more performant than
`g_object_notify()`(as it doesn't need to take a global lock to lookup
the property name). It also prevents accidental typos in the property
name at compile time.

Also always add `G_PARAM_STATIC_STRINGS`, to prevent some unnecessary
string duplications of property name, blurb and description.
2023-07-18 15:52:10 +00:00
Robert Ancell
b28ae07ae1 Add missing allow-none annotations 2019-03-18 10:58:36 +13: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
Alberts Muktupāvels
7e2d239a91 remove unneeded *_class_init and *_init declarations 2015-09-09 14:13:00 +03:00
Giovanni Campagna
74c08620b4 Add a GIcon accessor for GvcMixerUIDevices
This will allow to have different icons for internal audio cards
(which are flagged generically as "audio-card"), depending on which
port is in use (ie. headphones or speakers).
This requires the new icon information, which is only exported by
PulseAudio 3.0. If it's not available, we fallback to card icons
like before.

https://bugzilla.gnome.org/show_bug.cgi?id=689931
2013-02-18 14:39:54 +01:00
Giovanni Campagna
a1448acc5b Fix introspection support
Fix includes, comments and parameter names so that introspection builds
without warnings.
2012-10-19 20:00:47 +02:00
Giovanni Campagna
9b6e6719d4 Initial import
Code from gnome-control-center, build system integration from gnome-shell
2012-10-19 20:00:25 +02:00