122
122
case PROP_DESC_LINE_1:
123
123
g_free (self->priv->first_line_desc);
124
124
self->priv->first_line_desc = g_value_dup_string (value);
125
/*g_debug ("gvc-mixer-output-set-property - 1st line: %s\n",
126
self->priv->first_line_desc);*/
125
g_debug ("gvc-mixer-output-set-property - 1st line: %s\n",
126
self->priv->first_line_desc);
128
128
case PROP_DESC_LINE_2:
129
129
g_free (self->priv->second_line_desc);
130
130
self->priv->second_line_desc = g_value_dup_string (value);
131
/*g_debug ("gvc-mixer-output-set-property - 2nd line: %s\n",
132
self->priv->second_line_desc);*/
131
g_debug ("gvc-mixer-output-set-property - 2nd line: %s\n",
132
self->priv->second_line_desc);
134
134
case PROP_CARD_ID:
135
135
self->priv->card_id = g_value_get_int (value);
136
/*g_debug ("gvc-mixer-output-set-property - card id: %i\n",
137
self->priv->gvc_card_id);*/
136
g_debug ("gvc-mixer-output-set-property - card id: %i\n",
137
self->priv->card_id);
139
139
case PROP_PORT_NAME:
140
140
g_free (self->priv->port_name);
141
141
self->priv->port_name = g_value_dup_string (value);
142
/*g_debug ("gvc-mixer-output-set-property - card port name: %s\n",
143
self->priv->card_port_name);*/
142
g_debug ("gvc-mixer-output-set-property - card port name: %s\n",
143
self->priv->port_name);
145
145
case PROP_STREAM_ID:
146
146
self->priv->stream_id = g_value_get_int (value);
147
/*g_debug ("gvc-mixer-output-set-property - sink id: %i\n",
148
self->priv->stream_id);*/
147
g_debug ("gvc-mixer-output-set-property - sink id: %i\n",
148
self->priv->stream_id);
150
150
case PROP_UI_DEVICE_TYPE:
151
151
self->priv->type = (UiDeviceDirection)g_value_get_uint (value);
153
153
case PROP_PORT_AVAILABLE:
154
154
self->priv->port_available = g_value_get_boolean (value);
155
/*g_debug ("gvc-mixer-output-set-property - port available %i, value passed in %i \n",
156
self->priv->port_available, g_value_get_boolean (value));*/
155
g_debug ("gvc-mixer-output-set-property - port available %i, value passed in %i \n",
156
self->priv->port_available, g_value_get_boolean (value));
159
159
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
315
315
g_type_class_add_private (klass, sizeof (GvcMixerUIDevicePrivate));
319
// Optimise so as on the first pass you can 'choose' which profiles to hold on to and
320
// which are useles because they are essentially duplicates.
321
// => a Breadthfirst approach is needed ...
319
gvc_mixer_ui_device_set_profiles (GvcMixerUIDevice *device, const GList *in_profiles)
321
This method attempts to reduce the list of profiles visible to the user by figuring out
322
from the context of that device (whether it's an input or an output) what profiles actually provide an alternative.
324
It does this by the following.
325
- It ignores off profiles.
326
- Sorts the incoming profiles by attempting to split each profile on the char '+'.
327
-- This will pull out the relevant aspect of the profile for the type of device this is.
328
e.g stereo analog out, bluetooth or HDMI for an output, stereo analog in or bluetooth for the input coming from
329
a typical setup of a onboard HDA intel card and bluetooth headset.
330
-- Will store this shortened string against the profile full length name.
332
- Next it tries to determine from our prepared hash above if we want to allow the user to change
333
the profile on the device i.e. if the profile combo should be visible to the user on the UI.
334
-- Is there any actual choice or just much of the same thing from the
335
context of the direction on this device.
336
-If there is a choice
337
-- It will gather the groups of identical profiles and choose the one that has the highest priority to insert
338
into the final list to be presented to the user.
339
- if the shortened profiles are identical so that the profile combo is to be hidden from the user
340
-- It will choose the profile with the highest priority. (the pattern assumes a device will always have a profile in it's profile list)
342
I think this algorithm is inherently flawed.
343
https://bugs.launchpad.net/ubuntu/+source/gnome-control-center/+bug/972554
344
An issue arises in this bug whereby the user needs to get at a specific profile which allows him a certain input and output
345
configuration. But this algorithem because of priority values etc will reject that one profile that he needs to get at.
347
Optimise so as on the first pass you can 'choose' which profiles to hold on to and
348
which are useles because they are essentially duplicates.
349
=> a depthfirst like approach is needed ...
323
352
gvc_mixer_ui_device_set_profiles (GvcMixerUIDevice *device, const GList *in_profiles)
325
354
g_debug ("\n SET PROFILES %s", gvc_mixer_ui_device_get_description(device));
330
357
GHashTable *profile_descriptions;
331
359
if (in_profiles == NULL)
334
362
device->priv->supported_profiles = g_list_copy (in_profiles);
336
// Is this being used ? TODO
337
profile_count = g_list_length (in_profiles);
339
363
profile_descriptions = g_hash_table_new_full (g_str_hash,
345
368
// Store each profile in a hash with the shortened relevant string as the key
346
369
for (t = in_profiles; t != NULL; t = t->next) {
443
466
g_debug ("\n Not identical - examine %s -> %s \n\n", short_name, p->profile);
445
// If we have already populated for this short name - trust our prioritisation below and move on.
468
// If we have already populated for this short name - trust?? our prioritisation below and move on
446
469
if (g_hash_table_contains (device->priv->profiles, short_name) == TRUE){
447
470
g_debug ("\n already populated for %s => ignore %s \n", short_name, p->profile);
489
// If it's identical (=> combo is insensitive) we want to find the profile that is
490
// relevant to the context of the device for the sake of the UI - avoid user confusion.
491
GList* profile_descriptions_keys;
492
profile_descriptions_keys = g_hash_table_get_keys (profile_descriptions);
494
gboolean matched = FALSE;
495
for (c = profile_descriptions_keys; c != NULL; c = c->next) {
498
gchar* shortened_value;
499
shortened_value = g_hash_table_lookup (profile_descriptions, prof);
500
if (g_strcmp0 (shortened_value, prof) == 0){
502
for (j = in_profiles; j != NULL; j = j->next) {
503
GvcMixerCardProfile* l;
505
if (g_strcmp0 (l->profile, prof) == 0){
506
g_hash_table_insert (device->priv->profiles,
507
g_strdup(shortened_value),
515
// We can't find the ideal profile for the insensitive combo
516
// just pick the one with the highest priority.
518
GvcMixerCardProfile* p = NULL;
519
// Since the profile list was already sorted on card port creation
520
// we just need to take the last one as this will have the highest priority
521
p = g_list_last (in_profiles)->data;
522
if (p != NULL && p->human_profile != NULL)
523
g_debug ("\n fail to match on profile %s \n", p->human_profile);
524
g_hash_table_insert (device->priv->profiles,
512
// Since the profile list was already sorted on card port creation
513
// we just need to take the last one as this will have the highest priority
514
GvcMixerCardProfile* p = NULL;
515
p = g_list_last (in_profiles)->data;
516
if (p != NULL && p->human_profile != NULL)
517
g_hash_table_insert (device->priv->profiles,
531
523
final_keys = g_hash_table_get_keys (device->priv->profiles);
533
525
g_debug ("\n\n Profile population \n FOR DEVICE %s", gvc_mixer_ui_device_get_description (device));