gst-libs/gst/interfaces/mixertrack.c: API: Add "index" property to GstMixerTrack to differantiate between multiple mi...

Original commit message from CVS:
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.
This commit is contained in:
Sam Morris 2008-06-26 06:03:38 +00:00 committed by Sebastian Dröge
parent 0d4409ce49
commit 752cf09704
4 changed files with 54 additions and 5 deletions

View file

@ -1,3 +1,18 @@
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.
2008-06-25 Stefan Kost <ensonic@users.sf.net>
* tests/examples/seek/Makefile.am:

View file

@ -73,13 +73,17 @@ gst_alsa_mixer_options_new (snd_mixer_elem_t * element, gint track_num)
GstAlsaMixerOptions *alsa_opts;
GstMixerTrack *track;
const gchar *label;
guint index;
gint num, i;
gchar str[256];
label = snd_mixer_selem_get_name (element);
index = snd_mixer_selem_get_index (element);
GST_LOG ("[%s,%u]", label, index);
opts = g_object_new (GST_ALSA_MIXER_OPTIONS_TYPE,
"untranslated-label", label, NULL);
"untranslated-label", label, "index", index, NULL);
alsa_opts = (GstAlsaMixerOptions *) opts;
track = (GstMixerTrack *) opts;

View file

@ -131,6 +131,7 @@ gst_alsa_mixer_track_new (snd_mixer_elem_t * element,
GstAlsaMixerTrack *alsa_track;
GstMixerTrack *track;
const gchar *name;
guint index;
const gchar *label;
gint i;
long min = 0, max = 0;
@ -154,12 +155,15 @@ gst_alsa_mixer_track_new (snd_mixer_elem_t * element,
};
name = snd_mixer_selem_get_name (element);
index = snd_mixer_selem_get_index (element);
GST_LOG ("[%s] num=%d,track_num=%d,flags=0x%08x,sw=%s,shared_mute_track=%p",
name, num, track_num, flags, (sw) ? "true" : "false", shared_mute_track);
GST_LOG
("[%s,%u] num=%d,track_num=%d,flags=0x%08x,sw=%s,shared_mute_track=%p",
name, index, num, track_num, flags, (sw) ? "true" : "false",
shared_mute_track);
track = (GstMixerTrack *) g_object_new (GST_ALSA_MIXER_TRACK_TYPE,
"untranslated-label", name, NULL);
"untranslated-label", name, "index", index, NULL);
alsa_track = (GstAlsaMixerTrack *) track;

View file

@ -41,6 +41,7 @@ enum
ARG_0,
ARG_LABEL,
ARG_UNTRANSLATED_LABEL,
ARG_INDEX,
ARG_MIN_VOLUME,
ARG_MAX_VOLUME,
ARG_FLAGS,
@ -117,6 +118,20 @@ gst_mixer_track_class_init (GstMixerTrackClass * klass)
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
/**
* GstMixerTrack:index
*
* Index of the mixer track, if available. Mixer track implementations
* must set this at construct time. This can be used to discern between
* multiple tracks with identical labels.
*
* Since: 0.10.21
*/
g_object_class_install_property (object_klass, ARG_INDEX,
g_param_spec_uint ("index", "Index",
"Track index", 0, G_MAXUINT,
0, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_klass, ARG_MIN_VOLUME,
g_param_spec_int ("min-volume", "Minimum volume level",
"The minimum possible volume level", G_MININT, G_MAXINT,
@ -173,8 +188,9 @@ gst_mixer_track_init (GstMixerTrack * mixer_track)
mixer_track->num_channels = 0;
}
/* FIXME 0.11: move this as a member into the mixer track structure */
/* FIXME 0.11: move these as members into the mixer track structure */
#define MIXER_TRACK_OBJECT_DATA_KEY_UNTRANSLATED_LABEL "gst-mixer-track-ulabel"
#define MIXER_TRACK_OBJECT_DATA_KEY_INDEX "index"
static void
gst_mixer_track_get_property (GObject * object, guint prop_id, GValue * value,
@ -193,6 +209,11 @@ gst_mixer_track_get_property (GObject * object, guint prop_id, GValue * value,
(const gchar *) g_object_get_data (G_OBJECT (mixer_track),
MIXER_TRACK_OBJECT_DATA_KEY_UNTRANSLATED_LABEL));
break;
case ARG_INDEX:
g_value_set_uint (value,
GPOINTER_TO_INT (g_object_get_data (G_OBJECT (mixer_track),
MIXER_TRACK_OBJECT_DATA_KEY_INDEX)));
break;
case ARG_MIN_VOLUME:
g_value_set_int (value, mixer_track->min_volume);
break;
@ -225,6 +246,11 @@ gst_mixer_track_set_property (GObject * object, guint prop_id,
MIXER_TRACK_OBJECT_DATA_KEY_UNTRANSLATED_LABEL,
g_value_dup_string (value), (GDestroyNotify) g_free);
break;
case ARG_INDEX:
g_object_set_data (G_OBJECT (mixer_track),
MIXER_TRACK_OBJECT_DATA_KEY_INDEX,
GINT_TO_POINTER (g_value_get_uint (value)));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;