[Mplayer-cvslog] CVS: main/libmpdemux demuxer.h,1.37,1.38 demuxer.c,1.96,1.97 video.c,1.17,1.18

Alban Bedel CVS albeu at mplayerhq.hu
Thu May 2 12:26:02 CEST 2002


Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv19741/libmpdemux

Modified Files:
	demuxer.h demuxer.c video.c 
Log Message:
Fix frame_time for variable fps movies as it was the last frame duration.


Index: demuxer.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demuxer.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- demuxer.h	3 Apr 2002 15:40:13 -0000	1.37
+++ demuxer.h	2 May 2002 10:25:48 -0000	1.38
@@ -173,6 +173,7 @@
 void ds_free_packs(demux_stream_t *ds);
 int ds_get_packet(demux_stream_t *ds,unsigned char **start);
 int ds_get_packet_sub(demux_stream_t *ds,unsigned char **start);
+float ds_get_next_pts(demux_stream_t *ds);
 
 // This is defined here because demux_stream_t ins't defined in stream.h
 stream_t* new_ds_stream(demux_stream_t *ds);

Index: demuxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demuxer.c,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -r1.96 -r1.97
--- demuxer.c	29 Apr 2002 13:36:18 -0000	1.96
+++ demuxer.c	2 May 2002 10:25:48 -0000	1.97
@@ -438,6 +438,25 @@
     }
 }
 
+float ds_get_next_pts(demux_stream_t *ds) {
+  demuxer_t* demux = ds->demuxer;
+  while(!ds->first) {
+    if(demux->audio->packs>=MAX_PACKS || demux->audio->bytes>=MAX_PACK_BYTES){
+      mp_msg(MSGT_DEMUXER,MSGL_ERR,MSGTR_TooManyAudioInBuffer,demux->audio->packs,demux->audio->bytes);
+      mp_msg(MSGT_DEMUXER,MSGL_HINT,MSGTR_MaybeNI);
+      return -1;
+    }
+    if(demux->video->packs>=MAX_PACKS || demux->video->bytes>=MAX_PACK_BYTES){
+      mp_msg(MSGT_DEMUXER,MSGL_ERR,MSGTR_TooManyVideoInBuffer,demux->video->packs,demux->video->bytes);
+      mp_msg(MSGT_DEMUXER,MSGL_HINT,MSGTR_MaybeNI);
+      return -1;
+    }
+    if(!demux_fill_buffer(demux,ds))
+      return -1;
+  }
+  return ds->first->pts;
+}
+
 // ====================================================================
 
 // feed-back from demuxers:
@@ -696,7 +715,7 @@
       mp_msg(MSGT_DEMUXER,MSGL_INFO,MSGTR_DetectedMPEGPSfile);
     file_format=DEMUXER_TYPE_MPEG_PS;
   } else {
-    printf("MPEG packet stats: p100: %d  p101: %d  PES: %d  MP3: %d \n",
+    mp_msg(MSGT_DEMUX,MSGL_V,"MPEG packet stats: p100: %d  p101: %d  PES: %d  MP3: %d \n",
 	num_elementary_packets100,num_elementary_packets101,num_elementary_packetsPES,num_mp3audio_packets);
 //MPEG packet stats: p100: 458  p101: 458  PES: 0  MP3: 1103  (.m2v)
     if(num_mp3audio_packets>50 && num_mp3audio_packets>2*num_elementary_packets100

Index: video.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/video.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- video.c	29 Apr 2002 15:57:22 -0000	1.17
+++ video.c	2 May 2002 10:25:48 -0000	1.18
@@ -291,14 +291,18 @@
       case DEMUXER_TYPE_FILM:
       case DEMUXER_TYPE_VIVO:
       case DEMUXER_TYPE_ASF: {
-        float d=d_video->pts-pts1;
-        if(d>0 && d<5) frame_time=d;
+        float next_pts = ds_get_next_pts(d_video);
+        float d= next_pts > 0 ? next_pts - d_video->pts : d_video->pts-pts1;
         if(d>0){
           if(verbose)
             if((int)sh_video->fps==1000)
               mp_msg(MSGT_CPLAYER,MSGL_STATUS,"\navg. framerate: %d fps             \n",(int)(1.0f/d));
           sh_video->frametime=d; // 1ms
           sh_video->fps=1.0f/d;
+          frame_time = d;
+        } else {
+          mp_msg(MSGT_CPLAYER,MSGL_WARN,"\nInvalid frame duration value. Defaulting to 1/25 sec.\n");
+          frame_time = 1/25.0;
         }
       }
     }




More information about the MPlayer-cvslog mailing list