1 /* GStreamer Tuner 2 * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net> 3 * 4 * tuner.h: tuner interface 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 #ifndef __GST_TUNER_H__ 23 #define __GST_TUNER_H__ 24 25 #include <gst/gst.h> 26 27 #include "tunernorm.h" 28 #include "tunerchannel.h" 29 30 G_BEGIN_DECLS 31 32 #define GST_TYPE_TUNER \ 33 (gst_tuner_get_type ()) 34 #define GST_TUNER(obj) \ 35 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TUNER, GstTuner)) 36 #define GST_IS_TUNER(obj) \ 37 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TUNER)) 38 #define GST_TUNER_GET_INTERFACE(inst) \ 39 (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_TUNER, GstTunerInterface)) 40 41 typedef struct _GstTuner GstTuner; 42 typedef struct _GstTunerInterface GstTunerInterface; 43 44 /** 45 * GstTunerInterface: 46 * @iface: the parent interface 47 * @list_channels: list available channels 48 * @set_channel: set to a channel 49 * @get_channel: return the current channel 50 * @list_norms: list available norms 51 * @set_norm: set a norm 52 * @get_norm: return the current norm 53 * @set_frequency: set the frequency 54 * @get_frequency: return the current frequency 55 * @signal_strength: get the signal strength 56 * @channel_changed: default handler for channel changed notification 57 * @norm_changed: default handler for norm changed notification 58 * @frequency_changed: default handler for frequency changed notification 59 * @signal_changed: default handler for signal-strength changed notification 60 * 61 * Tuner interface. 62 */ 63 struct _GstTunerInterface { 64 GTypeInterface iface; 65 66 /* virtual functions */ 67 const GList * (* list_channels) (GstTuner *tuner); 68 void (* set_channel) (GstTuner *tuner, 69 GstTunerChannel *channel); 70 GstTunerChannel * 71 (* get_channel) (GstTuner *tuner); 72 73 const GList * (* list_norms) (GstTuner *tuner); 74 void (* set_norm) (GstTuner *tuner, 75 GstTunerNorm *norm); 76 GstTunerNorm *(* get_norm) (GstTuner *tuner); 77 78 void (* set_frequency) (GstTuner *tuner, 79 GstTunerChannel *channel, 80 gulong frequency); 81 gulong (* get_frequency) (GstTuner *tuner, 82 GstTunerChannel *channel); 83 gint (* signal_strength) (GstTuner *tuner, 84 GstTunerChannel *channel); 85 86 /* signals */ 87 void (*channel_changed) (GstTuner *tuner, 88 GstTunerChannel *channel); 89 void (*norm_changed) (GstTuner *tuner, 90 GstTunerNorm *norm); 91 void (*frequency_changed) (GstTuner *tuner, 92 GstTunerChannel *channel, 93 gulong frequency); 94 void (*signal_changed) (GstTuner *tuner, 95 GstTunerChannel *channel, 96 gint signal); 97 }; 98 99 GType gst_tuner_get_type (void); 100 101 /* virtual class function wrappers */ 102 const GList * gst_tuner_list_channels (GstTuner *tuner); 103 void gst_tuner_set_channel (GstTuner *tuner, 104 GstTunerChannel *channel); 105 GstTunerChannel * 106 gst_tuner_get_channel (GstTuner *tuner); 107 108 const GList * gst_tuner_list_norms (GstTuner *tuner); 109 void gst_tuner_set_norm (GstTuner *tuner, 110 GstTunerNorm *norm); 111 GstTunerNorm * gst_tuner_get_norm (GstTuner *tuner); 112 113 void gst_tuner_set_frequency (GstTuner *tuner, 114 GstTunerChannel *channel, 115 gulong frequency); 116 gulong gst_tuner_get_frequency (GstTuner *tuner, 117 GstTunerChannel *channel); 118 gint gst_tuner_signal_strength (GstTuner *tuner, 119 GstTunerChannel *channel); 120 121 /* helper functions */ 122 GstTunerNorm * gst_tuner_find_norm_by_name (GstTuner *tuner, 123 gchar *norm); 124 GstTunerChannel *gst_tuner_find_channel_by_name (GstTuner *tuner, 125 gchar *channel); 126 127 /* trigger signals */ 128 void gst_tuner_channel_changed (GstTuner *tuner, 129 GstTunerChannel *channel); 130 void gst_tuner_norm_changed (GstTuner *tuner, 131 GstTunerNorm *norm); 132 void gst_tuner_frequency_changed (GstTuner *tuner, 133 GstTunerChannel *channel, 134 gulong frequency); 135 void gst_tuner_signal_changed (GstTuner *tuner, 136 GstTunerChannel *channel, 137 gint signal); 138 139 G_END_DECLS 140 141 #endif /* __GST_TUNER_H__ */ 142