[mythtv] New teletext patch, ready for CVS.
Martin Moeller
martin at martinm-76.dk
Sun Jul 27 17:14:15 EDT 2003
Hi everyone.
With a bit of luck this will mark the phasing out of my frequent updates
about teletext since it seems to be working A-OK for me now, including
setting the page in the database on-the-fly (well, nearly).
Attached is what I believe is the final patch for now. I haven't seen
any ill effects from running with this setup, but it's only been tested
for a few days in various stages.
I sincerely hope this can be applied to the CVS tree shortly.
I have taken the liberty of updating cvs.sql as well. Maybe the
DBSchemaVer should stay at 1003 for such a small and non-critical
update. Feel free to set it back if so.
A little later today I will be recording a newer edition of TV Avisen
and later still I'll take a screenshot of it with international
characters enabled.
Thanks to all who helped out when I hit a bump in the road :)
/Martin.
--
Martin Moeller <martin at martinm-76.dk>
-------------- next part --------------
? programs/menutest/Makefile
? programs/menutest/menutest
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 27 Jul 2003 14:04:01 -0000
@@ -7,13 +7,14 @@
#
DELETE FROM settings WHERE value='DBSchemaVer';
-INSERT INTO settings VALUES ('DBSchemaVer', 1003, NULL);
+INSERT INTO settings VALUES ('DBSchemaVer', 1004, NULL);
#
# Below are the recent alterations to the database.
# The most recent are listed first. Execution should fail
# when a previously executed command is encountered.
#
+INSERT INTO settings SET value="VBIpageNr", data=888;
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 27 Jul 2003 14:04:16 -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 27 Jul 2003 14:04:22 -0000
@@ -1782,6 +1782,7 @@
for (int y = 0; y < VT_HEIGHT; y++)
{
+ //printf("\n"); /* Make sure we change lines */
char c = ' ';
char last_c = ' ';
int hid = 0;
@@ -1797,6 +1798,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 +1874,12 @@
}
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 */
if (!visible)
{
st.row = y;
@@ -2100,9 +2103,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 27 Jul 2003 14:04:26 -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 27 Jul 2003 14:04:28 -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 27 Jul 2003 14:04:30 -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