v4l2object: Don't use mmap64 if off_t is 64-bit
[platform/upstream/gst-plugins-good.git] / sys / v4l2 / 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., 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 "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 G_DEFINE_TYPE (GstTunerChannel, gst_tuner_channel, G_TYPE_OBJECT);
55
56 static void gst_tuner_channel_dispose (GObject * object);
57
58 static guint signals[LAST_SIGNAL] = { 0 };
59
60 static void
61 gst_tuner_channel_class_init (GstTunerChannelClass * klass)
62 {
63   GObjectClass *object_klass = (GObjectClass *) klass;
64
65   /**
66    * GstTunerChannel::frequency-changed:
67    * @tunerchannel: The #GstTunerChannel
68    * @frequency: The new frequency (an unsigned long)
69    *
70    * Reports that the current frequency has changed.
71    */
72   signals[SIGNAL_FREQUENCY_CHANGED] =
73       g_signal_new ("frequency-changed", G_TYPE_FROM_CLASS (klass),
74       G_SIGNAL_RUN_LAST,
75       G_STRUCT_OFFSET (GstTunerChannelClass,
76           frequency_changed),
77       NULL, NULL, g_cclosure_marshal_VOID__ULONG, G_TYPE_NONE, 1, G_TYPE_ULONG);
78   /**
79    * GstTunerChannel::signal-changed:
80    * @tunerchannel: The #GstTunerChannel
81    * @signal: The new signal strength (an integer)
82    *
83    * Reports that the signal strength has changed.
84    *
85    * See Also: gst_tuner_signal_strength()
86    */
87   signals[SIGNAL_SIGNAL_CHANGED] =
88       g_signal_new ("signal-changed", G_TYPE_FROM_CLASS (klass),
89       G_SIGNAL_RUN_LAST,
90       G_STRUCT_OFFSET (GstTunerChannelClass,
91           signal_changed),
92       NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
93
94   object_klass->dispose = gst_tuner_channel_dispose;
95 }
96
97 static void
98 gst_tuner_channel_init (GstTunerChannel * channel)
99 {
100   channel->label = NULL;
101   channel->flags = 0;
102   channel->min_frequency = channel->max_frequency = 0;
103   channel->min_signal = channel->max_signal = 0;
104 }
105
106 static void
107 gst_tuner_channel_dispose (GObject * object)
108 {
109   GstTunerChannel *channel = GST_TUNER_CHANNEL (object);
110
111   if (channel->label) {
112     g_free (channel->label);
113     channel->label = NULL;
114   }
115
116   G_OBJECT_CLASS (gst_tuner_channel_parent_class)->dispose (object);
117 }