Mercurial > mplayer.hg
comparison libmpcodecs/dec_video.c @ 31953:2b390c08ed07
Improve correct-pts with PAFF streams.
Patch by P«”sztor Szil«”rd, bartosteka freemail hu
author | cehoyos |
---|---|
date | Mon, 30 Aug 2010 23:24:56 +0000 |
parents | 6e0b5a97e00f |
children | 96559880e475 |
comparison
equal
deleted
inserted
replaced
31952:beaf6bf007a5 | 31953:2b390c08ed07 |
---|---|
392 { | 392 { |
393 mp_image_t *mpi = NULL; | 393 mp_image_t *mpi = NULL; |
394 unsigned int t = GetTimer(); | 394 unsigned int t = GetTimer(); |
395 unsigned int t2; | 395 unsigned int t2; |
396 double tt; | 396 double tt; |
397 | 397 int delay; |
398 if (correct_pts && pts != MP_NOPTS_VALUE) { | 398 int got_picture = 1; |
399 | |
400 mpi = mpvdec->decode(sh_video, start, in_size, drop_frame); | |
401 | |
402 //------------------------ frame decoded. -------------------- | |
403 | |
404 if (mpi && mpi->type == MP_IMGTYPE_INCOMPLETE) { | |
405 got_picture = 0; | |
406 mpi = NULL; | |
407 } | |
408 | |
409 delay = get_current_video_decoder_lag(sh_video); | |
410 if (correct_pts && pts != MP_NOPTS_VALUE | |
411 && (got_picture || sh_video->num_buffered_pts < delay)) { | |
399 if (sh_video->num_buffered_pts == | 412 if (sh_video->num_buffered_pts == |
400 sizeof(sh_video->buffered_pts) / sizeof(double)) | 413 sizeof(sh_video->buffered_pts) / sizeof(double)) |
401 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Too many buffered pts\n"); | 414 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Too many buffered pts\n"); |
402 else { | 415 else { |
403 int i, j; | 416 int i, j; |
409 sh_video->buffered_pts[i] = pts; | 422 sh_video->buffered_pts[i] = pts; |
410 sh_video->num_buffered_pts++; | 423 sh_video->num_buffered_pts++; |
411 } | 424 } |
412 } | 425 } |
413 | 426 |
414 mpi = mpvdec->decode(sh_video, start, in_size, drop_frame); | |
415 | |
416 //------------------------ frame decoded. -------------------- | |
417 | |
418 #if HAVE_MMX | 427 #if HAVE_MMX |
419 // some codecs are broken, and doesn't restore MMX state :( | 428 // some codecs are broken, and doesn't restore MMX state :( |
420 // it happens usually with broken/damaged files. | 429 // it happens usually with broken/damaged files. |
421 if (gCpuCaps.has3DNow) { | 430 if (gCpuCaps.has3DNow) { |
422 __asm__ volatile ("femms\n\t":::"memory"); | 431 __asm__ volatile ("femms\n\t":::"memory"); |
437 mpi->fields |= MP_IMGFIELD_TOP_FIRST; | 446 mpi->fields |= MP_IMGFIELD_TOP_FIRST; |
438 else if (field_dominance == 1) | 447 else if (field_dominance == 1) |
439 mpi->fields &= ~MP_IMGFIELD_TOP_FIRST; | 448 mpi->fields &= ~MP_IMGFIELD_TOP_FIRST; |
440 | 449 |
441 if (correct_pts) { | 450 if (correct_pts) { |
442 int delay = get_current_video_decoder_lag(sh_video); | |
443 if (sh_video->num_buffered_pts) { | 451 if (sh_video->num_buffered_pts) { |
444 sh_video->num_buffered_pts--; | 452 sh_video->num_buffered_pts--; |
445 sh_video->pts = sh_video->buffered_pts[sh_video->num_buffered_pts]; | 453 sh_video->pts = sh_video->buffered_pts[sh_video->num_buffered_pts]; |
446 } else { | 454 } else { |
447 mp_msg(MSGT_CPLAYER, MSGL_ERR, | 455 mp_msg(MSGT_CPLAYER, MSGL_ERR, |