From ccc213fdac9783b9e450342cf5a346508e961e2f Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 4 Apr 2013 14:24:42 +0200 Subject: core: add --heartbeat-interval option This closely follows MPlayer commit 36099, with some changes. Move a mutable static variable into MPContext. --- core/mplayer.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'core/mplayer.c') diff --git a/core/mplayer.c b/core/mplayer.c index 460862f057..21af9ca57a 100644 --- a/core/mplayer.c +++ b/core/mplayer.c @@ -3243,10 +3243,11 @@ static void run_playloop(struct MPContext *mpctx) vo_check_events(vo); if (opts->heartbeat_cmd) { - static unsigned last_heartbeat; unsigned now = GetTimerMS(); - if (now - last_heartbeat > 30000) { - last_heartbeat = now; + if (now - mpctx->last_heartbeat > + (unsigned)(opts->heartbeat_interval * 1000)) + { + mpctx->last_heartbeat = now; system(opts->heartbeat_cmd); } } -- cgit v1.2.3