ALSA mixer track label internationalization (#154054).

Original commit message from CVS:
Reviewd by:  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_build_list):
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
* po/POTFILES.in:
ALSA mixer track label internationalization (#154054).
This commit is contained in:
Ronald S. Bultje 2004-10-25 15:58:35 +00:00
parent 3dfce58f84
commit 8c1e1212d6
5 changed files with 55 additions and 14 deletions

View file

@ -1,3 +1,13 @@
2004-10-25 Takao Fujiwara <Takao.Fujiwara@Sun.COM>
Reviewd by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_build_list):
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
* po/POTFILES.in:
ALSA mixer track label internationalization (#154054).
2004-10-25 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* ext/theora/theoradec.c: (theora_dec_chain):

View file

@ -265,7 +265,6 @@ gst_alsa_mixer_build_list (GstAlsaMixer * mixer)
/* build track list */
for (i = 0; i < count; i++) {
GList *item;
gchar *name;
gint channels = 0, samename = 0;
gint flags = GST_MIXER_TRACK_OUTPUT;
gboolean got_it = FALSE;
@ -286,16 +285,11 @@ gst_alsa_mixer_build_list (GstAlsaMixer * mixer)
element)))
samename++;
}
if (samename == 0)
name = g_strdup (snd_mixer_selem_get_name (element));
else
name = g_strdup_printf ("%s %d", snd_mixer_selem_get_name (element),
samename + 1);
if (snd_mixer_selem_has_capture_volume (element)) {
while (snd_mixer_selem_has_capture_channel (element, channels))
channels++;
track = gst_alsa_mixer_track_new (element, name,
track = gst_alsa_mixer_track_new (element, samename,
i, channels, flags, GST_ALSA_MIXER_TRACK_CAPTURE);
mixer->tracklist = g_list_append (mixer->tracklist, track);
got_it = TRUE;
@ -312,7 +306,7 @@ gst_alsa_mixer_build_list (GstAlsaMixer * mixer)
first = FALSE;
flags |= GST_MIXER_TRACK_MASTER;
}
track = gst_alsa_mixer_track_new (element, name,
track = gst_alsa_mixer_track_new (element, samename,
i, channels, flags, GST_ALSA_MIXER_TRACK_PLAYBACK);
mixer->tracklist = g_list_append (mixer->tracklist, track);
got_it = TRUE;
@ -328,13 +322,12 @@ gst_alsa_mixer_build_list (GstAlsaMixer * mixer)
if (flags == GST_MIXER_TRACK_OUTPUT &&
snd_mixer_selem_has_playback_switch (element)) {
/* simple mute switch */
track = gst_alsa_mixer_track_new (element, name,
track = gst_alsa_mixer_track_new (element, samename,
i, 0, flags, GST_ALSA_MIXER_TRACK_PLAYBACK);
mixer->tracklist = g_list_append (mixer->tracklist, track);
}
}
g_free (name);
next:
element = snd_mixer_elem_next (element);
}

View file

@ -21,6 +21,8 @@
#include "config.h"
#endif
#include <gst/gst-i18n-plugin.h>
#include "gstalsamixertrack.h"
static void gst_alsa_mixer_track_init (GstAlsaMixerTrack * alsa_track);
@ -69,17 +71,52 @@ gst_alsa_mixer_track_init (GstAlsaMixerTrack * alsa_track)
GstMixerTrack *
gst_alsa_mixer_track_new (snd_mixer_elem_t * element,
const gchar * label,
gint track_num, gint channels, gint flags, gint alsa_flags)
gint num, gint track_num, gint channels, gint flags, gint alsa_flags)
{
gint i;
long min = 0, max = 0;
struct
{
gchar *orig, *trans;
} alsa_track_labels[] = {
{
"Master", _("Master")}, {
"Bass", _("Bass")}, {
"Treble", _("Treble")}, {
"PCM", _("PCM")}, {
"Synth", _("Synth")}, {
"Line", _("Line-in")}, {
"CD", _("CD")}, {
"Mic", _("Microphone")}, {
"PC Speaker", _("PC Speaker")}, {
"Playback", _("Playback")}, {
"Capture", _("Capture")}, {
NULL, NULL}
};
GstMixerTrack *track = g_object_new (GST_ALSA_MIXER_TRACK_TYPE, NULL);
GstAlsaMixerTrack *alsa_track = (GstAlsaMixerTrack *) track;
/* set basic information */
track->label = g_strdup (label);
if (num == 0)
track->label = g_strdup (snd_mixer_selem_get_name (element));
else
track->label = g_strdup_printf ("%s %d",
snd_mixer_selem_get_name (element), num + 1);
i = 0;
while (alsa_track_labels[i].orig != NULL) {
if (!g_utf8_collate (snd_mixer_selem_get_name (element),
alsa_track_labels[i].orig)) {
g_free (track->label);
if (num == 0)
track->label = g_strdup (alsa_track_labels[i].trans);
else
track->label = g_strdup_printf ("%s %d",
alsa_track_labels[i].trans, num);
break;
}
i++;
}
track->num_channels = channels;
track->flags = flags;
alsa_track->element = element;

View file

@ -51,7 +51,7 @@ struct _GstAlsaMixerTrackClass {
GType gst_alsa_mixer_track_get_type (void);
GstMixerTrack * gst_alsa_mixer_track_new (snd_mixer_elem_t * element,
const gchar * name,
gint num,
gint track_num,
gint channels,
gint flags,

View file

@ -1,3 +1,4 @@
ext/alsa/gstalsamixertrack.c
ext/audiofile/gstafsink.c
ext/audiofile/gstafsrc.c
ext/cdparanoia/gstcdparanoia.c