Project

General

Profile

Bug #469 ยป osdteletext-0.8.2.cz.diff

urig, 01/08/2011 05:39 PM

View differences:

osdteletext-0.8.2.cz/displaybase.c 2009-05-26 19:00:30.000000000 +0200
#include <time.h>
#include "displaybase.h"
#include "txtfont.h"
#include <vdr/tools.h>
#include <exception>
#include "txtrecv.h"
cDisplay::cDisplay(int width, int height) {
osdteletext-0.8.2.cz/display.h 2009-05-26 19:00:30.000000000 +0200
inline bool GetBlink()
{ if (display) return display->GetBlink(); else return false; }
inline bool SetBlink(bool blink)
{ if (display) display->SetBlink(blink); else return false; }
{ if (display) return display->SetBlink(blink); else return false; }
inline bool GetConceal()
{ if (display) return display->GetConceal(); else return false; }
inline bool SetConceal(bool conceal)
{ if (display) display->SetConceal(conceal); else return false; }
{ if (display) return display->SetConceal(conceal); else return false; }
inline cDisplay::enumZoom GetZoom()
{ if (display) return display->GetZoom(); else return cDisplay::Zoom_Off; }
inline void SetZoom(cDisplay::enumZoom zoom)
osdteletext-0.8.2.cz/hamm.c 2009-05-26 19:00:30.000000000 +0200
#include "hamm.h"
unsigned char invtab[256] = {
0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff,
};
// table to decode hamm8/4 encoded bytes.
// the low 4 bits are the (corrected) data bits
// bit 8 is set if there was a single bit error
// bit 12 is set if there was an uncorrectable error
// the idea: you may add up to 15 words and get the
// number of single bit errors in b8-b11 and the number
// of double errors in b12-b15
unsigned short hammtab[256] =
{
0x0101, 0x100f, 0x0001, 0x0101, 0x100f, 0x0100, 0x0101, 0x100f,
0x100f, 0x0102, 0x0101, 0x100f, 0x010a, 0x100f, 0x100f, 0x0107,
0x100f, 0x0100, 0x0101, 0x100f, 0x0100, 0x0000, 0x100f, 0x0100,
0x0106, 0x100f, 0x100f, 0x010b, 0x100f, 0x0100, 0x0103, 0x100f,
0x100f, 0x010c, 0x0101, 0x100f, 0x0104, 0x100f, 0x100f, 0x0107,
0x0106, 0x100f, 0x100f, 0x0107, 0x100f, 0x0107, 0x0107, 0x0007,
0x0106, 0x100f, 0x100f, 0x0105, 0x100f, 0x0100, 0x010d, 0x100f,
0x0006, 0x0106, 0x0106, 0x100f, 0x0106, 0x100f, 0x100f, 0x0107,
0x100f, 0x0102, 0x0101, 0x100f, 0x0104, 0x100f, 0x100f, 0x0109,
0x0102, 0x0002, 0x100f, 0x0102, 0x100f, 0x0102, 0x0103, 0x100f,
0x0108, 0x100f, 0x100f, 0x0105, 0x100f, 0x0100, 0x0103, 0x100f,
0x100f, 0x0102, 0x0103, 0x100f, 0x0103, 0x100f, 0x0003, 0x0103,
0x0104, 0x100f, 0x100f, 0x0105, 0x0004, 0x0104, 0x0104, 0x100f,
0x100f, 0x0102, 0x010f, 0x100f, 0x0104, 0x100f, 0x100f, 0x0107,
0x100f, 0x0105, 0x0105, 0x0005, 0x0104, 0x100f, 0x100f, 0x0105,
0x0106, 0x100f, 0x100f, 0x0105, 0x100f, 0x010e, 0x0103, 0x100f,
0x100f, 0x010c, 0x0101, 0x100f, 0x010a, 0x100f, 0x100f, 0x0109,
0x010a, 0x100f, 0x100f, 0x010b, 0x000a, 0x010a, 0x010a, 0x100f,
0x0108, 0x100f, 0x100f, 0x010b, 0x100f, 0x0100, 0x010d, 0x100f,
0x100f, 0x010b, 0x010b, 0x000b, 0x010a, 0x100f, 0x100f, 0x010b,
0x010c, 0x000c, 0x100f, 0x010c, 0x100f, 0x010c, 0x010d, 0x100f,
0x100f, 0x010c, 0x010f, 0x100f, 0x010a, 0x100f, 0x100f, 0x0107,
0x100f, 0x010c, 0x010d, 0x100f, 0x010d, 0x100f, 0x000d, 0x010d,
0x0106, 0x100f, 0x100f, 0x010b, 0x100f, 0x010e, 0x010d, 0x100f,
0x0108, 0x100f, 0x100f, 0x0109, 0x100f, 0x0109, 0x0109, 0x0009,
0x100f, 0x0102, 0x010f, 0x100f, 0x010a, 0x100f, 0x100f, 0x0109,
0x0008, 0x0108, 0x0108, 0x100f, 0x0108, 0x100f, 0x100f, 0x0109,
0x0108, 0x100f, 0x100f, 0x010b, 0x100f, 0x010e, 0x0103, 0x100f,
0x100f, 0x010c, 0x010f, 0x100f, 0x0104, 0x100f, 0x100f, 0x0109,
0x010f, 0x100f, 0x000f, 0x010f, 0x100f, 0x010e, 0x010f, 0x100f,
0x0108, 0x100f, 0x100f, 0x0105, 0x100f, 0x010e, 0x010d, 0x100f,
0x100f, 0x010e, 0x010f, 0x100f, 0x010e, 0x000e, 0x100f, 0x010e,
};
// this table generates the parity checks for hamm24/18 decoding.
// bit 0 is for test A, 1 for B, ...
// thanks to R. Gancarz for this fine table *g*
char hamm24par[3][256] =
{
{ // parities of first byte
0, 33, 34, 3, 35, 2, 1, 32, 36, 5, 6, 39, 7, 38, 37, 4,
37, 4, 7, 38, 6, 39, 36, 5, 1, 32, 35, 2, 34, 3, 0, 33,
38, 7, 4, 37, 5, 36, 39, 6, 2, 35, 32, 1, 33, 0, 3, 34,
3, 34, 33, 0, 32, 1, 2, 35, 39, 6, 5, 36, 4, 37, 38, 7,
39, 6, 5, 36, 4, 37, 38, 7, 3, 34, 33, 0, 32, 1, 2, 35,
2, 35, 32, 1, 33, 0, 3, 34, 38, 7, 4, 37, 5, 36, 39, 6,
1, 32, 35, 2, 34, 3, 0, 33, 37, 4, 7, 38, 6, 39, 36, 5,
36, 5, 6, 39, 7, 38, 37, 4, 0, 33, 34, 3, 35, 2, 1, 32,
40, 9, 10, 43, 11, 42, 41, 8, 12, 45, 46, 15, 47, 14, 13, 44,
13, 44, 47, 14, 46, 15, 12, 45, 41, 8, 11, 42, 10, 43, 40, 9,
14, 47, 44, 13, 45, 12, 15, 46, 42, 11, 8, 41, 9, 40, 43, 10,
43, 10, 9, 40, 8, 41, 42, 11, 15, 46, 45, 12, 44, 13, 14, 47,
15, 46, 45, 12, 44, 13, 14, 47, 43, 10, 9, 40, 8, 41, 42, 11,
42, 11, 8, 41, 9, 40, 43, 10, 14, 47, 44, 13, 45, 12, 15, 46,
41, 8, 11, 42, 10, 43, 40, 9, 13, 44, 47, 14, 46, 15, 12, 45,
12, 45, 46, 15, 47, 14, 13, 44, 40, 9, 10, 43, 11, 42, 41, 8
}, { // parities of second byte
0, 41, 42, 3, 43, 2, 1, 40, 44, 5, 6, 47, 7, 46, 45, 4,
45, 4, 7, 46, 6, 47, 44, 5, 1, 40, 43, 2, 42, 3, 0, 41,
46, 7, 4, 45, 5, 44, 47, 6, 2, 43, 40, 1, 41, 0, 3, 42,
3, 42, 41, 0, 40, 1, 2, 43, 47, 6, 5, 44, 4, 45, 46, 7,
47, 6, 5, 44, 4, 45, 46, 7, 3, 42, 41, 0, 40, 1, 2, 43,
2, 43, 40, 1, 41, 0, 3, 42, 46, 7, 4, 45, 5, 44, 47, 6,
1, 40, 43, 2, 42, 3, 0, 41, 45, 4, 7, 46, 6, 47, 44, 5,
44, 5, 6, 47, 7, 46, 45, 4, 0, 41, 42, 3, 43, 2, 1, 40,
48, 25, 26, 51, 27, 50, 49, 24, 28, 53, 54, 31, 55, 30, 29, 52,
29, 52, 55, 30, 54, 31, 28, 53, 49, 24, 27, 50, 26, 51, 48, 25,
30, 55, 52, 29, 53, 28, 31, 54, 50, 27, 24, 49, 25, 48, 51, 26,
51, 26, 25, 48, 24, 49, 50, 27, 31, 54, 53, 28, 52, 29, 30, 55,
31, 54, 53, 28, 52, 29, 30, 55, 51, 26, 25, 48, 24, 49, 50, 27,
50, 27, 24, 49, 25, 48, 51, 26, 30, 55, 52, 29, 53, 28, 31, 54,
49, 24, 27, 50, 26, 51, 48, 25, 29, 52, 55, 30, 54, 31, 28, 53,
28, 53, 54, 31, 55, 30, 29, 52, 48, 25, 26, 51, 27, 50, 49, 24
}, { // parities of third byte
63, 14, 13, 60, 12, 61, 62, 15, 11, 58, 57, 8, 56, 9, 10, 59,
10, 59, 56, 9, 57, 8, 11, 58, 62, 15, 12, 61, 13, 60, 63, 14,
9, 56, 59, 10, 58, 11, 8, 57, 61, 12, 15, 62, 14, 63, 60, 13,
60, 13, 14, 63, 15, 62, 61, 12, 8, 57, 58, 11, 59, 10, 9, 56,
8, 57, 58, 11, 59, 10, 9, 56, 60, 13, 14, 63, 15, 62, 61, 12,
61, 12, 15, 62, 14, 63, 60, 13, 9, 56, 59, 10, 58, 11, 8, 57,
62, 15, 12, 61, 13, 60, 63, 14, 10, 59, 56, 9, 57, 8, 11, 58,
11, 58, 57, 8, 56, 9, 10, 59, 63, 14, 13, 60, 12, 61, 62, 15,
31, 46, 45, 28, 44, 29, 30, 47, 43, 26, 25, 40, 24, 41, 42, 27,
42, 27, 24, 41, 25, 40, 43, 26, 30, 47, 44, 29, 45, 28, 31, 46,
41, 24, 27, 42, 26, 43, 40, 25, 29, 44, 47, 30, 46, 31, 28, 45,
28, 45, 46, 31, 47, 30, 29, 44, 40, 25, 26, 43, 27, 42, 41, 24,
40, 25, 26, 43, 27, 42, 41, 24, 28, 45, 46, 31, 47, 30, 29, 44,
29, 44, 47, 30, 46, 31, 28, 45, 41, 24, 27, 42, 26, 43, 40, 25,
30, 47, 44, 29, 45, 28, 31, 46, 42, 27, 24, 41, 25, 40, 43, 26,
43, 26, 25, 40, 24, 41, 42, 27, 31, 46, 45, 28, 44, 29, 30, 47
}
};
// table to extract the lower 4 bit from hamm24/18 encoded bytes
char hamm24val[256] =
{
0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1,
2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3,
4, 4, 4, 4, 5, 5, 5, 5, 4, 4, 4, 4, 5, 5, 5, 5,
6, 6, 6, 6, 7, 7, 7, 7, 6, 6, 6, 6, 7, 7, 7, 7,
8, 8, 8, 8, 9, 9, 9, 9, 8, 8, 8, 8, 9, 9, 9, 9,
10, 10, 10, 10, 11, 11, 11, 11, 10, 10, 10, 10, 11, 11, 11, 11,
12, 12, 12, 12, 13, 13, 13, 13, 12, 12, 12, 12, 13, 13, 13, 13,
14, 14, 14, 14, 15, 15, 15, 15, 14, 14, 14, 14, 15, 15, 15, 15,
0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1,
2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3,
4, 4, 4, 4, 5, 5, 5, 5, 4, 4, 4, 4, 5, 5, 5, 5,
6, 6, 6, 6, 7, 7, 7, 7, 6, 6, 6, 6, 7, 7, 7, 7,
8, 8, 8, 8, 9, 9, 9, 9, 8, 8, 8, 8, 9, 9, 9, 9,
10, 10, 10, 10, 11, 11, 11, 11, 10, 10, 10, 10, 11, 11, 11, 11,
12, 12, 12, 12, 13, 13, 13, 13, 12, 12, 12, 12, 13, 13, 13, 13,
14, 14, 14, 14, 15, 15, 15, 15, 14, 14, 14, 14, 15, 15, 15, 15
};
// mapping from parity checks made by table hamm24par to error
// results return by hamm24.
// (0 = no error, 0x0100 = single bit error, 0x1000 = double error)
short hamm24err[64] =
{
0x0000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
};
// mapping from parity checks made by table hamm24par to faulty bit
// in the decoded 18 bit word.
int hamm24cor[64] =
{
0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
0x00000, 0x00000, 0x00000, 0x00001, 0x00000, 0x00002, 0x00004, 0x00008,
0x00000, 0x00010, 0x00020, 0x00040, 0x00080, 0x00100, 0x00200, 0x00400,
0x00000, 0x00800, 0x01000, 0x02000, 0x04000, 0x08000, 0x10000, 0x20000,
0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
};
int
hamm8(unsigned char *p, int *err)
{
int a = hammtab[p[0]];
*err += a;
return a & 15;
}
int
hamm16(unsigned char *p, int *err)
{
int a = hammtab[p[0]];
int b = hammtab[p[1]];
*err += a;
*err += b;
return (a & 15) | (b & 15) * 16;
}
int
hamm24(unsigned char *p, int *err)
{
int e = hamm24par[0][p[0]] ^ hamm24par[1][p[1]] ^ hamm24par[2][p[2]];
int x = hamm24val[p[0]] + p[1] % 128 * 16 + p[2] % 128 * 2048;
*err += hamm24err[e];
return x ^ hamm24cor[e];
}
int
chk_parity(unsigned char *p, int n)
{
int err;
for (err = 0; n--; p++)
if (hamm24par[0][*p] & 32)
*p &= 0x7f;
else
*p = 0xb8, err++;
return err;
}
unsigned char
doinvert(unsigned char p)
{
return invtab[p];
}
osdteletext-0.8.2.cz/hamm.h 2009-05-26 19:00:30.000000000 +0200
#ifndef HAMM_H
#define HAMM_H
int hamm8(unsigned char *p, int *err);
int hamm16(unsigned char *p, int *err);
int hamm24(unsigned char *p, int *err);
int chk_parity(unsigned char *p, int n);
unsigned char doinvert(unsigned char p);
#endif
osdteletext-0.8.2.cz/Makefile 2009-05-26 19:00:30.000000000 +0200
### The object files (add further files here):
OBJS = $(PLUGIN).o menu.o txtfont.o txtrecv.o txtrender.o displaybase.o display.o
OBJS = $(PLUGIN).o menu.o txtfont.o txtrecv.o txtrender.o displaybase.o display.o hamm.o
### Implicit rules:
osdteletext-0.8.2.cz/txtfont.c 2009-05-26 19:00:30.000000000 +0200
#include "txtfont.h"
#include <vdr/tools.h>
unsigned int TXT_Mask[11]= {
0x0000, // ************ ****
......
0x0000, // ************ ****
0x0000 // ************ ****
},
{ // 0x84 =
0x0600, // *****##***** ****
0x3FC0, // **########** ****
0x6660, // *##**##**##* ****
0x6600, // *##**##***** ****
0x3FC0, // **########** ****
0x0660, // *****##**##* ****
0x6660, // *##**##**##* ****
0x3FC0, // **########** ****
0x0600, // *****##***** ****
{ // 0x84 =
0x0700, // *****###**** ****
0x0D80, // ****##*##*** ****
0x0700, // *****###**** ****
0x3060, // **##*****##* ****
0x3060, // **##*****##* ****
0x3060, // **##*****##* ****
0x30E0, // **##****###* ****
0x1F60, // ***#####*##* ****
0x0000, // ************ ****
0x0000 // ************ ****
},
{ // 0x85 =
0x07F0, // *****####### ****
0x0C00, // ****##****** ****
0x19F0, // ***##**##### ****
{ // 0x85 =
0x06C0, // *****##*##** ****
0x0380, // ******###*** ****
0x0000, // ************ ****
0x0FE0, // ****#######* ****
0x1800, // ***##******* ****
0x19F0, // ***##**##### ****
0x3000, // **##******** ****
0x1800, // ***##******* ****
0x19F0, // ***##**##### ****
0x0C00, // ****##****** ****
0x07F0, // *****####### ****
0x0FE0, // ****#######* ****
0x0000, // ************ ****
0x0000 // ************ ****
},
{ // 0x86 =
0xFFC0, // ##########** ****
0x1C60, // ***###***##* ****
0x0830, // ****#*****## ****
0x7F30, // *#######**## ****
0x4130, // *#*****#**## ****
0x7F30, // *#######**## ****
0x0830, // ****#*****## ****
0x1C60, // ***###***##* ****
0xFFC0, // ##########** ****
{ // 0x86 =
0x0D80, // ****##*##*** ****
0x0700, // *****###**** ****
0x0000, // ************ ****
0x1FC0, // ***#######** ****
0x3000, // **##******** ****
0x1FC0, // ***#######** ****
0x0060, // *********##* ****
0x1FC0, // ***#######** ****
0x0000, // ************ ****
0x0000 // ************ ****
},
{ // 0x87 =
0xFFC0, // ##########** ****
0x0060, // *********##* ****
0x3E30, // **#####***## ****
0x6330, // *##***##**## ****
0x0E30, // ****###***## ****
0x1830, // ***##*****## ****
0x1830, // ***##*****## ****
0x0060, // *********##* ****
0xFFC0, // ##########** ****
{ // 0x87 =
0x0D80, // ****##*##*** ****
0x0700, // *****###**** ****
0x0000, // ************ ****
0x33E0, // **##**#####* ****
0x3C00, // **####****** ****
0x3000, // **##******** ****
0x3000, // **##******** ****
0x3000, // **##******** ****
0x0000, // ************ ****
0x0000 // ************ ****
},
{ // 0x88 =
{ // 0x88 =
0x0000, // ************ ****
0x3980, // ***##**##*** ****
0x3980, // ***##**##*** ****
......
0x0600, // *****##***** ****
0x0600 // *****##***** ****
},
{ // 0x8F =
{ // 0x8F =
0x0D80, // ****##*##*** ****
0x0700, // *****###**** ****
0x0000, // ************ ****
0x1FC0, // ***#######** ****
0x3060, // **##*****##* ****
0x3FE0, // **#########* ****
0x3000, // **##******** ****
0x1FC0, // ***#######** ****
0x0000, // ************ ****
0x1980, // ***##**##*** ****
0x1980, // ***##**##*** ****
0x7FE0, // *##########* ****
0x1980, // ***##**##*** ****
0x1980, // ***##**##*** ****
0x7FE0, // *##########* ****
0x1980, // ***##**##*** ****
0x1980, // ***##**##*** ****
0x0000 // ************ ****
},
{ // 0x90 =
{ // 0x90 =
0x0300, // ******##**** ****
0x0600, // *****##***** ****
0x3FC0, // **########** ****
......
0x0000, // ************ ****
0x0000 // ************ ****
},
{ // 0x92 =
{ // 0x92 =
0x0300, // ******##**** ****
0x0600, // *****##***** ****
0x0000, // ************ ****
0x3180, // **##***##*** ****
0x3060, // **##*****##* ****
0x18C0, // ***##***##** ****
0x0D80, // ****##*##*** ****
0x0700, // *****###**** ****
0x0600, // *****##***** ****
0x0C00, // ****##****** ****
0x3800 // **###******* ****
},
{ // 0x93 =
0x0D80, // ****##*##*** ****
0x0700, // *****###**** ****
0x0000, // ************ ****
0x7F80, // *########*** ****
0x00C0, // ********##** ****
0x3FC0, // **########** ****
0x60C0, // *##*****##** ****
0x3FE0, // **#########* ****
0x0180, // *******##*** ****
0x0700, // *****###**** ****
0x0C00, // ****##****** ****
0x3FE0, // **#########* ****
0x0000, // ************ ****
0x0000 // ************ ****
},
{ // 0x93 =
0x0000, // ************ ****
0x1980, // ***##**##*** ****
0x1980, // ***##**##*** ****
0x7FE0, // *##########* ****
0x1980, // ***##**##*** ****
0x1980, // ***##**##*** ****
0x7FE0, // *##########* ****
0x1980, // ***##**##*** ****
0x1980, // ***##**##*** ****
0x0000 // ************ ****
},
{ // 0x94 =
{ // 0x94 =
0x0000, // ************ ****
0x6060, // *##******##* ****
0x30C0, // **##****##** ****
......
0x6060, // *##******##* ****
0x0000 // ************ ****
},
{ // 0x95 =
0xFFC0, // ##########** ****
0x0060, // *********##* ****
0xFF30, // ########**## ****
0x0030, // **********## ****
0xFF30, // ########**## ****
0x0030, // **********## ****
0xFF30, // ########**## ****
0x0060, // *********##* ****
0xFFC0, // ##########** ****
{ // 0x95 =
0x001B, // *******##*## ****
0x0C0E, // ****##**###* ****
0x0C00, // ****##****** ****
0x3F80, // **#######*** ****
0x0C00, // ****##****** ****
0x0C00, // ****##****** ****
0x0C00, // ****##****** ****
0x07E0, // *****######* ****
0x0000, // ************ ****
0x0000 // ************ ****
},
{ // 0x96 =
0xFFC0, // ##########** ****
{ // 0x96 =
0x0D80, // ****##*##*** ****
0x0700, // *****###**** ****
0x1FC0, // ***#######** ****
0x3000, // **##******** ****
0x1FC0, // ***#######** ****
0x0060, // *********##* ****
0x3E30, // **#####***## ****
0x4730, // *#***###**## ****
0x4730, // *#***###**## ****
0x7F30, // *#######**## ****
0x3E30, // **#####***## ****
0x0060, // *********##* ****
0xFFC0, // ##########** ****
0x1FC0, // ***#######** ****
0x0000, // ************ ****
0x0000 // ************ ****
},
{ // 0x97 =
0xFFC0, // ##########** ****
0x0860, // ****#****##* ****
0x1C30, // ***###****## ****
0x0030, // **********## ****
0x7F30, // *#######**## ****
0x0030, // **********## ****
0x1C30, // ***###****## ****
0x0860, // ****#****##* ****
0xFFC0, // ##########** ****
{ // 0x97 =
0x0D80, // ****##*##*** ****
0x0700, // *****###**** ****
0x3FC0, // **########** ****
0x0300, // ******##**** ****
0x0600, // *****##***** ****
0x0C00, // ****##****** ****
0x1800, // ***##******* ****
0x3FC0, // **########** ****
0x0000, // ************ ****
0x0000 // ************ ****
},
{ // 0x98 =
0x0000, // ************ ****
0x18C0, // ***##***##** ****
0x0000, // ************ ****
0x1FC0, // ***#######** ****
0x3060, // **##*****##* ****
0x3060, // **##*****##* ****
0x3060, // **##*****##* ****
0x1FC0, // ***#######** ****
{ // 0x98 =
0x0D80, // ****##*##*** ****
0x0700, // *****###**** ****
0x3FC0, // **########** ****
0x3000, // **##******** ****
0x3F80, // **#######*** ****
0x3000, // **##******** ****
0x3000, // **##******** ****
0x3FC0, // **########** ****
0x0000, // ************ ****
0x0000 // ************ ****
},
{ // 0x99 =
{ // 0x99 =
0x0E00, // ****###***** ****
0x1B00, // ***##*##**** ****
0x0E00, // ****###***** ****
......
0x0000 // ************ ****
},
{ // 0x9A =
0x0000, // ************ ****
0x18C0, // ***##***##** ****
0x0000, // ************ ****
0x0700, // *****###**** ****
0x0D80, // ****##*##*** ****
0x3760, // **##*###*##* ****
0x3060, // **##*****##* ****
0x3060, // **##*****##* ****
0x3060, // **##*****##* ****
0x30E0, // **##****###* ****
0x1F60, // ***#####*##* ****
0x3060, // **##*****##* ****
0x1FC0, // ***#######** ****
0x0000, // ************ ****
0x0000 // ************ ****
},
{ // 0x9B =
0x18C0, // ***##***##** ****
0x0000, // ************ ****
0x1FC0, // ***#######** ****
0x3060, // **##*****##* ****
0x3060, // **##*****##* ****
0x3FE0, // **#########* ****
0x3060, // **##*****##* ****
0x3060, // **##*****##* ****
0x0D80, // ****##*##*** ****
0x0700, // *****###**** ****
0x1860, // ****######** ****
0x3000, // ***##****##* ****
0x3000, // **##******** ****
0x3000, // **##******** ****
0x1860, // ***##****##* ****
0x0FC0, // ****######** ****
0x0000, // ************ ****
0x0000 // ************ ****
},
{ // 0x9C =
0x18C0, // ***##***##** ****
0x0000, // ************ ****
0x1FC0, // ***#######** ****
0x3060, // **##*****##* ****
0x3060, // **##*****##* ****
0x1B00, // ***##*##**** ****
0x0E00, // ****###***** ****
0x30C0, // **#######*** ****
0x3060, // **##****##** ****
0x3060, // **##*****##* ****
0x3060, // **##*****##* ****
0x1FC0, // ***#######** ****
0x30C0, // **##****##** ****
0x3F80, // **#######*** ****
0x0000, // ************ ****
0x0000 // ************ ****
},
{ // 0x9D =
{ // 0x9D =
0x0700, // *****###**** ****
0x0700, // *****###**** ****
0x1FC0, // ***#######** ****
......
0x0000, // ************ ****
0x0000 // ************ ****
},
{ // 0x9E =
0x18C0, // ***##***##** ****
0x0000, // ************ ****
0x3060, // **##*****##* ****
0x3060, // **##*****##* ****
0x3060, // **##*****##* ****
{ // 0x9E =
0x0D80, // ****##*##*** ****
0x0760, // *****###*##* ****
0x0060, // *********##* ****
0x1F60, // ***#####*##* ****
0x30E0, // **##****###* ****
0x3060, // **##*****##* ****
0x3060, // **##*****##* ****
0x1FC0, // ***#######** ****
0x1FE0, // ***########* ****
0x0000, // ************ ****
0x0000 // ************ ****
},
{ // 0x9F = _
0x0000, // ************ ****
0x0000, // ************ ****
0x0000, // ************ ****
0x0000, // ************ ****
0x0000, // ************ ****
0x0000, // ************ ****
0x0000, // ************ ****
0x0000, // ************ ****
{ // 0x9F =
0x0D80, // ****##*##*** ****
0x0700, // *****###**** ****
0x7860, // *####****##* ****
0x6C60, // *##*##***##* ****
0x6660, // *##**##**##* ****
0x6360, // *##***##*##* ****
0x61E0, // *##****####* ****
0x60E0, // *##*****###* ****
0x0000, // ************ ****
0x7FE0 // *##########* ****
0x0000 // ************ ****
},
......
},
{ // 0xC0 =
0x0600, // *****##***** ****
0x0C00, // ****##****** ****
0x0D80, // ****##*##*** ****
0x0700, // *****###**** ****
0x0000, // ************ ****
0x3FC0, // **########** ****
0x6060, // *##******##* ****
0x7FE0, // *##########* ****
0x6000, // *##********* ****
0x3FC0, // **########** ****
0x37C0, // **##*#####** ****
0x3860, // **###****##* ****
0x3060, // **##*****##* ****
0x3060, // **##*****##* ****
0x3060, // **##*****##* ****
0x0000, // ************ ****
0x0000 // ************ ****
},
{ // 0xC1 =
{ // 0xC1 =
0x0600, // *****##***** ****
0x0300, // ******##**** ****
0x0000, // ************ ****
......
0x0000 // ************ ****
},
{ // 0xC3 =
0x0000, // ************ ****
0x0FC0, // ****######** ****
0x1860, // ***##****##* ****
0x0C00, // ****##****** ****
0x3F00, // **######**** ****
0x0C00, // ****##****** ****
0x3E60, // **#####**##* ****
0x33C0, // **##**####** ****
0x0D80, // ****##*##*** ****
0x0700, // *****###**** ****
0x3FC0, // **########** ****
0x3060, // **##*****##* ****
0x3FC0, // **########** ****
0x3300, // **##**##**** ****
0x31C0, // **##***###** ****
0x30E0, // **##****###* ****
0x0000, // ************ ****
0x0000 // ************ ****
},
{ // 0xC4 =
{ // 0xC4 =
0x0D80, // ****##*##*** ****
0x0700, // *****###**** ****
0x7FE0, // *##########* ****
0x0600, // *****##***** ****
0x3FC0, // **########** ****
0x6660, // *##**##**##* ****
0x6600, // *##**##***** ****
0x3FC0, // **########** ****
0x0660, // *****##**##* ****
0x6660, // *##**##**##* ****
0x3F60, // **########** ****
0x06C0, // *****##***** ****
0x0600, // *****##***** ****
0x0600, // *****##***** ****
0x0600, // *****##***** ****
0x0600, // *****##***** ****
0x0000, // ************ ****
0x0000 // ************ ****
},
{ // 0xC5 =
0x3CC0, // **####**##** ****
0x6780, // *##**####*** ****
0x0000, // ************ ****
0x7F80, // *########*** ****
0x00C0, // ********##** ****
0x3FC0, // **########** ****
0x60C0, // *##*****##** ****
0x3FE0, // **#########* ****
0x0300, // ******##**** ****
0x6660, // *##**##**##* ****
0x30C0, // **##****##** ****
0x1980, // ***##**##*** ****
0x0F00, // ****####**** ****
0x0600, // *****##***** ****
0x0600, // *****##***** ****
0x0600, // *****##***** ****
0x0000, // ************ ****
0x0000 // ************ ****
},
......
0x0000, // ************ ****
0x0000 // ************ ****
},
{ // 0xD3 =
0x0300, // ******##**** ****
0x0600, // *****##***** ****
0x0000, // ************ ****
0x1FC0, // ***#######** ****
0x3060, // **##*****##* ****
0x3FE0, // **#########* ****
0x3000, // **##******** ****
0x1FC0, // ***#######** ****
0x0000, // ************ ****
0x0000 // ************ ****
},
{ // 0xD4 =
{ // 0xD3 =
0x0300, // ******##**** ****
0x0600, // *****##***** ****
0x0000, // ************ ****
0x1FC0, // ***#######** ****
0x3060, // **##*****##* ****
0x3FE0, // **#########* ****
0x3000, // **##******** ****
0x1FC0, // ***#######** ****
0x0000, // ************ ****
0x0000 // ************ ****
},
{ // 0xD4 =
0x0000, // ************ ****
0x1980, // ***##**##*** ****
0x0000, // ************ ****
......
}
};
int NationalOptionSubsetG0Default[13]=
{0x23,0x94,0x80,0 ,0 ,0 ,0x5e,0x5f,0 ,0 ,0 ,0 ,0 };
int NationalOptionSubsetCZ_SK[13]=
{0x23,0 ,0 ,0 ,0 ,0 ,0xed,0 ,0xec,0xeb,0 ,0xef,0 };
int NationalOptionSubsetEN[13]=
{0x83,0x24,0x80,0x8b,0x8c,0x8d,0x8e,0x23,0x81,0x82,0x88,0x89,0x8a};
int NationalOptionSubsetEE[13]=
{0x23,0xc6,0 ,0x5b,0x5c,0 ,0x5d,0xd6,0 ,0x7b,0x7c,0 ,0x7d};
int NationalOptionSubsetFR[13]=
{0xd3,0xd4,0xd0,0xdb,0xdc,0xc1,0xde,0x23,0xd1,0xd2,0xd8,0xd9,0xcc};
int NationalOptionSubsetDE[13]=
{0x23,0x24,0x40,0x5b,0x5c,0x5d,0x5e,0x5f,0x60,0x7b,0x7c,0x7d,0x7e};
int NationalOptionSubsetSV_FI[13]=
{0x23,0x94,0x90,0x5b,0x5c,0x9d,0x5d,0x5f,0x91,0x7b,0x7c,0x99,0x7d};
int NationalOptionSubsetIT[13]=
{0x83,0x24,0xd3,0x60,0xcc,0x8d,0x8e,0x23,0xdd,0xc1,0xc8,0xc9,0xca};
{0x83,0x24,0x91,0x60,0xcc,0x8d,0x8e,0x23,0xdd,0xc2,0xc8,0xc9,0xca};
int NationalOptionSubsetPT_ES[13]=
{0xcc,0x24,0xe0,0xeb,0x91,0xed,0xee,0xef,0xe1,0x7d,0xe8,0xc9,0xc2};
int NationalOptionSubsetFR[13]=
{0x91,0xd4,0xc2,0xdb,0xdc,0xc1,0xde,0x23,0xc9,0xd2,0xd8,0xd9,0xcc};
int NationalOptionSubsetCZ_SK[13]=
{0x23,0x84,0x85,0x95,0x93,0x92,0xed,0x87,0x91,0xeb,0x8f,0xef,0x86};
int NationalOptionSubsetEE[13]=
{0x23,0xc6,0x96,0x5b,0x5c,0x97,0x5d,0xd6,0x86,0x7b,0x7c,0x93,0x7d};
int NationalOptionSubsetG0Default[13]=
{0x23,0x94,0x80,0 ,0 ,0 ,0x5e,0x5f,0 ,0 ,0 ,0 ,0 };
int NationalOptionSubsetSR_HR_SL[13]=
{0x23,0 ,0 ,0 ,0x97,0xfb,0x96,0xdb,0x85,0 ,0x93,0 ,0x86};
int NationalOptionSubsetLV_LT[13]=
{0x23,0x24,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 };
{0x23,0x24,0x96,0 ,0 ,0x97,0x85,0 ,0x86,0 ,0 ,0x93,0 };
int NationalOptionSubsetPL[13]=
{0x23,0 ,0 ,0 ,0 ,0 ,0 ,0xee,0 ,0 ,0 ,0 ,0 };
int NationalOptionSubsetPT_ES[13]=
{0xcc,0x24,0xe0,0xeb,0xec,0xed,0xee,0xef,0xe1,0x7d,0xe8,0xc9,0xc2};
int NationalOptionSubsetRO[13]=
{0x23,0x94,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0xd2,0 ,0 ,0xde};
int NationalOptionSubsetSR_HR_SL[13]=
{0x23,0 ,0 ,0 ,0 ,0xfb,0 ,0xdb,0 ,0 ,0 ,0 ,0 };
int NationalOptionSubsetSV_FI[13]=
{0x23,0x94,0x90,0x5b,0x5c,0x9d,0x5d,0x5f,0x91,0x7b,0x7c,0x99,0x7d};
int NationalOptionSubsetTR[13]=
{0 ,0 ,0 ,0 ,0x5c,0xd7,0x5d,0 ,0 ,0 ,0x7c,0xcc,0x7d};
inline int NationalOptionSubset(int chr) {
switch (chr) {
case 0x23: return 0;
......
enumCharsets font=c.GetCharset();
int chr=c.GetChar();
unsigned char enh=c.GetEnhance();
unsigned int *bitmap=NULL;
int i;
int NationalOption=NationalOptionSubset(chr);
......
}
break;
case CHARSET_LATIN_G0_CZ_SK:
if (NationalOption>=0) {
if (NationalOptionSubsetCZ_SK[NationalOption]>0)
bitmap=TXT_Font[NationalOptionSubsetCZ_SK[NationalOption]-0x20];
} else {
if (chr>=0x20 && chr<0x80) {
bitmap=TXT_Font[chr-0x20];
}
}
break;
case CHARSET_LATIN_G0_EE:
if (NationalOption>=0) {
if (NationalOptionSubsetEE[NationalOption]>0)
bitmap=TXT_Font[NationalOptionSubsetEE[NationalOption]-0x20];
} else {
if (chr>=0x20 && chr<0x80) {
bitmap=TXT_Font[chr-0x20];
}
}
break;
case CHARSET_LATIN_G0_LV_LT:
if (NationalOption>=0) {
if (NationalOptionSubsetLV_LT[NationalOption]>0)
bitmap=TXT_Font[NationalOptionSubsetLV_LT[NationalOption]-0x20];
} else {
if (chr>=0x20 && chr<0x80) {
bitmap=TXT_Font[chr-0x20];
}
}
break;
case CHARSET_LATIN_G0_PL:
if (NationalOption>=0) {
if (NationalOptionSubsetPL[NationalOption]>0)
bitmap=TXT_Font[NationalOptionSubsetPL[NationalOption]-0x20];
} else {
if (chr>=0x20 && chr<0x80) {
bitmap=TXT_Font[chr-0x20];
}
}
break;
case CHARSET_LATIN_G0_RO:
if (NationalOption>=0) {
if (NationalOptionSubsetRO[NationalOption]>0)
bitmap=TXT_Font[NationalOptionSubsetRO[NationalOption]-0x20];
} else {
if (chr>=0x20 && chr<0x80) {
bitmap=TXT_Font[chr-0x20];
}
}
break;
case CHARSET_LATIN_G0_SR_HR_SL:
if (NationalOption>=0) {
if (NationalOptionSubsetSR_HR_SL[NationalOption]>0)
bitmap=TXT_Font[NationalOptionSubsetSR_HR_SL[NationalOption]-0x20];
} else {
if (chr>=0x20 && chr<0x80) {
bitmap=TXT_Font[chr-0x20];
}
}
break;
case CHARSET_LATIN_G0_TR:
// Partially supported latin charsets
if (chr>=0x20 && chr<0x80 && NationalOption<0) {
bitmap=TXT_Font[chr-0x20];
if (NationalOption>=0) {
if (NationalOptionSubsetTR[NationalOption]>0)
bitmap=TXT_Font[NationalOptionSubsetTR[NationalOption]-0x20];
} else {
if (chr>=0x20 && chr<0x80) {
bitmap=TXT_Font[chr-0x20];
}
}
break;
case CHARSET_LATIN_G2:
if (enh == 0x42) {
if (chr==0x41){ //A
bitmap=TXT_Font[0xf0-0x20];
} else if (chr==0x45){//E
bitmap=TXT_Font[0x90-0x20];
} else if (chr==0x49){//I
bitmap=TXT_Font[0xf3-0x20];
} else if (chr==0x4f){//O
bitmap=TXT_Font[0xf5-0x20];
} else if (chr==0x55){//U
bitmap=TXT_Font[0xf7-0x20];
} else if (chr==0x59){//Y
bitmap=TXT_Font[0xc5-0x20];
} else if (chr==0x6f){//o
bitmap=TXT_Font[0xee -0x20];
}
}
else if (enh == 0x48) {
if (chr==0x41){//A
bitmap=TXT_Font[0x5b-0x20];
} else if (chr==0x4f){//O
bitmap=TXT_Font[0x5c-0x20];
} else if (chr==0x55){//U
bitmap=TXT_Font[0x5d-0x20];
} else if (chr==0x61){//a
bitmap=TXT_Font[0x7b-0x20];
} else if (chr==0x6f){//o
bitmap=TXT_Font[0x7c-0x20];
} else if (chr==0x75){//u
bitmap=TXT_Font[0x7d-0x20];
}
}
else if (enh == 0x4a) {
if (chr==0x55){//U
bitmap=TXT_Font[0x9a-0x20];
}
}
else if (enh == 0x4f) {
if (chr==0x43){//C
bitmap=TXT_Font[0x9b-0x20];
} else if (chr==0x44){//D
bitmap=TXT_Font[0x9c-0x20];
} else if (chr==0x45){//E
bitmap=TXT_Font[0x98-0x20];
} else if (chr==0x4e){//N
bitmap=TXT_Font[0x9f-0x20];
} else if (chr==0x52){//R
bitmap=TXT_Font[0xc3-0x20];
} else if (chr==0x53){//S
bitmap=TXT_Font[0x96-0x20];
} else if (chr==0x54){//T
bitmap=TXT_Font[0xc4-0x20];
} else if (chr==0x5a){//Z
bitmap=TXT_Font[0x97-0x20];
} else if (chr==0x64){//d
bitmap=TXT_Font[0x9e -0x20];
} else if (chr==0x6e){//n
bitmap=TXT_Font[0xc0-0x20];
}
}
dsyslog("Warning: CHARSET_LATIN_G2: %x %x %x \n",font,chr,enh);
break;
case CHARSET_CYRILLIC_G0_SR_HR:
case CHARSET_CYRILLIC_G0_RU_BG:
case CHARSET_CYRILLIC_G0_UK:
......
case CHARSET_ARABIC_G0:
case CHARSET_ARABIC_G2:
case CHARSET_HEBREW_G0:
dsyslog("Warning: totally unsupported: %x %x %x \n",font,chr,enh);
// totally unsupported
break;
......
break;
case CHARSET_GRAPHICS_G3:
dsyslog("Warning: CHARSET_LATIN_G3: %x %x\n",font,chr);
break;
case CHARSET_INVALID:
dsyslog("Warning: CHARSET_INVALID: %x %x\n",font,chr);
// Totally unsupported
break;
}
if (!buffer) {
printf("Warning: Undefined char: %x %x\n",font,chr);
if (!buffer || !bitmap) {
return NULL;
}
osdteletext-0.8.2.cz/txtrecv.c 2009-05-26 19:05:32.000000000 +0200
#include <dirent.h>
#include "txtrecv.h"
#include "tables.h"
#include "hamm.h"
#include "setup.h"
#include "menu.h"
......
failedFreeSpace=false;
}
#define TELETEXT_PAGESIZE 972
#define TELETEXT_PAGESIZE (TELEPAGE_SIZE + TRIPPLETS_SIZE*sizeof(int) + 4 + 12)
LegacyStorage::LegacyStorage() {
maxBytes=0;
......
cTelePage::cTelePage(PageID t_page, uchar t_flags, uchar t_lang,int t_mag)
: mag(t_mag), flags(t_flags), lang(t_lang), page(t_page)
{
memset(pagebuf,' ',26*40);
memset(pagebuf,' ',TELEPAGE_SIZE);
memset(tripplets,0,TRIPPLETS_SIZE*sizeof(int));
next_des = 0;
}
cTelePage::~cTelePage() {
......
memcpy(pagebuf+40*line,myptr,40);
}
void cTelePage::SetTripplets(int dcode, int *t)
{
if (dcode == next_des)
{
memcpy(tripplets + dcode * 13, t, 13 * sizeof(*t));
next_des++;
}
else
next_des = -1;
}
void cTelePage::save()
{
Storage *s=Storage::instance();
unsigned char buf;
StorageHandle fd;
......
buf=lang; s->write(&buf,1,fd);
buf=0x00; s->write(&buf,1,fd);
buf=0x00; s->write(&buf,1,fd);
s->write(pagebuf,24*40,fd);
s->write(pagebuf,TELEPAGE_SIZE,fd);
s->write(&next_des,4,fd);
s->write(tripplets,TRIPPLETS_SIZE*sizeof(int),fd);
s->close(fd);
}
}
......
for (int i=0; i < 4; i++) {
if (Datai[4+i*46]==2 || Datai[4+i*46]==3) {
for (int j=(8+i*46);j<(50+i*46);j++)
Datai[j]=invtab[Datai[j]];
Datai[j]=doinvert(Datai[j]);
DecodeTXT(&Datai[i*46]);
}
}
......
running=false;
}
uchar cTxtReceiver::unham16 (uchar *p)
{
unsigned short c1,c2;
c1=unhamtab[p[0]];
c2=unhamtab[p[1]];
return (c1 & 0x0F) | (c2 & 0x0F) *16;
}
void cTxtReceiver::DecodeTXT(uchar* TXT_buf)
{
// Format of buffer:
......
int hdr,mag,mag8,line;
int err = 0;
uchar *ptr;
uchar flags,lang;
hdr = unham16 (&TXT_buf[0x8]);
hdr = hamm16(&TXT_buf[0x8], &err);
mag = hdr & 0x07;
mag8 = mag ?: 8;
line = (hdr>>3) & 0x1f;
ptr = &TXT_buf[10];
switch (line) {
case 0:
{
unsigned char b1, b2, b3, b4;
int pgno, subno;
b1 = unham16 (ptr);
b1 = hamm16(ptr, &err);
// Page no, 10- and 1-digit
if (b1 == 0xff) break;
......
TxtPage=NULL;
}
b2 = unham16 (ptr+2); // Sub-code 0..6 + C4
b3 = unham16 (ptr+4); // Sub-code 8..13 + C5,C6
b4 = unham16 (ptr+6); // C7..C14
b2 = hamm16(ptr+2, &err); // Sub-code 0..6 + C4
b3 = hamm16(ptr+4, &err); // Sub-code 8..13 + C5,C6
b4 = hamm16(ptr+6, &err); // C7..C14
// if (err & 0xf000){
// esyslog("OSDTeletext: b1,b2,b3,b4=hamm16");
// return;
// }
// flags:
// 0x80 C4 - Erase page
......
TxtPage->SetLine((int)line,(uchar *)ptr);
break;
}
case 1 ... 25:
case 1 ... 24:
{
if (TxtPage) TxtPage->SetLine((int)line,(uchar *)ptr);
break;
}
/*case 23:
case 26:
{
if (TxtPage) {
TxtPage->save();
delete TxtPage;
TxtPage=NULL;
}
int d, t[13];
d = hamm8(ptr, &err);
// if (err & 0xf000){
// esyslog("OSDTeletext: d=hamm8");
// return;
// }
for (int i = 0; i < 13; ++i)
t[i] = hamm24(ptr + 1 + 3*i, &err);
// if (err & 0xf000){
// esyslog("OSDTeletext: hamm24");
// return;
// }
if (TxtPage) TxtPage->SetTripplets(d, t);
break;
}*/
}
/* case 27:
{
// FLOF data (FastText)
int b1,b2,b3,x;
if (~cvtp->flags & PG_ACTIVE)
return 0; // -1 flushes all pages. we may never resync again :(
b1 = hamm8(p, &err);
b2 = hamm8(p + 37, &err);
if (err & 0xf000)
return 4;
if (b1 != 0 || not(b2 & 8))
return 0;
for (i = 0; i < 6; ++i)
{
err = 0;
b1 = hamm16(p+1+6*i, &err);
b2 = hamm16(p+3+6*i, &err);
b3 = hamm16(p+5+6*i, &err);
if (err & 0xf000)
return 1;
x = (b2 >> 7) | ((b3 >> 5) & 0x06);
cvtp->link[i].pgno = ((mag ^ x) ?: 8) * 256 + b1;
cvtp->link[i].subno = (b2 + b3 * 256) & 0x3f7f;
}
cvtp->flof = 1;
return 0;
}
case 30:
{
if (mag8 != 8)
return 0;
p[0] = hamm8(p, &err); // designation code
p[1] = hamm16(p+1, &err); // initial page
p[3] = hamm16(p+3, &err); // initial subpage + mag
p[5] = hamm16(p+5, &err); // initial subpage + mag
if (err & 0xf000)
return 4;
err += chk_parity(p+20, 20);
conv2latin(p+20, 20, 0);
vbi_send(vbi, EV_XPACKET, mag8, pkt, err, p);
return 0;
}*/
default:
break;
}
osdteletext-0.8.2.cz/txtrecv.h 2009-05-26 19:00:30.000000000 +0200
void registerFile(PageID page);
};
#define TRIPPLETS_SIZE 13*16
#define TELEPAGE_SIZE 24*40
class cTelePage {
private:
int mag;
unsigned char flags;
unsigned char lang;
PageID page;
unsigned char pagebuf[27*40];
unsigned char pagebuf[TELEPAGE_SIZE];
int tripplets[TRIPPLETS_SIZE]; // tripplets
int next_des; // next expected designation code
char Directory [255];
public:
cTelePage(PageID page, uchar flags, uchar lang, int mag);
~cTelePage();
void SetLine(int, uchar*);
void SetTripplets(int dcode, int *t);
void save();
};
......
class cTxtReceiver : public cReceiver, public cThread {
private:
void DecodeTXT(uchar*);
uchar unham16 (uchar*);
tChannelID chan;
cTelePage *TxtPage;
protected:
osdteletext-0.8.2.cz/txtrender.c 2009-05-26 19:00:30.000000000 +0200
#include <strings.h>
#include "txtrender.h"
#include <vdr/tools.h>
#include "txtrecv.h"
// Font tables
......
void cRenderPage::RenderTeletextCode(unsigned char *PageCode) {
int x,y;
bool EmptyNextLine=false;
cTeletextChar c;
// Skip one line, in case double height chars were/will be used
// Get code pages:
int LocalG0CodePage=(FirstG0CodePage & 0x78)
int LocalG0CodePage=(FirstG0CodePage & 0x78)
| ((Lang & 0x04)>>2) | (Lang & 0x02) | ((Lang & 0x01)<<2);
enumCharsets FirstG0=GetG0Charset(LocalG0CodePage);
enumCharsets SecondG0=GetG0Charset(SecondG0CodePage);
// Reserved for later use:
// enumCharsets FirstG2=GetG2Charset(LocalG0CodePage);
for (y=0;y<24;(EmptyNextLine?y+=2:y++)) {
// Start of line: Set start of line defaults
// Hold Mosaics mode: Remember last mosaic char/charset
// for next spacing code
bool HoldMosaics=false;
......
EmptyNextLine=false;
// Skip next line, for double-height
cTeletextChar c;
// auto.initialized to everything off
c.SetFGColor(ttcWhite);
c.SetBGColor(ttcBlack);
......
}
SetChar(x,24,c);
}
//enhanced code
int next_des = *(int *)(PageCode+TELEPAGE_SIZE);
int *eh = (int *)(PageCode+TELEPAGE_SIZE+4);
int row = 0;
int *p, *e;
if (next_des < 1)
return;
for (p = eh, e = p + next_des * 13; p < e; p++)
if (*p % 2048 != 2047)
{
int adr = *p % 64;
int mode = *p / 64 % 32;
int data = *p / 2048 % 128;
if (adr < 40)
{
// col functions
switch (mode)
{
case 15: // char from G2 set
c = GetChar(adr, row);
c.SetCharset(CHARSET_LATIN_G2);
c.SetEnhance(data);
c.SetChar(0x20);
SetChar(adr, row, c);
// esyslog("char from G2 set adr=%d,row=%d,data=%d", adr, row, data);
break;
case 16 ... 31: // char from G0 set with diacritical mark
c = GetChar(adr, row);
c.SetCharset(CHARSET_LATIN_G2);
c.SetEnhance(0x40|(mode&0x0f));
c.SetChar(data);
SetChar(adr, row, c);
// esyslog("char from G0 set with diacritical mark adr=%d,row=%d,data=%d", adr, row, data);
break;
}
}
else
{
// row functions
if ((adr -= 40) == 0)
adr = 24;
switch (mode)
{
case 1: // full row color
row = adr;
break;
case 4: // set active position
row = adr;
break;
case 7: // address row 0 (+ full row color)
if (adr == 23)
row = 0;
break;
}
}
}
}
osdteletext-0.8.2.cz/txtrender.h 2009-05-26 19:00:31.000000000 +0200
protected:
unsigned int c;
unsigned char eh;
static const unsigned int CHAR = 0x000000FF;
// character code
......
static const unsigned int BLINK = 0x80000000;
// blinking character
cTeletextChar(unsigned int cc) { c=cc; }
cTeletextChar(unsigned int cc, unsigned char ee) { c=cc; eh=ee; }
public:
cTeletextChar() { c=0; }
cTeletextChar() { c=0; eh=0;}
// inline helper functions:
// For each parameter encoded into the 32-bit int, there is
......
inline void SetChar(unsigned char chr)
{ c=(c&~CHAR)|chr; }
inline cTeletextChar ToChar(unsigned char chr)
{ return cTeletextChar((c&~CHAR)|chr); }
{ return cTeletextChar((c&~CHAR)|chr, eh); }
inline unsigned char GetEnhance()
{ return eh; }
inline void SetEnhance(unsigned char chr)
{ eh=chr; }
inline enumCharsets GetCharset()
{ return (enumCharsets)(c&CHARSET); }
inline void SetCharset(enumCharsets charset)
{ c=(c&~CHARSET)|charset; }
inline cTeletextChar ToCharset(enumCharsets charset)
{ return cTeletextChar((c&~CHARSET)|charset); }
{ return cTeletextChar((c&~CHARSET)|charset, eh); }
inline enumTeletextColor GetFGColor()
{ return (enumTeletextColor)((c&FGCOLOR) >> LowestSet32Bit(FGCOLOR)); }
inline void SetFGColor(enumTeletextColor fgc)
{ c=(c&~FGCOLOR) | (fgc << LowestSet32Bit(FGCOLOR)); }
inline cTeletextChar ToFGColor(enumTeletextColor fgc)
{ return cTeletextChar((c&~FGCOLOR) | (fgc << LowestSet32Bit(FGCOLOR))); }
{ return cTeletextChar((c&~FGCOLOR) | (fgc << LowestSet32Bit(FGCOLOR)), eh); }
inline enumTeletextColor GetBGColor()
{ return (enumTeletextColor)((c&BGCOLOR) >> LowestSet32Bit(BGCOLOR)); }
inline void SetBGColor(enumTeletextColor bgc)
{ c=(c&~BGCOLOR) | (bgc << LowestSet32Bit(BGCOLOR)); }
inline cTeletextChar ToBGColor(enumTeletextColor bgc)
... This diff was truncated because it exceeds the maximum size that can be displayed.
    (1-1/1)