ae22fba845d4edd1397bd577ac0b5b1afdd920d6
[mafwsubrenderer] / gst-plugins-base-subtitles0.10 / gst-libs / gst / interfaces / colorbalancechannel.c
1 /* GStreamer Color Balance
2  * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
3  *
4  * colorbalancechannel.c: colorbalance channel 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 #ifdef HAVE_CONFIG_H
23 #include "config.h"
24 #endif
25
26 #include "colorbalancechannel.h"
27
28 /**
29  * SECTION:gstcolorbalancechannel
30  * @short_description: Object representing a channel from the #GstColorBalance
31  *         interface.
32  *
33  * <refsect2><para>The #GstColorBalanceChannel object represents a parameter
34  * for modifying the color balance implemented by an element providing the
35  * #GstColorBalance interface. For example, Hue or Saturation.
36  * </para></refsect2>
37  */
38
39 enum
40 {
41   /* FILL ME */
42   SIGNAL_VALUE_CHANGED,
43   LAST_SIGNAL
44 };
45
46 static void gst_color_balance_channel_class_init (GstColorBalanceChannelClass *
47     klass);
48 static void gst_color_balance_channel_init (GstColorBalanceChannel * balance);
49 static void gst_color_balance_channel_dispose (GObject * object);
50
51 static GObjectClass *parent_class = NULL;
52 static guint signals[LAST_SIGNAL] = { 0 };
53
54 GType
55 gst_color_balance_channel_get_type (void)
56 {
57   static GType gst_color_balance_channel_type = 0;
58
59   if (!gst_color_balance_channel_type) {
60     static const GTypeInfo color_balance_channel_info = {
61       sizeof (GstColorBalanceChannelClass),
62       NULL,
63       NULL,
64       (GClassInitFunc) gst_color_balance_channel_class_init,
65       NULL,
66       NULL,
67       sizeof (GstColorBalanceChannel),
68       0,
69       (GInstanceInitFunc) gst_color_balance_channel_init,
70       NULL
71     };
72
73     gst_color_balance_channel_type =
74         g_type_register_static (G_TYPE_OBJECT,
75         "GstColorBalanceChannel", &color_balance_channel_info, 0);
76   }
77
78   return gst_color_balance_channel_type;
79 }
80
81 static void
82 gst_color_balance_channel_class_init (GstColorBalanceChannelClass * klass)
83 {
84   GObjectClass *object_klass = (GObjectClass *) klass;
85
86   parent_class = g_type_class_peek_parent (klass);
87
88   /**
89    * GstColorBalanceChannel::value-changed:
90    * @channel: The #GstColorBalanceChannel
91    * @value: The new value
92    *
93    * Fired when the value of the indicated channel has changed.
94    */
95   signals[SIGNAL_VALUE_CHANGED] =
96       g_signal_new ("value-changed", G_TYPE_FROM_CLASS (klass),
97       G_SIGNAL_RUN_LAST,
98       G_STRUCT_OFFSET (GstColorBalanceChannelClass,
99           value_changed),
100       NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
101
102   object_klass->dispose = gst_color_balance_channel_dispose;
103 }
104
105 static void
106 gst_color_balance_channel_init (GstColorBalanceChannel * channel)
107 {
108   channel->label = NULL;
109   channel->min_value = channel->max_value = 0;
110 }
111
112 static void
113 gst_color_balance_channel_dispose (GObject * object)
114 {
115   GstColorBalanceChannel *channel = GST_COLOR_BALANCE_CHANNEL (object);
116
117   if (channel->label)
118     g_free (channel->label);
119
120   channel->label = NULL;
121
122   if (parent_class->dispose)
123     parent_class->dispose (object);
124 }