[MPlayer-cvslog] r36099 - in trunk: DOCS/man/en/mplayer.1 cfg-mplayer.h mplayer.c mplayer.h

reimar subversion at mplayerhq.hu
Sat Mar 30 09:42:58 CET 2013


Author: reimar
Date: Sat Mar 30 09:42:57 2013
New Revision: 36099

Log:
Add -heartbeat-interval option.

Patch by Android Jack [jackdroido gmail], with minor modification and
man page update by me.

Modified:
   trunk/cfg-mplayer.h
   trunk/mplayer.c
   trunk/mplayer.h

Changes in other areas also in this revision:
Modified:
   trunk/DOCS/man/en/mplayer.1

Modified: trunk/cfg-mplayer.h
==============================================================================
--- trunk/cfg-mplayer.h	Sat Mar 30 04:32:16 2013	(r36098)
+++ trunk/cfg-mplayer.h	Sat Mar 30 09:42:57 2013	(r36099)
@@ -189,6 +189,7 @@ const m_option_t mplayer_opts[]={
     {"fstype", &vo_fstype_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
 #endif
     {"heartbeat-cmd", &heartbeat_cmd, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {"heartbeat-interval", &heartbeat_interval, CONF_TYPE_FLOAT, CONF_MIN, 0.0, 0, NULL},
     {"mouseinput", &vo_nomouse_input, CONF_TYPE_FLAG, 0, 1, 0, NULL},
     {"nomouseinput", &vo_nomouse_input, CONF_TYPE_FLAG,0, 0, 1, NULL},
 

Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c	Sat Mar 30 04:32:16 2013	(r36098)
+++ trunk/mplayer.c	Sat Mar 30 09:42:57 2013	(r36099)
@@ -146,6 +146,7 @@ int enable_mouse_movements;
 float start_volume = -1;
 double start_pts   = MP_NOPTS_VALUE;
 char *heartbeat_cmd;
+float heartbeat_interval = 30.0;
 static int max_framesize;
 
 int noconsolecontrols;
@@ -3818,7 +3819,9 @@ goto_enable_cache:
                 if (heartbeat_cmd) {
                     static unsigned last_heartbeat;
                     unsigned now = GetTimerMS();
-                    if (now - last_heartbeat > 30000) {
+                    // compare as unsigned so that any mistakes (overflow etc)
+                    // trigger a heartbeat, thus resetting the logic.
+                    if (now - last_heartbeat > (unsigned)(heartbeat_interval * 1000)) {
                         last_heartbeat = now;
                         system(heartbeat_cmd);
                     }

Modified: trunk/mplayer.h
==============================================================================
--- trunk/mplayer.h	Sat Mar 30 04:32:16 2013	(r36098)
+++ trunk/mplayer.h	Sat Mar 30 09:42:57 2013	(r36099)
@@ -33,6 +33,7 @@ extern int frame_dropping;
 extern int slave_mode;
 extern int player_idle_mode;
 extern int use_menu;
+extern float heartbeat_interval;
 
 extern float  audio_delay;
 extern double start_pts;


More information about the MPlayer-cvslog mailing list