3 * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
4 * 2006 Edgard Lima <edgard.lima@indt.org.br>
6 * gstv4l2tuner.h: tuner interface implementation for V4L2
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
24 #ifndef __GST_V4L2_TUNER_H__
25 #define __GST_V4L2_TUNER_H__
28 #include <gst/interfaces/tuner.h>
30 #include "gstv4l2object.h"
34 #define GST_TYPE_V4L2_TUNER_CHANNEL \
35 (gst_v4l2_tuner_channel_get_type ())
36 #define GST_V4L2_TUNER_CHANNEL(obj) \
37 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_V4L2_TUNER_CHANNEL, \
39 #define GST_V4L2_TUNER_CHANNEL_CLASS(klass) \
40 (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_V4L2_TUNER_CHANNEL, \
41 GstV4l2TunerChannelClass))
42 #define GST_IS_V4L2_TUNER_CHANNEL(obj) \
43 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_V4L2_TUNER_CHANNEL))
44 #define GST_IS_V4L2_TUNER_CHANNEL_CLASS(klass) \
45 (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_V4L2_TUNER_CHANNEL))
47 typedef struct _GstV4l2TunerChannel {
48 GstTunerChannel parent;
53 } GstV4l2TunerChannel;
55 typedef struct _GstV4l2TunerChannelClass {
56 GstTunerChannelClass parent;
57 } GstV4l2TunerChannelClass;
59 #define GST_TYPE_V4L2_TUNER_NORM \
60 (gst_v4l2_tuner_norm_get_type ())
61 #define GST_V4L2_TUNER_NORM(obj) \
62 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_V4L2_TUNER_NORM, \
64 #define GST_V4L2_TUNER_NORM_CLASS(klass) \
65 (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_V4L2_TUNER_NORM, \
66 GstV4l2TunerNormClass))
67 #define GST_IS_V4L2_TUNER_NORM(obj) \
68 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_V4L2_TUNER_NORM))
69 #define GST_IS_V4L2_TUNER_NORM_CLASS(klass) \
70 (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_V4L2_TUNER_NORM))
72 typedef struct _GstV4l2TunerNorm {
78 typedef struct _GstV4l2TunerNormClass {
79 GstTunerNormClass parent;
80 } GstV4l2TunerNormClass;
83 gst_v4l2_tuner_set_channel (GstV4l2Object * v4l2object, GstTunerChannel * channel);
85 gst_v4l2_tuner_set_norm (GstV4l2Object * v4l2object, GstTunerNorm * norm);
87 gst_v4l2_tuner_set_frequency (GstV4l2Object * v4l2object,
88 GstTunerChannel * channel, gulong frequency);
90 GType gst_v4l2_tuner_channel_get_type (void);
91 GType gst_v4l2_tuner_norm_get_type (void);
94 gst_v4l2_tuner_list_channels (GstV4l2Object * v4l2object);
96 gst_v4l2_tuner_set_channel_and_notify (GstV4l2Object * v4l2object, GstTunerChannel * channel);
97 extern GstTunerChannel *
98 gst_v4l2_tuner_get_channel (GstV4l2Object * v4l2object);
101 gst_v4l2_tuner_list_norms (GstV4l2Object * v4l2object);
103 gst_v4l2_tuner_set_norm_and_notify (GstV4l2Object * v4l2object, GstTunerNorm * norm);
104 extern GstTunerNorm *
105 gst_v4l2_tuner_get_norm (GstV4l2Object * v4l2object);
108 gst_v4l2_tuner_set_frequency_and_notify (GstV4l2Object * v4l2object,
109 GstTunerChannel * channel, gulong frequency);
111 gst_v4l2_tuner_get_frequency (GstV4l2Object * v4l2object, GstTunerChannel * channel);
113 gst_v4l2_tuner_signal_strength (GstV4l2Object * v4l2object, GstTunerChannel * channel);
115 #define GST_IMPLEMENT_V4L2_TUNER_METHODS(Type, interface_as_function) \
117 static const GList * \
118 interface_as_function ## _tuner_list_channels (GstTuner * mixer) \
120 Type *this = (Type*) mixer; \
121 return gst_v4l2_tuner_list_channels (this->v4l2object); \
125 interface_as_function ## _tuner_set_channel_and_notify (GstTuner * mixer, \
126 GstTunerChannel * channel) \
128 Type *this = (Type*) mixer; \
129 gst_v4l2_tuner_set_channel_and_notify (this->v4l2object, channel); \
131 static GstTunerChannel * \
132 interface_as_function ## _tuner_get_channel (GstTuner * mixer) \
134 Type *this = (Type*) mixer; \
135 return gst_v4l2_tuner_get_channel (this->v4l2object); \
137 static const GList * \
138 interface_as_function ## _tuner_list_norms (GstTuner * mixer) \
140 Type *this = (Type*) mixer; \
141 return gst_v4l2_tuner_list_norms (this->v4l2object); \
144 interface_as_function ## _tuner_set_norm_and_notify (GstTuner * mixer, \
145 GstTunerNorm * norm) \
147 Type *this = (Type*) mixer; \
148 gst_v4l2_tuner_set_norm_and_notify (this->v4l2object, norm); \
150 static GstTunerNorm * \
151 interface_as_function ## _tuner_get_norm (GstTuner * mixer) \
153 Type *this = (Type*) mixer; \
154 return gst_v4l2_tuner_get_norm (this->v4l2object); \
158 interface_as_function ## _tuner_set_frequency_and_notify (GstTuner * mixer, \
159 GstTunerChannel * channel, \
162 Type *this = (Type*) mixer; \
163 gst_v4l2_tuner_set_frequency_and_notify (this->v4l2object, channel, frequency); \
167 interface_as_function ## _tuner_get_frequency (GstTuner * mixer, \
168 GstTunerChannel * channel) \
170 Type *this = (Type*) mixer; \
171 return gst_v4l2_tuner_get_frequency (this->v4l2object, channel); \
175 interface_as_function ## _tuner_signal_strength (GstTuner * mixer, \
176 GstTunerChannel * channel) \
178 Type *this = (Type*) mixer; \
179 return gst_v4l2_tuner_signal_strength (this->v4l2object, channel); \
183 interface_as_function ## _tuner_interface_init (GstTunerClass * klass) \
185 /* default virtual functions */ \
186 klass->list_channels = interface_as_function ## _tuner_list_channels; \
187 klass->set_channel = interface_as_function ## _tuner_set_channel_and_notify; \
188 klass->get_channel = interface_as_function ## _tuner_get_channel; \
190 klass->list_norms = interface_as_function ## _tuner_list_norms; \
191 klass->set_norm = interface_as_function ## _tuner_set_norm_and_notify; \
192 klass->get_norm = interface_as_function ## _tuner_get_norm; \
194 klass->set_frequency = interface_as_function ## _tuner_set_frequency_and_notify; \
195 klass->get_frequency = interface_as_function ## _tuner_get_frequency; \
196 klass->signal_strength = interface_as_function ## _tuner_signal_strength; \
199 #endif /* __GST_V4L2_TUNER_H__ */