annotate libmpdemux/tvi_v4l.c @ 2836:ec672ea5ac2c

Applied SAMI patch by Evgeny Chukreev <codedj at echo dot ru>
author atmos4
date Sun, 11 Nov 2001 15:41:17 +0000
parents 596a6ba3520f
children c63562f5f56f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
1 /*
09d5c9834580 tv update
alex
parents: 2790
diff changeset
2 v4l interface for libmpemux/tvi
09d5c9834580 tv update
alex
parents: 2790
diff changeset
3
09d5c9834580 tv update
alex
parents: 2790
diff changeset
4 (C) Alex Beregszaszi <alex@naxine.org>
09d5c9834580 tv update
alex
parents: 2790
diff changeset
5
09d5c9834580 tv update
alex
parents: 2790
diff changeset
6 Some ideas are based on xawtv/libng's grab-v4l.c written by
09d5c9834580 tv update
alex
parents: 2790
diff changeset
7 Gerd Knorr <kraxel@bytesex.org>
09d5c9834580 tv update
alex
parents: 2790
diff changeset
8
09d5c9834580 tv update
alex
parents: 2790
diff changeset
9 CODE IS UNDER DEVELOPMENT, NO FEATURE REQUESTS PLEASE!
09d5c9834580 tv update
alex
parents: 2790
diff changeset
10 */
09d5c9834580 tv update
alex
parents: 2790
diff changeset
11
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
12 #include "config.h"
98769cea155c added tv subsystem
alex
parents:
diff changeset
13
98769cea155c added tv subsystem
alex
parents:
diff changeset
14 #ifdef USE_TV
98769cea155c added tv subsystem
alex
parents:
diff changeset
15
98769cea155c added tv subsystem
alex
parents:
diff changeset
16 #include <stdio.h>
98769cea155c added tv subsystem
alex
parents:
diff changeset
17 #include <errno.h>
98769cea155c added tv subsystem
alex
parents:
diff changeset
18 #include <fcntl.h>
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
19 #include <signal.h>
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
20 #include <sys/ioctl.h>
98769cea155c added tv subsystem
alex
parents:
diff changeset
21 #include <sys/types.h>
98769cea155c added tv subsystem
alex
parents:
diff changeset
22 #include <linux/videodev.h>
98769cea155c added tv subsystem
alex
parents:
diff changeset
23 #include <unistd.h>
98769cea155c added tv subsystem
alex
parents:
diff changeset
24 #include <sys/mman.h>
98769cea155c added tv subsystem
alex
parents:
diff changeset
25
2830
596a6ba3520f never include files from public headers...
arpi
parents: 2819
diff changeset
26 #include "mp_msg.h"
596a6ba3520f never include files from public headers...
arpi
parents: 2819
diff changeset
27 #include "../libao2/afmt.h"
596a6ba3520f never include files from public headers...
arpi
parents: 2819
diff changeset
28 #include "../libvo/img_format.h"
596a6ba3520f never include files from public headers...
arpi
parents: 2819
diff changeset
29 #include "../libvo/fastmemcpy.h"
596a6ba3520f never include files from public headers...
arpi
parents: 2819
diff changeset
30
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
31 #include "tv.h"
98769cea155c added tv subsystem
alex
parents:
diff changeset
32
98769cea155c added tv subsystem
alex
parents:
diff changeset
33 static tvi_info_t info = {
98769cea155c added tv subsystem
alex
parents:
diff changeset
34 "Video for Linux TV Input",
98769cea155c added tv subsystem
alex
parents:
diff changeset
35 "v4l",
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
36 "Alex Beregszaszi <alex@naxine.org>",
09d5c9834580 tv update
alex
parents: 2790
diff changeset
37 "under development"
09d5c9834580 tv update
alex
parents: 2790
diff changeset
38 };
09d5c9834580 tv update
alex
parents: 2790
diff changeset
39
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
40 typedef struct {
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
41 /* general */
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
42 char *video_device;
98769cea155c added tv subsystem
alex
parents:
diff changeset
43 int fd;
98769cea155c added tv subsystem
alex
parents:
diff changeset
44 struct video_capability capability;
98769cea155c added tv subsystem
alex
parents:
diff changeset
45 struct video_channel *channels;
98769cea155c added tv subsystem
alex
parents:
diff changeset
46 struct video_tuner tuner;
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
47
09d5c9834580 tv update
alex
parents: 2790
diff changeset
48 /* video */
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
49 struct video_picture picture;
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
50 int format; /* output format */
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
51 int width;
98769cea155c added tv subsystem
alex
parents:
diff changeset
52 int height;
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
53 int bytesperline;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
54
09d5c9834580 tv update
alex
parents: 2790
diff changeset
55 struct video_mbuf mbuf;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
56 unsigned char *mmap;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
57 struct video_mmap *buf;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
58 int nbuf;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
59 int queue;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
60
09d5c9834580 tv update
alex
parents: 2790
diff changeset
61 /* audio */
09d5c9834580 tv update
alex
parents: 2790
diff changeset
62 struct video_audio audio;
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
63 } priv_t;
98769cea155c added tv subsystem
alex
parents:
diff changeset
64
98769cea155c added tv subsystem
alex
parents:
diff changeset
65 #include "tvi_def.h"
98769cea155c added tv subsystem
alex
parents:
diff changeset
66
98769cea155c added tv subsystem
alex
parents:
diff changeset
67 static const char *device_cap[] = {
98769cea155c added tv subsystem
alex
parents:
diff changeset
68 "capture", "tuner", "teletext", "overlay", "chromakey", "clipping",
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
69 "frameram", "scales", "monochrome", "subcapture", "mpeg-decoder",
09d5c9834580 tv update
alex
parents: 2790
diff changeset
70 "mpeg-encoder", "mjpeg-decoder", "mjpeg-encoder", NULL
09d5c9834580 tv update
alex
parents: 2790
diff changeset
71 };
09d5c9834580 tv update
alex
parents: 2790
diff changeset
72
09d5c9834580 tv update
alex
parents: 2790
diff changeset
73 static const char *device_pal[] = {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
74 "-", "grey", "hi240", "rgb16", "rgb24", "rgb32", "rgb15", "yuv422",
09d5c9834580 tv update
alex
parents: 2790
diff changeset
75 "yuyv", "uyvy", "yuv420", "yuv411", "raw", "yuv422p", "yuv411p",
09d5c9834580 tv update
alex
parents: 2790
diff changeset
76 "yuv420p", "yuv410p", NULL
09d5c9834580 tv update
alex
parents: 2790
diff changeset
77 };
09d5c9834580 tv update
alex
parents: 2790
diff changeset
78 #define PALETTE(x) ((x < sizeof(device_pal)/sizeof(char*)) ? device_pal[x] : "UNKNOWN")
09d5c9834580 tv update
alex
parents: 2790
diff changeset
79
09d5c9834580 tv update
alex
parents: 2790
diff changeset
80 static int palette2depth(int palette)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
81 {
2810
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
82 switch(palette)
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
83 {
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
84 case VIDEO_PALETTE_RGB555:
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
85 return(15);
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
86 case VIDEO_PALETTE_RGB565:
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
87 return(16);
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
88 case VIDEO_PALETTE_RGB24:
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
89 return(24);
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
90 case VIDEO_PALETTE_RGB32:
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
91 return(32);
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
92 case VIDEO_PALETTE_YUV420P:
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
93 return(12);
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
94 case VIDEO_PALETTE_YUV422:
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
95 case VIDEO_PALETTE_UYVY:
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
96 return(16);
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
97 }
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
98 return(-1);
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
99 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
100
09d5c9834580 tv update
alex
parents: 2790
diff changeset
101 static int format2palette(int format)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
102 {
2810
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
103 switch(format)
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
104 {
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
105 case IMGFMT_RGB15:
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
106 return(VIDEO_PALETTE_RGB555);
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
107 case IMGFMT_RGB16:
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
108 return(VIDEO_PALETTE_RGB565);
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
109 case IMGFMT_RGB24:
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
110 return(VIDEO_PALETTE_RGB24);
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
111 case IMGFMT_RGB32:
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
112 return(VIDEO_PALETTE_RGB32);
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
113 case IMGFMT_YV12:
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
114 return(VIDEO_PALETTE_YUV420P);
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
115 case IMGFMT_UYVY:
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
116 return(VIDEO_PALETTE_YUV422);
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
117 }
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
118 return(-1);
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
119 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
120
09d5c9834580 tv update
alex
parents: 2790
diff changeset
121 #if 0
09d5c9834580 tv update
alex
parents: 2790
diff changeset
122 struct STRTAB {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
123 long nr;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
124 const char *str;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
125 };
09d5c9834580 tv update
alex
parents: 2790
diff changeset
126
09d5c9834580 tv update
alex
parents: 2790
diff changeset
127 static struct STRTAB stereo[] = {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
128 { 0, "auto" },
09d5c9834580 tv update
alex
parents: 2790
diff changeset
129 { VIDEO_SOUND_MONO, "mono" },
09d5c9834580 tv update
alex
parents: 2790
diff changeset
130 { VIDEO_SOUND_STEREO, "stereo" },
09d5c9834580 tv update
alex
parents: 2790
diff changeset
131 { VIDEO_SOUND_LANG1, "lang1" },
09d5c9834580 tv update
alex
parents: 2790
diff changeset
132 { VIDEO_SOUND_LANG2, "lang1" },
09d5c9834580 tv update
alex
parents: 2790
diff changeset
133 { -1, NULL }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
134 };
09d5c9834580 tv update
alex
parents: 2790
diff changeset
135
09d5c9834580 tv update
alex
parents: 2790
diff changeset
136 static struct STRTAB norms_v4l[] = {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
137 { VIDEO_MODE_PAL, "PAL" },
09d5c9834580 tv update
alex
parents: 2790
diff changeset
138 { VIDEO_MODE_NTSC, "NTSC" },
09d5c9834580 tv update
alex
parents: 2790
diff changeset
139 { VIDEO_MODE_SECAM, "SECAM" },
09d5c9834580 tv update
alex
parents: 2790
diff changeset
140 { VIDEO_MODE_AUTO, "AUTO" },
09d5c9834580 tv update
alex
parents: 2790
diff changeset
141 { -1, NULL }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
142 };
09d5c9834580 tv update
alex
parents: 2790
diff changeset
143
09d5c9834580 tv update
alex
parents: 2790
diff changeset
144 static struct STRTAB norms_bttv[] = {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
145 { VIDEO_MODE_PAL, "PAL" },
09d5c9834580 tv update
alex
parents: 2790
diff changeset
146 { VIDEO_MODE_NTSC, "NTSC" },
09d5c9834580 tv update
alex
parents: 2790
diff changeset
147 { VIDEO_MODE_SECAM, "SECAM" },
09d5c9834580 tv update
alex
parents: 2790
diff changeset
148 { 3, "PAL-NC" },
09d5c9834580 tv update
alex
parents: 2790
diff changeset
149 { 4, "PAL-M" },
09d5c9834580 tv update
alex
parents: 2790
diff changeset
150 { 5, "PAL-N" },
09d5c9834580 tv update
alex
parents: 2790
diff changeset
151 { 6, "NTSC-JP" },
09d5c9834580 tv update
alex
parents: 2790
diff changeset
152 { -1, NULL }
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
153 };
98769cea155c added tv subsystem
alex
parents:
diff changeset
154
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
155 static unsigned short _format2palette[VIDEO_FMT_COUNT] = {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
156 0, /* unused */
09d5c9834580 tv update
alex
parents: 2790
diff changeset
157 VIDEO_PALETTE_HI240, /* RGB8 */
09d5c9834580 tv update
alex
parents: 2790
diff changeset
158 VIDEO_PALETTE_GREY,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
159 VIDEO_PALETTE_RGB555,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
160 VIDEO_PALETTE_RGB565,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
161 0,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
162 0,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
163 VIDEO_PALETTE_RGB24,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
164 VIDEO_PALETTE_RGB32,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
165 0,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
166 0,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
167 0,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
168 0,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
169 VIDEO_PALETTE_YUV422,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
170 VIDEO_PALETTE_YUV422P,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
171 VIDEO_PALETTE_YUV420P,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
172 };
09d5c9834580 tv update
alex
parents: 2790
diff changeset
173 #define FMT2PAL(fmt) ((fmt < sizeof(format2palette)/sizeof(unsigned short)) ? \
09d5c9834580 tv update
alex
parents: 2790
diff changeset
174 format2palette[fmt] : 0);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
175
09d5c9834580 tv update
alex
parents: 2790
diff changeset
176 const unsigned int vfmt_to_depth[] = {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
177 0,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
178 8,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
179 8,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
180 16,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
181 16,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
182 16,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
183 16,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
184 24,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
185 32,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
186 24,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
187 32,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
188 16,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
189 32,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
190 16,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
191 16,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
192 12,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
193 0,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
194 0,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
195 };
09d5c9834580 tv update
alex
parents: 2790
diff changeset
196 #endif
09d5c9834580 tv update
alex
parents: 2790
diff changeset
197
09d5c9834580 tv update
alex
parents: 2790
diff changeset
198 static int one = 1, zero = 0;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
199
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
200 tvi_handle_t *tvi_init_v4l(char *device)
98769cea155c added tv subsystem
alex
parents:
diff changeset
201 {
98769cea155c added tv subsystem
alex
parents:
diff changeset
202 tvi_handle_t *h;
98769cea155c added tv subsystem
alex
parents:
diff changeset
203 priv_t *priv;
98769cea155c added tv subsystem
alex
parents:
diff changeset
204
98769cea155c added tv subsystem
alex
parents:
diff changeset
205 h = new_handle();
98769cea155c added tv subsystem
alex
parents:
diff changeset
206 if (!h)
98769cea155c added tv subsystem
alex
parents:
diff changeset
207 return(NULL);
98769cea155c added tv subsystem
alex
parents:
diff changeset
208
98769cea155c added tv subsystem
alex
parents:
diff changeset
209 priv = h->priv;
98769cea155c added tv subsystem
alex
parents:
diff changeset
210
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
211 /* set video device name */
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
212 if (!device)
98769cea155c added tv subsystem
alex
parents:
diff changeset
213 {
2819
2e58962dc9fe cleaned up some warnings, and tv_param_on moved out from #ifdef USE_TV
alex
parents: 2818
diff changeset
214 priv->video_device = (char *)malloc(strlen("/dev/video0"));
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
215 sprintf(priv->video_device, "/dev/video0");
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
216 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
217 else
98769cea155c added tv subsystem
alex
parents:
diff changeset
218 {
2819
2e58962dc9fe cleaned up some warnings, and tv_param_on moved out from #ifdef USE_TV
alex
parents: 2818
diff changeset
219 priv->video_device = (char *)malloc(strlen(device));
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
220 strcpy(priv->video_device, device);
98769cea155c added tv subsystem
alex
parents:
diff changeset
221 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
222
98769cea155c added tv subsystem
alex
parents:
diff changeset
223 return(h);
98769cea155c added tv subsystem
alex
parents:
diff changeset
224 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
225
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
226 static int init(priv_t *priv, tvi_param_t *params)
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
227 {
98769cea155c added tv subsystem
alex
parents:
diff changeset
228 int i;
98769cea155c added tv subsystem
alex
parents:
diff changeset
229
2810
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
230 priv->fd = open(priv->video_device, O_RDWR);
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
231 if (priv->fd == -1)
98769cea155c added tv subsystem
alex
parents:
diff changeset
232 {
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
233 mp_msg(MSGT_TV, MSGL_ERR, "unable to open '%s': %s\n",
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
234 priv->video_device, strerror(errno));
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
235 goto err;
98769cea155c added tv subsystem
alex
parents:
diff changeset
236 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
237
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
238 mp_msg(MSGT_TV, MSGL_V, "Video fd: %d\n", priv->fd);
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
239
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
240 /* get capabilities (priv->capability is needed!) */
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
241 if (ioctl(priv->fd, VIDIOCGCAP, &priv->capability) == -1)
98769cea155c added tv subsystem
alex
parents:
diff changeset
242 {
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
243 mp_msg(MSGT_TV, MSGL_ERR, "ioctl get capabilites failed: %s\n", strerror(errno));
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
244 goto err;
98769cea155c added tv subsystem
alex
parents:
diff changeset
245 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
246
98769cea155c added tv subsystem
alex
parents:
diff changeset
247 fcntl(priv->fd, F_SETFD, FD_CLOEXEC);
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
248 // siginit();
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
249
09d5c9834580 tv update
alex
parents: 2790
diff changeset
250 #if 0
09d5c9834580 tv update
alex
parents: 2790
diff changeset
251 for (i=0; params[i].opt; i++)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
252 {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
253 if (!strcmp(params[i].opt, "input"))
09d5c9834580 tv update
alex
parents: 2790
diff changeset
254 priv->input = (int)*(void **)params[i].value;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
255 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
256 printf("priv->input: %d\n", priv->input);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
257 #endif
09d5c9834580 tv update
alex
parents: 2790
diff changeset
258
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
259 mp_msg(MSGT_TV, MSGL_INFO, "Selected device: %s\n", priv->capability.name);
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
260 mp_msg(MSGT_TV, MSGL_INFO, " Capabilites: ");
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
261 for (i = 0; device_cap[i] != NULL; i++)
98769cea155c added tv subsystem
alex
parents:
diff changeset
262 if (priv->capability.type & (1 << i))
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
263 mp_msg(MSGT_TV, MSGL_INFO, "%s ", device_cap[i]);
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
264 mp_msg(MSGT_TV, MSGL_INFO, "\n");
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
265 mp_msg(MSGT_TV, MSGL_INFO, " Device type: %d\n", priv->capability.type);
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
266 mp_msg(MSGT_TV, MSGL_INFO, " Supported sizes: %dx%d => %dx%d\n",
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
267 priv->capability.minwidth, priv->capability.minheight,
98769cea155c added tv subsystem
alex
parents:
diff changeset
268 priv->capability.maxwidth, priv->capability.maxheight);
98769cea155c added tv subsystem
alex
parents:
diff changeset
269 priv->width = priv->capability.minwidth;
98769cea155c added tv subsystem
alex
parents:
diff changeset
270 priv->height = priv->capability.minheight;
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
271 mp_msg(MSGT_TV, MSGL_INFO, " Inputs: %d\n", priv->capability.channels);
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
272
2819
2e58962dc9fe cleaned up some warnings, and tv_param_on moved out from #ifdef USE_TV
alex
parents: 2818
diff changeset
273 priv->channels = (struct video_channel *)malloc(sizeof(struct video_channel)*priv->capability.channels);
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
274 memset(priv->channels, 0, sizeof(struct video_channel)*priv->capability.channels);
98769cea155c added tv subsystem
alex
parents:
diff changeset
275 for (i = 0; i < priv->capability.channels; i++)
98769cea155c added tv subsystem
alex
parents:
diff changeset
276 {
98769cea155c added tv subsystem
alex
parents:
diff changeset
277 priv->channels[i].channel = i;
98769cea155c added tv subsystem
alex
parents:
diff changeset
278 ioctl(priv->fd, VIDIOCGCHAN, &priv->channels[i]);
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
279 mp_msg(MSGT_TV, MSGL_INFO, " %d: %s: %s%s%s%s (tuner:%d, norm:%d)\n", i,
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
280 priv->channels[i].name,
98769cea155c added tv subsystem
alex
parents:
diff changeset
281 (priv->channels[i].flags & VIDEO_VC_TUNER) ? "tuner " : "",
98769cea155c added tv subsystem
alex
parents:
diff changeset
282 (priv->channels[i].flags & VIDEO_VC_AUDIO) ? "audio " : "",
98769cea155c added tv subsystem
alex
parents:
diff changeset
283 (priv->channels[i].flags & VIDEO_TYPE_TV) ? "tv " : "",
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
284 (priv->channels[i].flags & VIDEO_TYPE_CAMERA) ? "camera " : "",
09d5c9834580 tv update
alex
parents: 2790
diff changeset
285 priv->channels[i].tuners,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
286 priv->channels[i].norm);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
287 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
288
09d5c9834580 tv update
alex
parents: 2790
diff changeset
289 if (!(priv->capability.type & VID_TYPE_CAPTURE))
09d5c9834580 tv update
alex
parents: 2790
diff changeset
290 {
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
291 mp_msg(MSGT_TV, MSGL_ERR, "Only grabbing supported (for overlay use another program)\n");
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
292 goto err;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
293 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
294
09d5c9834580 tv update
alex
parents: 2790
diff changeset
295 /* map grab buffer */
09d5c9834580 tv update
alex
parents: 2790
diff changeset
296 if (ioctl(priv->fd, VIDIOCGMBUF, &priv->mbuf) == -1)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
297 {
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
298 mp_msg(MSGT_TV, MSGL_ERR, "ioctl get mbuf failed: %s\n", strerror(errno));
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
299 goto err;
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
300 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
301
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
302 mp_msg(MSGT_TV, MSGL_V, "mbuf: size=%d, frames=%d\n",
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
303 priv->mbuf.size, priv->mbuf.frames);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
304 priv->mmap = mmap(0, priv->mbuf.size, PROT_READ|PROT_WRITE,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
305 MAP_SHARED, priv->fd, 0);
2819
2e58962dc9fe cleaned up some warnings, and tv_param_on moved out from #ifdef USE_TV
alex
parents: 2818
diff changeset
306 if (priv->mmap == (unsigned char *)-1)
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
307 {
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
308 mp_msg(MSGT_TV, MSGL_ERR, "Unabel to map memory for buffers: %s\n", strerror(errno));
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
309 goto err;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
310 }
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
311 mp_msg(MSGT_TV, MSGL_DBG2, "our buffer: %p\n", priv->mmap);
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
312
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
313 /* num of buffers */
09d5c9834580 tv update
alex
parents: 2790
diff changeset
314 priv->nbuf = priv->mbuf.frames;
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
315
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
316 /* video buffers */
2819
2e58962dc9fe cleaned up some warnings, and tv_param_on moved out from #ifdef USE_TV
alex
parents: 2818
diff changeset
317 priv->buf = (struct video_mmap *)malloc(priv->nbuf * sizeof(struct video_mmap));
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
318 memset(priv->buf, 0, priv->nbuf * sizeof(struct video_mmap));
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
319
98769cea155c added tv subsystem
alex
parents:
diff changeset
320 return(1);
98769cea155c added tv subsystem
alex
parents:
diff changeset
321
98769cea155c added tv subsystem
alex
parents:
diff changeset
322 err:
98769cea155c added tv subsystem
alex
parents:
diff changeset
323 if (priv->fd != -1)
98769cea155c added tv subsystem
alex
parents:
diff changeset
324 close(priv->fd);
98769cea155c added tv subsystem
alex
parents:
diff changeset
325 return(0);
98769cea155c added tv subsystem
alex
parents:
diff changeset
326 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
327
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
328 static int uninit(priv_t *priv)
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
329 {
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
330 #warning "Implement uninit!"
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
331 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
332
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
333 static int start(priv_t *priv)
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
334 {
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
335 int i;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
336
09d5c9834580 tv update
alex
parents: 2790
diff changeset
337
09d5c9834580 tv update
alex
parents: 2790
diff changeset
338 if (ioctl(priv->fd, VIDIOCGPICT, &priv->picture) == -1)
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
339 {
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
340 mp_msg(MSGT_TV, MSGL_ERR, "ioctl get picture failed: %s\n", strerror(errno));
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
341 return(0);
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
342 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
343
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
344 priv->picture.palette = format2palette(priv->format);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
345 priv->picture.depth = palette2depth(priv->picture.palette);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
346 priv->bytesperline = priv->width * priv->picture.depth / 8;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
347
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
348 mp_msg(MSGT_TV, MSGL_INFO, "Picture values:\n");
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
349 mp_msg(MSGT_TV, MSGL_INFO, " Depth: %d, Palette: %d (Format: %s)\n", priv->picture.depth,
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
350 priv->picture.palette, vo_format_name(priv->format));
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
351 mp_msg(MSGT_TV, MSGL_INFO, " Brightness: %d, Hue: %d, Colour: %d, Contrast: %d\n",
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
352 priv->picture.brightness, priv->picture.hue,
09d5c9834580 tv update
alex
parents: 2790
diff changeset
353 priv->picture.colour, priv->picture.contrast);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
354
09d5c9834580 tv update
alex
parents: 2790
diff changeset
355
09d5c9834580 tv update
alex
parents: 2790
diff changeset
356 if (ioctl(priv->fd, VIDIOCSPICT, &priv->picture) == -1)
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
357 {
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
358 mp_msg(MSGT_TV, MSGL_ERR, "ioctl set picture failed: %s\n", strerror(errno));
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
359 return(0);
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
360 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
361
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
362 priv->nbuf = priv->mbuf.frames;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
363 for (i=0; i < priv->nbuf; i++)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
364 {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
365 priv->buf[i].format = priv->picture.palette;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
366 priv->buf[i].frame = i;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
367 priv->buf[i].width = priv->width;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
368 priv->buf[i].height = priv->height;
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
369 mp_msg(MSGT_TV, MSGL_DBG2, "buffer: %d => %p\n", i, &priv->buf[i]);
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
370 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
371
09d5c9834580 tv update
alex
parents: 2790
diff changeset
372 /* start capture */
09d5c9834580 tv update
alex
parents: 2790
diff changeset
373 if (ioctl(priv->fd, VIDIOCCAPTURE, &one) == -1)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
374 {
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
375 mp_msg(MSGT_TV, MSGL_ERR, "ioctl capture failed: %s\n", strerror(errno));
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
376 return(0);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
377 }
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
378 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
379
98769cea155c added tv subsystem
alex
parents:
diff changeset
380 static int control(priv_t *priv, int cmd, void *arg)
98769cea155c added tv subsystem
alex
parents:
diff changeset
381 {
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
382 mp_msg(MSGT_TV, MSGL_DBG2, "debug: control(priv=%p, cmd=%d, arg=%p)\n",
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
383 priv, cmd, arg);
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
384 switch(cmd)
98769cea155c added tv subsystem
alex
parents:
diff changeset
385 {
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
386 /* ========== GENERIC controls =========== */
09d5c9834580 tv update
alex
parents: 2790
diff changeset
387 case TVI_CONTROL_IS_VIDEO:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
388 {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
389 if (priv->capability.type & VID_TYPE_CAPTURE)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
390 return(TVI_CONTROL_TRUE);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
391 return(TVI_CONTROL_FALSE);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
392 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
393 case TVI_CONTROL_IS_AUDIO:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
394 return(TVI_CONTROL_FALSE); /* IMPLEMENT CHECK! */
09d5c9834580 tv update
alex
parents: 2790
diff changeset
395 case TVI_CONTROL_IS_TUNER:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
396 {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
397 if (priv->capability.type & VID_TYPE_TUNER)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
398 return(TVI_CONTROL_TRUE);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
399 return(TVI_CONTROL_FALSE);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
400 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
401
09d5c9834580 tv update
alex
parents: 2790
diff changeset
402 /* ========== VIDEO controls =========== */
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
403 case TVI_CONTROL_VID_GET_FORMAT:
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
404 {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
405 int output_fmt = -1;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
406
09d5c9834580 tv update
alex
parents: 2790
diff changeset
407 #if 0
09d5c9834580 tv update
alex
parents: 2790
diff changeset
408 switch(priv->palette)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
409 {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
410 case VIDEO_PALETTE_RGB555:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
411 output_fmt = IMGFMT_RGB15;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
412 break;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
413 case VIDEO_PALETTE_RGB565:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
414 output_fmt = IMGFMT_RGB16;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
415 break;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
416 case VIDEO_PALETTE_RGB24:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
417 output_fmt = IMGFMT_RGB24;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
418 break;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
419 case VIDEO_PALETTE_RGB32:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
420 output_fmt = IMGFMT_RGB32;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
421 break;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
422 case VIDEO_PALETTE_UYVY:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
423 output_fmt = IMGFMT_UYVY;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
424 break;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
425 case VIDEO_PALETTE_YUV420P:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
426 output_fmt = IMGFMT_YV12;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
427 break;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
428 default:
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
429 mp_msg(MSGT_TV, MSGL_ERR, "no suitable output format found (%s)\n",
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
430 PALETTE(priv->palette));
09d5c9834580 tv update
alex
parents: 2790
diff changeset
431 return(TVI_CONTROL_FALSE);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
432 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
433 #endif
09d5c9834580 tv update
alex
parents: 2790
diff changeset
434 output_fmt = priv->format;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
435 (int)*(void **)arg = output_fmt;
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
436 mp_msg(MSGT_TV, MSGL_INFO, "Output format: %s\n", vo_format_name(output_fmt));
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
437 return(TVI_CONTROL_TRUE);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
438 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
439 case TVI_CONTROL_VID_SET_FORMAT:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
440 priv->format = (int)*(void **)arg;
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
441 return(TVI_CONTROL_TRUE);
98769cea155c added tv subsystem
alex
parents:
diff changeset
442 case TVI_CONTROL_VID_GET_PLANES:
98769cea155c added tv subsystem
alex
parents:
diff changeset
443 (int)*(void **)arg = 1;
98769cea155c added tv subsystem
alex
parents:
diff changeset
444 return(TVI_CONTROL_TRUE);
98769cea155c added tv subsystem
alex
parents:
diff changeset
445 case TVI_CONTROL_VID_GET_BITS:
2810
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
446 (int)*(void **)arg = palette2depth(format2palette(priv->format));
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
447 return(TVI_CONTROL_TRUE);
98769cea155c added tv subsystem
alex
parents:
diff changeset
448 case TVI_CONTROL_VID_GET_WIDTH:
98769cea155c added tv subsystem
alex
parents:
diff changeset
449 (int)*(void **)arg = priv->width;
98769cea155c added tv subsystem
alex
parents:
diff changeset
450 return(TVI_CONTROL_TRUE);
98769cea155c added tv subsystem
alex
parents:
diff changeset
451 case TVI_CONTROL_VID_CHK_WIDTH:
98769cea155c added tv subsystem
alex
parents:
diff changeset
452 {
98769cea155c added tv subsystem
alex
parents:
diff changeset
453 int req_width = (int)*(void **)arg;
98769cea155c added tv subsystem
alex
parents:
diff changeset
454
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
455 mp_msg(MSGT_TV, MSGL_INFO, "Requested width: %d\n", req_width);
2810
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
456 if ((req_width >= priv->capability.minwidth) &&
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
457 (req_width <= priv->capability.maxwidth))
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
458 return(TVI_CONTROL_TRUE);
98769cea155c added tv subsystem
alex
parents:
diff changeset
459 return(TVI_CONTROL_FALSE);
98769cea155c added tv subsystem
alex
parents:
diff changeset
460 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
461 case TVI_CONTROL_VID_SET_WIDTH:
98769cea155c added tv subsystem
alex
parents:
diff changeset
462 priv->width = (int)*(void **)arg;
98769cea155c added tv subsystem
alex
parents:
diff changeset
463 return(TVI_CONTROL_TRUE);
98769cea155c added tv subsystem
alex
parents:
diff changeset
464 case TVI_CONTROL_VID_GET_HEIGHT:
98769cea155c added tv subsystem
alex
parents:
diff changeset
465 (int)*(void **)arg = priv->height;
98769cea155c added tv subsystem
alex
parents:
diff changeset
466 return(TVI_CONTROL_TRUE);
98769cea155c added tv subsystem
alex
parents:
diff changeset
467 case TVI_CONTROL_VID_CHK_HEIGHT:
98769cea155c added tv subsystem
alex
parents:
diff changeset
468 {
98769cea155c added tv subsystem
alex
parents:
diff changeset
469 int req_height = (int)*(void **)arg;
98769cea155c added tv subsystem
alex
parents:
diff changeset
470
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
471 mp_msg(MSGT_TV, MSGL_INFO, "Requested height: %d\n", req_height);
2810
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
472 if ((req_height >= priv->capability.minheight) &&
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
473 (req_height <= priv->capability.maxheight))
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
474 return(TVI_CONTROL_TRUE);
98769cea155c added tv subsystem
alex
parents:
diff changeset
475 return(TVI_CONTROL_FALSE);
98769cea155c added tv subsystem
alex
parents:
diff changeset
476 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
477 case TVI_CONTROL_VID_SET_HEIGHT:
98769cea155c added tv subsystem
alex
parents:
diff changeset
478 priv->height = (int)*(void **)arg;
98769cea155c added tv subsystem
alex
parents:
diff changeset
479 return(TVI_CONTROL_TRUE);
98769cea155c added tv subsystem
alex
parents:
diff changeset
480
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
481 /* ========== TUNER controls =========== */
09d5c9834580 tv update
alex
parents: 2790
diff changeset
482 case TVI_CONTROL_TUN_GET_FREQ:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
483 {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
484 unsigned long freq;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
485
09d5c9834580 tv update
alex
parents: 2790
diff changeset
486 if (ioctl(priv->fd, VIDIOCGFREQ, &freq) == -1)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
487 {
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
488 mp_msg(MSGT_TV, MSGL_ERR, "ioctl get freq failed: %s\n", strerror(errno));
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
489 return(TVI_CONTROL_FALSE);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
490 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
491
09d5c9834580 tv update
alex
parents: 2790
diff changeset
492 /* tuner uses khz not mhz ! */
09d5c9834580 tv update
alex
parents: 2790
diff changeset
493 if (priv->tuner.flags & VIDEO_TUNER_LOW)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
494 freq /= 1000;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
495 (unsigned long)*(void **)arg = freq;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
496 return(TVI_CONTROL_TRUE);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
497 }
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
498 case TVI_CONTROL_TUN_SET_FREQ:
98769cea155c added tv subsystem
alex
parents:
diff changeset
499 {
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
500 /* argument is in MHz ! */
09d5c9834580 tv update
alex
parents: 2790
diff changeset
501 unsigned long freq = (unsigned long)*(void **)arg;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
502
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
503 mp_msg(MSGT_TV, MSGL_V, "requested frequency: %lu MHz\n", (float)freq/16);
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
504
09d5c9834580 tv update
alex
parents: 2790
diff changeset
505 /* tuner uses khz not mhz ! */
09d5c9834580 tv update
alex
parents: 2790
diff changeset
506 if (priv->tuner.flags & VIDEO_TUNER_LOW)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
507 freq *= 1000;
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
508 mp_msg(MSGT_TV, MSGL_V, " requesting from driver: freq=%.3f\n", (float)freq/16);
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
509 if (ioctl(priv->fd, VIDIOCSFREQ, &freq) == -1)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
510 {
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
511 mp_msg(MSGT_TV, MSGL_ERR, "ioctl set freq failed: %s\n", strerror(errno));
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
512 return(TVI_CONTROL_FALSE);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
513 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
514 return(TVI_CONTROL_TRUE);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
515 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
516 case TVI_CONTROL_TUN_GET_TUNER:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
517 {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
518 if (ioctl(priv->fd, VIDIOCGTUNER, &priv->tuner) == -1)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
519 {
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
520 mp_msg(MSGT_TV, MSGL_ERR, "ioctl get tuner failed: %s\n", strerror(errno));
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
521 return(TVI_CONTROL_FALSE);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
522 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
523
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
524 mp_msg(MSGT_TV, MSGL_INFO, "Tuner (%s) range: %lu -> %lu\n", priv->tuner.name,
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
525 priv->tuner.rangelow, priv->tuner.rangehigh);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
526 return(TVI_CONTROL_TRUE);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
527 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
528 case TVI_CONTROL_TUN_SET_TUNER:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
529 {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
530 if (ioctl(priv->fd, VIDIOCSTUNER, &priv->tuner) == -1)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
531 {
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
532 mp_msg(MSGT_TV, MSGL_ERR, "ioctl get tuner failed: %s\n", strerror(errno));
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
533 return(TVI_CONTROL_FALSE);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
534 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
535 return(TVI_CONTROL_TRUE);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
536 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
537 case TVI_CONTROL_TUN_SET_NORM:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
538 {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
539 int req_mode = (int)*(void **)arg;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
540
09d5c9834580 tv update
alex
parents: 2790
diff changeset
541 if ((!(priv->tuner.flags & VIDEO_TUNER_NORM)) ||
09d5c9834580 tv update
alex
parents: 2790
diff changeset
542 ((req_mode == VIDEO_MODE_PAL) && !(priv->tuner.flags & VIDEO_TUNER_PAL)) ||
09d5c9834580 tv update
alex
parents: 2790
diff changeset
543 ((req_mode == VIDEO_MODE_NTSC) && !(priv->tuner.flags & VIDEO_TUNER_NTSC)) ||
09d5c9834580 tv update
alex
parents: 2790
diff changeset
544 ((req_mode == VIDEO_MODE_SECAM) && !(priv->tuner.flags & VIDEO_TUNER_SECAM)))
09d5c9834580 tv update
alex
parents: 2790
diff changeset
545 {
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
546 mp_msg(MSGT_TV, MSGL_ERR, "Tuner isn't capable to set norm!\n");
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
547 return(TVI_CONTROL_FALSE);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
548 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
549
09d5c9834580 tv update
alex
parents: 2790
diff changeset
550 priv->tuner.mode = req_mode;
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
551
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
552 if (control(priv->fd, TVI_CONTROL_TUN_SET_TUNER, &priv->tuner) != TVI_CONTROL_TRUE)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
553 return(TVI_CONTROL_FALSE);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
554 return(TVI_CONTROL_TRUE);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
555 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
556 case TVI_CONTROL_TUN_GET_NORM:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
557 {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
558 (int)*(void **)arg = priv->tuner.mode;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
559
09d5c9834580 tv update
alex
parents: 2790
diff changeset
560 return(TVI_CONTROL_TRUE);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
561 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
562
09d5c9834580 tv update
alex
parents: 2790
diff changeset
563 /* ========== AUDIO controls =========== */
09d5c9834580 tv update
alex
parents: 2790
diff changeset
564 case TVI_CONTROL_AUD_GET_FORMAT:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
565 {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
566 (int)*(void **)arg = AFMT_S16_LE;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
567 return(TVI_CONTROL_TRUE);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
568 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
569 case TVI_CONTROL_AUD_GET_CHANNELS:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
570 {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
571 (int)*(void **)arg = 2;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
572 return(TVI_CONTROL_TRUE);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
573 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
574 case TVI_CONTROL_AUD_GET_SAMPLERATE:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
575 {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
576 (int)*(void **)arg = 44100;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
577 return(TVI_CONTROL_TRUE);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
578 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
579 case TVI_CONTROL_AUD_GET_SAMPLESIZE:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
580 {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
581 (int)*(void **)arg = 76000;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
582 return(TVI_CONTROL_TRUE);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
583 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
584
09d5c9834580 tv update
alex
parents: 2790
diff changeset
585 /* ========== SPECIFIC controls =========== */
09d5c9834580 tv update
alex
parents: 2790
diff changeset
586 case TVI_CONTROL_SPC_GET_INPUT:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
587 {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
588 int req_chan = (int)*(void **)arg;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
589 int i;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
590
09d5c9834580 tv update
alex
parents: 2790
diff changeset
591 for (i = 0; i < priv->capability.channels; i++)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
592 {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
593 if (priv->channels[i].channel == req_chan)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
594 break;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
595 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
596
09d5c9834580 tv update
alex
parents: 2790
diff changeset
597 if (ioctl(priv->fd, VIDIOCGCHAN, &priv->channels[i]) == -1)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
598 {
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
599 mp_msg(MSGT_TV, MSGL_ERR, "ioctl get channel failed: %s\n", strerror(errno));
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
600 return(TVI_CONTROL_FALSE);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
601 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
602 return(TVI_CONTROL_TRUE);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
603 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
604
09d5c9834580 tv update
alex
parents: 2790
diff changeset
605 case TVI_CONTROL_SPC_SET_INPUT:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
606 {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
607 struct video_channel chan;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
608 int req_chan = (int)*(void **)arg;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
609 int i;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
610
09d5c9834580 tv update
alex
parents: 2790
diff changeset
611 if (req_chan >= priv->capability.channels)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
612 {
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
613 mp_msg(MSGT_TV, MSGL_ERR, "Invalid input requested: %d, valid: 0-%d\n",
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
614 req_chan, priv->capability.channels);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
615 return(TVI_CONTROL_FALSE);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
616 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
617
09d5c9834580 tv update
alex
parents: 2790
diff changeset
618 for (i = 0; i < priv->capability.channels; i++)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
619 {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
620 if (priv->channels[i].channel == req_chan)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
621 chan = priv->channels[i];
09d5c9834580 tv update
alex
parents: 2790
diff changeset
622 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
623
09d5c9834580 tv update
alex
parents: 2790
diff changeset
624 if (ioctl(priv->fd, VIDIOCSCHAN, &chan) == -1)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
625 {
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
626 mp_msg(MSGT_TV, MSGL_ERR, "ioctl set chan failed: %s\n", strerror(errno));
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
627 return(TVI_CONTROL_FALSE);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
628 }
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
629 mp_msg(MSGT_TV, MSGL_INFO, "Using input '%s'\n", chan.name);
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
630
09d5c9834580 tv update
alex
parents: 2790
diff changeset
631 /* update tuner state */
09d5c9834580 tv update
alex
parents: 2790
diff changeset
632 if (priv->capability.type & VID_TYPE_TUNER)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
633 control(priv, TVI_CONTROL_TUN_GET_TUNER, 0);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
634
09d5c9834580 tv update
alex
parents: 2790
diff changeset
635 /* update local channel list */
09d5c9834580 tv update
alex
parents: 2790
diff changeset
636 control(priv, TVI_CONTROL_SPC_GET_INPUT, &req_chan);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
637 return(TVI_CONTROL_TRUE);
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
638 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
639 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
640
98769cea155c added tv subsystem
alex
parents:
diff changeset
641 return(TVI_CONTROL_UNKNOWN);
98769cea155c added tv subsystem
alex
parents:
diff changeset
642 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
643
98769cea155c added tv subsystem
alex
parents:
diff changeset
644 static int grab_video_frame(priv_t *priv, char *buffer, int len)
98769cea155c added tv subsystem
alex
parents:
diff changeset
645 {
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
646 int frame = priv->queue % priv->nbuf;
2814
37fc45a05082 doublebuffeing SYNC fixed
arpi
parents: 2810
diff changeset
647 int nextframe = (priv->queue+1) % priv->nbuf;
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
648
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
649 mp_msg(MSGT_TV, MSGL_DBG2, "grab_video_frame(priv=%p, buffer=%p, len=%d\n",
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
650 priv, buffer, len);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
651
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
652 mp_msg(MSGT_TV, MSGL_DBG3, "buf: %p + frame: %d => %p\n",
2814
37fc45a05082 doublebuffeing SYNC fixed
arpi
parents: 2810
diff changeset
653 priv->buf, nextframe, &priv->buf[nextframe]);
37fc45a05082 doublebuffeing SYNC fixed
arpi
parents: 2810
diff changeset
654 if (ioctl(priv->fd, VIDIOCMCAPTURE, &priv->buf[nextframe]) == -1)
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
655 {
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
656 mp_msg(MSGT_TV, MSGL_ERR, "ioctl mcapture failed: %s\n", strerror(errno));
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
657 return(0);
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
658 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
659
2814
37fc45a05082 doublebuffeing SYNC fixed
arpi
parents: 2810
diff changeset
660 if (ioctl(priv->fd, VIDIOCSYNC, &priv->buf[frame].frame) == -1)
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
661 mp_msg(MSGT_TV, MSGL_ERR, "ioctl sync failed: %s\n", strerror(errno));
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
662 priv->queue++;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
663
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2814
diff changeset
664 mp_msg(MSGT_TV, MSGL_DBG3, "mmap: %p + offset: %d => %p\n",
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
665 priv->mmap, priv->mbuf.offsets[frame],
09d5c9834580 tv update
alex
parents: 2790
diff changeset
666 priv->mmap+priv->mbuf.offsets[frame]);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
667 memcpy(buffer, priv->mmap+priv->mbuf.offsets[frame], len);
09d5c9834580 tv update
alex
parents: 2790
diff changeset
668
09d5c9834580 tv update
alex
parents: 2790
diff changeset
669 return(len);
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
670 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
671
98769cea155c added tv subsystem
alex
parents:
diff changeset
672 static int get_video_framesize(priv_t *priv)
98769cea155c added tv subsystem
alex
parents:
diff changeset
673 {
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
674 return priv->bytesperline * priv->height;
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
675 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
676
98769cea155c added tv subsystem
alex
parents:
diff changeset
677 static int grab_audio_frame(priv_t *priv, char *buffer, int len)
98769cea155c added tv subsystem
alex
parents:
diff changeset
678 {
98769cea155c added tv subsystem
alex
parents:
diff changeset
679 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
680
98769cea155c added tv subsystem
alex
parents:
diff changeset
681 static int get_audio_framesize(priv_t *priv)
98769cea155c added tv subsystem
alex
parents:
diff changeset
682 {
98769cea155c added tv subsystem
alex
parents:
diff changeset
683 return 65536;
98769cea155c added tv subsystem
alex
parents:
diff changeset
684 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
685
98769cea155c added tv subsystem
alex
parents:
diff changeset
686 #endif /* USE_TV */