summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOwen Fraser-Green <owen@discobabe.net>2004-06-01 20:08:52 +0000
committerOwen Fraser-Green <owen@discobabe.net>2004-06-01 20:08:52 +0000
commit014fbbc3a487f387de4fa9db11833b55fc4ed064 (patch)
tree67bb699bc177075a4062617c83a48989d510f685
parent601f40db268c9dbb7edd3b0dd27600d19f987560 (diff)
downloadgst-plugins-bad-014fbbc3a487f387de4fa9db11833b55fc4ed064.tar.gz
gst-plugins-bad-014fbbc3a487f387de4fa9db11833b55fc4ed064.tar.bz2
gst-plugins-bad-014fbbc3a487f387de4fa9db11833b55fc4ed064.zip
Added property accessors for mixertrack and mixeroptions.
Original commit message from CVS: Added property accessors for mixertrack and mixeroptions.
-rw-r--r--ChangeLog12
-rw-r--r--gst-libs/gst/mixer/mixer.c2
-rw-r--r--gst-libs/gst/mixer/mixer.h5
-rw-r--r--gst-libs/gst/mixer/mixeroptions.c23
-rw-r--r--gst-libs/gst/mixer/mixeroptions.h14
-rw-r--r--gst-libs/gst/mixer/mixertrack.c81
-rw-r--r--gst-libs/gst/mixer/mixertrack.h12
7 files changed, 130 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 94b5ef70..27597ac1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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):
diff --git a/gst-libs/gst/mixer/mixer.c b/gst-libs/gst/mixer/mixer.c
index dcae8741..ff8d5367 100644
--- a/gst-libs/gst/mixer/mixer.c
+++ b/gst-libs/gst/mixer/mixer.c
@@ -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.
*
diff --git a/gst-libs/gst/mixer/mixer.h b/gst-libs/gst/mixer/mixer.h
index 2cb326dc..85ff107a 100644
--- a/gst-libs/gst/mixer/mixer.h
+++ b/gst-libs/gst/mixer/mixer.h
@@ -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);
diff --git a/gst-libs/gst/mixer/mixeroptions.c b/gst-libs/gst/mixer/mixeroptions.c
index 5e79a414..35d8ceba 100644
--- a/gst-libs/gst/mixer/mixeroptions.c
+++ b/gst-libs/gst/mixer/mixeroptions.c
@@ -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)
{
diff --git a/gst-libs/gst/mixer/mixeroptions.h b/gst-libs/gst/mixer/mixeroptions.h
index 586c9e48..d0a309ea 100644
--- a/gst-libs/gst/mixer/mixeroptions.h
+++ b/gst-libs/gst/mixer/mixeroptions.h
@@ -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__ */
diff --git a/gst-libs/gst/mixer/mixertrack.c b/gst-libs/gst/mixer/mixertrack.c
index ae8976f1..756b4c07 100644
--- a/gst-libs/gst/mixer/mixertrack.c
+++ b/gst-libs/gst/mixer/mixertrack.c
@@ -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)
+{
+ 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)
{
- channel->label = NULL;
- channel->min_volume = channel->max_volume = 0;
- channel->flags = 0;
- channel->num_channels = 0;
+ 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
diff --git a/gst-libs/gst/mixer/mixertrack.h b/gst-libs/gst/mixer/mixertrack.h
index 0e05d9cb..7bebf3de 100644
--- a/gst-libs/gst/mixer/mixertrack.h
+++ b/gst-libs/gst/mixer/mixertrack.h
@@ -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);