Initialize Tizen 2.3
[framework/multimedia/gst-plugins-base0.10.git] / mobile / gst-libs / gst / interfaces / tunerchannel.c
1 /* GStreamer Tuner
2  * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
3  *
4  * tunerchannel.c: tuner 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 "tunerchannel.h"
27
28 /**
29  * SECTION:gsttunerchannel
30  * @short_description: A channel from an element implementing the #GstTuner
31  * interface.
32  *
33  * <refsect2>
34  * <para>The #GstTunerChannel object is provided by an element implementing
35  * the #GstTuner interface.
36  * </para>
37  * <para>
38  * GstTunerChannel provides a name and flags to determine the type and
39  * capabilities of the channel. If the GST_TUNER_CHANNEL_FREQUENCY flag is
40  * set, then the channel also information about the minimum and maximum
41  * frequency, and range of the reported signal strength.
42  * </para>
43  * </refsect2>
44  */
45
46 enum
47 {
48   /* FILL ME */
49   SIGNAL_FREQUENCY_CHANGED,
50   SIGNAL_SIGNAL_CHANGED,
51   LAST_SIGNAL
52 };
53
54 static void gst_tuner_channel_class_init (GstTunerChannelClass * klass);
55 static void gst_tuner_channel_init (GstTunerChannel * channel);
56 static void gst_tuner_channel_dispose (GObject * object);
57
58 static GObjectClass *parent_class = NULL;
59 static guint signals[LAST_SIGNAL] = { 0 };
60
61 GType
62 gst_tuner_channel_get_type (void)
63 {
64   static GType gst_tuner_channel_type = 0;
65
66   if (!gst_tuner_channel_type) {
67     static const GTypeInfo tuner_channel_info = {
68       sizeof (GstTunerChannelClass),
69       NULL,
70       NULL,
71       (GClassInitFunc) gst_tuner_channel_class_init,
72       NULL,
73       NULL,
74       sizeof (GstTunerChannel),
75       0,
76       (GInstanceInitFunc) gst_tuner_channel_init,
77       NULL
78     };
79
80     gst_tuner_channel_type =
81         g_type_register_static (G_TYPE_OBJECT,
82         "GstTunerChannel", &tuner_channel_info, 0);
83   }
84
85   return gst_tuner_channel_type;
86 }
87
88 static void
89 gst_tuner_channel_class_init (GstTunerChannelClass * klass)
90 {
91   GObjectClass *object_klass = (GObjectClass *) klass;
92
93   parent_class = g_type_class_peek_parent (klass);
94
95   /**
96    * GstTunerChannel::frequency-changed:
97    * @tunerchannel: The #GstTunerChannel
98    * @frequency: The new frequency (an unsigned long)
99    *
100    * Reports that the current frequency has changed.
101    */
102   signals[SIGNAL_FREQUENCY_CHANGED] =
103       g_signal_new ("frequency-changed", G_TYPE_FROM_CLASS (klass),
104       G_SIGNAL_RUN_LAST,
105       G_STRUCT_OFFSET (GstTunerChannelClass,
106           frequency_changed),
107       NULL, NULL, g_cclosure_marshal_VOID__ULONG, G_TYPE_NONE, 1, G_TYPE_ULONG);
108   /**
109    * GstTunerChannel::signal-changed:
110    * @tunerchannel: The #GstTunerChannel
111    * @signal: The new signal strength (an integer)
112    *
113    * Reports that the signal strength has changed.
114    *
115    * See Also: gst_tuner_signal_strength()
116    */
117   signals[SIGNAL_SIGNAL_CHANGED] =
118       g_signal_new ("signal-changed", G_TYPE_FROM_CLASS (klass),
119       G_SIGNAL_RUN_LAST,
120       G_STRUCT_OFFSET (GstTunerChannelClass,
121           signal_changed),
122       NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
123
124   object_klass->dispose = gst_tuner_channel_dispose;
125 }
126
127 static void
128 gst_tuner_channel_init (GstTunerChannel * channel)
129 {
130   channel->label = NULL;
131   channel->flags = 0;
132   channel->min_frequency = channel->max_frequency = 0;
133   channel->min_signal = channel->max_signal = 0;
134 }
135
136 static void
137 gst_tuner_channel_dispose (GObject * object)
138 {
139   GstTunerChannel *channel = GST_TUNER_CHANNEL (object);
140
141   if (channel->label) {
142     g_free (channel->label);
143     channel->label = NULL;
144   }
145
146   if (parent_class->dispose)
147     parent_class->dispose (object);
148 }