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., 51 Franklin St, Fifth Floor,
19 * Boston, MA 02110-1301, 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 * @title: GstColorBalanceChannel
31 * @short_description: Object representing a channel from the #GstColorBalance
32 * interface.
33 *
34 * The #GstColorBalanceChannel object represents a parameter
35 * for modifying the color balance implemented by an element providing the
36 * #GstColorBalance interface. For example, Hue or Saturation.
37 *
38 */
39
40 enum
41 {
42 /* FILL ME */
43 SIGNAL_VALUE_CHANGED,
44 LAST_SIGNAL
45 };
46
47 static void gst_color_balance_channel_class_init (GstColorBalanceChannelClass *
48 klass);
49 static void gst_color_balance_channel_init (GstColorBalanceChannel * balance);
50 static void gst_color_balance_channel_dispose (GObject * object);
51
52 static GObjectClass *parent_class = NULL;
53 static guint signals[LAST_SIGNAL] = { 0 };
54
55 GType
gst_color_balance_channel_get_type(void)56 gst_color_balance_channel_get_type (void)
57 {
58 static GType gst_color_balance_channel_type = 0;
59
60 if (!gst_color_balance_channel_type) {
61 static const GTypeInfo color_balance_channel_info = {
62 sizeof (GstColorBalanceChannelClass),
63 NULL,
64 NULL,
65 (GClassInitFunc) gst_color_balance_channel_class_init,
66 NULL,
67 NULL,
68 sizeof (GstColorBalanceChannel),
69 0,
70 (GInstanceInitFunc) gst_color_balance_channel_init,
71 NULL
72 };
73
74 gst_color_balance_channel_type =
75 g_type_register_static (G_TYPE_OBJECT,
76 "GstColorBalanceChannel", &color_balance_channel_info, 0);
77 }
78
79 return gst_color_balance_channel_type;
80 }
81
82 static void
gst_color_balance_channel_class_init(GstColorBalanceChannelClass * klass)83 gst_color_balance_channel_class_init (GstColorBalanceChannelClass * klass)
84 {
85 GObjectClass *object_klass = (GObjectClass *) klass;
86
87 parent_class = g_type_class_peek_parent (klass);
88
89 /**
90 * GstColorBalanceChannel::value-changed:
91 * @channel: The #GstColorBalanceChannel
92 * @value: The new value
93 *
94 * Fired when the value of the indicated channel has changed.
95 */
96 signals[SIGNAL_VALUE_CHANGED] =
97 g_signal_new ("value-changed", G_TYPE_FROM_CLASS (klass),
98 G_SIGNAL_RUN_LAST,
99 G_STRUCT_OFFSET (GstColorBalanceChannelClass,
100 value_changed), NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_INT);
101
102 object_klass->dispose = gst_color_balance_channel_dispose;
103 }
104
105 static void
gst_color_balance_channel_init(GstColorBalanceChannel * channel)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
gst_color_balance_channel_dispose(GObject * object)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 }
125