[If you have any questions or comments on this program, please post
a follow-up in this TiVo
UK Community thread.]
teletext program decodes, selects, and displays
teletext packets from the input stream of a UK Thomson TiVo.
It can select individual packets or full pages, displaying them on the
terminal as plain text, or in colour with limited graphics.
This requires ANSI
colour support for the terminal program
(eg. HyperTerminal on Windows
or XTerm on Unix), and cannot
display teletext graphics, except as full-character blocks - hence
the unreadable "BBC CEEFAX" at the top of this screenshot.
It can also show subtitles from the input stream (ie. current broadcast, not recording).
So far this is just a toy, and I doubt it will be much real use to anyone on its own (most people with TiVos have a Teletext-capable TV, and anyway who wants to view teletext from a terminal window?).
However one potential development that could be very interesting is
the use of the decoded PDC signals to adjust the start and end of
a recording for schedule changes.
This probably wouldn't be able to handle
all possibilities (unlike a PDC-capable VCR, it may not be practicable for TiVo to
switch channels just to check for PDC signals on another channel), but it
should be possible to extend a recording where there are no conflicts
in a similar way to what EndPad
does, but only actually recording the extra if required.
PDC signals are only available over aerial on BBC1, BBC2,
some ITV regions (I understand), and Channel 5
(though most last-minute schedule changes seem to be on BBC anyway).
This program currently just displays decoded PDC packets.
Each line shows the time the PDC packet was transmitted (starting with 31-Aug-2005 00:09:23), the channel or programme name (BBC ONE), the channel's index page number (P100), the scheduled start time of the current programme (or special command to the VCR), and the decoded Country and Network Identifier (BBC1 UK). When this command was started, a film scheduled from 22:35 to 00:40 was in progress. The film actually ended at 00:38:00 and the next programme started at 00:42:26. A longer example is given here.bash-2.02# teletext -zTC X8/30.1 31-Aug-2005 00:09:23 X8/30.1 | BBC ONE | index:P100 30-Aug 22:35 BBC1 UK 31-Aug-2005 00:38:00 X8/30.1 | BBC ONE | index:P100 recording inhibit/terminate BBC1 UK 31-Aug-2005 00:42:26 X8/30.1 | BBC ONE | index:P100 31-Aug 00:40 BBC1 UK LCI:1
Whereteletext [OPTIONS] [PACKET-SELECTIONS]
OPTIONS are:
The optional-f show full teletext packet information. Parity errors shown as ~ -p show only full pages for packets 0-24 -P like -p, but also displays other packets -z show only changes in X8/30.1 (PDC) packets -c show teletext formatting using ANSI colour codes -o use existing buffer contents -O only use existing buffer contents -C continuous running -v verbose running for debugging (-vv for extra verbose) -q quiet: don't display packets (useful to get statistics) -e show errors -n NUM without -p: stop after displaying NUM packets (default=25 if no -N) -n NUM with -p: stop after displaying NUM pages (default=1 if no -N) -N NUM stop after reading NUM packets -m check for missing scan-lines -M LIST check for missing scan-lines, apart from the ones listed, eg -M 22e,23 -b decode blank lines -s show statistics summary at the end -t SECS time to wait between each read (default=0.5s, data loss if >5s) -T display local timestamps based on X8/30.0 (BSDP) packets
PACKET-SELECTIONS are of the form [[Xn|[P]nnn][:nnnn][/nn][.d]]
Only packets matching all the criteria in any of the space-separated selections
are displayed. The components are magazine (Xn), page number (Pnnn),
subpage (:nnnn), packet (/nn), and designation code (.d).
With the -f option, full details of each packet are displayed, eg.
where thebash-2.02# teletext -f P199 X8 P100:1/0
P100:1/0 matches
where018419 80265D50 L09o/2B P100:0001/00 | P100 CEEFAX 1 100 Wed 31 Aug 01:00/38| English, update, out of seq
018419Packet number read by the program 80265D50frame address in the fpga7114 module's buffer (hex) L09o/2BScan line 9, odd frame. 2Bis the SAA7118's SAV code, bits 0-7 (hex; SAV=Start of Active Video line). Why do I see different values for this?P100:0001/00Page 100, subpage 1, packet 0.
For header packets (/00), the language (only the correct decoding for certain
regions) and flags (update, out of seq in this case) are also shown.
The packet text is displayed using 7-bit ASCII only between |s. Special characters
(eg. accents) are displayed with their closest ASCII equivalents.
Graphics are shown as "#".
If -c is specified, the text output is displayed in colour
and graphics characters are shown as solid foreground colour.
As well as text packets 0 to 25, packet 30 is also fully decoded (if selected).
The Network Identity Group (NIG) (X8/30.0), Country and Network Identifier (CNI), and Programme Type Indicator (PTY) (X8/30.1) names are shown if present and known (from the full PDC or CNI specification). The raw numbers are also shown ifbash-2.02# teletext -f X8/30 000039 80242500 L07e/6C X8/30.0 | BBC TWO | index:P100 9-Sep-2005 23:51:58 +0100 BBC2 UK (A2FE) 000399 80246880 L07e/6C X8/30.1 | BBC TWO | index:P100 9-Sep 23:35 BBC2 UK (2C3E) LCI:1
-f is specified, as it is here.
Other packets types (26-29 and 31), if selected, are displayed in hexadecimal, verbatim.
My UK 2.5.5 TiVo has a 197 kB VBI buffer. That can hold 4206 48-byte frames (~168 pages),
or about 5 seconds of UK BBC1 transmission (you can see the actual number of packets in
the buffer (including blanks) with teletext -qOCs; and
time teletext -qN 4206 times how long it takes to receive).
In contrast, ThomsonTiVo noted
that on the US system it takes 81 seconds to process
137 pages via one pass through the VBI buffer.
In most cases, the program spends >95% of the time sleeping, so the load on the TiVo's processor isn't too high.
One oddity that I haven't understood yet is that packets 8/0 to 8/24 can have a variable data count byte (2nd byte of the frame), instead of the expected 0x4B which other packets have (11 4-byte words=44 data bytes in the frame, with bit 6 set for even parity). Perhaps TiVo somehow uses this to flag subtitles (the only ones it cares about). Anyway, this prevented earlier versions of this program from displaying subtitles.
Thebash-2.02# powerpc-TiVo-linux-gcc -Wall -O99 -s -o teletext teletext.c
-Wall -O99 -s (for full compilation warnings,
maximum optimisation, and stripped binary) are optional.
Add -DSMALL to remove some of the larger tables and full help text.
This reduces the binary size from 90k to 55k, but shows some values
(like the PDC channel names) as numeric codes.
hamm.c routines)
from AleVT 1.6.1.
The original concept is from
Teletext_0.0.2.zip (24-Nov-2004) by ThomsonTiVo, and the
test scripts by
Martijn van Oosterhout.