annotate dvdsub.c @ 2756:d8874c8749ec libavcodec

subtitle codec type support
author bellard
date Fri, 03 Jun 2005 13:59:38 +0000
parents
children 217844bd1fa1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2756
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
1 /*
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
2 * DVD subtitle decoding for ffmpeg
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
3 * Copyright (c) 2005 Fabrice Bellard.
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
4 *
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
5 * This library is free software; you can redistribute it and/or
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
8 * version 2 of the License, or (at your option) any later version.
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
9 *
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
10 * This library is distributed in the hope that it will be useful,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
13 * Lesser General Public License for more details.
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
14 *
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
16 * License along with this library; if not, write to the Free Software
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
18 */
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
19 #include "avcodec.h"
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
20
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
21 //#define DEBUG
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
22
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
23 typedef struct DVDSubContext {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
24 } DVDSubContext;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
25
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
26 static int dvdsub_init_decoder(AVCodecContext *avctx)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
27 {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
28 return 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
29 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
30
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
31 uint16_t getbe16(const uint8_t *p)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
32 {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
33 return (p[0] << 8) | p[1];
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
34 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
35
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
36 int get_nibble(const uint8_t *buf, int nibble_offset)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
37 {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
38 return (buf[nibble_offset >> 1] >> ((1 - (nibble_offset & 1)) << 2)) & 0xf;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
39 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
40
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
41 static int decode_rle(uint8_t *bitmap, int linesize, int w, int h,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
42 const uint8_t *buf, int nibble_offset, int buf_size)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
43 {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
44 unsigned int v;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
45 int x, y, len, color, nibble_end;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
46 uint8_t *d;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
47
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
48 nibble_end = buf_size * 2;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
49 x = 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
50 y = 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
51 d = bitmap;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
52 for(;;) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
53 if (nibble_offset >= nibble_end)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
54 return -1;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
55 v = get_nibble(buf, nibble_offset++);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
56 if (v < 0x4) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
57 v = (v << 4) | get_nibble(buf, nibble_offset++);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
58 if (v < 0x10) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
59 v = (v << 4) | get_nibble(buf, nibble_offset++);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
60 if (v < 0x040) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
61 v = (v << 4) | get_nibble(buf, nibble_offset++);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
62 if (v < 4) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
63 v |= (w - x) << 2;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
64 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
65 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
66 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
67 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
68 len = v >> 2;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
69 if (len > (w - x))
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
70 len = (w - x);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
71 color = v & 0x03;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
72 memset(d + x, color, len);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
73 x += len;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
74 if (x >= w) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
75 y++;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
76 if (y >= h)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
77 break;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
78 d += linesize;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
79 x = 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
80 /* byte align */
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
81 nibble_offset += (nibble_offset & 1);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
82 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
83 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
84 return 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
85 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
86
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
87 static void guess_palette(uint32_t *rgba_palette,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
88 uint8_t *palette,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
89 uint8_t *alpha,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
90 uint32_t subtitle_color)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
91 {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
92 uint8_t color_used[16];
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
93 int nb_opaque_colors, i, level, j, r, g, b;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
94
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
95 for(i = 0; i < 4; i++)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
96 rgba_palette[i] = 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
97
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
98 memset(color_used, 0, 16);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
99 nb_opaque_colors = 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
100 for(i = 0; i < 4; i++) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
101 if (alpha[i] != 0 && !color_used[palette[i]]) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
102 color_used[palette[i]] = 1;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
103 nb_opaque_colors++;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
104 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
105 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
106
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
107 if (nb_opaque_colors == 0)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
108 return;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
109
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
110 j = 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
111 memset(color_used, 0, 16);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
112 for(i = 0; i < 4; i++) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
113 if (alpha[i] != 0) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
114 if (!color_used[palette[i]]) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
115 level = (0xff * (j + 1)) / nb_opaque_colors;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
116 r = (((subtitle_color >> 16) & 0xff) * level) >> 8;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
117 g = (((subtitle_color >> 8) & 0xff) * level) >> 8;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
118 b = (((subtitle_color >> 0) & 0xff) * level) >> 8;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
119 rgba_palette[i] = b | (g << 8) | (r << 16) | (0xff << 24);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
120 color_used[palette[i]] = (i + 1);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
121 j++;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
122 } else {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
123 rgba_palette[i] = rgba_palette[color_used[palette[i]] - 1];
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
124 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
125 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
126 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
127 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
128
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
129 static int decode_dvd_subtitles(AVSubtitle *sub_header,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
130 const uint8_t *buf, int buf_size)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
131 {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
132 int cmd_pos, pos, cmd, x1, y1, x2, y2, offset1, offset2, next_cmd_pos;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
133 uint8_t palette[4], alpha[4];
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
134 int date;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
135
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
136 if (buf_size < 4)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
137 return -1;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
138 sub_header->bitmap = NULL;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
139 sub_header->rgba_palette = NULL;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
140 sub_header->start_display_time = 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
141 sub_header->end_display_time = 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
142
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
143 cmd_pos = getbe16(buf + 2);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
144 while ((cmd_pos + 4) < buf_size) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
145 date = getbe16(buf + cmd_pos);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
146 next_cmd_pos = getbe16(buf + cmd_pos + 2);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
147 #ifdef DEBUG
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
148 av_log(NULL, AV_LOG_INFO, "cmd_pos=0x%04x next=0x%04x date=%d\n",
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
149 cmd_pos, next_cmd_pos, date);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
150 #endif
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
151 pos = cmd_pos + 4;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
152 offset1 = -1;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
153 offset2 = -1;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
154 x1 = y1 = x2 = y2 = 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
155 while (pos < buf_size) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
156 cmd = buf[pos++];
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
157 #ifdef DEBUG
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
158 av_log(NULL, AV_LOG_INFO, "cmd=%02x\n", cmd);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
159 #endif
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
160 switch(cmd) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
161 case 0x00:
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
162 /* force display */
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
163 break;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
164 case 0x01:
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
165 /* set start date */
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
166 sub_header->start_display_time = date * 10;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
167 break;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
168 case 0x02:
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
169 /* set end date */
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
170 sub_header->end_display_time = date * 10;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
171 break;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
172 case 0x03:
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
173 /* set palette */
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
174 if ((buf_size - pos) < 2)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
175 goto fail;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
176 palette[0] = buf[pos] >> 4;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
177 palette[1] = buf[pos] & 0x0f;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
178 palette[2] = buf[pos + 1] >> 4;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
179 palette[3] = buf[pos + 1] & 0x0f;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
180 pos += 2;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
181 break;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
182 case 0x04:
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
183 /* set alpha */
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
184 if ((buf_size - pos) < 2)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
185 goto fail;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
186 alpha[0] = buf[pos] >> 4;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
187 alpha[1] = buf[pos] & 0x0f;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
188 alpha[2] = buf[pos + 1] >> 4;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
189 alpha[3] = buf[pos + 1] & 0x0f;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
190 pos += 2;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
191 break;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
192 case 0x05:
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
193 if ((buf_size - pos) < 6)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
194 goto fail;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
195 x1 = (buf[pos] << 4) | (buf[pos + 1] >> 4);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
196 x2 = ((buf[pos + 1] & 0x0f) << 8) | buf[pos + 2];
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
197 y1 = (buf[pos + 3] << 4) | (buf[pos + 4] >> 4);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
198 y2 = ((buf[pos + 4] & 0x0f) << 8) | buf[pos + 5];
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
199 #ifdef DEBUG
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
200 av_log(NULL, AV_LOG_INFO, "x1=%d x2=%d y1=%d y2=%d\n",
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
201 x1, x2, y1, y2);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
202 #endif
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
203 pos += 6;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
204 break;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
205 case 0x06:
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
206 if ((buf_size - pos) < 4)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
207 goto fail;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
208 offset1 = getbe16(buf + pos);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
209 offset2 = getbe16(buf + pos + 2);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
210 #ifdef DEBUG
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
211 av_log(NULL, AV_LOG_INFO, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
212 #endif
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
213 pos += 4;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
214 break;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
215 case 0xff:
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
216 default:
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
217 goto the_end;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
218 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
219 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
220 the_end:
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
221 if (offset1 >= 0) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
222 int w, h;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
223 uint8_t *bitmap;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
224
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
225 /* decode the bitmap */
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
226 w = x2 - x1 + 1;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
227 if (w < 0)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
228 w = 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
229 h = y2 - y1;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
230 if (h < 0)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
231 h = 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
232 if (w > 0 && h > 0) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
233 av_freep(&sub_header->bitmap);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
234 av_freep(&sub_header->rgba_palette);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
235 bitmap = av_malloc(w * h);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
236 sub_header->rgba_palette = av_malloc(4 * 4);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
237 decode_rle(bitmap, w * 2, w, h / 2,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
238 buf, offset1 * 2, buf_size);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
239 decode_rle(bitmap + w, w * 2, w, h / 2,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
240 buf, offset2 * 2, buf_size);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
241 guess_palette(sub_header->rgba_palette,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
242 palette, alpha, 0xffff00);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
243 sub_header->x = x1;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
244 sub_header->y = y1;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
245 sub_header->w = w;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
246 sub_header->h = h;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
247 sub_header->nb_colors = 4;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
248 sub_header->linesize = w;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
249 sub_header->bitmap = bitmap;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
250 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
251 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
252 if (next_cmd_pos == cmd_pos)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
253 break;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
254 cmd_pos = next_cmd_pos;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
255 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
256 if (sub_header->bitmap)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
257 return 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
258 fail:
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
259 return -1;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
260 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
261
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
262 static int is_transp(const uint8_t *buf, int pitch, int n,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
263 const uint8_t *transp_color)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
264 {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
265 int i;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
266 for(i = 0; i < n; i++) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
267 if (!transp_color[*buf])
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
268 return 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
269 buf += pitch;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
270 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
271 return 1;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
272 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
273
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
274 /* return 0 if empty rectangle, 1 if non empty */
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
275 static int find_smallest_bouding_rectangle(AVSubtitle *s)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
276 {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
277 uint8_t transp_color[256];
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
278 int y1, y2, x1, x2, y, w, h, i;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
279 uint8_t *bitmap;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
280
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
281 if (s->w <= 0 || s->h <= 0)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
282 return 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
283
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
284 memset(transp_color, 0, 256);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
285 for(i = 0; i < s->nb_colors; i++) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
286 if ((s->rgba_palette[i] >> 24) == 0)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
287 transp_color[i] = 1;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
288 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
289 y1 = 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
290 while (y1 < s->h && is_transp(s->bitmap + y1 * s->linesize, 1, s->w,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
291 transp_color))
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
292 y1++;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
293 if (y1 == s->h) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
294 av_freep(&s->bitmap);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
295 s->w = s->h = 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
296 return 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
297 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
298
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
299 y2 = s->h - 1;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
300 while (y2 > 0 && is_transp(s->bitmap + y2 * s->linesize, 1, s->w,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
301 transp_color))
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
302 y2--;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
303 x1 = 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
304 while (x1 < (s->w - 1) && is_transp(s->bitmap + x1, s->linesize, s->h,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
305 transp_color))
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
306 x1++;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
307 x2 = s->w - 1;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
308 while (x2 > 0 && is_transp(s->bitmap + x2, s->linesize, s->h,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
309 transp_color))
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
310 x2--;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
311 w = x2 - x1 + 1;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
312 h = y2 - y1 + 1;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
313 bitmap = av_malloc(w * h);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
314 if (!bitmap)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
315 return 1;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
316 for(y = 0; y < h; y++) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
317 memcpy(bitmap + w * y, s->bitmap + x1 + (y1 + y) * s->linesize, w);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
318 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
319 av_freep(&s->bitmap);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
320 s->bitmap = bitmap;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
321 s->linesize = w;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
322 s->w = w;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
323 s->h = h;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
324 s->x += x1;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
325 s->y += y1;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
326 return 1;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
327 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
328
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
329 static int dvdsub_close_decoder(AVCodecContext *avctx)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
330 {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
331 return 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
332 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
333
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
334 #ifdef DEBUG
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
335 #undef fprintf
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
336 static void ppm_save(const char *filename, uint8_t *bitmap, int w, int h,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
337 uint32_t *rgba_palette)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
338 {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
339 int x, y, v;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
340 FILE *f;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
341
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
342 f = fopen(filename, "w");
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
343 if (!f) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
344 perror(filename);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
345 exit(1);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
346 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
347 fprintf(f, "P6\n"
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
348 "%d %d\n"
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
349 "%d\n",
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
350 w, h, 255);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
351 for(y = 0; y < h; y++) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
352 for(x = 0; x < w; x++) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
353 v = rgba_palette[bitmap[y * w + x]];
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
354 putc((v >> 16) & 0xff, f);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
355 putc((v >> 8) & 0xff, f);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
356 putc((v >> 0) & 0xff, f);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
357 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
358 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
359 fclose(f);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
360 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
361 #endif
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
362
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
363 static int dvdsub_decode(AVCodecContext *avctx,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
364 void *data, int *data_size,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
365 uint8_t *buf, int buf_size)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
366 {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
367 AVSubtitle *sub = (void *)data;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
368
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
369 if (decode_dvd_subtitles(sub, buf, buf_size) < 0) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
370 no_subtitle:
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
371 *data_size = 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
372
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
373 return buf_size;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
374 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
375 if (find_smallest_bouding_rectangle(sub) == 0)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
376 goto no_subtitle;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
377
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
378 #if defined(DEBUG)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
379 av_log(NULL, AV_LOG_INFO, "start=%d ms end =%d ms\n",
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
380 sub->start_display_time,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
381 sub->end_display_time);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
382 ppm_save("/tmp/a.ppm", sub->bitmap,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
383 sub->w, sub->h, sub->rgba_palette);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
384 #endif
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
385
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
386 *data_size = 1;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
387 return buf_size;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
388 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
389
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
390 AVCodec dvdsub_decoder = {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
391 "dvdsub",
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
392 CODEC_TYPE_SUBTITLE,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
393 CODEC_ID_DVD_SUBTITLE,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
394 sizeof(DVDSubContext),
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
395 dvdsub_init_decoder,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
396 NULL,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
397 dvdsub_close_decoder,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
398 dvdsub_decode,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
399 };
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
400
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
401 /* parser definition */
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
402 typedef struct DVDSubParseContext {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
403 uint8_t *packet;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
404 int packet_len;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
405 int packet_index;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
406 } DVDSubParseContext;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
407
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
408 static int dvdsub_parse_init(AVCodecParserContext *s)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
409 {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
410 return 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
411 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
412
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
413 static int dvdsub_parse(AVCodecParserContext *s,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
414 AVCodecContext *avctx,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
415 uint8_t **poutbuf, int *poutbuf_size,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
416 const uint8_t *buf, int buf_size)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
417 {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
418 DVDSubParseContext *pc = s->priv_data;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
419
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
420 if (pc->packet_index == 0) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
421 if (buf_size < 2)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
422 return 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
423 pc->packet_len = (buf[0] << 8) | buf[1];
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
424 av_freep(&pc->packet);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
425 pc->packet = av_malloc(pc->packet_len);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
426 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
427 if (pc->packet) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
428 if (pc->packet_index + buf_size <= pc->packet_len) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
429 memcpy(pc->packet + pc->packet_index, buf, buf_size);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
430 pc->packet_index += buf_size;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
431 if (pc->packet_index >= pc->packet_len) {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
432 *poutbuf = pc->packet;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
433 *poutbuf_size = pc->packet_len;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
434 pc->packet_index = 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
435 return buf_size;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
436 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
437 } else {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
438 /* erroneous size */
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
439 pc->packet_index = 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
440 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
441 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
442 *poutbuf = NULL;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
443 *poutbuf_size = 0;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
444 return buf_size;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
445 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
446
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
447 static void dvdsub_parse_close(AVCodecParserContext *s)
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
448 {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
449 DVDSubParseContext *pc = s->priv_data;
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
450 av_freep(&pc->packet);
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
451 }
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
452
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
453 AVCodecParser dvdsub_parser = {
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
454 { CODEC_ID_DVD_SUBTITLE },
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
455 sizeof(DVDSubParseContext),
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
456 dvdsub_parse_init,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
457 dvdsub_parse,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
458 dvdsub_parse_close,
d8874c8749ec subtitle codec type support
bellard
parents:
diff changeset
459 };