Package: xawtv
Version: 3.94-1.1
Severity: normal
Tags: patch
This is a patch I hacked together for ntsc-cc so that it works with the
saa7134 driver (which uses a slightly different sample rate and buffer
size). It is against the zvbi version of ntsc-cc, but only touches the
non-zvbi-using code, so should be fairly easy to adapt to the original
ntsc-cc if desired (even if what I read about the zvbi version
of ntsc-cc being used in future xawtv releases isn't true). Might
be useful to someone (although not to me by itself, I did this only to
find out why closed captions didn't work for me on my tv card, to learn
how I could later patch the stuff I actually use).
Index: ntsc-cc.c
===================================================================
RCS file: /cvsroot/zapping/vbi/contrib/ntsc-cc.c,v
retrieving revision 1.2
diff -u -r1.2 ntsc-cc.c
--- ntsc-cc.c 10 Feb 2006 06:25:36 -0000 1.2
+++ ntsc-cc.c 22 Feb 2006 19:18:35 -0000
@@ -38,6 +38,7 @@
#endif
#include <assert.h>
#include "src/libzvbi.h"
+#include <linux/videodev.h>
#ifndef X_DISPLAY_MISSING
@@ -107,15 +108,15 @@
return mask;
}
-static int decodebit(unsigned char *data, int threshold)
+static int decodebit(unsigned char *data, int threshold, int scale1)
{
int i, sum = 0;
- for (i = 0; i < 23; i++)
+ for (i = 0; i < scale1; i++)
sum += data[i];
- return (sum > threshold*23);
+ return (sum > threshold*scale1);
}
-static int decode(unsigned char *vbiline)
+static int decode(unsigned char *vbiline, int scale0, int scale1)
{
int max[7], min[7], val[7], i, clk, tmp, sample, packedbits = 0;
@@ -165,16 +166,16 @@
#ifndef X_DISPLAY_MISSING
if (debugwin) {
- for (clk=i;clk<i+57*18;clk+=57)
+ for (clk=i;clk<i+scale0*18;clk+=scale0)
XDrawLine(dpy,Win,WinGC,clk/2,0,clk/2,128);
XFlush(dpy);
}
#endif
- tmp = i+57;
+ tmp = i+scale0;
for (i = 0; i < 16; i++)
- if(decodebit(&vbiline[tmp + i * 57], sample))
+ if(decodebit(&vbiline[tmp + i * scale0], sample, scale1))
packedbits |= 1<<i;
return packedbits&parityok(packedbits);
} /* decode */
@@ -619,6 +620,12 @@
vbi_sliced *sliced;
struct timeval timeout;
+#else
+
+ struct vbi_format vfmt;
+ int src_w, src_h, bufsize, start0, count0, start1, count1;
+ int scale0, scale1;
+
#endif
verbose = 0;
@@ -762,6 +769,49 @@
exit(1);
}
+ if (ioctl(vbifd, VIDIOCGVBIFMT, &vfmt) < 0) {
+ perror("ioctl(VIDIOCGVBIFMT)");
+ exit(1);
+ }
+
+ /* bttv:
+ * sampling rate: 28636363
+ * samples per line: 2048
+ * sample format: 12
+ * start: 10, 273
+ * count: 16, 16
+ * flags: 0x0
+ * saa7134:
+ * sampling rate: 27000000
+ * samples per line: 2048
+ * sample format: 12
+ * start: 10, 273
+ * count: 12, 12
+ * flags: 0x0
+ */
+
+ src_w = vfmt.samples_per_line;
+ src_h = vfmt.count[0] + vfmt.count[1];
+ bufsize = src_w * src_h;
+ start0 = vfmt.start[0];
+ start1 = vfmt.start[1];
+ count0 = vfmt.count[0];
+ count1 = vfmt.count[1];
+
+ scale0 = (vfmt.sampling_rate + 503488/2) / 503488;
+ scale1 = (scale0*2+3)/5; /* 40% */
+
+#if 0
+ printf("VBI Format\n");
+ printf(" sampling rate: %d\n", vfmt.sampling_rate);
+ printf(" samples per line: %d\n", vfmt.samples_per_line);
+ printf(" sample format: %d\n", vfmt.sample_format);
+ printf(" start: %d, %d\n", vfmt.start[0], vfmt.start[1]);
+ printf(" count: %d, %d\n", vfmt.count[0], vfmt.count[1]);
+ printf(" flags: 0x%x\n", vfmt.flags);
+ printf("scale: %d, %d\n", scale0, scale1);
+#endif
+
#endif
if (!args)
@@ -890,7 +940,7 @@
FD_SET(vbifd, &rfds);
select(FD_SETSIZE, &rfds, NULL, NULL, NULL);
if (FD_ISSET(vbifd, &rfds)) {
- if (read(vbifd, buf , 65536)!=65536)
+ if (read(vbifd, buf , bufsize)!=bufsize)
printf("read error\n");
if (useraw)
{
@@ -899,12 +949,12 @@
XClearArea(dpy,Win,0,0,1024,128,0);
XDrawLine(dpy,Win,WinGC1,0,128-85/2,1024,128-85/2);
for (x=0;x<1024;x++)
- if (buf[2048 * rawline+x*2]/2<128 && buf[2048 *
rawline+x*2+2]/2 < 128)
- XDrawLine(dpy,Win,WinGC0,x,128-buf[2048 *
rawline+x*2]/2,
- x+1,128-buf[2048 * rawline+x*2+2]/2);
+ if (buf[src_w * rawline+x*2]/2<128 && buf[src_w *
rawline+x*2+2]/2 < 128)
+ XDrawLine(dpy,Win,WinGC0,x,128-buf[src_w *
rawline+x*2]/2,
+ x+1,128-buf[src_w * rawline+x*2+2]/2);
}
#endif
- RAW(decode(&buf[2048 * rawline]));
+ RAW(decode(&buf[src_w * rawline], scale0, scale1));
#ifndef X_DISPLAY_MISSING
if (debugwin) {
XFlush(dpy);
@@ -913,11 +963,11 @@
#endif
}
if (usexds)
- XDSdecode(decode(&buf[2048 * 27]));
+ XDSdecode(decode(&buf[src_w * (284-start1+count0)],
scale0, scale1));
if (usecc)
- CCdecode(decode(&buf[2048 * 11]));
+ CCdecode(decode(&buf[src_w * (21-start0)], scale0,
scale1));
if (usesen)
- sentence(decode(&buf[2048 * 11]));
+ sentence(decode(&buf[src_w * (21-start0)], scale0,
scale1));
#ifndef X_DISPLAY_MISSING
if (debugwin) {
XFlush(dpy);
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15-1-k7
Locale: LANG=no_NO, LC_CTYPE=no_NO (charmap=ISO-8859-1)
Versions of packages xawtv depends on:
ii debconf 1.4.70 Debian configuration management sy
ii libasound2 1.0.10-2 ALSA library
ii libc6 2.3.6-1 GNU C Library: Shared libraries an
ii libfontconfig1 2.3.2-2 generic font configuration library
ii libfreetype6 2.1.10-1 FreeType 2 font engine, shared lib
ii libice6 6.9.0.dfsg.1-4 Inter-Client Exchange library
ii libjpeg62 6b-11 The Independent JPEG Group's JPEG
ii liblircclient0 0.7.2-2 LIRC client library
ii libncurses5 5.5-1 Shared libraries for terminal hand
ii libpng12-0 1.2.8rel-5 PNG library - runtime
ii libsm6 6.9.0.dfsg.1-4 X Window System Session Management
ii libx11-6 6.9.0.dfsg.1-4 X Window System protocol client li
ii libxaw7 6.9.0.dfsg.1-4 X Athena widget set library
ii libxext6 6.9.0.dfsg.1-4 X Window System miscellaneous exte
ii libxft2 2.1.8.2-3 FreeType-based font drawing librar
ii libxinerama1 6.9.0.dfsg.1-4 X Window System multi-head display
ii libxmu6 6.9.0.dfsg.1-4 X Window System miscellaneous util
ii libxpm4 6.9.0.dfsg.1-4 X pixmap library
ii libxrandr2 6.9.0.dfsg.1-4 X Window System Resize, Rotate and
ii libxrender1 1:0.9.0.2-1 X Rendering Extension client libra
ii libxt6 6.9.0.dfsg.1-4 X Toolkit Intrinsics
ii libxv1 6.9.0.dfsg.1-4 X Window System video extension li
ii libxxf86dga1 6.9.0.dfsg.1-4 X Direct Graphics Access extension
ii libxxf86vm1 6.9.0.dfsg.1-4 X Video Mode selection library
ii libzvbi0 0.2.18-1 video Blank Interval decoder (VBI)
ii pia 3.94-1.1 movie player
ii scantv 3.94-1.1 scan TV channels for stations
ii v4l-conf 3.94-1.1 tool to configure video4linux driv
ii xawtv-plugins 3.94-1.1 plugins for xawtv and motv
ii xlibmesa-gl [libgl1] 6.9.0.dfsg.1-4 Mesa 3D graphics library [X.Org]
ii xutils 6.9.0.dfsg.1-4 X Window System utility programs
ii zlib1g 1:1.2.3-9 compression library - runtime
xawtv recommends no packages.
-- debconf information excluded
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]