summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/en/mplayer.118
-rw-r--r--cfg-mplayer.h1
-rw-r--r--mplayer.c10
3 files changed, 29 insertions, 0 deletions
diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1
index 580ce3ac14..2ae23ef8c9 100644
--- a/DOCS/man/en/mplayer.1
+++ b/DOCS/man/en/mplayer.1
@@ -836,6 +836,24 @@ More intense frame dropping (breaks decoding).
Leads to image distortion!
.
.TP
+.B \-heartbeat-cmd
+Command that is executed every 30 seconds during playback via system() -
+i.e. using the shell.
+.sp 1
+.I NOTE:
+MPlayer uses this command without any checking, it is your responsibility
+to ensure it does not cause security problems (e.g. make sure to use full
+paths if "." is in your path like on Windows).
+.sp 1
+This can be "misused" to disable screensavers that do not support the proper
+X API for this.
+.sp 1
+.I EXAMPLE for gnome screensaver:
+mplayer \-heartbeat-cmd "gnome-screensaver-command -p" file
+.RE
+.PD 1
+.
+.TP
.B \-identify
Shorthand for \-msglevel identify=4.
Show file parameters in an easily parseable format.
diff --git a/cfg-mplayer.h b/cfg-mplayer.h
index 1728328161..9cc2c953a9 100644
--- a/cfg-mplayer.h
+++ b/cfg-mplayer.h
@@ -207,6 +207,7 @@ const m_option_t mplayer_opts[]={
{"stop_xscreensaver", "Use -stop-xscreensaver instead, options with _ have been obsoleted.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
{"fstype", &vo_fstype_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
#endif
+ {"heartbeat-cmd", &heartbeat_cmd, CONF_TYPE_STRING, 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 --git a/mplayer.c b/mplayer.c
index f4607330ec..6fb986a1a7 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -89,6 +89,8 @@ int enable_mouse_movements=0;
char * proc_priority=NULL;
#endif
+char *heartbeat_cmd;
+
#define ROUND(x) ((int)((x)<0 ? (x)-0.5 : (x)+0.5))
#ifdef HAVE_RTC
@@ -3442,6 +3444,14 @@ if(!mpctx->sh_video) {
xscreensaver_heartbeat();
}
#endif
+ if (heartbeat_cmd) {
+ static unsigned last_heartbeat;
+ unsigned now = GetTimerMS();
+ if (now - last_heartbeat > 30000) {
+ last_heartbeat = now;
+ system(heartbeat_cmd);
+ }
+ }
frame_time_remaining = sleep_until_update(&time_frame, &aq_sleep_time);