29426
|
1 /*
|
29479
|
2 * TV interface
|
29426
|
3 *
|
29478
|
4 * Copyright (C) 2001 Alex Beregsz叩szi
|
|
5 * Copyright (C) 2007 Attila �tv旦s
|
29426
|
6 * Copyright (C) 2007 Vladimir Voroshilov <voroshil@gmail.com>
|
|
7 *
|
|
8 * This file is part of MPlayer.
|
|
9 *
|
|
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.
|
|
14 *
|
|
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.
|
|
19 *
|
|
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.
|
|
23 */
|
|
24
|
26029
|
25 #ifndef MPLAYER_TV_H
|
|
26 #define MPLAYER_TV_H
|
2790
|
27
|
29806
|
28 #include "libmpcodecs/dec_teletext.h"
|
|
29 #include "libmpdemux/demuxer.h"
|
|
30
|
23882
|
31 typedef struct tv_param_s {
|
|
32 char *freq;
|
|
33 char *channel;
|
|
34 char *chanlist;
|
|
35 char *norm;
|
|
36 int automute;
|
|
37 int normid;
|
|
38 char *device;
|
|
39 char *driver;
|
|
40 int width;
|
|
41 int height;
|
|
42 int input;
|
|
43 int outfmt;
|
|
44 float fps;
|
|
45 char **channels;
|
|
46 int noaudio;
|
|
47 int immediate;
|
|
48 int audiorate;
|
|
49 int audio_id;
|
|
50 int amode;
|
|
51 int volume;
|
|
52 int bass;
|
|
53 int treble;
|
|
54 int balance;
|
|
55 int forcechan;
|
|
56 int force_audio;
|
|
57 int buffer_size;
|
|
58 int mjpeg;
|
|
59 int decimation;
|
|
60 int quality;
|
|
61 int alsa;
|
|
62 char* adevice;
|
|
63 int brightness;
|
|
64 int contrast;
|
|
65 int hue;
|
|
66 int saturation;
|
24553
|
67 int gain;
|
29806
|
68 struct tt_param teletext;
|
24105
|
69
|
|
70 int scan;
|
|
71 int scan_threshold;
|
|
72 float scan_period;
|
24744
|
73 /**
|
29263
|
74 Terminate stream with video renderer instead of Null renderer
|
24744
|
75 Will help if video freezes but audio does not.
|
|
76 May not work with -vo directx and -vf crop combination.
|
|
77 */
|
|
78 int hidden_video_renderer;
|
|
79 /**
|
|
80 For VIVO cards VP pin have to be rendered too.
|
29263
|
81 This tweak will cause VidePort pin stream to be terminated with video renderer
|
24744
|
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.
|
|
85 */
|
|
86 int hidden_vp_renderer;
|
|
87 /**
|
29263
|
88 Use system clock as sync source instead of default graph clock (usually the clock
|
24744
|
89 from one of live sources in graph.
|
|
90 */
|
|
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.
|
|
97 */
|
|
98 int normalize_audio_chunks;
|
23882
|
99 } tv_param_t;
|
29263
|
100
|
23882
|
101 extern tv_param_t stream_tv_defaults;
|
29263
|
102
|
2790
|
103 typedef struct tvi_info_s
|
|
104 {
|
23883
|
105 struct tvi_handle_s * (*tvi_init)(tv_param_t* tv_param);
|
2790
|
106 const char *name;
|
|
107 const char *short_name;
|
|
108 const char *author;
|
|
109 const char *comment;
|
|
110 } tvi_info_t;
|
|
111
|
31322
|
112
|
|
113 struct priv;
|
|
114
|
2790
|
115 typedef struct tvi_functions_s
|
|
116 {
|
31322
|
117 int (*init)(struct priv *priv);
|
|
118 int (*uninit)(struct priv *priv);
|
|
119 int (*control)(struct priv *priv, int cmd, void *arg);
|
|
120 int (*start)(struct priv *priv);
|
|
121 double (*grab_video_frame)(struct priv *priv, char *buffer, int len);
|
|
122 int (*get_video_framesize)(struct priv *priv);
|
|
123 double (*grab_audio_frame)(struct priv *priv, char *buffer, int len);
|
|
124 int (*get_audio_framesize)(struct priv *priv);
|
2790
|
125 } tvi_functions_t;
|
|
126
|
|
127 typedef struct tvi_handle_s {
|
25684
|
128 const tvi_functions_t *functions;
|
2802
|
129 void *priv;
|
|
130 int seq;
|
29806
|
131 demuxer_t *demuxer;
|
2941
|
132
|
|
133 /* specific */
|
|
134 int norm;
|
|
135 int chanlist;
|
18032
|
136 const struct CHANLIST *chanlist_s;
|
2941
|
137 int channel;
|
23882
|
138 tv_param_t * tv_param;
|
24105
|
139 void * scan;
|
2790
|
140 } tvi_handle_t;
|
|
141
|
8627
|
142 typedef struct tv_channels_s {
|
|
143 int index;
|
|
144 char number[5];
|
|
145 char name[20];
|
27025
|
146 int norm;
|
8627
|
147 int freq;
|
|
148 struct tv_channels_s *next;
|
|
149 struct tv_channels_s *prev;
|
|
150 } tv_channels_t;
|
|
151
|
14607
7a80c6ac5058
several sets of headers declare global variables in them, which causes multiple definition errors with gcc 4.x
iive
diff
changeset
|
152 extern tv_channels_t *tv_channel_list;
|
7a80c6ac5058
several sets of headers declare global variables in them, which causes multiple definition errors with gcc 4.x
iive
diff
changeset
|
153 extern tv_channels_t *tv_channel_current, *tv_channel_last;
|
7a80c6ac5058
several sets of headers declare global variables in them, which causes multiple definition errors with gcc 4.x
iive
diff
changeset
|
154 extern char *tv_channel_last_real;
|
2802
|
155
|
24105
|
156 typedef struct {
|
|
157 unsigned int scan_timer;
|
|
158 int channel_num;
|
|
159 int new_channels;
|
|
160 } tv_scan_t;
|
|
161
|
2790
|
162 #define TVI_CONTROL_FALSE 0
|
|
163 #define TVI_CONTROL_TRUE 1
|
|
164 #define TVI_CONTROL_NA -1
|
|
165 #define TVI_CONTROL_UNKNOWN -2
|
|
166
|
2802
|
167 /* ======================== CONTROLS =========================== */
|
2790
|
168
|
2802
|
169 /* GENERIC controls */
|
|
170 #define TVI_CONTROL_IS_AUDIO 0x1
|
|
171 #define TVI_CONTROL_IS_VIDEO 0x2
|
|
172 #define TVI_CONTROL_IS_TUNER 0x3
|
7058
|
173 #define TVI_CONTROL_IMMEDIATE 0x4
|
2802
|
174
|
|
175 /* VIDEO controls */
|
|
176 #define TVI_CONTROL_VID_GET_FPS 0x101
|
|
177 #define TVI_CONTROL_VID_GET_PLANES 0x102
|
|
178 #define TVI_CONTROL_VID_GET_BITS 0x103
|
|
179 #define TVI_CONTROL_VID_CHK_BITS 0x104
|
|
180 #define TVI_CONTROL_VID_SET_BITS 0x105
|
|
181 #define TVI_CONTROL_VID_GET_FORMAT 0x106
|
|
182 #define TVI_CONTROL_VID_CHK_FORMAT 0x107
|
|
183 #define TVI_CONTROL_VID_SET_FORMAT 0x108
|
|
184 #define TVI_CONTROL_VID_GET_WIDTH 0x109
|
|
185 #define TVI_CONTROL_VID_CHK_WIDTH 0x110
|
|
186 #define TVI_CONTROL_VID_SET_WIDTH 0x111
|
|
187 #define TVI_CONTROL_VID_GET_HEIGHT 0x112
|
|
188 #define TVI_CONTROL_VID_CHK_HEIGHT 0x113
|
|
189 #define TVI_CONTROL_VID_SET_HEIGHT 0x114
|
2937
|
190 #define TVI_CONTROL_VID_GET_BRIGHTNESS 0x115
|
|
191 #define TVI_CONTROL_VID_SET_BRIGHTNESS 0x116
|
|
192 #define TVI_CONTROL_VID_GET_HUE 0x117
|
|
193 #define TVI_CONTROL_VID_SET_HUE 0x118
|
|
194 #define TVI_CONTROL_VID_GET_SATURATION 0x119
|
|
195 #define TVI_CONTROL_VID_SET_SATURATION 0x11a
|
|
196 #define TVI_CONTROL_VID_GET_CONTRAST 0x11b
|
|
197 #define TVI_CONTROL_VID_SET_CONTRAST 0x11c
|
|
198 #define TVI_CONTROL_VID_GET_PICTURE 0x11d
|
|
199 #define TVI_CONTROL_VID_SET_PICTURE 0x11e
|
24553
|
200 #define TVI_CONTROL_VID_SET_GAIN 0x11f
|
|
201 #define TVI_CONTROL_VID_GET_GAIN 0x120
|
28940
|
202 #define TVI_CONTROL_VID_SET_WIDTH_HEIGHT 0x121
|
2790
|
203
|
2802
|
204 /* TUNER controls */
|
|
205 #define TVI_CONTROL_TUN_GET_FREQ 0x201
|
|
206 #define TVI_CONTROL_TUN_SET_FREQ 0x202
|
|
207 #define TVI_CONTROL_TUN_GET_TUNER 0x203 /* update priv->tuner struct for used input */
|
|
208 #define TVI_CONTROL_TUN_SET_TUNER 0x204 /* update priv->tuner struct for used input */
|
|
209 #define TVI_CONTROL_TUN_GET_NORM 0x205
|
|
210 #define TVI_CONTROL_TUN_SET_NORM 0x206
|
24105
|
211 #define TVI_CONTROL_TUN_GET_SIGNAL 0x207
|
2802
|
212
|
|
213 /* AUDIO controls */
|
|
214 #define TVI_CONTROL_AUD_GET_FORMAT 0x301
|
|
215 #define TVI_CONTROL_AUD_GET_SAMPLERATE 0x302
|
|
216 #define TVI_CONTROL_AUD_GET_SAMPLESIZE 0x303
|
|
217 #define TVI_CONTROL_AUD_GET_CHANNELS 0x304
|
5572
|
218 #define TVI_CONTROL_AUD_SET_SAMPLERATE 0x305
|
2802
|
219
|
|
220 /* SPECIFIC controls */
|
|
221 #define TVI_CONTROL_SPC_GET_INPUT 0x401 /* set input channel (tv,s-video,composite..) */
|
|
222 #define TVI_CONTROL_SPC_SET_INPUT 0x402 /* set input channel (tv,s-video,composite..) */
|
13978
|
223 #define TVI_CONTROL_SPC_GET_NORMID 0x403 /* get normid from norm name */
|
2802
|
224
|
29766
|
225 //tvi_* ioctl (not dec_teletext.c !!!)
|
23900
|
226 #define TVI_CONTROL_VBI_INIT 0x501 ///< vbi init
|
29806
|
227 #define TVI_CONTROL_GET_VBI_PTR 0x502 ///< get teletext private pointer
|
23900
|
228
|
2941
|
229 int tv_set_color_options(tvi_handle_t *tvh, int opt, int val);
|
18172
|
230 int tv_get_color_options(tvi_handle_t *tvh, int opt, int* val);
|
2937
|
231 #define TV_COLOR_BRIGHTNESS 1
|
|
232 #define TV_COLOR_HUE 2
|
|
233 #define TV_COLOR_SATURATION 3
|
|
234 #define TV_COLOR_CONTRAST 4
|
|
235
|
8627
|
236 int tv_step_channel_real(tvi_handle_t *tvh, int direction);
|
2941
|
237 int tv_step_channel(tvi_handle_t *tvh, int direction);
|
|
238 #define TV_CHANNEL_LOWER 1
|
|
239 #define TV_CHANNEL_HIGHER 2
|
|
240
|
8627
|
241 int tv_last_channel(tvi_handle_t *tvh);
|
|
242
|
|
243 int tv_set_channel_real(tvi_handle_t *tvh, char *channel);
|
8494
|
244 int tv_set_channel(tvi_handle_t *tvh, char *channel);
|
|
245
|
2941
|
246 int tv_step_norm(tvi_handle_t *tvh);
|
|
247 int tv_step_chanlist(tvi_handle_t *tvh);
|
|
248
|
10521
|
249 int tv_set_freq(tvi_handle_t *tvh, unsigned long freq);
|
|
250 int tv_get_freq(tvi_handle_t *tvh, unsigned long *freq);
|
24105
|
251 int tv_get_signal(tvi_handle_t *tvh);
|
22667
|
252 int tv_step_freq(tvi_handle_t *tvh, float step_interval);
|
10521
|
253
|
|
254 int tv_set_norm(tvi_handle_t *tvh, char* norm);
|
|
255
|
24105
|
256 void tv_start_scan(tvi_handle_t *tvh, int start);
|
|
257
|
2941
|
258 #define TV_NORM_PAL 1
|
|
259 #define TV_NORM_NTSC 2
|
|
260 #define TV_NORM_SECAM 3
|
8477
|
261 #define TV_NORM_PALNC 4
|
|
262 #define TV_NORM_PALM 5
|
|
263 #define TV_NORM_PALN 6
|
|
264 #define TV_NORM_NTSCJP 7
|
2941
|
265
|
26029
|
266 #endif /* MPLAYER_TV_H */
|