* libmpeg2.c: mpeg2 video decoder module making use of libmpeg2.\r
*****************************************************************************\r
* Copyright (C) 1999-2001 VideoLAN\r
- * $Id: libmpeg2.c,v 1.4 2003/03/25 23:06:49 gbazin Exp $\r
+ * $Id: libmpeg2.c,v 1.5 2003/03/26 22:56:39 gbazin Exp $\r
*\r
* Authors: Gildas Bazin <gbazin@netcourrier.com>\r
*\r
if( p_dec->p_info->display_picture->flags & PIC_FLAG_PTS )\r
{\r
p_dec->i_pts = p_pic->date;\r
+ p_dec->i_period_remainder = 0;\r
}\r
else\r
{\r
vout_DatePicture( p_dec->p_vout, p_pic, p_dec->i_pts );\r
\r
vout_DisplayPicture( p_dec->p_vout, p_pic );\r
+\r
+ /* Handle pulldown by adding some delay to the pts of the next\r
+ * picture. */\r
+ if( p_dec->p_info->display_picture->nb_fields > 2 )\r
+ {\r
+ int i_repeat_fields =\r
+ p_dec->p_info->display_picture->nb_fields - 2;\r
+\r
+ p_dec->i_pts += ( (p_dec->p_info->sequence->frame_period +\r
+ p_dec->i_period_remainder)\r
+ / 27 / 2 * i_repeat_fields );\r
+ p_dec->i_period_remainder =\r
+ p_dec->p_info->sequence->frame_period +\r
+ p_dec->i_period_remainder -\r
+ ( p_dec->p_info->sequence->frame_period +\r
+ p_dec->i_period_remainder ) / 27 / 2 * 27 * 2;\r
+ }\r
}\r
break;\r
\r