Added property accessors for mixertrack and mixeroptions.

Original commit message from CVS:
Added property accessors for mixertrack and mixeroptions.
This commit is contained in:
Owen Fraser-Green 2004-06-01 20:08:52 +00:00
parent 601f40db26
commit 014fbbc3a4
7 changed files with 130 additions and 19 deletions

View file

@ -1,3 +1,15 @@
2004-06-01 Owen Fraser-Green <owen@discobabe.net>
* gst-libs/gst/mixer/mixertrack.h: Changed struct syntax
* gst-libs/gst/mixer/mixertrack.c:
(gst_mixer_track_get_property), (get_mixer_track_init),
(get_mixer_track_get_property): Added property accessors
* gst-libs/gst/mixer/mixeroptions.h: Changed struct syntax
* gst-libs/gst/mixer/mixeroptions.c:
(gst_mixer_options_get_values): Added
* gst-libs/gst/mixer/mixer.h: Changed GstMixerClass syntax
* gst-libs/gst/mixer/mixer.c: Fixed comment
2004-06-01 Thomas Vander Stichele <thomas (at) apestaart (dot) org>
* ext/alsa/gstalsa.c: (gst_alsa_open_audio):

View file

@ -256,7 +256,7 @@ gst_mixer_set_option (GstMixer * mixer, GstMixerOptions * opts, gchar * value)
}
/**
* gst_mixer_g_option:
* gst_mixer_get_option:
* @mixer: The #GstMixer (a #GstElement) that owns the optionlist.
* @opts: The #GstMixerOptions that we operate on.
*

View file

@ -45,6 +45,7 @@ G_BEGIN_DECLS
#define GST_MIXER_TYPE(klass) (klass->mixer_type)
typedef struct _GstMixer GstMixer;
typedef struct _GstMixerClass GstMixerClass;
typedef enum
{
@ -52,7 +53,7 @@ typedef enum
GST_MIXER_SOFTWARE
} GstMixerType;
typedef struct _GstMixerClass {
struct _GstMixerClass {
GTypeInterface klass;
GstMixerType mixer_type;
@ -97,7 +98,7 @@ typedef struct _GstMixerClass {
gchar *option);
gpointer _gst_reserved[GST_PADDING-3];
} GstMixerClass;
};
GType gst_mixer_get_type (void);

View file

@ -84,11 +84,30 @@ gst_mixer_options_class_init (GstMixerOptionsClass * klass)
}
static void
gst_mixer_options_init (GstMixerOptions * channel)
gst_mixer_options_init (GstMixerOptions * mixer_options)
{
channel->values = NULL;
mixer_options->values = NULL;
}
/**
* gst_mixer_options_get_values:
* @mixer_optnios: The #GstMixerOptions item that owns the values.
*
* Get the values for the mixer option.
*
* Returns: A list of all the possible values for the mixer option.
*/
GList *
gst_mixer_options_get_values (GstMixerOptions * mixer_options)
{
if (!mixer_options->values)
return NULL;
return (GList *) mixer_options->values;
}
static void
gst_mixer_options_dispose (GObject * object)
{

View file

@ -42,26 +42,32 @@ G_BEGIN_DECLS
#define GST_IS_MIXER_OPTIONS_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MIXER_OPTIONS))
typedef struct _GstMixerOptions {
typedef struct _GstMixerOptions GstMixerOptions;
typedef struct _GstMixerOptionsClass GstMixerOptionsClass;
struct _GstMixerOptions {
GstMixerTrack parent;
/* list of strings */
GList *values;
gpointer _gst_reserved[GST_PADDING];
} GstMixerOptions;
};
typedef struct _GstMixerOptionsClass {
struct _GstMixerOptionsClass {
GstMixerTrackClass parent;
/* signals */
void (* option_changed) (GstMixerOptions *opts,
gchar *value);
gpointer _gst_reserved[GST_PADDING];
} GstMixerOptionsClass;
};
GType gst_mixer_options_get_type (void);
GList * gst_mixer_options_get_values (GstMixerOptions *mixer_options);
G_END_DECLS
#endif /* __GST_MIXER_OPTIONS_H__ */

View file

@ -34,10 +34,23 @@ enum
LAST_SIGNAL
};
enum
{
ARG_0,
ARG_LABEL,
ARG_MIN_VOLUME,
ARG_MAX_VOLUME,
ARG_FLAGS,
ARG_NUM_CHANNELS
};
static void gst_mixer_track_class_init (GstMixerTrackClass * klass);
static void gst_mixer_track_init (GstMixerTrack * mixer);
static void gst_mixer_track_dispose (GObject * object);
static void gst_mixer_track_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static GObjectClass *parent_class = NULL;
static guint signals[LAST_SIGNAL] = { 0 };
@ -71,10 +84,36 @@ gst_mixer_track_get_type (void)
static void
gst_mixer_track_class_init (GstMixerTrackClass * klass)
{
GObjectClass *object_klass = (GObjectClass *) klass;
GObjectClass *object_klass = G_OBJECT_CLASS (klass);
parent_class = g_type_class_ref (G_TYPE_OBJECT);
object_klass->get_property = gst_mixer_track_get_property;
g_object_class_install_property (object_klass, ARG_LABEL,
g_param_spec_string ("label", "Track label",
"The label assigned to the track", NULL, G_PARAM_READABLE));
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_MININT32, G_MAXINT,
0, G_PARAM_READABLE));
g_object_class_install_property (object_klass, ARG_MAX_VOLUME,
g_param_spec_int ("max_volume", "Maximum volume level",
"The maximum possible volume level", G_MININT32, G_MAXINT,
0, G_PARAM_READABLE));
g_object_class_install_property (object_klass, ARG_FLAGS,
g_param_spec_uint ("flags", "Flags",
"Flags indicating the type of mixer track",
0, G_MAXUINT32, 0, G_PARAM_READABLE));
g_object_class_install_property (object_klass, ARG_NUM_CHANNELS,
g_param_spec_int ("num_channels", "Number of channels",
"The number of channels contained within the track",
0, G_MAXINT, 0, G_PARAM_READABLE));
signals[SIGNAL_RECORD_TOGGLED] =
g_signal_new ("record_toggled", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
@ -101,12 +140,42 @@ gst_mixer_track_class_init (GstMixerTrackClass * klass)
}
static void
gst_mixer_track_init (GstMixerTrack * channel)
gst_mixer_track_init (GstMixerTrack * mixer_track)
{
channel->label = NULL;
channel->min_volume = channel->max_volume = 0;
channel->flags = 0;
channel->num_channels = 0;
mixer_track->label = NULL;
mixer_track->min_volume = mixer_track->max_volume = 0;
mixer_track->flags = 0;
mixer_track->num_channels = 0;
}
static void
gst_mixer_track_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec)
{
GstMixerTrack *mixer_track;
mixer_track = GST_MIXER_TRACK (object);
switch (prop_id) {
case ARG_LABEL:
g_value_set_string (value, mixer_track->label);
break;
case ARG_MIN_VOLUME:
g_value_set_int (value, mixer_track->min_volume);
break;
case ARG_MAX_VOLUME:
g_value_set_int (value, mixer_track->max_volume);
break;
case ARG_FLAGS:
g_value_set_uint (value, (guint32) mixer_track->flags);
break;
case ARG_NUM_CHANNELS:
g_value_set_int (value, mixer_track->num_channels);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void

View file

@ -67,17 +67,21 @@ typedef enum {
#define GST_MIXER_TRACK_HAS_FLAG(channel, flag) \
((channel)->flags & flag)
typedef struct _GstMixerTrack {
typedef struct _GstMixerTrack GstMixerTrack;
typedef struct _GstMixerTrackClass GstMixerTrackClass;
struct _GstMixerTrack {
GObject parent;
gchar *label;
/* FIXME: flags should be guint32. Change in 0.9 */
GstMixerTrackFlags flags;
gint num_channels,
min_volume,
max_volume;
} GstMixerTrack;
};
typedef struct _GstMixerTrackClass {
struct _GstMixerTrackClass {
GObjectClass parent;
/* signals */
@ -89,7 +93,7 @@ typedef struct _GstMixerTrackClass {
gint *volumes);
gpointer _gst_reserved[GST_PADDING];
} GstMixerTrackClass;
};
GType gst_mixer_track_get_type (void);