Changeset 5d3d5ee7b9480de73e87a54355378447127735cd
- Timestamp:
- 08/11/06 15:24:54
(2 years ago)
- Author:
- Christophe Massiot <massiot@videolan.org>
- git-committer:
- Christophe Massiot <massiot@videolan.org> 1162995894 +0000
- git-parent:
[b1b72b632aed8ccf9624093214efe1329093e6f8]
- git-author:
- Christophe Massiot <massiot@videolan.org> 1162995894 +0000
- Message:
- modules/codec/libmpeg2.c, modules/packetizer/mpegvideo.c: Fixed wrong PTS
and DTS for field pictures.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| ra91a6ab |
r5d3d5ee |
|
| 65 | 65 | * the sequence header ? */ |
|---|
| 66 | 66 | vlc_bool_t b_slice_i; /* intra-slice refresh stream */ |
|---|
| 67 | | |
|---|
| 68 | | vlc_bool_t b_preroll; |
|---|
| | 67 | vlc_bool_t b_second_field; |
|---|
| | 68 | |
|---|
| | 69 | vlc_bool_t b_preroll; |
|---|
| 69 | 70 | |
|---|
| 70 | 71 | /* |
|---|
| … | … | |
| 144 | 145 | p_sys->b_garbage_pic = 0; |
|---|
| 145 | 146 | p_sys->b_slice_i = 0; |
|---|
| | 147 | p_sys->b_second_field = 0; |
|---|
| 146 | 148 | p_sys->b_skip = 0; |
|---|
| 147 | 149 | p_sys->b_preroll = VLC_FALSE; |
|---|
| … | … | |
| 340 | 342 | |
|---|
| 341 | 343 | case STATE_PICTURE_2ND: |
|---|
| 342 | | vout_SynchroNewPicture( p_sys->p_synchro, |
|---|
| 343 | | p_sys->p_info->current_picture->flags & PIC_MASK_CODING_TYPE, |
|---|
| 344 | | p_sys->p_info->current_picture->nb_fields, |
|---|
| 345 | | 0, 0, p_sys->i_current_rate, |
|---|
| 346 | | p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY ); |
|---|
| 347 | | |
|---|
| 348 | | if( p_sys->b_skip ) |
|---|
| 349 | | { |
|---|
| 350 | | vout_SynchroTrash( p_sys->p_synchro ); |
|---|
| 351 | | } |
|---|
| 352 | | else |
|---|
| 353 | | { |
|---|
| 354 | | vout_SynchroDecode( p_sys->p_synchro ); |
|---|
| 355 | | } |
|---|
| | 344 | p_sys->b_second_field = 1; |
|---|
| 356 | 345 | break; |
|---|
| 357 | 346 | |
|---|
| … | … | |
| 409 | 398 | #endif |
|---|
| 410 | 399 | |
|---|
| | 400 | /* If nb_fields == 1, it is a field picture, and it will be |
|---|
| | 401 | * followed by another field picture for which we won't call |
|---|
| | 402 | * vout_SynchroNewPicture() because this would have other |
|---|
| | 403 | * problems, so we take it into account here. |
|---|
| | 404 | * This kind of sucks, but I didn't think better. --Meuuh |
|---|
| | 405 | */ |
|---|
| 411 | 406 | vout_SynchroNewPicture( p_sys->p_synchro, |
|---|
| 412 | 407 | p_sys->p_info->current_picture->flags & PIC_MASK_CODING_TYPE, |
|---|
| | 408 | p_sys->p_info->current_picture->nb_fields == 1 ? 2 : |
|---|
| 413 | 409 | p_sys->p_info->current_picture->nb_fields, i_pts, i_dts, |
|---|
| 414 | 410 | p_sys->i_current_rate, |
|---|
| r386b36f |
r5d3d5ee |
|
| 119 | 119 | mtime_t i_old_duration; |
|---|
| 120 | 120 | mtime_t i_last_ref_pts; |
|---|
| | 121 | vlc_bool_t b_second_field; |
|---|
| 121 | 122 | |
|---|
| 122 | 123 | /* Number of pictures since last sequence header */ |
|---|
| … | … | |
| 186 | 187 | p_sys->i_old_duration = 0; |
|---|
| 187 | 188 | p_sys->i_last_ref_pts = 0; |
|---|
| | 189 | p_sys->b_second_field = 0; |
|---|
| 188 | 190 | |
|---|
| 189 | 191 | p_sys->b_discontinuity = VLC_FALSE; |
|---|
| … | … | |
| 434 | 436 | { |
|---|
| 435 | 437 | /* Correct interpolated dts when we receive a new pts/dts */ |
|---|
| 436 | | if( p_sys->i_last_ref_pts > 0 ) |
|---|
| | 438 | if( p_sys->i_last_ref_pts > 0 && !p_sys->b_second_field ) |
|---|
| 437 | 439 | p_sys->i_interpolated_dts = p_sys->i_last_ref_pts; |
|---|
| 438 | 440 | if( p_sys->i_dts > 0 ) p_sys->i_interpolated_dts = p_sys->i_dts; |
|---|
| 439 | 441 | |
|---|
| 440 | | p_sys->i_last_ref_pts = p_sys->i_pts; |
|---|
| | 442 | if( !p_sys->b_second_field ) |
|---|
| | 443 | p_sys->i_last_ref_pts = p_sys->i_pts; |
|---|
| 441 | 444 | } |
|---|
| 442 | 445 | |
|---|
| 443 | 446 | p_pic->i_dts = p_sys->i_interpolated_dts; |
|---|
| | 447 | p_sys->i_interpolated_dts += i_duration; |
|---|
| 444 | 448 | |
|---|
| 445 | 449 | /* Set PTS only if we have a B frame or if it comes from the stream */ |
|---|
| … | … | |
| 455 | 459 | { |
|---|
| 456 | 460 | p_pic->i_pts = 0; |
|---|
| 457 | | } |
|---|
| 458 | | |
|---|
| 459 | | if( p_sys->b_low_delay || p_sys->i_picture_type == 0x03 ) |
|---|
| 460 | | { |
|---|
| 461 | | /* Trivial case (DTS == PTS) */ |
|---|
| 462 | | p_sys->i_interpolated_dts += i_duration; |
|---|
| 463 | | } |
|---|
| 464 | | else |
|---|
| 465 | | { |
|---|
| 466 | | p_sys->i_interpolated_dts += p_sys->i_old_duration; |
|---|
| 467 | | p_sys->i_old_duration = i_duration; |
|---|
| 468 | 461 | } |
|---|
| 469 | 462 | |
|---|
| … | … | |
| 492 | 485 | p_sys->pp_last = &p_sys->p_frame; |
|---|
| 493 | 486 | p_sys->b_frame_slice = VLC_FALSE; |
|---|
| | 487 | |
|---|
| | 488 | if( p_sys->i_picture_structure != 0x03 ) |
|---|
| | 489 | { |
|---|
| | 490 | p_sys->b_second_field = !p_sys->b_second_field; |
|---|
| | 491 | } |
|---|
| | 492 | else |
|---|
| | 493 | { |
|---|
| | 494 | p_sys->b_second_field = 0; |
|---|
| | 495 | } |
|---|
| 494 | 496 | } |
|---|
| 495 | 497 | |
|---|