* libmpeg2.c: mpeg2 video decoder module making use of libmpeg2.\r
*****************************************************************************\r
* Copyright (C) 1999-2001 VideoLAN\r
- * $Id: libmpeg2.c,v 1.1 2003/02/25 17:15:32 gbazin Exp $\r
+ * $Id: libmpeg2.c,v 1.2 2003/02/25 21:09:34 gbazin Exp $\r
*\r
* Authors: Gildas Bazin <gbazin@netcourrier.com>\r
*\r
decoder_fifo_t *p_fifo; /* stores the PES stream data */\r
pes_packet_t *p_pes; /* current PES we are decoding */\r
mtime_t i_pts;\r
+ mtime_t i_previous_pts;\r
+ mtime_t i_current_pts;\r
\r
/*\r
* Output properties\r
p_dec->p_mpeg2dec = NULL;\r
p_dec->p_info = NULL;\r
p_dec->i_pts = 0;\r
+ p_dec->i_current_pts = 0;\r
+ p_dec->i_previous_pts = 0;\r
\r
/* Initialize decoder */\r
p_dec->p_mpeg2dec = mpeg2_init();\r
if( p_dec->p_pes->i_pts )\r
{\r
mpeg2_pts( p_dec->p_mpeg2dec,\r
- p_dec->p_pes->i_pts * 9 / 100 );\r
+ (uint32_t)p_dec->p_pes->i_pts );\r
+ p_dec->i_previous_pts = p_dec->i_current_pts;\r
+ p_dec->i_current_pts = p_dec->p_pes->i_pts;\r
}\r
p_data = p_dec->p_pes->p_first;\r
}\r
break;\r
\r
case STATE_END:\r
+#if 0\r
msg_Err( p_dec->p_fifo, "STATE_END" );\r
+#endif\r
case STATE_SLICE:\r
#if 0\r
msg_Err( p_dec->p_fifo, "STATE_SLICE: %i",\r
\r
if( p_dec->p_info->display_picture->flags & PIC_FLAG_PTS )\r
{\r
- p_dec->i_pts =\r
- ((mtime_t)p_dec->p_info->display_picture->pts)\r
- * 100 / 9;\r
+ p_dec->i_pts = ( p_dec->p_info->display_picture->pts ==\r
+ (uint32_t)p_dec->i_current_pts ) ?\r
+ p_dec->i_current_pts : p_dec->i_previous_pts;\r
}\r
else\r
{\r