Mercurial > mplayer.hg
annotate libmpcodecs/dec_teletext.h @ 34757:da38eb1e2069
subassconvert: handle "\r\n" line ends
Previously the code converting text subtitles to ASS format converted newline
characters, and only those, to ASS "new line" markup. If the subtitles
contained "\r\n", the "\r" was thus left in the text. In previous libass
versions the "\r" was not visible, but in the current one it produces an empty
box. Improve the conversion to remove the "\r" in that case. Also treat a lone
"\r" as a newline.
Picked from mplayer2/3e0a2705
author | cboesch |
---|---|
date | Sat, 07 Apr 2012 11:17:09 +0000 |
parents | b06429c8c104 |
children | 99ac85950277 |
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 | 25 |
29806 | 26 struct tt_param { |
27 char *device; ///< teletext device | |
28 int format; ///< teletext display format | |
29 int page; ///< start teletext page | |
30 int lang; ///< primary language code | |
31 }; | |
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 | 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 | 42 _SET_ should be _GET_ +1 |
43 _STEP_ should be _GET_ +2 | |
44 */ | |
45 #define TV_VBI_CONTROL_GET_MODE 0x510 ///< get current mode teletext | |
46 #define TV_VBI_CONTROL_SET_MODE 0x511 ///< on/off grab teletext | |
47 | |
48 #define TV_VBI_CONTROL_GET_PAGE 0x513 ///< get grabbed teletext page | |
49 #define TV_VBI_CONTROL_SET_PAGE 0x514 ///< set grab teletext page number | |
50 #define TV_VBI_CONTROL_STEP_PAGE 0x515 ///< step grab teletext page number | |
51 | |
52 #define TV_VBI_CONTROL_GET_SUBPAGE 0x516 ///< get grabbed teletext page | |
53 #define TV_VBI_CONTROL_SET_SUBPAGE 0x517 ///< set grab teletext page number | |
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 | 56 #define TV_VBI_CONTROL_SET_FORMAT 0x51a ///< set teletext format |
57 | |
58 #define TV_VBI_CONTROL_GET_HALF_PAGE 0x51c ///< get current half page | |
59 #define TV_VBI_CONTROL_SET_HALF_PAGE 0x51d ///< switch half page | |
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 | 64 #define TV_VBI_CONTROL_ADD_DEC 0x550 ///< add page number with dec |
65 #define TV_VBI_CONTROL_GO_LINK 0x551 ///< go link (1..6) NYI | |
66 #define TV_VBI_CONTROL_GET_VBIPAGE 0x552 ///< get vbi_image for grabbed teletext page | |
67 #define TV_VBI_CONTROL_RESET 0x553 ///< vbi reset | |
68 #define TV_VBI_CONTROL_START 0x554 ///< vbi start | |
69 #define TV_VBI_CONTROL_STOP 0x555 ///< vbi stop | |
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 | 72 #define TV_VBI_CONTROL_DECODE_DVB 0x558 ///< decode DVB teletext |
23900 | 73 |
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 | 76 #define VBI_TFORMAT_GRAY 2 ///< grayscale mode |
77 #define VBI_TFORMAT_COLOR 3 ///< color mode (require color_spu patch!) | |
78 | |
79 #define VBI_MAX_PAGES 0x800 ///< max sub pages number | |
80 #define VBI_MAX_SUBPAGES 64 ///< max sub pages number | |
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 | 84 #define VBI_TIME_LINEPOS 26 ///< time line pos in page header |
85 | |
86 typedef | |
87 enum{ | |
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 | 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 | 92 } teletext_format; |
93 | |
94 typedef | |
95 enum{ | |
96 TT_ZOOM_NORMAL=0, | |
97 TT_ZOOM_TOP_HALF, | |
98 TT_ZOOM_BOTTOM_HALF | |
99 } teletext_zoom; | |
100 | |
101 typedef struct tt_char_s{ | |
102 unsigned int unicode; ///< unicode (utf8) character | |
103 unsigned char fg; ///< foreground color | |
104 unsigned char bg; ///< background color | |
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 | 107 unsigned char hidden; ///< char is hidden (for subtitle pages) |
23900 | 108 unsigned char ctl; ///< control character |
24290 | 109 unsigned char lng; ///< lang: 0-secondary language,1-primary language |
23900 | 110 unsigned char raw; ///< raw character (as received from device) |
111 } tt_char; | |
112 | |
24244 | 113 typedef struct tt_link_s{ |
114 int pagenum; ///< page number | |
115 int subpagenum; ///< subpage number | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28940
diff
changeset
|
116 } tt_link_t; |
24244 | 117 |
23900 | 118 typedef struct tt_page_s{ |
119 int pagenum; ///< page number | |
120 int subpagenum; ///< subpage number | |
24290 | 121 unsigned char primary_lang; ///< primary language code |
122 unsigned char secondary_lang; ///< secondary language code | |
23900 | 123 unsigned char active; ///< page is complete and ready for rendering |
24344 | 124 unsigned char flags; ///< page flags |
23900 | 125 unsigned char raw[VBI_ROWS*VBI_COLUMNS]; ///< page data |
126 struct tt_page_s* next_subpage; | |
24244 | 127 struct tt_link_s links[6]; |
23900 | 128 } tt_page; |
129 | |
24344 | 130 #define TT_PGFL_SUPPRESS_HEADER 0x01 |
131 #define TT_PGFL_UPDATE_INDICATOR 0x02 | |
132 #define TT_PGFL_INTERRUPTED_SEQ 0x04 | |
133 #define TT_PGFL_INHIBIT_DISPLAY 0x08 | |
134 #define TT_PGFL_NEWFLASH 0x10 | |
135 #define TT_PGFL_SUBTITLE 0x20 | |
136 #define TT_PGFL_ERASE_PAGE 0x40 | |
137 #define TT_PGFL_MAGAZINE_SERIAL 0x80 | |
138 | |
23900 | 139 typedef struct tt_stream_props_s{ |
140 int sampling_rate; | |
141 int samples_per_line; | |
142 int offset; | |
143 int count[2]; ///< number of lines in first and second fields | |
144 int interlaced; ///< vbi data are interlaced | |
145 int bufsize; ///< required buffer size | |
146 } tt_stream_props; | |
147 | |
29759
d287e2785570
Move teletext specific code from stream into libmpcodecs.
cehoyos
parents:
29479
diff
changeset
|
148 #endif /* MPLAYER_DEC_TELETEXT_H */ |