From: Stefan Kost Date: Tue, 24 Jun 2008 16:15:26 +0000 (+0000) Subject: ext/alsa/gstalsamixer.c: Also consider "speaker" as a name for master volume. If... X-Git-Tag: RELEASE-0_10_21~98 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1834a009a114d295f1712da62edea707616509de;p=platform%2Fupstream%2Fgst-plugins-base.git ext/alsa/gstalsamixer.c: Also consider "speaker" as a name for master volume. If that doesn't help look for the first... Original commit message from CVS: * ext/alsa/gstalsamixer.c: Also consider "speaker" as a name for master volume. If that doesn't help look for the first non-mono volume control that also has a playback switch. --- diff --git a/ChangeLog b/ChangeLog index fd44d1b0d..dfaad8cb9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-06-24 Stefan Kost + + * ext/alsa/gstalsamixer.c: + Also consider "speaker" as a name for master volume. If that doesn't + help look for the first non-mono volume control that also has a + playback switch. + 2008-06-24 Stefan Kost * ChangeLog: diff --git a/ext/alsa/gstalsamixer.c b/ext/alsa/gstalsamixer.c index 44d78bb67..96a6da014 100644 --- a/ext/alsa/gstalsamixer.c +++ b/ext/alsa/gstalsamixer.c @@ -165,7 +165,29 @@ gst_alsa_mixer_find_master_mixer (GstAlsaMixer * mixer, snd_mixer_t * handle) element = snd_mixer_elem_next (element); } - /* If not, check if we have a playback mixer with both volume and switch */ + /* If not, check if we have a playback mixer labelled as 'Speaker' */ + element = snd_mixer_first_elem (handle); + for (i = 0; i < count; i++) { + if (snd_mixer_selem_has_playback_volume (element) && + strcmp (snd_mixer_selem_get_name (element), "Speaker") == 0) { + return element; + } + element = snd_mixer_elem_next (element); + } + + /* If not, check if we have a playback mixer with both volume and switch that + * is not mono */ + element = snd_mixer_first_elem (handle); + for (i = 0; i < count; i++) { + if (snd_mixer_selem_has_playback_volume (element) && + snd_mixer_selem_has_playback_switch (element) && + !snd_mixer_selem_is_playback_mono (element)) { + return element; + } + element = snd_mixer_elem_next (element); + } + + /* If not, check if we have any playback mixer with both volume and switch */ element = snd_mixer_first_elem (handle); for (i = 0; i < count; i++) { if (snd_mixer_selem_has_playback_volume (element) &&