# HG changeset patch # User reimar # Date 1364632977 0 # Node ID 3be3990375da911d302a1bbf22911dba2ef048cc # Parent b81edd9d28ab2c014fe6d759be6a7244d18d9fb9 Add -heartbeat-interval option. Patch by Android Jack [jackdroido gmail], with minor modification and man page update by me. diff -r b81edd9d28ab -r 3be3990375da DOCS/man/en/mplayer.1 --- a/DOCS/man/en/mplayer.1 Sat Mar 30 03:32:16 2013 +0000 +++ b/DOCS/man/en/mplayer.1 Sat Mar 30 08:42:57 2013 +0000 @@ -1076,6 +1076,10 @@ .PD 1 . .TP +.B \-heartbeat\-interval +Specify how often the \-heartbeat\-cmd should be executed, in seconds between executions (default: 30.0). +. +.TP .B \-identify Shorthand for \-msglevel identify=4. Show file parameters in an easily parseable format. diff -r b81edd9d28ab -r 3be3990375da cfg-mplayer.h --- a/cfg-mplayer.h Sat Mar 30 03:32:16 2013 +0000 +++ b/cfg-mplayer.h Sat Mar 30 08:42:57 2013 +0000 @@ -189,6 +189,7 @@ {"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}, diff -r b81edd9d28ab -r 3be3990375da mplayer.c --- a/mplayer.c Sat Mar 30 03:32:16 2013 +0000 +++ b/mplayer.c Sat Mar 30 08:42:57 2013 +0000 @@ -146,6 +146,7 @@ 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 @@ 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); } diff -r b81edd9d28ab -r 3be3990375da mplayer.h --- a/mplayer.h Sat Mar 30 03:32:16 2013 +0000 +++ b/mplayer.h Sat Mar 30 08:42:57 2013 +0000 @@ -33,6 +33,7 @@ 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;