2 * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
4 * mixeroptions.c: mixer track options object design
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
23 * SECTION:gstmixeroptions
24 * @short_description: Multi-option mixer control
25 * @see_also: GstMixer, GstMixerTrack
27 * Mixer control object that allows switching between multiple options.
28 * Note that <classname>GstMixerOptions</classname> is a subclass of
29 * <classname>GstMixerTrack</classname>.
36 #include "mixeroptions.h"
42 SIGNAL_OPTION_CHANGED,
45 static guint signals[LAST_SIGNAL] = { 0 };
48 static void gst_mixer_options_class_init (GstMixerOptionsClass * klass);
49 static void gst_mixer_options_init (GstMixerOptions * mixer);
50 static void gst_mixer_options_dispose (GObject * object);
52 static GObjectClass *parent_class = NULL;
55 gst_mixer_options_get_type (void)
57 static GType gst_mixer_options_type = 0;
59 if (!gst_mixer_options_type) {
60 static const GTypeInfo mixer_options_info = {
61 sizeof (GstMixerOptionsClass),
64 (GClassInitFunc) gst_mixer_options_class_init,
67 sizeof (GstMixerOptions),
69 (GInstanceInitFunc) gst_mixer_options_init,
73 gst_mixer_options_type =
74 g_type_register_static (GST_TYPE_MIXER_TRACK,
75 "GstMixerOptions", &mixer_options_info, 0);
78 return gst_mixer_options_type;
82 gst_mixer_options_class_init (GstMixerOptionsClass * klass)
84 GObjectClass *object_klass = (GObjectClass *) klass;
86 parent_class = g_type_class_peek_parent (klass);
88 signals[SIGNAL_OPTION_CHANGED] =
89 g_signal_new ("option_changed", G_TYPE_FROM_CLASS (klass),
91 G_STRUCT_OFFSET (GstMixerOptionsClass, option_changed),
92 NULL, NULL, g_cclosure_marshal_VOID__STRING,
93 G_TYPE_NONE, 1, G_TYPE_STRING);
96 object_klass->dispose = gst_mixer_options_dispose;
100 gst_mixer_options_init (GstMixerOptions * mixer_options)
102 mixer_options->values = NULL;
106 * gst_mixer_options_get_values:
107 * @mixer_options: The #GstMixerOptions item that owns the values.
109 * Get the values for the mixer option.
111 * Returns: A list of strings with all the possible values for the mixer
112 * option. You must not free or modify the list or its contents, it belongs
113 * to the @mixer_options object.
116 gst_mixer_options_get_values (GstMixerOptions * mixer_options)
118 GstMixerOptionsClass *klass;
121 g_return_val_if_fail (GST_IS_MIXER_OPTIONS (mixer_options), NULL);
123 klass = GST_MIXER_OPTIONS_GET_CLASS (mixer_options);
125 if (klass->get_values != NULL) {
126 ret = klass->get_values (mixer_options);
128 ret = mixer_options->values;
136 gst_mixer_options_dispose (GObject * object)
138 GstMixerOptions *opts = GST_MIXER_OPTIONS (object);
140 g_list_foreach (opts->values, (GFunc) g_free, NULL);
141 g_list_free (opts->values);
144 if (parent_class->dispose)
145 parent_class->dispose (object);