annotate stream/tvi_bsdbt848.c @ 23542:2e13eea875a3

Copile fix: missing libswscale part of ffmpeg r9322 TARGET_ARCH -> ARCH change.
author reimar
date Sat, 16 Jun 2007 15:17:00 +0000
parents c51b95236413
children d65439444b75
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5081
7473fca49ca0 initial
alex
parents:
diff changeset
1 /*
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
2 (C)2002 Charles R. Henrich (henrich@msu.edu)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
3 *BSD (hopefully, requires working driver!) BrookTree capture support.
5081
7473fca49ca0 initial
alex
parents:
diff changeset
4
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
5 Still in (active) development!
5081
7473fca49ca0 initial
alex
parents:
diff changeset
6
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
7 v1.1 Mar 13 2002 Fully functional, need to move ring buffer to
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
8 the kernel driver.
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
9 v1.0 Feb 19 2002 First Release, need to add support for changing
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
10 audio parameters.
5081
7473fca49ca0 initial
alex
parents:
diff changeset
11 */
7473fca49ca0 initial
alex
parents:
diff changeset
12
7473fca49ca0 initial
alex
parents:
diff changeset
13 #include "config.h"
7473fca49ca0 initial
alex
parents:
diff changeset
14
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
15 #define RINGSIZE 8
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
16 #define FRAGSIZE 4096 /* (2^12 see SETFRAGSIZE below) */
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
17
5081
7473fca49ca0 initial
alex
parents:
diff changeset
18 #define TRUE (1==1)
7473fca49ca0 initial
alex
parents:
diff changeset
19 #define FALSE (1==0)
7473fca49ca0 initial
alex
parents:
diff changeset
20
7473fca49ca0 initial
alex
parents:
diff changeset
21 #define PAL_WIDTH 768
7473fca49ca0 initial
alex
parents:
diff changeset
22 #define PAL_HEIGHT 576
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
23 #define PAL_FPS 25
5081
7473fca49ca0 initial
alex
parents:
diff changeset
24
7473fca49ca0 initial
alex
parents:
diff changeset
25 #define NTSC_WIDTH 640
7473fca49ca0 initial
alex
parents:
diff changeset
26 #define NTSC_HEIGHT 480
8953
1ebf4c3ab032 NTSC is 29.97 fps, not 30. wrong values here are likely to cause
rfelker
parents: 5886
diff changeset
27 #define NTSC_FPS 29.97
5081
7473fca49ca0 initial
alex
parents:
diff changeset
28
7473fca49ca0 initial
alex
parents:
diff changeset
29 #include <stdio.h>
7473fca49ca0 initial
alex
parents:
diff changeset
30 #include <stdlib.h>
7473fca49ca0 initial
alex
parents:
diff changeset
31 #include <unistd.h>
7473fca49ca0 initial
alex
parents:
diff changeset
32 #include <fcntl.h>
7473fca49ca0 initial
alex
parents:
diff changeset
33 #include <sys/types.h>
7473fca49ca0 initial
alex
parents:
diff changeset
34 #include <sys/mman.h>
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
35 #include <sys/filio.h>
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
36 #include <sys/time.h>
5081
7473fca49ca0 initial
alex
parents:
diff changeset
37 #include <signal.h>
7473fca49ca0 initial
alex
parents:
diff changeset
38 #include <string.h>
7473fca49ca0 initial
alex
parents:
diff changeset
39
11723
0629994c4fe0 FreeBSD 5.2-CURRENT support
alex
parents: 11000
diff changeset
40 #include <sys/param.h>
22934
da61a88adf63 remove ugly #include from tvi_bsdbt848.c
voroshil
parents: 22898
diff changeset
41 #ifdef USE_SUN_AUDIO
11725
64137954a868 sync with netbsd ports: audio grabbing support fixed
alex
parents: 11723
diff changeset
42 #include <sys/audioio.h>
22934
da61a88adf63 remove ugly #include from tvi_bsdbt848.c
voroshil
parents: 22898
diff changeset
43 #endif
da61a88adf63 remove ugly #include from tvi_bsdbt848.c
voroshil
parents: 22898
diff changeset
44
da61a88adf63 remove ugly #include from tvi_bsdbt848.c
voroshil
parents: 22898
diff changeset
45 #ifdef IOCTL_METEOR_H_NAME
da61a88adf63 remove ugly #include from tvi_bsdbt848.c
voroshil
parents: 22898
diff changeset
46 #include IOCTL_METEOR_H_NAME
da61a88adf63 remove ugly #include from tvi_bsdbt848.c
voroshil
parents: 22898
diff changeset
47 #endif
da61a88adf63 remove ugly #include from tvi_bsdbt848.c
voroshil
parents: 22898
diff changeset
48
da61a88adf63 remove ugly #include from tvi_bsdbt848.c
voroshil
parents: 22898
diff changeset
49 #ifdef IOCTL_BT848_H_NAME
da61a88adf63 remove ugly #include from tvi_bsdbt848.c
voroshil
parents: 22898
diff changeset
50 #include IOCTL_BT848_H_NAME
5872
02576893af2a OpenBSD, NetBSD portability patches by
arpi
parents: 5572
diff changeset
51 #endif
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
52
5142
7fc559dbc607 BSD compatibility fix by Steven M. Schultz
alex
parents: 5081
diff changeset
53 #ifdef HAVE_SYS_SOUNDCARD_H
7fc559dbc607 BSD compatibility fix by Steven M. Schultz
alex
parents: 5081
diff changeset
54 #include <sys/soundcard.h>
7fc559dbc607 BSD compatibility fix by Steven M. Schultz
alex
parents: 5081
diff changeset
55 #else
5886
d4307620912d soundcard.h fix, by Bernd Ernesti <mplayer@lists.veego.de>
arpi
parents: 5872
diff changeset
56 #ifdef HAVE_SOUNDCARD_H
d4307620912d soundcard.h fix, by Bernd Ernesti <mplayer@lists.veego.de>
arpi
parents: 5872
diff changeset
57 #include <soundcard.h>
d4307620912d soundcard.h fix, by Bernd Ernesti <mplayer@lists.veego.de>
arpi
parents: 5872
diff changeset
58 #else
5081
7473fca49ca0 initial
alex
parents:
diff changeset
59 #include <machine/soundcard.h>
5142
7fc559dbc607 BSD compatibility fix by Steven M. Schultz
alex
parents: 5081
diff changeset
60 #endif
5886
d4307620912d soundcard.h fix, by Bernd Ernesti <mplayer@lists.veego.de>
arpi
parents: 5872
diff changeset
61 #endif
5081
7473fca49ca0 initial
alex
parents:
diff changeset
62
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 15566
diff changeset
63 #include "libaf/af_format.h"
19431
ac69ba536915 Explicitly include libmpcodecs/img_format.h and libvo/fastmemcpy.h.
diego
parents: 19271
diff changeset
64 #include "libmpcodecs/img_format.h"
5081
7473fca49ca0 initial
alex
parents:
diff changeset
65 #include "tv.h"
7473fca49ca0 initial
alex
parents:
diff changeset
66
22381
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21848
diff changeset
67 static tvi_handle_t *tvi_init_bsdbt848(char *device, char *adevice);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
68 /* information about this file */
22381
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21848
diff changeset
69 tvi_info_t tvi_info_bsdbt848 = {
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21848
diff changeset
70 tvi_init_bsdbt848,
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
71 "Brooktree848 Support",
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
72 "bsdbt848",
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
73 "Charles Henrich",
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
74 "in development"
5081
7473fca49ca0 initial
alex
parents:
diff changeset
75 };
7473fca49ca0 initial
alex
parents:
diff changeset
76
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
77 typedef struct {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
78 int dirty;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
79 double timestamp;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
80 char *buf;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
81 } RBFRAME;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
82
5081
7473fca49ca0 initial
alex
parents:
diff changeset
83 /* private data's */
7473fca49ca0 initial
alex
parents:
diff changeset
84 typedef struct {
7473fca49ca0 initial
alex
parents:
diff changeset
85
7473fca49ca0 initial
alex
parents:
diff changeset
86 /* Audio */
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
87 char *dspdev;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
88 int dspready;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
89 int dspfd;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
90 int dspsamplesize;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
91 int dspstereo;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
92 int dspspeed;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
93 int dspfmt;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
94 int dspframesize;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
95 int dsprate;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
96 long long dspbytesread;
5081
7473fca49ca0 initial
alex
parents:
diff changeset
97
7473fca49ca0 initial
alex
parents:
diff changeset
98 /* Video */
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
99 char *btdev;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
100 int videoready;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
101 int btfd;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
102 int source;
10019
0ea7b9c6c27f 1000000000l
rfelker
parents: 8953
diff changeset
103 float maxfps;
0ea7b9c6c27f 1000000000l
rfelker
parents: 8953
diff changeset
104 float fps;
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
105 int iformat;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
106 int maxheight;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
107 int maxwidth;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
108 struct meteor_geomet geom;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
109 struct meteor_capframe capframe;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
110
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
111 /* Frame Buffer */
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
112
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
113 int framebufsize;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
114 float timestamp;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
115 int curpaintframe;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
116 int curbufframe;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
117 unsigned char *livebuf;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
118 RBFRAME framebuf[RINGSIZE];
5081
7473fca49ca0 initial
alex
parents:
diff changeset
119
7473fca49ca0 initial
alex
parents:
diff changeset
120 /* Inputs */
7473fca49ca0 initial
alex
parents:
diff changeset
121
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
122 int input;
5081
7473fca49ca0 initial
alex
parents:
diff changeset
123
7473fca49ca0 initial
alex
parents:
diff changeset
124 /* Tuner */
7473fca49ca0 initial
alex
parents:
diff changeset
125
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
126 char *tunerdev;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
127 int tunerfd;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
128 int tunerready;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
129 u_long tunerfreq;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
130 struct bktr_chnlset cset;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
131
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
132 /* Other */
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
133
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
134 int immediatemode;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
135 double starttime;
5081
7473fca49ca0 initial
alex
parents:
diff changeset
136
7473fca49ca0 initial
alex
parents:
diff changeset
137 } priv_t;
7473fca49ca0 initial
alex
parents:
diff changeset
138
7473fca49ca0 initial
alex
parents:
diff changeset
139 #include "tvi_def.h"
7473fca49ca0 initial
alex
parents:
diff changeset
140
7473fca49ca0 initial
alex
parents:
diff changeset
141 static priv_t *G_private=NULL;
7473fca49ca0 initial
alex
parents:
diff changeset
142
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
143 static int getinput(int innumber);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
144
7473fca49ca0 initial
alex
parents:
diff changeset
145 static void processframe(int signal)
7473fca49ca0 initial
alex
parents:
diff changeset
146 {
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
147 struct timeval curtime;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
148
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
149 if(G_private->immediatemode == TRUE) return;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
150
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
151 gettimeofday(&curtime, NULL);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
152
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
153 if(G_private->framebuf[G_private->curpaintframe].dirty == TRUE)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
154 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
155 memcpy(G_private->framebuf[G_private->curpaintframe].buf,
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
156 G_private->livebuf, G_private->framebufsize);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
157
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
158 G_private->framebuf[G_private->curpaintframe].dirty = FALSE;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
159
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
160 G_private->framebuf[G_private->curpaintframe].timestamp =
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
161 curtime.tv_sec + curtime.tv_usec*.000001;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
162
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
163 G_private->curpaintframe++;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
164
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
165 if(G_private->curpaintframe >= RINGSIZE) G_private->curpaintframe = 0;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
166 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
167
7473fca49ca0 initial
alex
parents:
diff changeset
168 return;
7473fca49ca0 initial
alex
parents:
diff changeset
169 }
7473fca49ca0 initial
alex
parents:
diff changeset
170
7473fca49ca0 initial
alex
parents:
diff changeset
171 /* handler creator - entry point ! */
22381
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21848
diff changeset
172 static tvi_handle_t *tvi_init_bsdbt848(char *device,char* adevice)
5081
7473fca49ca0 initial
alex
parents:
diff changeset
173 {
22898
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
174 char* sep ;
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
175 tvi_handle_t* tvh;
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
176 priv_t* priv;
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
177
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
178 tvh=new_handle();
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
179 if(!tvh)
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
180 return NULL;
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
181 priv=(priv_t*)tvh->priv;
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
182 /*
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
183 if user needs to specify both /dev/bktr<n> and /dev/tuner<n>
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
184 it can do this with "-tv device=/dev/bktr1,/dev/tuner1"
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
185 */
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
186
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
187 /* set video device name */
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
188 if (!device){
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
189 priv->btdev = strdup("/dev/bktr0");
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
190 priv->tunerdev = strdup("/dev/tuner0");
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
191 }else{
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
192 sep = strchr(device,',');
23333
c51b95236413 Fix OpenBSD compilation: strndup is a GNU extension.
reimar
parents: 22934
diff changeset
193 priv->btdev = strdup(device);
22898
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
194 if(sep){
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
195 // tuner device is also passed
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
196 priv->tunerdev = strdup(sep+1);
23333
c51b95236413 Fix OpenBSD compilation: strndup is a GNU extension.
reimar
parents: 22934
diff changeset
197 priv->btdev[sep - device] = 0;
22898
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
198 }else{
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
199 priv->tunerdev = strdup("/dev/tuner0");
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
200 }
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
201 }
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
202
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
203 /* set audio device name */
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
204 if (!adevice)
22934
da61a88adf63 remove ugly #include from tvi_bsdbt848.c
voroshil
parents: 22898
diff changeset
205 #ifdef USE_SUN_AUDIO
22898
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
206 priv->dspdev = strdup("/dev/sound");
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
207 #else
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
208 priv->dspdev = strdup("/dev/dsp");
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
209 #endif
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
210 else
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
211 priv->dspdev = strdup(adevice);
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
212
b5b63e82bb3e Ability to specify video and audio capture device names
voroshil
parents: 22381
diff changeset
213 return tvh;
5081
7473fca49ca0 initial
alex
parents:
diff changeset
214 }
7473fca49ca0 initial
alex
parents:
diff changeset
215
7473fca49ca0 initial
alex
parents:
diff changeset
216 static int control(priv_t *priv, int cmd, void *arg)
7473fca49ca0 initial
alex
parents:
diff changeset
217 {
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
218 switch(cmd)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
219 {
5081
7473fca49ca0 initial
alex
parents:
diff changeset
220
7473fca49ca0 initial
alex
parents:
diff changeset
221 /* Tuner Controls */
7473fca49ca0 initial
alex
parents:
diff changeset
222
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
223 case TVI_CONTROL_IS_TUNER:
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
224 if(priv->tunerready == FALSE) return TVI_CONTROL_FALSE;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
225 return(TVI_CONTROL_TRUE);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
226
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
227 case TVI_CONTROL_TUN_GET_FREQ:
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
228 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
229 if(ioctl(priv->tunerfd, TVTUNER_GETFREQ, &priv->tunerfreq) < 0)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
230 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
231 perror("GETFREQ:ioctl");
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
232 return(TVI_CONTROL_FALSE);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
233 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
234
20145
d7fbd215d8c9 Change occurrences of "(int)*(void **)arg" to "*(int *)arg".
uau
parents: 19431
diff changeset
235 *(int *)arg = priv->tunerfreq;
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
236 return(TVI_CONTROL_TRUE);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
237 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
238
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
239 case TVI_CONTROL_TUN_SET_FREQ:
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
240 {
20145
d7fbd215d8c9 Change occurrences of "(int)*(void **)arg" to "*(int *)arg".
uau
parents: 19431
diff changeset
241 priv->tunerfreq = *(int *)arg;
5081
7473fca49ca0 initial
alex
parents:
diff changeset
242
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
243 if(ioctl(priv->tunerfd, TVTUNER_SETFREQ, &priv->tunerfreq) < 0)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
244 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
245 perror("SETFREQ:ioctl");
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
246 return(0);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
247 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
248
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
249 return(TVI_CONTROL_TRUE);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
250 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
251
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
252 case TVI_CONTROL_TUN_GET_TUNER:
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
253 case TVI_CONTROL_TUN_SET_TUNER:
5081
7473fca49ca0 initial
alex
parents:
diff changeset
254
7473fca49ca0 initial
alex
parents:
diff changeset
255 /* Inputs */
7473fca49ca0 initial
alex
parents:
diff changeset
256
7473fca49ca0 initial
alex
parents:
diff changeset
257 case TVI_CONTROL_SPC_GET_INPUT:
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
258 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
259 if(ioctl(priv->btfd, METEORGINPUT, &priv->input) < 0)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
260 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
261 perror("GINPUT:ioctl");
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
262 return(TVI_CONTROL_FALSE);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
263 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
264
20145
d7fbd215d8c9 Change occurrences of "(int)*(void **)arg" to "*(int *)arg".
uau
parents: 19431
diff changeset
265 *(int *)arg = priv->input;
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
266 return(TVI_CONTROL_TRUE);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
267 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
268
5081
7473fca49ca0 initial
alex
parents:
diff changeset
269 case TVI_CONTROL_SPC_SET_INPUT:
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
270 {
20145
d7fbd215d8c9 Change occurrences of "(int)*(void **)arg" to "*(int *)arg".
uau
parents: 19431
diff changeset
271 priv->input = getinput(*(int *)arg);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
272
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
273 if(ioctl(priv->btfd, METEORSINPUT, &priv->input) < 0)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
274 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
275 perror("tunerfreq:ioctl");
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
276 return(0);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
277 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
278
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
279 return(TVI_CONTROL_TRUE);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
280 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
281
7473fca49ca0 initial
alex
parents:
diff changeset
282 /* Audio Controls */
7473fca49ca0 initial
alex
parents:
diff changeset
283
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
284 case TVI_CONTROL_IS_AUDIO:
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
285 if(priv->dspready == FALSE) return TVI_CONTROL_FALSE;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
286 return(TVI_CONTROL_TRUE);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
287
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
288 case TVI_CONTROL_AUD_GET_FORMAT:
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
289 {
20145
d7fbd215d8c9 Change occurrences of "(int)*(void **)arg" to "*(int *)arg".
uau
parents: 19431
diff changeset
290 *(int *)arg = AF_FORMAT_S16_LE;
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
291 return(TVI_CONTROL_TRUE);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
292 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
293 case TVI_CONTROL_AUD_GET_CHANNELS:
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
294 {
20145
d7fbd215d8c9 Change occurrences of "(int)*(void **)arg" to "*(int *)arg".
uau
parents: 19431
diff changeset
295 *(int *)arg = 2;
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
296 return(TVI_CONTROL_TRUE);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
297 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
298 case TVI_CONTROL_AUD_SET_SAMPLERATE:
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
299 {
20145
d7fbd215d8c9 Change occurrences of "(int)*(void **)arg" to "*(int *)arg".
uau
parents: 19431
diff changeset
300 int dspspeed = *(int *)arg;
5081
7473fca49ca0 initial
alex
parents:
diff changeset
301
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
302 if(ioctl(priv->dspfd, SNDCTL_DSP_SPEED, &dspspeed) == -1)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
303 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
304 perror("invalidaudiorate");
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
305 return(TVI_CONTROL_FALSE);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
306 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
307
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
308 priv->dspspeed = dspspeed;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
309
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
310 priv->dspframesize = priv->dspspeed*priv->dspsamplesize/8/
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
311 priv->fps * (priv->dspstereo+1);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
312 priv->dsprate = priv->dspspeed * priv->dspsamplesize/8*
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
313 (priv->dspstereo+1);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
314
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
315 return(TVI_CONTROL_TRUE);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
316 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
317 case TVI_CONTROL_AUD_GET_SAMPLERATE:
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
318 {
20145
d7fbd215d8c9 Change occurrences of "(int)*(void **)arg" to "*(int *)arg".
uau
parents: 19431
diff changeset
319 *(int *)arg = priv->dspspeed;
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
320 return(TVI_CONTROL_TRUE);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
321 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
322 case TVI_CONTROL_AUD_GET_SAMPLESIZE:
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
323 {
20145
d7fbd215d8c9 Change occurrences of "(int)*(void **)arg" to "*(int *)arg".
uau
parents: 19431
diff changeset
324 *(int *)arg = priv->dspsamplesize/8;
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
325 return(TVI_CONTROL_TRUE);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
326 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
327
7473fca49ca0 initial
alex
parents:
diff changeset
328 /* Video Controls */
7473fca49ca0 initial
alex
parents:
diff changeset
329
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
330 case TVI_CONTROL_IS_VIDEO:
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
331 if(priv->videoready == FALSE) return TVI_CONTROL_FALSE;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
332 return(TVI_CONTROL_TRUE);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
333
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
334 case TVI_CONTROL_TUN_SET_NORM:
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
335 {
20145
d7fbd215d8c9 Change occurrences of "(int)*(void **)arg" to "*(int *)arg".
uau
parents: 19431
diff changeset
336 int req_mode = *(int *)arg;
12139
e34f9638aa51 correct typeconversion of fps, patches by several ppl
alex
parents: 11725
diff changeset
337 u_short tmp_fps;
5081
7473fca49ca0 initial
alex
parents:
diff changeset
338
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
339 priv->iformat = METEOR_FMT_AUTOMODE;
5081
7473fca49ca0 initial
alex
parents:
diff changeset
340
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
341 if(req_mode == TV_NORM_PAL)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
342 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
343 priv->iformat = METEOR_FMT_PAL;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
344 priv->maxheight = PAL_HEIGHT;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
345 priv->maxwidth = PAL_WIDTH;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
346 priv->maxfps = PAL_FPS;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
347 priv->fps = PAL_FPS;
5081
7473fca49ca0 initial
alex
parents:
diff changeset
348
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
349 if(priv->fps > priv->maxfps) priv->fps = priv->maxfps;
5081
7473fca49ca0 initial
alex
parents:
diff changeset
350
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
351 if(priv->geom.rows > priv->maxheight)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
352 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
353 priv->geom.rows = priv->maxheight;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
354 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
355
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
356 if(priv->geom.columns > priv->maxwidth)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
357 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
358 priv->geom.columns = priv->maxwidth;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
359 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
360 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
361
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
362 if(req_mode == TV_NORM_NTSC)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
363 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
364 priv->iformat = METEOR_FMT_NTSC;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
365 priv->maxheight = NTSC_HEIGHT;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
366 priv->maxwidth = NTSC_WIDTH;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
367 priv->maxfps = NTSC_FPS;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
368 priv->fps = NTSC_FPS;
5081
7473fca49ca0 initial
alex
parents:
diff changeset
369
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
370 priv->dspframesize = priv->dspspeed*priv->dspsamplesize/8/
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
371 priv->fps * (priv->dspstereo+1);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
372 priv->dsprate = priv->dspspeed * priv->dspsamplesize/8 *
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
373 (priv->dspstereo+1);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
374
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
375 if(priv->fps > priv->maxfps) priv->fps = priv->maxfps;
5081
7473fca49ca0 initial
alex
parents:
diff changeset
376
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
377 if(priv->geom.rows > priv->maxheight)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
378 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
379 priv->geom.rows = priv->maxheight;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
380 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
381
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
382 if(priv->geom.columns > priv->maxwidth)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
383 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
384 priv->geom.columns = priv->maxwidth;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
385 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
386 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
387
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
388 if(req_mode == TV_NORM_SECAM) priv->iformat = METEOR_FMT_SECAM;
5081
7473fca49ca0 initial
alex
parents:
diff changeset
389
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
390 if(ioctl(priv->btfd, METEORSFMT, &priv->iformat) < 0)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
391 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
392 perror("format:ioctl");
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
393 return(TVI_CONTROL_FALSE);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
394 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
395
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
396 if(ioctl(priv->btfd, METEORSETGEO, &priv->geom) < 0)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
397 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
398 perror("geo:ioctl");
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
399 return(0);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
400 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
401
12139
e34f9638aa51 correct typeconversion of fps, patches by several ppl
alex
parents: 11725
diff changeset
402 tmp_fps = priv->fps;
e34f9638aa51 correct typeconversion of fps, patches by several ppl
alex
parents: 11725
diff changeset
403 if(ioctl(priv->btfd, METEORSFPS, &tmp_fps) < 0)
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
404 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
405 perror("fps:ioctl");
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
406 return(0);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
407 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
408
10822
6377c7d0459e audio id setting support for bsdbt848 by Nikolay Nikolaev <nicknickolaev@yahoo.com>
alex
parents: 10019
diff changeset
409 #ifdef BT848_SAUDIO
12608
fbd18fae40f1 10l, patch by Michael Nottebrock <michaelnottebrock@gmx.net>
faust3
parents: 12140
diff changeset
410 if(priv->tunerready == TRUE &&
fbd18fae40f1 10l, patch by Michael Nottebrock <michaelnottebrock@gmx.net>
faust3
parents: 12140
diff changeset
411 ioctl(priv->tunerfd, BT848_SAUDIO, &tv_param_audio_id) < 0)
10822
6377c7d0459e audio id setting support for bsdbt848 by Nikolay Nikolaev <nicknickolaev@yahoo.com>
alex
parents: 10019
diff changeset
412 {
6377c7d0459e audio id setting support for bsdbt848 by Nikolay Nikolaev <nicknickolaev@yahoo.com>
alex
parents: 10019
diff changeset
413 perror("audioid:ioctl");
6377c7d0459e audio id setting support for bsdbt848 by Nikolay Nikolaev <nicknickolaev@yahoo.com>
alex
parents: 10019
diff changeset
414 }
6377c7d0459e audio id setting support for bsdbt848 by Nikolay Nikolaev <nicknickolaev@yahoo.com>
alex
parents: 10019
diff changeset
415 #endif
6377c7d0459e audio id setting support for bsdbt848 by Nikolay Nikolaev <nicknickolaev@yahoo.com>
alex
parents: 10019
diff changeset
416
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
417 return(TVI_CONTROL_TRUE);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
418 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
419
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
420 case TVI_CONTROL_VID_GET_FORMAT:
20145
d7fbd215d8c9 Change occurrences of "(int)*(void **)arg" to "*(int *)arg".
uau
parents: 19431
diff changeset
421 *(int *)arg = IMGFMT_UYVY;
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
422 return(TVI_CONTROL_TRUE);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
423
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
424 case TVI_CONTROL_VID_SET_FORMAT:
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
425 {
20145
d7fbd215d8c9 Change occurrences of "(int)*(void **)arg" to "*(int *)arg".
uau
parents: 19431
diff changeset
426 int req_fmt = *(int *)arg;
5081
7473fca49ca0 initial
alex
parents:
diff changeset
427
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
428 if(req_fmt != IMGFMT_UYVY) return(TVI_CONTROL_FALSE);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
429
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
430 return(TVI_CONTROL_TRUE);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
431 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
432 case TVI_CONTROL_VID_SET_WIDTH:
20145
d7fbd215d8c9 Change occurrences of "(int)*(void **)arg" to "*(int *)arg".
uau
parents: 19431
diff changeset
433 priv->geom.columns = *(int *)arg;
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
434
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
435 if(priv->geom.columns > priv->maxwidth)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
436 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
437 priv->geom.columns = priv->maxwidth;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
438 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
439
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
440 if(ioctl(priv->btfd, METEORSETGEO, &priv->geom) < 0)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
441 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
442 perror("width:ioctl");
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
443 return(0);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
444 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
445
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
446 return(TVI_CONTROL_TRUE);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
447
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
448 case TVI_CONTROL_VID_GET_WIDTH:
20145
d7fbd215d8c9 Change occurrences of "(int)*(void **)arg" to "*(int *)arg".
uau
parents: 19431
diff changeset
449 *(int *)arg = priv->geom.columns;
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
450 return(TVI_CONTROL_TRUE);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
451
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
452 case TVI_CONTROL_VID_SET_HEIGHT:
20145
d7fbd215d8c9 Change occurrences of "(int)*(void **)arg" to "*(int *)arg".
uau
parents: 19431
diff changeset
453 priv->geom.rows = *(int *)arg;
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
454
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
455 if(priv->geom.rows > priv->maxheight)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
456 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
457 priv->geom.rows = priv->maxheight;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
458 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
459
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
460 if(priv->geom.rows <= priv->maxheight / 2)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
461 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
462 priv->geom.oformat |= METEOR_GEO_EVEN_ONLY;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
463 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
464
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
465 if(ioctl(priv->btfd, METEORSETGEO, &priv->geom) < 0)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
466 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
467 perror("height:ioctl");
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
468 return(0);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
469 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
470
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
471 return(TVI_CONTROL_TRUE);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
472
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
473 case TVI_CONTROL_VID_GET_HEIGHT:
20145
d7fbd215d8c9 Change occurrences of "(int)*(void **)arg" to "*(int *)arg".
uau
parents: 19431
diff changeset
474 *(int *)arg = priv->geom.rows;
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
475 return(TVI_CONTROL_TRUE);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
476
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
477 case TVI_CONTROL_VID_GET_FPS:
10019
0ea7b9c6c27f 1000000000l
rfelker
parents: 8953
diff changeset
478 *(float *)arg = priv->fps;
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
479 return(TVI_CONTROL_TRUE);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
480
7473fca49ca0 initial
alex
parents:
diff changeset
481 /*
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
482 case TVI_CONTROL_VID_SET_FPS:
20145
d7fbd215d8c9 Change occurrences of "(int)*(void **)arg" to "*(int *)arg".
uau
parents: 19431
diff changeset
483 priv->fps = *(int *)arg;
5081
7473fca49ca0 initial
alex
parents:
diff changeset
484
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
485 if(priv->fps > priv->maxfps) priv->fps = priv->maxfps;
5081
7473fca49ca0 initial
alex
parents:
diff changeset
486
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
487 if(ioctl(priv->btfd, METEORSFPS, &priv->fps) < 0)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
488 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
489 perror("fps:ioctl");
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
490 return(0);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
491 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
492
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
493 return(TVI_CONTROL_TRUE);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
494 */
7473fca49ca0 initial
alex
parents:
diff changeset
495
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
496 case TVI_CONTROL_VID_CHK_WIDTH:
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
497 case TVI_CONTROL_VID_CHK_HEIGHT:
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
498 return(TVI_CONTROL_TRUE);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
499
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
500 case TVI_CONTROL_IMMEDIATE:
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
501 priv->immediatemode = TRUE;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
502 return(TVI_CONTROL_TRUE);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
503 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
504
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
505 return(TVI_CONTROL_UNKNOWN);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
506 }
7473fca49ca0 initial
alex
parents:
diff changeset
507
7473fca49ca0 initial
alex
parents:
diff changeset
508 static int init(priv_t *priv)
7473fca49ca0 initial
alex
parents:
diff changeset
509 {
7473fca49ca0 initial
alex
parents:
diff changeset
510 int marg;
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
511 int count;
12139
e34f9638aa51 correct typeconversion of fps, patches by several ppl
alex
parents: 11725
diff changeset
512 u_short tmp_fps;
5081
7473fca49ca0 initial
alex
parents:
diff changeset
513
7473fca49ca0 initial
alex
parents:
diff changeset
514 G_private = priv; /* Oooh, sick */
7473fca49ca0 initial
alex
parents:
diff changeset
515
7473fca49ca0 initial
alex
parents:
diff changeset
516 /* Video Configuration */
7473fca49ca0 initial
alex
parents:
diff changeset
517
7473fca49ca0 initial
alex
parents:
diff changeset
518 priv->videoready = TRUE;
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
519 priv->immediatemode = FALSE;
5081
7473fca49ca0 initial
alex
parents:
diff changeset
520 priv->iformat = METEOR_FMT_PAL;
7473fca49ca0 initial
alex
parents:
diff changeset
521 priv->maxheight = PAL_HEIGHT;
7473fca49ca0 initial
alex
parents:
diff changeset
522 priv->maxwidth = PAL_WIDTH;
7473fca49ca0 initial
alex
parents:
diff changeset
523 priv->maxfps = PAL_FPS;
7473fca49ca0 initial
alex
parents:
diff changeset
524 priv->source = METEOR_INPUT_DEV0;
7473fca49ca0 initial
alex
parents:
diff changeset
525 priv->fps = priv->maxfps;
7473fca49ca0 initial
alex
parents:
diff changeset
526
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
527 priv->starttime=0;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
528 priv->curpaintframe=0;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
529 priv->curbufframe=0;
5081
7473fca49ca0 initial
alex
parents:
diff changeset
530
7473fca49ca0 initial
alex
parents:
diff changeset
531 priv->geom.columns = priv->maxwidth;
7473fca49ca0 initial
alex
parents:
diff changeset
532 priv->geom.rows = priv->maxheight;
7473fca49ca0 initial
alex
parents:
diff changeset
533 priv->geom.frames = 1;
7473fca49ca0 initial
alex
parents:
diff changeset
534 priv->geom.oformat = METEOR_GEO_YUV_PACKED;
7473fca49ca0 initial
alex
parents:
diff changeset
535
7473fca49ca0 initial
alex
parents:
diff changeset
536 priv->btfd = open(priv->btdev, O_RDONLY);
7473fca49ca0 initial
alex
parents:
diff changeset
537
7473fca49ca0 initial
alex
parents:
diff changeset
538 if(priv->btfd < 0)
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
539 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
540 perror("bktr open");
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
541 priv->videoready = FALSE;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
542 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
543
7473fca49ca0 initial
alex
parents:
diff changeset
544 if(priv->videoready == TRUE &&
7473fca49ca0 initial
alex
parents:
diff changeset
545 ioctl(priv->btfd, METEORSFMT, &priv->iformat) < 0)
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
546 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
547 perror("FMT:ioctl");
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
548 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
549
7473fca49ca0 initial
alex
parents:
diff changeset
550 if(priv->videoready == TRUE &&
7473fca49ca0 initial
alex
parents:
diff changeset
551 ioctl(priv->btfd, METEORSINPUT, &priv->source) < 0)
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
552 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
553 perror("SINPUT:ioctl");
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
554 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
555
12139
e34f9638aa51 correct typeconversion of fps, patches by several ppl
alex
parents: 11725
diff changeset
556 tmp_fps = priv->fps;
5081
7473fca49ca0 initial
alex
parents:
diff changeset
557 if(priv->videoready == TRUE &&
12139
e34f9638aa51 correct typeconversion of fps, patches by several ppl
alex
parents: 11725
diff changeset
558 ioctl(priv->btfd, METEORSFPS, &tmp_fps) < 0)
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
559 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
560 perror("SFPS:ioctl");
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
561 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
562
7473fca49ca0 initial
alex
parents:
diff changeset
563 if(priv->videoready == TRUE &&
7473fca49ca0 initial
alex
parents:
diff changeset
564 ioctl(priv->btfd, METEORSETGEO, &priv->geom) < 0)
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
565 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
566 perror("SGEO:ioctl");
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
567 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
568
7473fca49ca0 initial
alex
parents:
diff changeset
569 if(priv->videoready == TRUE)
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
570 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
571 priv->framebufsize = (priv->geom.columns * priv->geom.rows * 2);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
573 priv->livebuf = (u_char *)mmap((caddr_t)0, priv->framebufsize, PROT_READ,
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
574 MAP_SHARED, priv->btfd, (off_t)0);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
575
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
576 if(priv->livebuf == (u_char *) MAP_FAILED)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
577 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
578 perror("mmap");
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
579 priv->videoready = FALSE;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
580 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
581
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
582 for(count=0;count<RINGSIZE;count++)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
583 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
584 priv->framebuf[count].buf = malloc(priv->framebufsize);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
585
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
586 if(priv->framebuf[count].buf == NULL)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
587 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
588 perror("framebufmalloc");
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
589 priv->videoready = FALSE;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
590 break;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
591 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
592
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
593 priv->framebuf[count].dirty = TRUE;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
594 priv->framebuf[count].timestamp = 0;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
595 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
596 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
597
7473fca49ca0 initial
alex
parents:
diff changeset
598 /* Tuner Configuration */
7473fca49ca0 initial
alex
parents:
diff changeset
599
7473fca49ca0 initial
alex
parents:
diff changeset
600 priv->tunerready = TRUE;
7473fca49ca0 initial
alex
parents:
diff changeset
601
7473fca49ca0 initial
alex
parents:
diff changeset
602 priv->tunerfd = open(priv->tunerdev, O_RDONLY);
7473fca49ca0 initial
alex
parents:
diff changeset
603
7473fca49ca0 initial
alex
parents:
diff changeset
604 if(priv->tunerfd < 0)
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
605 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
606 perror("tune open");
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
607 priv->tunerready = FALSE;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
608 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
609
7473fca49ca0 initial
alex
parents:
diff changeset
610 /* Audio Configuration */
7473fca49ca0 initial
alex
parents:
diff changeset
611
7473fca49ca0 initial
alex
parents:
diff changeset
612 priv->dspready = TRUE;
7473fca49ca0 initial
alex
parents:
diff changeset
613 priv->dspsamplesize = 16;
7473fca49ca0 initial
alex
parents:
diff changeset
614 priv->dspstereo = 1;
7473fca49ca0 initial
alex
parents:
diff changeset
615 priv->dspspeed = 44100;
7473fca49ca0 initial
alex
parents:
diff changeset
616 priv->dspfmt = AFMT_S16_LE;
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
617 priv->dspbytesread = 0;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
618 priv->dsprate = priv->dspspeed * priv->dspsamplesize/8*(priv->dspstereo+1);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
619 priv->dspframesize = priv->dspspeed*priv->dspsamplesize/8/priv->fps *
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
620 (priv->dspstereo+1);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
621
12140
9eed12b9b242 netbsd audio support by Bernd Ernesti
alex
parents: 12139
diff changeset
622 if((priv->dspfd = open (priv->dspdev, O_RDONLY, 0)) < 0)
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
623 {
12140
9eed12b9b242 netbsd audio support by Bernd Ernesti
alex
parents: 12139
diff changeset
624 perror("dsp open");
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
625 priv->dspready = FALSE;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
626 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
627
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
628 marg = (256 << 16) | 12;
5081
7473fca49ca0 initial
alex
parents:
diff changeset
629
7473fca49ca0 initial
alex
parents:
diff changeset
630 if (ioctl(priv->dspfd, SNDCTL_DSP_SETFRAGMENT, &marg ) < 0 )
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
631 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
632 perror("setfrag");
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
633 priv->dspready = FALSE;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
634 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
635
7473fca49ca0 initial
alex
parents:
diff changeset
636 if((priv->dspready == TRUE) &&
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
637 ((ioctl(priv->dspfd, SNDCTL_DSP_SAMPLESIZE, &priv->dspsamplesize) == -1) ||
5081
7473fca49ca0 initial
alex
parents:
diff changeset
638 (ioctl(priv->dspfd, SNDCTL_DSP_STEREO, &priv->dspstereo) == -1) ||
7473fca49ca0 initial
alex
parents:
diff changeset
639 (ioctl(priv->dspfd, SNDCTL_DSP_SPEED, &priv->dspspeed) == -1) ||
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
640 (ioctl(priv->dspfd, SNDCTL_DSP_SETFMT, &priv->dspfmt) == -1)))
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
641 {
12140
9eed12b9b242 netbsd audio support by Bernd Ernesti
alex
parents: 12139
diff changeset
642 perror ("configuration of dsp failed");
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
643 close(priv->dspfd);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
644 priv->dspready = FALSE;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
645 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
646
7473fca49ca0 initial
alex
parents:
diff changeset
647 return(1);
7473fca49ca0 initial
alex
parents:
diff changeset
648 }
7473fca49ca0 initial
alex
parents:
diff changeset
649
7473fca49ca0 initial
alex
parents:
diff changeset
650 /* that's the real start, we'got the format parameters (checked with control) */
7473fca49ca0 initial
alex
parents:
diff changeset
651 static int start(priv_t *priv)
7473fca49ca0 initial
alex
parents:
diff changeset
652 {
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
653 int tmp;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
654 struct timeval curtime;
5081
7473fca49ca0 initial
alex
parents:
diff changeset
655 int marg;
7473fca49ca0 initial
alex
parents:
diff changeset
656
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
657 fprintf(stderr,"START\n");
5081
7473fca49ca0 initial
alex
parents:
diff changeset
658 if(priv->videoready == FALSE) return(0);
7473fca49ca0 initial
alex
parents:
diff changeset
659
7473fca49ca0 initial
alex
parents:
diff changeset
660 signal(SIGUSR1, processframe);
7473fca49ca0 initial
alex
parents:
diff changeset
661 signal(SIGALRM, processframe);
7473fca49ca0 initial
alex
parents:
diff changeset
662
7473fca49ca0 initial
alex
parents:
diff changeset
663 marg = SIGUSR1;
7473fca49ca0 initial
alex
parents:
diff changeset
664
7473fca49ca0 initial
alex
parents:
diff changeset
665 if(ioctl(priv->btfd, METEORSSIGNAL, &marg) < 0)
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
666 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
667 perror("METEORSSIGNAL failed");
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
668 return(0);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
669 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
670
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
671 read(priv->dspfd, &tmp, 2);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
672
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
673 gettimeofday(&curtime, NULL);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
674
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
675 priv->starttime = curtime.tv_sec + (curtime.tv_usec *.000001);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
676
7473fca49ca0 initial
alex
parents:
diff changeset
677 marg = METEOR_CAP_CONTINOUS;
7473fca49ca0 initial
alex
parents:
diff changeset
678
7473fca49ca0 initial
alex
parents:
diff changeset
679 if(ioctl(priv->btfd, METEORCAPTUR, &marg) < 0)
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
680 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
681 perror("METEORCAPTUR failed");
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
682 return(0);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
683 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
684
7473fca49ca0 initial
alex
parents:
diff changeset
685 return(1);
7473fca49ca0 initial
alex
parents:
diff changeset
686 }
7473fca49ca0 initial
alex
parents:
diff changeset
687
7473fca49ca0 initial
alex
parents:
diff changeset
688 static int uninit(priv_t *priv)
7473fca49ca0 initial
alex
parents:
diff changeset
689 {
7473fca49ca0 initial
alex
parents:
diff changeset
690 int marg;
7473fca49ca0 initial
alex
parents:
diff changeset
691
7473fca49ca0 initial
alex
parents:
diff changeset
692 if(priv->videoready == FALSE) return(0);
7473fca49ca0 initial
alex
parents:
diff changeset
693
7473fca49ca0 initial
alex
parents:
diff changeset
694 marg = METEOR_SIG_MODE_MASK;
7473fca49ca0 initial
alex
parents:
diff changeset
695
7473fca49ca0 initial
alex
parents:
diff changeset
696 if(ioctl( priv->btfd, METEORSSIGNAL, &marg) < 0 )
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
697 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
698 perror("METEORSSIGNAL");
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
699 return(0);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
700 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
701
7473fca49ca0 initial
alex
parents:
diff changeset
702 marg = METEOR_CAP_STOP_CONT;
7473fca49ca0 initial
alex
parents:
diff changeset
703
7473fca49ca0 initial
alex
parents:
diff changeset
704 if(ioctl(priv->btfd, METEORCAPTUR, &marg) < 0 )
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
705 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
706 perror("METEORCAPTUR STOP");
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
707 return(0);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
708 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
709
7473fca49ca0 initial
alex
parents:
diff changeset
710 close(priv->btfd);
7473fca49ca0 initial
alex
parents:
diff changeset
711 close(priv->dspfd);
7473fca49ca0 initial
alex
parents:
diff changeset
712
7473fca49ca0 initial
alex
parents:
diff changeset
713 priv->dspfd = -1;
7473fca49ca0 initial
alex
parents:
diff changeset
714 priv->btfd = -1;
7473fca49ca0 initial
alex
parents:
diff changeset
715
7473fca49ca0 initial
alex
parents:
diff changeset
716 priv->dspready = priv->videoready = FALSE;
7473fca49ca0 initial
alex
parents:
diff changeset
717
7473fca49ca0 initial
alex
parents:
diff changeset
718 return(1);
7473fca49ca0 initial
alex
parents:
diff changeset
719 }
7473fca49ca0 initial
alex
parents:
diff changeset
720
7473fca49ca0 initial
alex
parents:
diff changeset
721
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
722 static double grabimmediate_video_frame(priv_t *priv, char *buffer, int len)
5081
7473fca49ca0 initial
alex
parents:
diff changeset
723 {
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
724 struct timeval curtime;
5081
7473fca49ca0 initial
alex
parents:
diff changeset
725 sigset_t sa_mask;
7473fca49ca0 initial
alex
parents:
diff changeset
726
7473fca49ca0 initial
alex
parents:
diff changeset
727 if(priv->videoready == FALSE) return(0);
7473fca49ca0 initial
alex
parents:
diff changeset
728
7473fca49ca0 initial
alex
parents:
diff changeset
729 alarm(1);
7473fca49ca0 initial
alex
parents:
diff changeset
730 sigfillset(&sa_mask);
7473fca49ca0 initial
alex
parents:
diff changeset
731 sigdelset(&sa_mask,SIGINT);
7473fca49ca0 initial
alex
parents:
diff changeset
732 sigdelset(&sa_mask,SIGUSR1);
7473fca49ca0 initial
alex
parents:
diff changeset
733 sigdelset(&sa_mask,SIGALRM);
7473fca49ca0 initial
alex
parents:
diff changeset
734 sigsuspend(&sa_mask);
7473fca49ca0 initial
alex
parents:
diff changeset
735 alarm(0);
7473fca49ca0 initial
alex
parents:
diff changeset
736
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
737 memcpy(buffer, priv->livebuf, len);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
738
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
739 /* PTS = 0, show the frame NOW, this routine is only used in playback mode
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
740 without audio capture .. */
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
741
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
742 return(0);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
743 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
744
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
745 static double grab_video_frame(priv_t *priv, char *buffer, int len)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
746 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
747 struct timeval curtime;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
748 double timestamp=0;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
749 sigset_t sa_mask;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
750
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
751 if(priv->videoready == FALSE) return(0);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
752
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
753 if(priv->immediatemode == TRUE)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
754 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
755 return grabimmediate_video_frame(priv, buffer, len);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
756 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
757
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
758 while(priv->framebuf[priv->curbufframe].dirty == TRUE)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
759 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
760 alarm(1);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
761 sigemptyset(&sa_mask);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
762 sigsuspend(&sa_mask);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
763 alarm(0);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
764 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
765
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
766 memcpy(buffer, priv->framebuf[priv->curbufframe].buf, len);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
767 timestamp = priv->framebuf[priv->curbufframe].timestamp;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
768 priv->framebuf[priv->curbufframe].dirty = TRUE;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
769
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
770 priv->curbufframe++;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
771 if(priv->curbufframe >= RINGSIZE) priv->curbufframe = 0;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
772
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
773 return(timestamp-priv->starttime);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
774 }
7473fca49ca0 initial
alex
parents:
diff changeset
775
7473fca49ca0 initial
alex
parents:
diff changeset
776 static int get_video_framesize(priv_t *priv)
7473fca49ca0 initial
alex
parents:
diff changeset
777 {
7473fca49ca0 initial
alex
parents:
diff changeset
778 return(priv->geom.columns*priv->geom.rows*16/8);
7473fca49ca0 initial
alex
parents:
diff changeset
779 }
7473fca49ca0 initial
alex
parents:
diff changeset
780
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
781 static double grab_audio_frame(priv_t *priv, char *buffer, int len)
5081
7473fca49ca0 initial
alex
parents:
diff changeset
782 {
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
783 struct timeval curtime;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
784 double curpts;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
785 double timeskew;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
786 int bytesavail;
5081
7473fca49ca0 initial
alex
parents:
diff changeset
787 int bytesread;
7473fca49ca0 initial
alex
parents:
diff changeset
788 int ret;
7473fca49ca0 initial
alex
parents:
diff changeset
789
7473fca49ca0 initial
alex
parents:
diff changeset
790 if(priv->dspready == FALSE) return 0;
7473fca49ca0 initial
alex
parents:
diff changeset
791
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
792 gettimeofday(&curtime, NULL);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
793
5081
7473fca49ca0 initial
alex
parents:
diff changeset
794 /* Get exactly one frame of audio, which forces video sync to audio.. */
7473fca49ca0 initial
alex
parents:
diff changeset
795
7473fca49ca0 initial
alex
parents:
diff changeset
796 bytesread=read(priv->dspfd, buffer, len);
7473fca49ca0 initial
alex
parents:
diff changeset
797
7473fca49ca0 initial
alex
parents:
diff changeset
798 while(bytesread < len)
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
799 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
800 ret=read(priv->dspfd, &buffer[bytesread], len-bytesread);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
801
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
802 if(ret == -1)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
803 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
804 perror("Audio read failed!");
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
805 return 0;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
806 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
807
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
808 bytesread+=ret;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
809 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
810
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
811 priv->dspbytesread += bytesread;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
812
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
813 curpts = curtime.tv_sec + curtime.tv_usec * .000001;
5081
7473fca49ca0 initial
alex
parents:
diff changeset
814
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
815 timeskew = priv->dspbytesread * 1.0 / priv->dsprate - (curpts-priv->starttime);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
816
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
817 if(timeskew > .125/priv->fps)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
818 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
819 priv->starttime -= timeskew;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
820 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
821 else
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
822 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
823 if(timeskew < -.125/priv->fps)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
824 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
825 priv->starttime -= timeskew;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
826 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
827 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
828
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
829 return(priv->dspbytesread * 1.0 / priv->dsprate);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
830 }
7473fca49ca0 initial
alex
parents:
diff changeset
831
7473fca49ca0 initial
alex
parents:
diff changeset
832 static int get_audio_framesize(priv_t *priv)
7473fca49ca0 initial
alex
parents:
diff changeset
833 {
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
834 int bytesavail;
22934
da61a88adf63 remove ugly #include from tvi_bsdbt848.c
voroshil
parents: 22898
diff changeset
835 #ifdef USE_SUN_AUDIO
11725
64137954a868 sync with netbsd ports: audio grabbing support fixed
alex
parents: 11723
diff changeset
836 struct audio_info auinf;
64137954a868 sync with netbsd ports: audio grabbing support fixed
alex
parents: 11723
diff changeset
837 #endif
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
838
5081
7473fca49ca0 initial
alex
parents:
diff changeset
839 if(priv->dspready == FALSE) return 0;
7473fca49ca0 initial
alex
parents:
diff changeset
840
22934
da61a88adf63 remove ugly #include from tvi_bsdbt848.c
voroshil
parents: 22898
diff changeset
841 #ifdef USE_SUN_AUDIO
11725
64137954a868 sync with netbsd ports: audio grabbing support fixed
alex
parents: 11723
diff changeset
842 if(ioctl(priv->dspfd, AUDIO_GETINFO, &auinf) < 0)
64137954a868 sync with netbsd ports: audio grabbing support fixed
alex
parents: 11723
diff changeset
843 {
64137954a868 sync with netbsd ports: audio grabbing support fixed
alex
parents: 11723
diff changeset
844 perror("AUDIO_GETINFO");
64137954a868 sync with netbsd ports: audio grabbing support fixed
alex
parents: 11723
diff changeset
845 return(TVI_CONTROL_FALSE);
64137954a868 sync with netbsd ports: audio grabbing support fixed
alex
parents: 11723
diff changeset
846 }
64137954a868 sync with netbsd ports: audio grabbing support fixed
alex
parents: 11723
diff changeset
847 else
64137954a868 sync with netbsd ports: audio grabbing support fixed
alex
parents: 11723
diff changeset
848 bytesavail = auinf.record.seek; /* *priv->dspsamplesize; */
64137954a868 sync with netbsd ports: audio grabbing support fixed
alex
parents: 11723
diff changeset
849 #else
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
850 if(ioctl(priv->dspfd, FIONREAD, &bytesavail) < 0)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
851 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
852 perror("FIONREAD");
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
853 return(TVI_CONTROL_FALSE);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
854 }
11725
64137954a868 sync with netbsd ports: audio grabbing support fixed
alex
parents: 11723
diff changeset
855 #endif
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
856
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
857 /* When mencoder wants audio data, it wants data..
11000
6e35326c742f many small typo and grammar fixes
gabucino
parents: 10822
diff changeset
858 it won't go do anything else until it gets it :( */
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
859
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
860 if(bytesavail == 0) return FRAGSIZE;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
861
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
862 return(bytesavail);
5081
7473fca49ca0 initial
alex
parents:
diff changeset
863 }
7473fca49ca0 initial
alex
parents:
diff changeset
864
7473fca49ca0 initial
alex
parents:
diff changeset
865 static int getinput(int innumber)
7473fca49ca0 initial
alex
parents:
diff changeset
866 {
7473fca49ca0 initial
alex
parents:
diff changeset
867 switch(innumber)
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
868 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
869 case 0: return METEOR_INPUT_DEV0; /* RCA */
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
870 case 1: return METEOR_INPUT_DEV1; /* Tuner */
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
871 case 2: return METEOR_INPUT_DEV2; /* In 1 */
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
872 case 3: return METEOR_INPUT_DEV3; /* In 2 */
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
873 case 4: return METEOR_INPUT_DEV_RGB; /* RGB */
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
874 case 5: return METEOR_INPUT_DEV_SVIDEO; /* SVid */
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5142
diff changeset
875 }
5081
7473fca49ca0 initial
alex
parents:
diff changeset
876
7473fca49ca0 initial
alex
parents:
diff changeset
877 return 0;
7473fca49ca0 initial
alex
parents:
diff changeset
878 }