annotate libmpcodecs/dec_teletext.h @ 31259:dc3954ca63ca

Remove explicit eof check for mp_read code, stream code handles this case better, e.g. properly supporting growing files.
author reimar
date Sat, 05 Jun 2010 16:12:36 +0000
parents b06429c8c104
children 99ac85950277
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29426
1cedde378788 Add standard GPL license header. Patch by Francesco Lavra, francescolavra interfree it
cehoyos
parents: 29425
diff changeset
1 /*
29759
d287e2785570 Move teletext specific code from stream into libmpcodecs.
cehoyos
parents: 29479
diff changeset
2 * Teletext support
29426
1cedde378788 Add standard GPL license header. Patch by Francesco Lavra, francescolavra interfree it
cehoyos
parents: 29425
diff changeset
3 *
1cedde378788 Add standard GPL license header. Patch by Francesco Lavra, francescolavra interfree it
cehoyos
parents: 29425
diff changeset
4 * Copyright (C) 2007 Vladimir Voroshilov <voroshil@gmail.com>
1cedde378788 Add standard GPL license header. Patch by Francesco Lavra, francescolavra interfree it
cehoyos
parents: 29425
diff changeset
5 *
1cedde378788 Add standard GPL license header. Patch by Francesco Lavra, francescolavra interfree it
cehoyos
parents: 29425
diff changeset
6 * This file is part of MPlayer.
1cedde378788 Add standard GPL license header. Patch by Francesco Lavra, francescolavra interfree it
cehoyos
parents: 29425
diff changeset
7 *
1cedde378788 Add standard GPL license header. Patch by Francesco Lavra, francescolavra interfree it
cehoyos
parents: 29425
diff changeset
8 * MPlayer is free software; you can redistribute it and/or modify
1cedde378788 Add standard GPL license header. Patch by Francesco Lavra, francescolavra interfree it
cehoyos
parents: 29425
diff changeset
9 * it under the terms of the GNU General Public License as published by
1cedde378788 Add standard GPL license header. Patch by Francesco Lavra, francescolavra interfree it
cehoyos
parents: 29425
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
1cedde378788 Add standard GPL license header. Patch by Francesco Lavra, francescolavra interfree it
cehoyos
parents: 29425
diff changeset
11 * (at your option) any later version.
1cedde378788 Add standard GPL license header. Patch by Francesco Lavra, francescolavra interfree it
cehoyos
parents: 29425
diff changeset
12 *
1cedde378788 Add standard GPL license header. Patch by Francesco Lavra, francescolavra interfree it
cehoyos
parents: 29425
diff changeset
13 * MPlayer is distributed in the hope that it will be useful,
1cedde378788 Add standard GPL license header. Patch by Francesco Lavra, francescolavra interfree it
cehoyos
parents: 29425
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1cedde378788 Add standard GPL license header. Patch by Francesco Lavra, francescolavra interfree it
cehoyos
parents: 29425
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1cedde378788 Add standard GPL license header. Patch by Francesco Lavra, francescolavra interfree it
cehoyos
parents: 29425
diff changeset
16 * GNU General Public License for more details.
1cedde378788 Add standard GPL license header. Patch by Francesco Lavra, francescolavra interfree it
cehoyos
parents: 29425
diff changeset
17 *
1cedde378788 Add standard GPL license header. Patch by Francesco Lavra, francescolavra interfree it
cehoyos
parents: 29425
diff changeset
18 * You should have received a copy of the GNU General Public License along
1cedde378788 Add standard GPL license header. Patch by Francesco Lavra, francescolavra interfree it
cehoyos
parents: 29425
diff changeset
19 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
1cedde378788 Add standard GPL license header. Patch by Francesco Lavra, francescolavra interfree it
cehoyos
parents: 29425
diff changeset
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1cedde378788 Add standard GPL license header. Patch by Francesco Lavra, francescolavra interfree it
cehoyos
parents: 29425
diff changeset
21 */
1cedde378788 Add standard GPL license header. Patch by Francesco Lavra, francescolavra interfree it
cehoyos
parents: 29425
diff changeset
22
29759
d287e2785570 Move teletext specific code from stream into libmpcodecs.
cehoyos
parents: 29479
diff changeset
23 #ifndef MPLAYER_DEC_TELETEXT_H
d287e2785570 Move teletext specific code from stream into libmpcodecs.
cehoyos
parents: 29479
diff changeset
24 #define MPLAYER_DEC_TELETEXT_H
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
25
29806
a5e7590ffdbd Separate teletext from tv support.
cehoyos
parents: 29760
diff changeset
26 struct tt_param {
a5e7590ffdbd Separate teletext from tv support.
cehoyos
parents: 29760
diff changeset
27 char *device; ///< teletext device
a5e7590ffdbd Separate teletext from tv support.
cehoyos
parents: 29760
diff changeset
28 int format; ///< teletext display format
a5e7590ffdbd Separate teletext from tv support.
cehoyos
parents: 29760
diff changeset
29 int page; ///< start teletext page
a5e7590ffdbd Separate teletext from tv support.
cehoyos
parents: 29760
diff changeset
30 int lang; ///< primary language code
a5e7590ffdbd Separate teletext from tv support.
cehoyos
parents: 29760
diff changeset
31 };
a5e7590ffdbd Separate teletext from tv support.
cehoyos
parents: 29760
diff changeset
32
29760
1cc8a20520e8 Add MSGT_TELETEXT, rename TVI_CONTROL as VBI_CONTROL and fix some paths
cehoyos
parents: 29759
diff changeset
33 #define VBI_CONTROL_FALSE 0
1cc8a20520e8 Add MSGT_TELETEXT, rename TVI_CONTROL as VBI_CONTROL and fix some paths
cehoyos
parents: 29759
diff changeset
34 #define VBI_CONTROL_TRUE 1
1cc8a20520e8 Add MSGT_TELETEXT, rename TVI_CONTROL as VBI_CONTROL and fix some paths
cehoyos
parents: 29759
diff changeset
35 #define VBI_CONTROL_UNKNOWN -1
1cc8a20520e8 Add MSGT_TELETEXT, rename TVI_CONTROL as VBI_CONTROL and fix some paths
cehoyos
parents: 29759
diff changeset
36
29759
d287e2785570 Move teletext specific code from stream into libmpcodecs.
cehoyos
parents: 29479
diff changeset
37 int teletext_control(void* p, int cmd, void *arg);
23900
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
38
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28940
diff changeset
39 /*
29425
281ab18d64ca Fix more typos. Patch by Francesco Lavra, francescolavra interfree it
cehoyos
parents: 29424
diff changeset
40 TELETEXT controls (through teletext_control() )
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28940
diff changeset
41 NOTE:
23900
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
42 _SET_ should be _GET_ +1
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
43 _STEP_ should be _GET_ +2
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
44 */
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
45 #define TV_VBI_CONTROL_GET_MODE 0x510 ///< get current mode teletext
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
46 #define TV_VBI_CONTROL_SET_MODE 0x511 ///< on/off grab teletext
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
47
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
48 #define TV_VBI_CONTROL_GET_PAGE 0x513 ///< get grabbed teletext page
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
49 #define TV_VBI_CONTROL_SET_PAGE 0x514 ///< set grab teletext page number
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
50 #define TV_VBI_CONTROL_STEP_PAGE 0x515 ///< step grab teletext page number
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
51
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
52 #define TV_VBI_CONTROL_GET_SUBPAGE 0x516 ///< get grabbed teletext page
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
53 #define TV_VBI_CONTROL_SET_SUBPAGE 0x517 ///< set grab teletext page number
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
54
29425
281ab18d64ca Fix more typos. Patch by Francesco Lavra, francescolavra interfree it
cehoyos
parents: 29424
diff changeset
55 #define TV_VBI_CONTROL_GET_FORMAT 0x519 ///< get teletext format
23900
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
56 #define TV_VBI_CONTROL_SET_FORMAT 0x51a ///< set teletext format
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
57
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
58 #define TV_VBI_CONTROL_GET_HALF_PAGE 0x51c ///< get current half page
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
59 #define TV_VBI_CONTROL_SET_HALF_PAGE 0x51d ///< switch half page
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
60
24342
8873c972c6aa Decrease teletext page rendering frequency from 1/frame to about 4/sec.
voroshil
parents: 24292
diff changeset
61 #define TV_VBI_CONTROL_IS_CHANGED 0x540 ///< teletext page is changed
8873c972c6aa Decrease teletext page rendering frequency from 1/frame to about 4/sec.
voroshil
parents: 24292
diff changeset
62 #define TV_VBI_CONTROL_MARK_UNCHANGED 0x541 ///< teletext page is changed
8873c972c6aa Decrease teletext page rendering frequency from 1/frame to about 4/sec.
voroshil
parents: 24292
diff changeset
63
23900
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
64 #define TV_VBI_CONTROL_ADD_DEC 0x550 ///< add page number with dec
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
65 #define TV_VBI_CONTROL_GO_LINK 0x551 ///< go link (1..6) NYI
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
66 #define TV_VBI_CONTROL_GET_VBIPAGE 0x552 ///< get vbi_image for grabbed teletext page
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
67 #define TV_VBI_CONTROL_RESET 0x553 ///< vbi reset
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
68 #define TV_VBI_CONTROL_START 0x554 ///< vbi start
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
69 #define TV_VBI_CONTROL_STOP 0x555 ///< vbi stop
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
70 #define TV_VBI_CONTROL_DECODE_PAGE 0x556 ///< decode vbi page
24232
d0290b80e612 Implement 8/30 format 1 teletext packet decoding
voroshil
parents: 24183
diff changeset
71 #define TV_VBI_CONTROL_GET_NETWORKNAME 0x557 ///< get current network name
29833
b06429c8c104 Add support for DVB teletext.
reimar
parents: 29809
diff changeset
72 #define TV_VBI_CONTROL_DECODE_DVB 0x558 ///< decode DVB teletext
23900
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
73
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
74 #define VBI_TFORMAT_TEXT 0 ///< text mode
29425
281ab18d64ca Fix more typos. Patch by Francesco Lavra, francescolavra interfree it
cehoyos
parents: 29424
diff changeset
75 #define VBI_TFORMAT_BW 1 ///< black&white mode
23900
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
76 #define VBI_TFORMAT_GRAY 2 ///< grayscale mode
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
77 #define VBI_TFORMAT_COLOR 3 ///< color mode (require color_spu patch!)
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
78
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
79 #define VBI_MAX_PAGES 0x800 ///< max sub pages number
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
80 #define VBI_MAX_SUBPAGES 64 ///< max sub pages number
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
81
24183
820df52200db Enable decoding of packet X/24, it is usual teletext line
voroshil
parents: 24105
diff changeset
82 #define VBI_ROWS 25 ///< teletext page height in rows
820df52200db Enable decoding of packet X/24, it is usual teletext line
voroshil
parents: 24105
diff changeset
83 #define VBI_COLUMNS 40 ///< teletext page width in chars
23900
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
84 #define VBI_TIME_LINEPOS 26 ///< time line pos in page header
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
85
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
86 typedef
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
87 enum{
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
88 TT_FORMAT_OPAQUE=0, ///< opaque
29423
a4520dfd3e62 Fix typos. Patch by Francesco Lavra, francescolavra interfree it
cehoyos
parents: 29263
diff changeset
89 TT_FORMAT_TRANSPARENT, ///< transparent
23900
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
90 TT_FORMAT_OPAQUE_INV, ///< opaque with inverted colors
29423
a4520dfd3e62 Fix typos. Patch by Francesco Lavra, francescolavra interfree it
cehoyos
parents: 29263
diff changeset
91 TT_FORMAT_TRANSPARENT_INV ///< transparent with inverted colors
23900
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
92 } teletext_format;
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
93
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
94 typedef
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
95 enum{
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
96 TT_ZOOM_NORMAL=0,
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
97 TT_ZOOM_TOP_HALF,
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
98 TT_ZOOM_BOTTOM_HALF
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
99 } teletext_zoom;
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
100
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
101 typedef struct tt_char_s{
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
102 unsigned int unicode; ///< unicode (utf8) character
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
103 unsigned char fg; ///< foreground color
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
104 unsigned char bg; ///< background color
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
105 unsigned char gfx; ///< 0-no gfx, 1-solid gfx, 2-separated gfx
24292
ca146808e926 Proper support for flashing chars in teletext pages.
voroshil
parents: 24290
diff changeset
106 unsigned char flh; ///< 0-no flash, 1-flash
24344
09d402672398 Implement boxes for subtitle teletext pages.
voroshil
parents: 24342
diff changeset
107 unsigned char hidden; ///< char is hidden (for subtitle pages)
23900
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
108 unsigned char ctl; ///< control character
24290
ca7ee5c1b88d Support for selecting language via packet 28.
voroshil
parents: 24244
diff changeset
109 unsigned char lng; ///< lang: 0-secondary language,1-primary language
23900
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
110 unsigned char raw; ///< raw character (as received from device)
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
111 } tt_char;
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
112
24244
e446bad0872c Implement X/27/0 packet decoding.
voroshil
parents: 24232
diff changeset
113 typedef struct tt_link_s{
e446bad0872c Implement X/27/0 packet decoding.
voroshil
parents: 24232
diff changeset
114 int pagenum; ///< page number
e446bad0872c Implement X/27/0 packet decoding.
voroshil
parents: 24232
diff changeset
115 int subpagenum; ///< subpage number
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28940
diff changeset
116 } tt_link_t;
24244
e446bad0872c Implement X/27/0 packet decoding.
voroshil
parents: 24232
diff changeset
117
23900
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
118 typedef struct tt_page_s{
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
119 int pagenum; ///< page number
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
120 int subpagenum; ///< subpage number
24290
ca7ee5c1b88d Support for selecting language via packet 28.
voroshil
parents: 24244
diff changeset
121 unsigned char primary_lang; ///< primary language code
ca7ee5c1b88d Support for selecting language via packet 28.
voroshil
parents: 24244
diff changeset
122 unsigned char secondary_lang; ///< secondary language code
23900
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
123 unsigned char active; ///< page is complete and ready for rendering
24344
09d402672398 Implement boxes for subtitle teletext pages.
voroshil
parents: 24342
diff changeset
124 unsigned char flags; ///< page flags
23900
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
125 unsigned char raw[VBI_ROWS*VBI_COLUMNS]; ///< page data
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
126 struct tt_page_s* next_subpage;
24244
e446bad0872c Implement X/27/0 packet decoding.
voroshil
parents: 24232
diff changeset
127 struct tt_link_s links[6];
23900
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
128 } tt_page;
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
129
24344
09d402672398 Implement boxes for subtitle teletext pages.
voroshil
parents: 24342
diff changeset
130 #define TT_PGFL_SUPPRESS_HEADER 0x01
09d402672398 Implement boxes for subtitle teletext pages.
voroshil
parents: 24342
diff changeset
131 #define TT_PGFL_UPDATE_INDICATOR 0x02
09d402672398 Implement boxes for subtitle teletext pages.
voroshil
parents: 24342
diff changeset
132 #define TT_PGFL_INTERRUPTED_SEQ 0x04
09d402672398 Implement boxes for subtitle teletext pages.
voroshil
parents: 24342
diff changeset
133 #define TT_PGFL_INHIBIT_DISPLAY 0x08
09d402672398 Implement boxes for subtitle teletext pages.
voroshil
parents: 24342
diff changeset
134 #define TT_PGFL_NEWFLASH 0x10
09d402672398 Implement boxes for subtitle teletext pages.
voroshil
parents: 24342
diff changeset
135 #define TT_PGFL_SUBTITLE 0x20
09d402672398 Implement boxes for subtitle teletext pages.
voroshil
parents: 24342
diff changeset
136 #define TT_PGFL_ERASE_PAGE 0x40
09d402672398 Implement boxes for subtitle teletext pages.
voroshil
parents: 24342
diff changeset
137 #define TT_PGFL_MAGAZINE_SERIAL 0x80
09d402672398 Implement boxes for subtitle teletext pages.
voroshil
parents: 24342
diff changeset
138
23900
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
139 typedef struct tt_stream_props_s{
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
140 int sampling_rate;
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
141 int samples_per_line;
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
142 int offset;
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
143 int count[2]; ///< number of lines in first and second fields
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
144 int interlaced; ///< vbi data are interlaced
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
145 int bufsize; ///< required buffer size
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
146 } tt_stream_props;
b5cc28c45d73 Teletext support.
voroshil
parents: 23889
diff changeset
147
29759
d287e2785570 Move teletext specific code from stream into libmpcodecs.
cehoyos
parents: 29479
diff changeset
148 #endif /* MPLAYER_DEC_TELETEXT_H */