[MPlayer-cvslog] r21797 - trunk/libmpdemux/demux_mpg.c

nicodvb subversion at mplayerhq.hu
Sun Dec 31 12:08:27 CET 2006


Author: nicodvb
Date: Sun Dec 31 12:08:27 2006
New Revision: 21797

Modified:
   trunk/libmpdemux/demux_mpg.c

Log:
replace call to ds_read_packet() with the usual stream_read()+ds_add_packet() sequence;
fill demux_packet->stream_pts if the stream layer supports it



Modified: trunk/libmpdemux/demux_mpg.c
==============================================================================
--- trunk/libmpdemux/demux_mpg.c	(original)
+++ trunk/libmpdemux/demux_mpg.c	Sun Dec 31 12:08:27 2006
@@ -191,7 +191,10 @@
   unsigned char c=0;
   unsigned long long pts=0;
   unsigned long long dts=0;
+  int l;
+  double stream_pts = MP_NOPTS_VALUE;
   demux_stream_t *ds=NULL;
+  demux_packet_t* dp;
   mpg_demuxer_t *priv = (mpg_demuxer_t *) demux->priv;
   
   mp_dbg(MSGT_DEMUX,MSGL_DBG3,"demux_read_packet: %X\n",id);
@@ -405,7 +408,22 @@
   if(ds){
     mp_dbg(MSGT_DEMUX,MSGL_DBG2,"DEMUX_MPG: Read %d data bytes from packet %04X\n",len,id);
 //    printf("packet start = 0x%X  \n",stream_tell(demux->stream)-packet_start_pos);
-    ds_read_packet(ds,demux->stream,len,pts/90000.0f,demux->filepos,0);
+
+    dp=new_demux_packet(len);
+    if(!dp) {
+      mp_dbg(MSGT_DEMUX,MSGL_ERR,"DEMUX_MPG ERROR: couldn't create demux_packet(%d bytes)\n",len);
+      stream_skip(demux->stream,len);
+      return 0;
+    }
+    l = stream_read(demux->stream,dp->buffer,len);
+    if(l<len)
+      resize_demux_packet(dp, l);
+    len = l;
+    dp->pts=pts/90000.0f;
+    dp->pos=demux->filepos;
+    if(stream_control(demux->stream, STREAM_CTRL_GET_CURRENT_TIME,(void *)&stream_pts)!=STREAM_UNSUPORTED)
+      dp->stream_pts = stream_pts;
+    ds_add_packet(ds,dp);
     if (demux->priv) ((mpg_demuxer_t*)demux->priv)->last_pts = pts/90000.0f;
 //    if(ds==demux->sub) parse_dvdsub(ds->last->buffer,ds->last->len);
     return 1;



More information about the MPlayer-cvslog mailing list