After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 528299 - Multiple GstMixerTracks with the same label cause problems for GNOME Volume Control
Multiple GstMixerTracks with the same label cause problems for GNOME Volume C...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
0.10.19
Other All
: Normal normal
: 0.10.21
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks: 528050
 
 
Reported: 2008-04-15 20:24 UTC by Sam Morris
Modified: 2008-06-26 06:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fix duplicate untranslated-label in GstAlsaMixerTrack (2.75 KB, patch)
2008-04-16 00:32 UTC, Sam Morris
needs-work Details | Review
fix duplicate label and untranslated-label in GstAlsaMixerOptions (2.44 KB, patch)
2008-04-16 00:54 UTC, Sam Morris
needs-work Details | Review
add index property to GetAlsaMixerTrack & GstAlsaMixerOptions (4.56 KB, patch)
2008-06-22 21:35 UTC, Sam Morris
committed Details | Review

Description Sam Morris 2008-04-15 20:24:30 UTC
Background

I am trying to fix bug #528050. The problem is that gnome-volume-control needs to store persistent references to a system's GstMixerTracks. It currently uses a string key based on the values of the following tuple:

  (GstMixer->device-name, GstMixer->factory->long_name, GstMixerTrack->label)

Actually, it uses the GstMixerTrack's "untranslated-label" property, falling back to "label" if it is NULL.

The Problem

My new laptop has six problematic GstMixerTracks. The first three have a label of "Capture", "Capture 1" and "Capture 2", but they all share the same untranslated label property of "Capture". The next three all have the same label and untranslated label: "Input Source"

So, my question is: is gnome-volume-control correct to use these properties as a key to uniquely identify a GstMixerTrack?
Comment 1 Sam Morris 2008-04-16 00:32:04 UTC
Created attachment 109345 [details] [review]
fix duplicate untranslated-label in GstAlsaMixerTrack

This patch adds the index number to the untranslated-label property of GstAlsaMixerTrack.
Comment 2 Sam Morris 2008-04-16 00:54:42 UTC
Created attachment 109348 [details] [review]
fix duplicate label and untranslated-label in GstAlsaMixerOptions

This patch does the same for GstAlsaMixerOptions.
Comment 3 Sebastian Dröge (slomo) 2008-06-16 08:29:24 UTC
Looks good IMHO, will commit after base is unfrozen again.
Comment 4 Bastien Nocera 2008-06-19 13:30:56 UTC
+  /* FIXME: translate this? */
+  if (dupecount == 0) {
+    label = g_strdup (alsa_name);
+  } else {
+    label = g_strdup_printf ("%s %d", alsa_name, dupecount);
+  }

That breaks the translations (and the default visible tracks) in gnome-volume-control itself. You'd need to keep the same "untranslated-label" property, and add an "index" property for gnome-volume-control to manipulate, and present to the user properly.

And you should use snd_mixer_selem_get_index(), so you don't need to change the prototype of the functions:
http://www.alsa-project.org/alsa-doc/alsa-lib/group___simple_mixer.html#g3443fbb62c125c88009097e7fafe214f
Comment 5 Sam Morris 2008-06-19 13:59:06 UTC
Ok, and this won't tie the interface of the GstMixerTrack class to the way alsa works too closely?
Comment 6 Sam Morris 2008-06-22 21:35:39 UTC
Created attachment 113224 [details] [review]
add index property to GetAlsaMixerTrack & GstAlsaMixerOptions

First try at adding an 'index' property to GstAlsaMixerTrack and GstAlsaMixerOptions.
Comment 7 Sam Morris 2008-06-23 00:10:55 UTC
I should probably make the index property unsigned.
Comment 8 Sebastian Dröge (slomo) 2008-06-26 06:03:29 UTC
Looks good to me but the index property should really be unsigned I guess.
Committed with this change:

2008-06-26  Sebastian Dröge  <sebastian.droege@collabora.co.uk>

	Patch by: Sam Morris <sam at robots dot org to uk>

	* gst-libs/gst/interfaces/mixertrack.c:
	(gst_mixer_track_class_init), (gst_mixer_track_get_property),
	(gst_mixer_track_set_property):
	API: Add "index" property to GstMixerTrack to differantiate between
	multiple mixer tracks with the same label.

	* ext/alsa/gstalsamixeroptions.c: (gst_alsa_mixer_options_new):
	* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
	Set the "index" property of GstMixerTrack to the index given by ALSA.
	Fixes bug #528299.