[mythtv] UPDATE CVS SET Teletext = "New Patch" where Status =
"BufferOverrun->Gone";
Martin Moeller
martin at martinm-76.dk
Thu Jul 31 08:07:37 EDT 2003
Hi all.
I will test this patch a while yet, just to be sure everything works as
it should but so far I have recorded two shows that would normally have
crashed the backend and elegantly(?) jumped past it with this code.
I think it is fairly good as is, maybe 'max' needs to be updated if some
pages spew out many lines of subtitles and not just 1-4...
Then again my C knowledge is rather limited so maybe a rewrite by
someone more adept is in order. Bottom line: It seems to be working.
With my own debug lines in place, it went like this:
Changing from None to RecordingOnly
[New Thread 23576 (LWP 32586)]
[New Thread 24601 (LWP 32587)]
[New Thread 25626 (LWP 32588)]
[New Thread 26651 (LWP 32589)]
strange error flushing buffer ...
subtitle page 423.4
000 - Current bufferlen : 1, outpos : 142442976, st.len : 41
001 - Current bufferlen : 48, outpos: 142443023
000 - Current bufferlen : 48, outpos : 142443023, st.len : 41
001 - Current bufferlen : 95, outpos: 142443070
000 - Current bufferlen : 95, outpos : 142443070, st.len : 41
001 - Current bufferlen : 142, outpos: 142443117
000 - Current bufferlen : 142, outpos : 142443117, st.len : 41
001 - Current bufferlen : 189, outpos: 142443164
st.len : 41, act : 0, bufferlen : 189, buffer : 142442976
[New Thread 27676 (LWP 32677)]
only read 3072 from 4096 bytes from '/dev/dsp0'
read audio: Afbrudt systemkald
[New Thread 28701 (LWP 32718)]
only read 3072 from 4096 bytes from '/dev/dsp0'
read audio: Afbrudt systemkald
[New Thread 29726 (LWP 32731)]
Changing from RecordingOnly to None
... and ...
Changing from None to RecordingOnly
[New Thread 33826 (LWP 127)]
[New Thread 34851 (LWP 128)]
[New Thread 35876 (LWP 129)]
[New Thread 36901 (LWP 130)]
strange error flushing buffer ...
subtitle page 231.5
000 - Current bufferlen : 1, outpos : 140085312, st.len : 40
001 - Current bufferlen : 47, outpos: 140085358
000 - Current bufferlen : 47, outpos : 140085358, st.len : 37
001 - Current bufferlen : 90, outpos: 140085401
000 - Current bufferlen : 90, outpos : 140085401, st.len : 39
001 - Current bufferlen : 135, outpos: 140085446
000 - Current bufferlen : 135, outpos : 140085446, st.len : 40
001 - Current bufferlen : 181, outpos: 140085492
st.len : 40, act : 0, bufferlen : 181, buffer : 140085312
Changing from RecordingOnly to None
Data from before 'max':
Changing from None to RecordingOnly
[New Thread 60476 (LWP 29631)]
[New Thread 61501 (LWP 29632)]
[New Thread 62526 (LWP 29633)]
[New Thread 63551 (LWP 29634)]
strange error flushing buffer ...
subtitle page 574.3000
000 - Current bufferlen : 1, outpos : 138530184, st.len : 41
001 - Current bufferlen : 47, outpos: 138530230
000 - Current bufferlen : 47, outpos : 138530230, st.len : 38
001 - Current bufferlen : 91, outpos: 138530274
000 - Current bufferlen : 91, outpos : 138530274, st.len : 35
001 - Current bufferlen : 132, outpos: 138530315
000 - Current bufferlen : 132, outpos : 138530315, st.len : 41
001 - Current bufferlen : 178, outpos: 138530361
000 - Current bufferlen : 178, outpos : 138530361, st.len : 29
001 - Current bufferlen : 213, outpos: 138530396
000 - Current bufferlen : 213, outpos : 138530396, st.len : 37
001 - Current bufferlen : 256, outpos: 138530439
000 - Current bufferlen : 256, outpos : 138530439, st.len : 37
001 - Current bufferlen : 299, outpos: 138530482
000 - Current bufferlen : 299, outpos : 138530482, st.len : 40
001 - Current bufferlen : 345, outpos: 138530528
000 - Current bufferlen : 345, outpos : 138530528, st.len : 35
001 - Current bufferlen : 386, outpos: 138530569
000 - Current bufferlen : 386, outpos : 138530569, st.len : 25
001 - Current bufferlen : 417, outpos: 138530600
000 - Current bufferlen : 417, outpos : 138530600, st.len : 35
001 - Current bufferlen : 458, outpos: 138530641
000 - Current bufferlen : 458, outpos : 138530641, st.len : 28
001 - Current bufferlen : 492, outpos: 138530675
000 - Current bufferlen : 492, outpos : 138530675, st.len : 41
001 - Current bufferlen : 538, outpos: 138530721
000 - Current bufferlen : 538, outpos : 138530721, st.len : 33
001 - Current bufferlen : 577, outpos: 138530760
st.len : 33, act : 0, bufferlen : 577, buffer : 138530184
Program received signal SIGSEGV, Segmentation fault.
-------------- next part --------------
Index: database/cvs.sql
===================================================================
RCS file: /var/lib/mythcvs/mythtv/database/cvs.sql,v
retrieving revision 1.39
diff -u -w -r1.39 cvs.sql
--- database/cvs.sql 17 Jul 2003 01:04:13 -0000 1.39
+++ database/cvs.sql 31 Jul 2003 04:55:48 -0000
@@ -14,6 +14,8 @@
# The most recent are listed first. Execution should fail
# when a previously executed command is encountered.
#
+#INSERT INTO settings SET value="VBIpageNr", data=888;
+# Apply this if you use Teletext and it isn't already there.
ALTER TABLE record ADD recorddups INT DEFAULT 0 NOT NULL;
ALTER TABLE record ADD maxnewest INT DEFAULT 0 NOT NULL;
Index: libs/libmythtv/NuppelVideoPlayer.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/NuppelVideoPlayer.cpp,v
retrieving revision 1.231
diff -u -w -r1.231 NuppelVideoPlayer.cpp
--- libs/libmythtv/NuppelVideoPlayer.cpp 23 Jul 2003 19:58:27 -0000 1.231
+++ libs/libmythtv/NuppelVideoPlayer.cpp 31 Jul 2003 04:55:52 -0000
@@ -49,7 +49,18 @@
prebuffering = false;
vbimode = ' ';
+ //vbipagenr = 0x08880000;
+
+ bool valid;
+ //QString hostname = gContext->GetHostName();
+ //QString mypage = gContext->GetSettingOnHost("VBIpageNr", hostname, "888");
+ QString mypage = gContext->GetSetting("VBIpageNr", "888");
+ if (mypage)
+ vbipagenr = mypage.toInt(&valid, 16) << 16;
+ else
vbipagenr = 0x08880000;
+ //printf("vbipagenr : %x\n", vbipagenr); /* Debug */
+
video_height = 0;
video_width = 0;
video_size = 0;
@@ -741,10 +752,13 @@
memcpy(&pagenr, inpos, sizeof(int));
inpos += sizeof(int);
+ printf("pagenr : %x, vbipagenr : %x \n", pagenr, vbipagenr); /* Debug test of page numbers */
if (pagenr == vbipagenr)
{
// show teletext subtitles
osd->ClearAllCCText();
+
+ (*inpos)++;
while (*inpos)
{
struct teletextsubtitle st;
Index: libs/libmythtv/NuppelVideoRecorder.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/NuppelVideoRecorder.cpp,v
retrieving revision 1.128
diff -u -w -r1.128 NuppelVideoRecorder.cpp
--- libs/libmythtv/NuppelVideoRecorder.cpp 18 Jul 2003 20:10:58 -0000 1.128
+++ libs/libmythtv/NuppelVideoRecorder.cpp 31 Jul 2003 04:55:54 -0000
@@ -1779,9 +1779,11 @@
struct teletextsubtitle st;
unsigned char linebuf[VT_WIDTH + 1];
unsigned char *linebufpos = linebuf;
+ //bool br = false;
for (int y = 0; y < VT_HEIGHT; y++)
{
+ //if (br) printf("\n"); /* Make sure we change lines */
char c = ' ';
char last_c = ' ';
int hid = 0;
@@ -1797,6 +1799,7 @@
for (int x = 0; x < VT_WIDTH; ++x)
{
c = *inpos++;
+ //printf("%c", c); /* Output *every* teletext character */
switch (c)
{
case 0x00 ... 0x07: /* alpha + fg color */
@@ -1872,11 +1875,13 @@
}
if (hid)
c = ' ';
- if ((c & 0x80) || !c )
- c = ' ';
+ //if ((c & 0x80) || !c )
+ // c = ' ';
if (visible || (c != ' '))
{
+ //printf("%c", c); /* Go with just the visible characters */
+ //br = true;
if (!visible)
{
st.row = y;
@@ -1895,10 +1900,20 @@
if (visible)
{
st.len = linebufpos - linebuf + 1;;
+ int max = 200; /* Set a reasonable amount of characters to pass through. Should always be less than 500 */
+ int bufsize = ((outpos - textbuffer[act]->buffer + 1) + st.len); /* How many do we have now? */
+ if (bufsize > max) break; /* If we're over 'max' then bail. This seems to work quite well (/Martin Moeller) */
memcpy(outpos, &st, sizeof(st));
outpos += sizeof(st);
+ if (st.len < 42) {
memcpy(outpos, linebuf, st.len);
outpos += st.len;
+ }
+ else {
+ printf("Too much data (%d bytes), writing 41 bytes (*FIXME* - is this the best way to handle it?)\n", st.len);
+ memcpy(outpos, linebuf, 41);
+ outpos += 41;
+ }
*outpos = 0;
}
}
@@ -2100,9 +2115,10 @@
case EV_PAGE:
{
struct vt_page *vtp = (struct vt_page *) ev->p1;
+ //printf("subtitle page %x.%x\n", vtp->pgno, vtp->subno); /* Super debug: If teletext working at all? */
if (vtp->flags & PG_SUBTITLE)
{
- //printf("subtitle page %x.%x\n", vtp->pgno, vtp->subno);
+ printf("subtitle page %x.%x\n", vtp->pgno, vtp->subno); /* Debug: Are we getting any subtitles? */
data->foundteletextpage = true;
memcpy(&(data->teletextpage), vtp, sizeof(vt_page));
}
Index: libs/libmythtv/osd.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/osd.cpp,v
retrieving revision 1.69
diff -u -w -r1.69 osd.cpp
--- libs/libmythtv/osd.cpp 23 Jul 2003 19:58:27 -0000 1.69
+++ libs/libmythtv/osd.cpp 31 Jul 2003 04:55:55 -0000
@@ -101,7 +101,8 @@
if (!ccfont)
{
QString name = "cc_font";
- int fontsize = vid_height / 27;
+// int fontsize = vid_height / 27;
+ int fontsize = 480 / 27;
fontsize = (int)(fontsize * hmult);
ccfont = LoadFont(ccfontname, fontsize);
Index: libs/libmythtv/recorderbase.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/recorderbase.cpp,v
retrieving revision 1.6
diff -u -w -r1.6 recorderbase.cpp
--- libs/libmythtv/recorderbase.cpp 6 Jun 2003 15:41:29 -0000 1.6
+++ libs/libmythtv/recorderbase.cpp 31 Jul 2003 04:55:57 -0000
@@ -85,9 +85,9 @@
}
else if (name == "vbiformat")
{
- //if (value.lower() == "pal teletext")
- // vbimode = 1;
- //else
+ if (value.lower() == "pal teletext")
+ vbimode = 1;
+ else
if (value.lower().left(4) == "ntsc")
vbimode = 2;
else
Index: libs/libvbitext/vbi.c
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libvbitext/vbi.c,v
retrieving revision 1.1
diff -u -w -r1.1 vbi.c
--- libs/libvbitext/vbi.c 31 Jan 2003 14:35:49 -0000 1.1
+++ libs/libvbitext/vbi.c 31 Jul 2003 04:55:57 -0000
@@ -24,13 +24,24 @@
/***** v4l2 vbi-api *****/
+/* #include "/usr/src/linux/include/linux/videodev2.h" */
+
+enum v4l2_buf_type {
+ V4L2_BUF_TYPE_VIDEO_CAPTURE = 1,
+ V4L2_BUF_TYPE_VIDEO_OUTPUT = 2,
+ V4L2_BUF_TYPE_VIDEO_OVERLAY = 3,
+ V4L2_BUF_TYPE_VBI_CAPTURE = 4,
+ V4L2_BUF_TYPE_VBI_OUTPUT = 5,
+ V4L2_BUF_TYPE_PRIVATE = 0x80,
+};
+
struct v4l2_vbi_format
{
unsigned int sampling_rate; /* in 1 Hz */
unsigned int offset; /* sampling starts # samples after rising hs */
unsigned int samples_per_line;
unsigned int sample_format; /* V4L2_VBI_SF_* */
- int start[2];
+ signed int start[2];
unsigned int count[2];
unsigned int flags; /* V4L2_VBI_* */
unsigned int reserved2; /* must be zero */
@@ -38,7 +49,7 @@
struct v4l2_format
{
- unsigned int type; /* V4L2_BUF_TYPE_* */
+ enum v4l2_buf_type type; /* V4L2_BUF_TYPE_* */
union
{
struct v4l2_vbi_format vbi; /* VBI data */
@@ -46,8 +57,7 @@
} fmt;
};
-#define V4L2_VBI_SF_UBYTE 1
-#define V4L2_BUF_TYPE_VBI 0x00000009
+#define V4L2_PIX_FMT_GREY 0x59455247 /* v4l2_fourcc('G','R','E','Y') *//* 8 Greyscale */
#define VIDIOC_G_FMT _IOWR('V', 4, struct v4l2_format)
/***** end of api definitions *****/
@@ -424,8 +434,19 @@
vbi->seq = seq;
if (seq > 1) // the first may contain data from prev channel
+ {
+#if 1
for (i = 0; i+vbi->bpl <= n; i += vbi->bpl)
vbi_line(vbi, rawbuf + i);
+#else
+ /* work-around for old saa7134 driver versions (prior 0.2.6) */
+ for (i = 16 * vbi->bpl; i + vbi->bpl <= n; i += vbi->bpl)
+ vbi_line(vbi, rawbuf + i);
+
+ for (i = 0; i + vbi->bpl <= 16 * vbi->bpl; i += vbi->bpl)
+ vbi_line(vbi, rawbuf + i);
+#endif
+ }
}
@@ -469,8 +490,9 @@
int soc, eoc; // start/end of clock run-in
int bpl; // bytes per line
- if (p->sample_format != V4L2_VBI_SF_UBYTE)
+ if (p->sample_format != V4L2_PIX_FMT_GREY)
{
+ fprintf(stderr, "got pix fmt %x\n", p->sample_format);
error("v4l2: unsupported vbi data format");
return -1;
}
@@ -527,13 +549,15 @@
struct v4l2_format v4l2_format[1];
struct v4l2_vbi_format *vbifmt = &v4l2_format->fmt.vbi;
- if (ioctl(vbi->fd, VIDIOC_G_FMT, v4l2_format) == -1
- || v4l2_format->type != V4L2_BUF_TYPE_VBI)
+ memset(&v4l2_format, 0, sizeof(v4l2_format));
+ v4l2_format->type = V4L2_BUF_TYPE_VBI_CAPTURE;
+ if (ioctl(vbi->fd, VIDIOC_G_FMT, v4l2_format) == -1)
{
// not a v4l2 device. assume bttv and create a standard fmt-struct.
int size;
+ perror("ioctl VIDIOC_G_FMT");
- vbifmt->sample_format = V4L2_VBI_SF_UBYTE;
+ vbifmt->sample_format = V4L2_PIX_FMT_GREY;
vbifmt->sampling_rate = 35468950;
vbifmt->samples_per_line = 2048;
vbifmt->offset = 244;
@@ -663,4 +687,3 @@
// vbi->cache->op->reset(vbi->cache);
vbi_send(vbi, EV_RESET, 0, 0, 0, 0);
}
-
More information about the mythtv-dev
mailing list