Changeset 5d3d5ee7b9480de73e87a54355378447127735cd

Show
Ignore:
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
  • modules/codec/libmpeg2.c

    ra91a6ab r5d3d5ee  
    6565                                               * the sequence header ?    */ 
    6666    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; 
    6970 
    7071    /* 
     
    144145    p_sys->b_garbage_pic = 0; 
    145146    p_sys->b_slice_i  = 0; 
     147    p_sys->b_second_field = 0; 
    146148    p_sys->b_skip     = 0; 
    147149    p_sys->b_preroll = VLC_FALSE; 
     
    340342 
    341343        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; 
    356345            break; 
    357346 
     
    409398#endif 
    410399 
     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             */ 
    411406            vout_SynchroNewPicture( p_sys->p_synchro, 
    412407                p_sys->p_info->current_picture->flags & PIC_MASK_CODING_TYPE, 
     408                p_sys->p_info->current_picture->nb_fields == 1 ? 2 : 
    413409                p_sys->p_info->current_picture->nb_fields, i_pts, i_dts, 
    414410                p_sys->i_current_rate, 
  • modules/packetizer/mpegvideo.c

    r386b36f r5d3d5ee  
    119119    mtime_t i_old_duration; 
    120120    mtime_t i_last_ref_pts; 
     121    vlc_bool_t b_second_field; 
    121122 
    122123    /* Number of pictures since last sequence header */ 
     
    186187    p_sys->i_old_duration = 0; 
    187188    p_sys->i_last_ref_pts = 0; 
     189    p_sys->b_second_field = 0; 
    188190 
    189191    p_sys->b_discontinuity = VLC_FALSE; 
     
    434436        { 
    435437            /* 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
    437439                p_sys->i_interpolated_dts = p_sys->i_last_ref_pts; 
    438440            if( p_sys->i_dts > 0 ) p_sys->i_interpolated_dts = p_sys->i_dts; 
    439441 
    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; 
    441444        } 
    442445 
    443446        p_pic->i_dts = p_sys->i_interpolated_dts; 
     447        p_sys->i_interpolated_dts += i_duration; 
    444448 
    445449        /* Set PTS only if we have a B frame or if it comes from the stream */ 
     
    455459        { 
    456460            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; 
    468461        } 
    469462 
     
    492485        p_sys->pp_last = &p_sys->p_frame; 
    493486        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        } 
    494496    } 
    495497