[MPlayer-dev-eng] [PATCH] VFCTRL_PAUSE_UPDATE

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Thu Sep 15 17:43:44 CEST 2005


Hi,
this is the part from the vf_overlay patch that adds the
VFCTRL_PAUSE_UPDATE control that helps ensure a certain framerate.
Please review and comment.
I think it might make sense to update time_frame when it is called
before sleeping. Do you agree? And if yes, how should this be done?
Would GetRelativeTime be the right function?

Greetings,
Reimar Döffinger
-------------- next part --------------
--- mplayer.c	2005-09-11 12:47:18.000000000 -0400
+++ mplayer.c	2005-09-14 17:31:19.000000000 -0400
@@ -2548,6 +2548,10 @@
 	current_module="sleep_rtc";
         while (time_frame > 0.000) {
 	    unsigned long rtc_ts;
+	    // Update overlay; ensures an overlay framerate that is independent of
+	    // movie framerate.
+	    if (sh_video && sh_video->vfilter) 
+		    ((vf_instance_t*)sh_video->vfilter)->control(sh_video->vfilter, VFCTRL_PAUSE_UPDATE, video_out);
 	    if (read (rtc_fd, &rtc_ts, sizeof(rtc_ts)) <= 0)
 		    mp_msg(MSGT_CPLAYER, MSGL_ERR, MSGTR_LinuxRTCReadError, strerror(errno));
     	    time_frame-=GetRelativeTime();
@@ -2568,6 +2572,8 @@
 	float min=softsleep?0.021:0.005;
 	current_module="sleep_timer";
         while(time_frame>min){
+          if (sh_video && sh_video->vfilter) 
+             ((vf_instance_t*)sh_video->vfilter)->control(sh_video->vfilter, VFCTRL_PAUSE_UPDATE, video_out);
           if(time_frame<=0.020)
              usec_sleep(0); // sleeps 1 clock tick (10ms)!
           else
@@ -2764,7 +2770,7 @@
       if (audio_out && sh_audio)
          audio_out->pause();	// pause audio, keep data if possible
 
-      while( (cmd = mp_input_get_cmd(20,1,1)) == NULL) {
+      while( (cmd = mp_input_get_cmd(3,1,1)) == NULL) {
 	     if(sh_video && video_out && vo_config_count) video_out->check_events();
 #ifdef HAVE_NEW_GUI
              if(use_gui){
@@ -2777,7 +2783,11 @@
 	     if(vf_menu)
 	       vf_menu_pause_update(vf_menu);
 #endif
-             usec_sleep(20000);
+	     if (sh_video && sh_video->vfilter && CONTROL_OK == 
+	         ((vf_instance_t*)sh_video->vfilter)->control(sh_video->vfilter, VFCTRL_PAUSE_UPDATE, video_out))
+	       usec_sleep(1000);
+	     else
+	       usec_sleep(20000);
          }
       if (cmd && cmd->id == MP_CMD_PAUSE) {
       cmd = mp_input_get_cmd(0,1,0);
--- libmpcodecs/vf.h	2005-09-11 12:47:19.000000000 -0400
+++ libmpcodecs/vf.h	2005-09-11 12:48:53.000000000 -0400
@@ -75,6 +75,7 @@
 #define VFCTRL_SKIP_NEXT_FRAME 12 /* For encoding - drop the next frame that passes thru */
 #define VFCTRL_FLUSH_FRAMES    13 /* For encoding - flush delayed frames */
 #define VFCTRL_SCREENSHOT      14 /* Make a screenshot */
+#define VFCTRL_PAUSE_UPDATE    15 /* For every iteration of the pause loop */
 
 #include "vfcap.h"
 


More information about the MPlayer-dev-eng mailing list