From ae0af713c1bd385aa2d6aa3cbe94ae41c124b63e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20Ni=C3=9Fl?= Date: Thu, 20 Jan 2011 21:14:52 +0100 Subject: Fix pts handling after introduction of picture_ready() Transfer of seq_pts to img->pts takes now place at picture header of next image in decoding order. So far, seq_pts was set to cur_pts at sequence header and picture header. Hence, img->pts was incorrectly set to pts of next image in decoding order. Setting seq_pts only in picture header after call of picture_ready() keeps the correct pts in seq_pts until it has been transfered to img->pts. Furthermore, cur_pts of second field must be ignored as we put both fields into the same image so the image is due at pts of first field. --- src/video_dec/libvdpau/vdpau_mpeg12.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/video_dec/libvdpau/vdpau_mpeg12.c b/src/video_dec/libvdpau/vdpau_mpeg12.c index e0a7bcd67..d771fd364 100644 --- a/src/video_dec/libvdpau/vdpau_mpeg12.c +++ b/src/video_dec/libvdpau/vdpau_mpeg12.c @@ -257,11 +257,6 @@ static void sequence_header( vdpau_mpeg12_decoder_t *this_gen, uint8_t *buf, int int i, j; - if ( sequence->cur_pts ) { - sequence->seq_pts = sequence->cur_pts; - sequence->cur_pts = 0; - } - bits_reader_set( &sequence->br, buf, len ); sequence->coded_width = read_bits( &sequence->br, 12 ); lprintf( "coded_width: %d\n", sequence->coded_width ); @@ -351,11 +346,6 @@ static void picture_header( vdpau_mpeg12_decoder_t *this_gen, uint8_t *buf, int { sequence_t *sequence = (sequence_t*)&this_gen->sequence; - if ( sequence->cur_pts ) { - sequence->seq_pts = sequence->cur_pts; - sequence->cur_pts = 0; - } - if ( sequence->profile==VDP_DECODER_PROFILE_MPEG1 ) sequence->picture.vdp_infos.picture_structure = PICTURE_FRAME; @@ -372,6 +362,14 @@ static void picture_header( vdpau_mpeg12_decoder_t *this_gen, uint8_t *buf, int else if ( sequence->picture.vdp_infos.picture_structure ) { infos = &sequence->picture.vdp_infos2; sequence->picture.slices_pos_top = sequence->picture.slices_pos; + + sequence->cur_pts = 0; /* ignore pts of second field */ + } + + /* take over pts for next issued image */ + if ( sequence->cur_pts ) { + sequence->seq_pts = sequence->cur_pts; + sequence->cur_pts = 0; } bits_reader_set( &sequence->br, buf, len ); -- cgit v1.2.3