Initialize Tizen 2.3
[framework/multimedia/gst-plugins-base0.10.git] / wearable / gst-libs / gst / interfaces / mixeroptions.c
1 /* GStreamer Mixer
2  * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
3  *
4  * mixeroptions.c: mixer track options object design
5  *
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.
10  *
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.
15  *
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.
20  */
21
22 /**
23  * SECTION:gstmixeroptions
24  * @short_description: Multi-option mixer control
25  * @see_also: GstMixer, GstMixerTrack
26  *
27  * Mixer control object that allows switching between multiple options.
28  * Note that <classname>GstMixerOptions</classname> is a subclass of
29  * <classname>GstMixerTrack</classname>.
30  */
31
32 #ifdef HAVE_CONFIG_H
33 #include "config.h"
34 #endif
35
36 #include "mixeroptions.h"
37
38 #if 0
39 enum
40 {
41   /* FILL ME */
42   SIGNAL_OPTION_CHANGED,
43   LAST_SIGNAL
44 };
45 static guint signals[LAST_SIGNAL] = { 0 };
46 #endif
47
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);
51
52 static GObjectClass *parent_class = NULL;
53
54 GType
55 gst_mixer_options_get_type (void)
56 {
57   static GType gst_mixer_options_type = 0;
58
59   if (!gst_mixer_options_type) {
60     static const GTypeInfo mixer_options_info = {
61       sizeof (GstMixerOptionsClass),
62       NULL,
63       NULL,
64       (GClassInitFunc) gst_mixer_options_class_init,
65       NULL,
66       NULL,
67       sizeof (GstMixerOptions),
68       0,
69       (GInstanceInitFunc) gst_mixer_options_init,
70       NULL
71     };
72
73     gst_mixer_options_type =
74         g_type_register_static (GST_TYPE_MIXER_TRACK,
75         "GstMixerOptions", &mixer_options_info, 0);
76   }
77
78   return gst_mixer_options_type;
79 }
80
81 static void
82 gst_mixer_options_class_init (GstMixerOptionsClass * klass)
83 {
84   GObjectClass *object_klass = (GObjectClass *) klass;
85
86   parent_class = g_type_class_peek_parent (klass);
87 #if 0
88   signals[SIGNAL_OPTION_CHANGED] =
89       g_signal_new ("option_changed", G_TYPE_FROM_CLASS (klass),
90       G_SIGNAL_RUN_LAST,
91       G_STRUCT_OFFSET (GstMixerOptionsClass, option_changed),
92       NULL, NULL, g_cclosure_marshal_VOID__STRING,
93       G_TYPE_NONE, 1, G_TYPE_STRING);
94 #endif
95
96   object_klass->dispose = gst_mixer_options_dispose;
97 }
98
99 static void
100 gst_mixer_options_init (GstMixerOptions * mixer_options)
101 {
102   mixer_options->values = NULL;
103 }
104
105 /**
106  * gst_mixer_options_get_values:
107  * @mixer_options: The #GstMixerOptions item that owns the values.
108  *
109  * Get the values for the mixer option.
110  *
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.
114  */
115 GList *
116 gst_mixer_options_get_values (GstMixerOptions * mixer_options)
117 {
118   GstMixerOptionsClass *klass;
119   GList *ret = NULL;
120
121   g_return_val_if_fail (GST_IS_MIXER_OPTIONS (mixer_options), NULL);
122
123   klass = GST_MIXER_OPTIONS_GET_CLASS (mixer_options);
124
125   if (klass->get_values != NULL) {
126     ret = klass->get_values (mixer_options);
127   } else {
128     ret = mixer_options->values;
129   }
130
131   return ret;
132 }
133
134
135 static void
136 gst_mixer_options_dispose (GObject * object)
137 {
138   GstMixerOptions *opts = GST_MIXER_OPTIONS (object);
139
140   g_list_foreach (opts->values, (GFunc) g_free, NULL);
141   g_list_free (opts->values);
142   opts->values = NULL;
143
144   if (parent_class->dispose)
145     parent_class->dispose (object);
146 }