Ticket #1389: vobsub.patch
| File vobsub.patch, 2.7 KB (added by , 16 years ago) |
|---|
-
vobsub.c
285 285 unsigned char *packet; 286 286 unsigned int packet_reserve; 287 287 unsigned int packet_size; 288 289 unsigned int last_pts; 290 int last_pts_diff; 288 291 } mpeg_t; 289 292 290 293 static mpeg_t *mpeg_open(const char *filename) … … 293 296 int err = res == NULL; 294 297 if (!err) { 295 298 res->pts = 0; 299 res->last_pts = 0; 300 res->last_pts_diff = INT_MAX; 296 301 res->aid = -1; 297 302 res->packet = NULL; 298 303 res->packet_size = 0; … … 416 421 } else 417 422 mpeg->pts = ((buf[0] & 0x0e) << 29 | buf[1] << 22 | (buf[2] & 0xfe) << 14 418 423 | buf[3] << 7 | (buf[4] >> 1)); 424 if (mpeg->last_pts > 0) { 425 mpeg->last_pts_diff = mpeg->pts - mpeg->last_pts; 426 } 427 mp_msg(MSGT_VOBSUB, MSGL_DBG3, "mpeg_run: pts=%d diff=%d \n", mpeg->pts, mpeg->last_pts_diff); 428 mpeg->last_pts = mpeg->pts; 419 429 } else /* if ((pts_flags & 0xc0) == 0xc0) */ { 420 430 /* what's this? */ 421 431 /* abort(); */ … … 1026 1036 last_pts_diff = pkt->pts100 - mpg->pts; 1027 1037 else 1028 1038 pkt->pts100 = mpg->pts; 1039 1040 /* KLUGE: arbitrary pts difference 1041 to merge packets */ 1042 if (mpg->last_pts_diff < 10000) { 1043 packet_t *last = queue->packets + queue->current_index-1; 1044 mp_msg(MSGT_VOBSUB, MSGL_DBG3, "vobsub_open: new pts probably belongs to last chunk. pts=%d last=%d \n", pkt->pts100, last->pts100); 1045 pkt->pts100 = last->pts100; 1046 } 1047 1029 1048 /* FIXME: should not use mpg_sub internal informations, make a copy */ 1030 1049 pkt->data = mpg->packet; 1031 1050 pkt->size = mpg->packet_size; 1051 mp_msg(MSGT_VOBSUB, MSGL_DBG3, "vobsub_open: adding packet. pos=%lx size=%d pts100=%d \n", pos, pkt->size, pkt->pts100); 1032 1052 mpg->packet = NULL; 1033 1053 mpg->packet_reserve = 0; 1034 1054 mpg->packet_size = 0;
