Simplify: use &= instead of a = b & a;
[mplayer/greg.git] / stream / tv.h
blobabcbb0b6801e0d29d6ad1ded261fad19684668b0
1 /*
2 * TV interface
4 * Copyright (C) 2001 Alex Beregszászi
5 * Copyright (C) 2007 Attila Ötvös
6 * Copyright (C) 2007 Vladimir Voroshilov <voroshil@gmail.com>
8 * This file is part of MPlayer.
10 * MPlayer is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * MPlayer is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #ifndef MPLAYER_TV_H
26 #define MPLAYER_TV_H
28 typedef struct tv_param_s {
29 char *freq;
30 char *channel;
31 char *chanlist;
32 char *norm;
33 int automute;
34 int normid;
35 char *device;
36 char *driver;
37 int width;
38 int height;
39 int input;
40 int outfmt;
41 float fps;
42 char **channels;
43 int noaudio;
44 int immediate;
45 int audiorate;
46 int audio_id;
47 int amode;
48 int volume;
49 int bass;
50 int treble;
51 int balance;
52 int forcechan;
53 int force_audio;
54 int buffer_size;
55 int mjpeg;
56 int decimation;
57 int quality;
58 int alsa;
59 char* adevice;
60 int brightness;
61 int contrast;
62 int hue;
63 int saturation;
64 int gain;
65 char *tdevice; ///< teletext device
66 int tformat; ///< teletext display format
67 int tpage; ///< start teletext page
68 int tlang; ///< primary language code
70 int scan;
71 int scan_threshold;
72 float scan_period;
73 /**
74 Terminate stream with video renderer instead of Null renderer
75 Will help if video freezes but audio does not.
76 May not work with -vo directx and -vf crop combination.
78 int hidden_video_renderer;
79 /**
80 For VIVO cards VP pin have to be rendered too.
81 This tweak will cause VidePort pin stream to be terminated with video renderer
82 instead of removing it from graph.
83 Use if your card have vp pin and video is still choppy.
84 May not work with -vo directx and -vf crop combination.
86 int hidden_vp_renderer;
87 /**
88 Use system clock as sync source instead of default graph clock (usually the clock
89 from one of live sources in graph.
91 int system_clock;
92 /**
93 Some audio cards creates audio chunks with about 0.5 sec size.
94 This can cause choppy video when using mplayer with immediatemode=0
95 Use followingtweak to decrease audio chunk sizes.
96 It will create audio chunks with time length equal to one video frame time.
98 int normalize_audio_chunks;
99 } tv_param_t;
101 extern tv_param_t stream_tv_defaults;
103 typedef struct tvi_info_s
105 struct tvi_handle_s * (*tvi_init)(tv_param_t* tv_param);
106 const char *name;
107 const char *short_name;
108 const char *author;
109 const char *comment;
110 } tvi_info_t;
112 typedef struct tvi_functions_s
114 int (*init)();
115 int (*uninit)();
116 int (*control)();
117 int (*start)();
118 double (*grab_video_frame)();
119 int (*get_video_framesize)();
120 double (*grab_audio_frame)();
121 int (*get_audio_framesize)();
122 } tvi_functions_t;
124 typedef struct tvi_handle_s {
125 const tvi_functions_t *functions;
126 void *priv;
127 int seq;
129 /* specific */
130 int norm;
131 int chanlist;
132 const struct CHANLIST *chanlist_s;
133 int channel;
134 tv_param_t * tv_param;
135 void * scan;
136 } tvi_handle_t;
138 typedef struct tv_channels_s {
139 int index;
140 char number[5];
141 char name[20];
142 int norm;
143 int freq;
144 struct tv_channels_s *next;
145 struct tv_channels_s *prev;
146 } tv_channels_t;
148 extern tv_channels_t *tv_channel_list;
149 extern tv_channels_t *tv_channel_current, *tv_channel_last;
150 extern char *tv_channel_last_real;
152 typedef struct {
153 unsigned int scan_timer;
154 int channel_num;
155 int new_channels;
156 } tv_scan_t;
158 #define TVI_CONTROL_FALSE 0
159 #define TVI_CONTROL_TRUE 1
160 #define TVI_CONTROL_NA -1
161 #define TVI_CONTROL_UNKNOWN -2
163 /* ======================== CONTROLS =========================== */
165 /* GENERIC controls */
166 #define TVI_CONTROL_IS_AUDIO 0x1
167 #define TVI_CONTROL_IS_VIDEO 0x2
168 #define TVI_CONTROL_IS_TUNER 0x3
169 #define TVI_CONTROL_IMMEDIATE 0x4
171 /* VIDEO controls */
172 #define TVI_CONTROL_VID_GET_FPS 0x101
173 #define TVI_CONTROL_VID_GET_PLANES 0x102
174 #define TVI_CONTROL_VID_GET_BITS 0x103
175 #define TVI_CONTROL_VID_CHK_BITS 0x104
176 #define TVI_CONTROL_VID_SET_BITS 0x105
177 #define TVI_CONTROL_VID_GET_FORMAT 0x106
178 #define TVI_CONTROL_VID_CHK_FORMAT 0x107
179 #define TVI_CONTROL_VID_SET_FORMAT 0x108
180 #define TVI_CONTROL_VID_GET_WIDTH 0x109
181 #define TVI_CONTROL_VID_CHK_WIDTH 0x110
182 #define TVI_CONTROL_VID_SET_WIDTH 0x111
183 #define TVI_CONTROL_VID_GET_HEIGHT 0x112
184 #define TVI_CONTROL_VID_CHK_HEIGHT 0x113
185 #define TVI_CONTROL_VID_SET_HEIGHT 0x114
186 #define TVI_CONTROL_VID_GET_BRIGHTNESS 0x115
187 #define TVI_CONTROL_VID_SET_BRIGHTNESS 0x116
188 #define TVI_CONTROL_VID_GET_HUE 0x117
189 #define TVI_CONTROL_VID_SET_HUE 0x118
190 #define TVI_CONTROL_VID_GET_SATURATION 0x119
191 #define TVI_CONTROL_VID_SET_SATURATION 0x11a
192 #define TVI_CONTROL_VID_GET_CONTRAST 0x11b
193 #define TVI_CONTROL_VID_SET_CONTRAST 0x11c
194 #define TVI_CONTROL_VID_GET_PICTURE 0x11d
195 #define TVI_CONTROL_VID_SET_PICTURE 0x11e
196 #define TVI_CONTROL_VID_SET_GAIN 0x11f
197 #define TVI_CONTROL_VID_GET_GAIN 0x120
198 #define TVI_CONTROL_VID_SET_WIDTH_HEIGHT 0x121
200 /* TUNER controls */
201 #define TVI_CONTROL_TUN_GET_FREQ 0x201
202 #define TVI_CONTROL_TUN_SET_FREQ 0x202
203 #define TVI_CONTROL_TUN_GET_TUNER 0x203 /* update priv->tuner struct for used input */
204 #define TVI_CONTROL_TUN_SET_TUNER 0x204 /* update priv->tuner struct for used input */
205 #define TVI_CONTROL_TUN_GET_NORM 0x205
206 #define TVI_CONTROL_TUN_SET_NORM 0x206
207 #define TVI_CONTROL_TUN_GET_SIGNAL 0x207
209 /* AUDIO controls */
210 #define TVI_CONTROL_AUD_GET_FORMAT 0x301
211 #define TVI_CONTROL_AUD_GET_SAMPLERATE 0x302
212 #define TVI_CONTROL_AUD_GET_SAMPLESIZE 0x303
213 #define TVI_CONTROL_AUD_GET_CHANNELS 0x304
214 #define TVI_CONTROL_AUD_SET_SAMPLERATE 0x305
216 /* SPECIFIC controls */
217 #define TVI_CONTROL_SPC_GET_INPUT 0x401 /* set input channel (tv,s-video,composite..) */
218 #define TVI_CONTROL_SPC_SET_INPUT 0x402 /* set input channel (tv,s-video,composite..) */
219 #define TVI_CONTROL_SPC_GET_NORMID 0x403 /* get normid from norm name */
221 //tvi_* ioctl (not dec_teletext.c !!!)
222 #define TVI_CONTROL_VBI_INIT 0x501 ///< vbi init
224 int tv_set_color_options(tvi_handle_t *tvh, int opt, int val);
225 int tv_get_color_options(tvi_handle_t *tvh, int opt, int* val);
226 #define TV_COLOR_BRIGHTNESS 1
227 #define TV_COLOR_HUE 2
228 #define TV_COLOR_SATURATION 3
229 #define TV_COLOR_CONTRAST 4
231 int tv_step_channel_real(tvi_handle_t *tvh, int direction);
232 int tv_step_channel(tvi_handle_t *tvh, int direction);
233 #define TV_CHANNEL_LOWER 1
234 #define TV_CHANNEL_HIGHER 2
236 int tv_last_channel(tvi_handle_t *tvh);
238 int tv_set_channel_real(tvi_handle_t *tvh, char *channel);
239 int tv_set_channel(tvi_handle_t *tvh, char *channel);
241 int tv_step_norm(tvi_handle_t *tvh);
242 int tv_step_chanlist(tvi_handle_t *tvh);
244 int tv_set_freq(tvi_handle_t *tvh, unsigned long freq);
245 int tv_get_freq(tvi_handle_t *tvh, unsigned long *freq);
246 int tv_get_signal(tvi_handle_t *tvh);
247 int tv_step_freq(tvi_handle_t *tvh, float step_interval);
249 int tv_set_norm(tvi_handle_t *tvh, char* norm);
251 void tv_start_scan(tvi_handle_t *tvh, int start);
253 #define TV_NORM_PAL 1
254 #define TV_NORM_NTSC 2
255 #define TV_NORM_SECAM 3
256 #define TV_NORM_PALNC 4
257 #define TV_NORM_PALM 5
258 #define TV_NORM_PALN 6
259 #define TV_NORM_NTSCJP 7
261 #endif /* MPLAYER_TV_H */