[MPlayer-cvslog] r22306 - in trunk: mp_core.h mplayer.c

uau subversion at mplayerhq.hu
Wed Feb 21 22:59:34 CET 2007


Author: uau
Date: Wed Feb 21 22:59:33 2007
New Revision: 22306

Modified:
   trunk/mp_core.h
   trunk/mplayer.c

Log:
Cleanup, move "global" state from the frame_time_remaining mainloop
variable to mpctx.


Modified: trunk/mp_core.h
==============================================================================
--- trunk/mp_core.h	(original)
+++ trunk/mp_core.h	Wed Feb 21 22:59:33 2007
@@ -62,6 +62,10 @@
     demux_stream_t *d_sub;
     mixer_t mixer;
     vo_functions_t *video_out;
+    // Frames buffered in the vo ready to flip. Currently always 0 or 1.
+    // This is really a vo variable but currently there's no suitable vo
+    // struct.
+    int num_buffered_frames;
 
     short edl_muted; ///< Stores whether EDL is currently in muted mode.
     short user_muted; ///< Stores whether user wanted muted mode.

Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c	(original)
+++ trunk/mplayer.c	Wed Feb 21 22:59:33 2007
@@ -3182,6 +3182,7 @@
 
 int frame_time_remaining=0; // flag
 int blit_frame=0;
+mpctx->num_buffered_frames=0;
 
 // Make sure old OSD does not stay around,
 // e.g. with -fixed-vo and same-resolution files
@@ -3297,7 +3298,7 @@
   vo_pts=mpctx->sh_video->timer*90000.0;
   vo_fps=mpctx->sh_video->fps;
 
-  if (!frame_time_remaining) {
+  if (!mpctx->num_buffered_frames) {
       double frame_time = update_video(&blit_frame);
       mp_dbg(MSGT_AVSYNC,MSGL_DBG2,"*** ftime=%5.3f ***\n",frame_time);
       if (mpctx->sh_video->vf_inited < 0) {
@@ -3306,8 +3307,11 @@
       }
       if (frame_time < 0)
 	  mpctx->eof = 1;
-      else
+      else {
+	  // might return with !eof && !blit_frame if !correct_pts
+	  mpctx->num_buffered_frames += blit_frame;
 	  time_frame += frame_time / playback_speed;  // for nosound
+      }
   }
 
 // ==========================================================================
@@ -3338,6 +3342,7 @@
 	   unsigned int t2=GetTimer();
 
 	   if(vo_config_count) mpctx->video_out->flip_page();
+	   mpctx->num_buffered_frames--;
 
 	   vout_time_usage += (GetTimer() - t2) * 0.000001;
         }
@@ -3559,7 +3564,7 @@
 
   rel_seek_secs=0;
   abs_seek_pos=0;
-  frame_time_remaining=0;
+  mpctx->num_buffered_frames = 0;
   current_module=NULL;
   loop_seek=0;
 }



More information about the MPlayer-cvslog mailing list