[MPlayer-cvslog] CVS: main/libmpdemux demux_real.c,1.78,1.79

Roberto Togni CVS syncmail at mplayerhq.hu
Wed Jan 4 23:49:25 CET 2006


CVS change done by Roberto Togni CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv5353

Modified Files:
	demux_real.c 
Log Message:
Remove assumption that all audio packets in a block have the same 
timestamp; now the code stores timestamp for every packet and puts them 
on reordered packets
Fixes ra10cook.rmvc


Index: demux_real.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_real.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -r1.78 -r1.79
--- demux_real.c	4 Jan 2006 22:21:32 -0000	1.78
+++ demux_real.c	4 Jan 2006 22:49:23 -0000	1.79
@@ -114,7 +114,7 @@
     int coded_framesize[MAX_STREAMS]; ///< coded frame size, per stream
     int audiopk_size[MAX_STREAMS]; ///< audio packet size
     unsigned char *audio_buf; ///< place to store reordered audio data
-    float audio_timestamp; ///< timestamp for all audio packets in a block
+    float *audio_timestamp; ///< timestamp for each audio packet
     int sub_packet_cnt; ///< number of subpacket already received
     int audio_filepos; ///< file position of first audio packet in block
 } real_priv_t;
@@ -730,8 +730,8 @@
                     break;
             }
             priv->audio_need_keyframe = 0;
-            priv->audio_timestamp = timestamp / 1000.0f;
-            priv->a_pts = timestamp; // All packets in a block have the same timestamp
+            priv->audio_timestamp[priv->sub_packet_cnt] = (priv->a_pts==timestamp) ? 0 : (timestamp/1000.0f);
+            priv->a_pts = timestamp;
             if (priv->sub_packet_cnt == 0)
                 priv->audio_filepos = demuxer->filepos;
             if (++(priv->sub_packet_cnt) < sph)
@@ -744,7 +744,8 @@
                 for (x = 0; x < sph*w/apk_usize; x++) {
                     dp = new_demux_packet(apk_usize);
                     memcpy(dp->buffer, priv->audio_buf + x * apk_usize, apk_usize);
-                    dp->pts = x ? 0 : priv->audio_timestamp;
+                    /* Put timestamp only on packets that correspond to original audio packets in file */
+                    dp->pts = (x * apk_usize % w) ? 0 : priv->audio_timestamp[x * apk_usize / w];
                     dp->pos = priv->audio_filepos; // all equal
                     dp->flags = x ? 0 : 0x10; // Mark first packet as keyframe
                     ds_add_packet(ds, dp);
@@ -1044,6 +1045,7 @@
 	sh->ds=demuxer->audio;
 	demuxer->audio->sh=sh;
 	priv->audio_buf = malloc(priv->sub_packet_h[demuxer->audio->id] * priv->audiopk_size[demuxer->audio->id]);
+	priv->audio_timestamp = malloc(priv->sub_packet_h[demuxer->audio->id] * sizeof(float));
         mp_msg(MSGT_DEMUX,MSGL_V,"Auto-selected RM audio ID = %d\n",stream_id);
 	goto got_audio;
     }
@@ -1456,6 +1458,7 @@
 			sh->ds=demuxer->audio;
 			demuxer->audio->sh=sh;
         	priv->audio_buf = malloc(priv->sub_packet_h[demuxer->audio->id] * priv->audiopk_size[demuxer->audio->id]);
+        	priv->audio_timestamp = malloc(priv->sub_packet_h[demuxer->audio->id] * sizeof(float));
 		    }
 		    
 		    ++a_streams;




More information about the MPlayer-cvslog mailing list