Mercurial > mplayer.hg
comparison spudec.c @ 3842:32e488a4fc40
dvdsub pts fix, based on patch by Kim Minh Kaplan
author | arpi |
---|---|
date | Fri, 28 Dec 2001 19:20:12 +0000 |
parents | cdaacdac6571 |
children | a8e7238bb7b4 |
comparison
equal
deleted
inserted
replaced
3841:25600d0bdc63 | 3842:32e488a4fc40 |
---|---|
162 ++y; | 162 ++y; |
163 } | 163 } |
164 } | 164 } |
165 } | 165 } |
166 | 166 |
167 static void spudec_process_control(spudec_handle_t *this) | 167 static void spudec_process_control(spudec_handle_t *this, int pts100) |
168 { | 168 { |
169 int a,b; /* Temporary vars */ | 169 int a,b; /* Temporary vars */ |
170 int date, type; | 170 int date, type; |
171 int off; | 171 int off; |
172 int start_off = 0; | 172 int start_off = 0; |
188 mp_msg(MSGT_SPUDEC,MSGL_DBG2,"Menu ID\n"); | 188 mp_msg(MSGT_SPUDEC,MSGL_DBG2,"Menu ID\n"); |
189 break; | 189 break; |
190 case 0x01: | 190 case 0x01: |
191 /* Start display */ | 191 /* Start display */ |
192 mp_msg(MSGT_SPUDEC,MSGL_DBG2,"Start display!\n"); | 192 mp_msg(MSGT_SPUDEC,MSGL_DBG2,"Start display!\n"); |
193 this->start_pts = this->now_pts + date; | 193 this->start_pts = pts100 + date; |
194 break; | 194 break; |
195 case 0x02: | 195 case 0x02: |
196 /* Stop display */ | 196 /* Stop display */ |
197 mp_msg(MSGT_SPUDEC,MSGL_DBG2,"Stop display!\n"); | 197 mp_msg(MSGT_SPUDEC,MSGL_DBG2,"Stop display!\n"); |
198 this->end_pts = this->now_pts + date; | 198 this->end_pts = pts100 + date; |
199 break; | 199 break; |
200 case 0x03: | 200 case 0x03: |
201 /* Palette */ | 201 /* Palette */ |
202 this->palette[0] = this->packet[off] >> 4; | 202 this->palette[0] = this->packet[off] >> 4; |
203 this->palette[1] = this->packet[off] & 0xf; | 203 this->palette[1] = this->packet[off] & 0xf; |
255 next_control: | 255 next_control: |
256 ; | 256 ; |
257 } | 257 } |
258 } | 258 } |
259 | 259 |
260 static void spudec_decode(spudec_handle_t *this) | 260 static void spudec_decode(spudec_handle_t *this,int pts100) |
261 { | 261 { |
262 spudec_process_control(this); | 262 spudec_process_control(this, pts100); |
263 spudec_process_data(this); | 263 spudec_process_data(this); |
264 } | 264 } |
265 | 265 |
266 | 266 |
267 void spudec_assemble(void *this, unsigned char *packet, int len, int pts100) | 267 void spudec_assemble(void *this, unsigned char *packet, int len, int pts100) |
268 { | 268 { |
269 spudec_handle_t *spu = (spudec_handle_t*)this; | 269 spudec_handle_t *spu = (spudec_handle_t*)this; |
270 spudec_heartbeat(this, pts100); | 270 // spudec_heartbeat(this, pts100); |
271 if (spu->packet_offset == 0) { | 271 if (spu->packet_offset == 0) { |
272 unsigned int len2 = get_be16(packet); | 272 unsigned int len2 = get_be16(packet); |
273 // Start new fragment | 273 // Start new fragment |
274 if (spu->packet_reserve < len2) { | 274 if (spu->packet_reserve < len2) { |
275 if (spu->packet != NULL) | 275 if (spu->packet != NULL) |
302 y=get_be16(spu->packet+x+2); // next control pointer | 302 y=get_be16(spu->packet+x+2); // next control pointer |
303 mp_msg(MSGT_SPUDEC,MSGL_DBG2,"SPUtest: x=%d y=%d off=%d size=%d\n",x,y,spu->packet_offset,spu->packet_size); | 303 mp_msg(MSGT_SPUDEC,MSGL_DBG2,"SPUtest: x=%d y=%d off=%d size=%d\n",x,y,spu->packet_offset,spu->packet_size); |
304 if(x>=4 && x==y){ // if it points to self - we're done! | 304 if(x>=4 && x==y){ // if it points to self - we're done! |
305 // we got it! | 305 // we got it! |
306 mp_msg(MSGT_SPUDEC,MSGL_DBG2,"SPUgot: off=%d size=%d \n",spu->packet_offset,spu->packet_size); | 306 mp_msg(MSGT_SPUDEC,MSGL_DBG2,"SPUgot: off=%d size=%d \n",spu->packet_offset,spu->packet_size); |
307 spudec_decode(spu); | 307 spudec_decode(spu, pts100); |
308 spu->packet_offset = 0; | 308 spu->packet_offset = 0; |
309 break; | 309 break; |
310 } | 310 } |
311 if(y<=x || y>=spu->packet_size){ // invalid? | 311 if(y<=x || y>=spu->packet_size){ // invalid? |
312 mp_msg(MSGT_SPUDEC,MSGL_WARN,"SPUtest: broken packet!!!!! y=%d < x=%d\n",y,x); | 312 mp_msg(MSGT_SPUDEC,MSGL_WARN,"SPUtest: broken packet!!!!! y=%d < x=%d\n",y,x); |
316 x=y; | 316 x=y; |
317 } | 317 } |
318 } | 318 } |
319 #else | 319 #else |
320 if (spu->packet_offset == spu->packet_size) { | 320 if (spu->packet_offset == spu->packet_size) { |
321 spudec_decode(spu); | 321 spudec_decode(spu, pts100); |
322 spu->packet_offset = 0; | 322 spu->packet_offset = 0; |
323 } | 323 } |
324 #endif | 324 #endif |
325 } | 325 } |
326 | 326 |