[mythtv-users] mplayer and screensavers...something to be aware of

Tom Dexter digitalaudiorock at gmail.com
Wed Apr 2 20:26:14 UTC 2008

I only use mplayer for a few video types that I rarely watch.  Not
long ago I noticed that, after upgrading from
mplayer-1.0_rc2_p24929-r1 to mplayer-1.0_rc2_p25993 under Gentoo, the
stop-xscreensaver functionality in mplayer (in the command line or
config file) wasn't working.  That is, the screensaver would go on
during playback.  I'm using xscreensaver with fluxbox.  After quite a
bit of digging (even into the code itself) here's what I've found.

Apparently the issue of dealing with screen savers has been an ongoing
issue for some time between developers of video apps, screen savers,
and the xorg folks.  There's a screen saver API in X11 as defined in
/usr/include/X11/extensions/scrnsaver.h (on my Gentoo box anyway).
Apparently however, many screen savers including both the gnome screen
saver and xscreensaver don't work with that API.  I'm actually not
clear on which do(??).  Apparently the mplayer devs finally got fed up
and went with the approach of calling XResetScreenSaver from the above
X11 API and, if your screen saver doesn't support it, that's the
screen savers problem.  To be honest, I can't say as I blame them.
It's a bit ludicrous to expect x11 video application coders to support
every API of every individual screen saver out there.  Having said
that...I'm REALLY glad that mythtv supports xscreensaver :D

So if anyone's wondering why their screen saver started coming of
while using mplayer...this is most likely why.  In these newer
versions there's a new command line option added called -heartbeat-cmd
that can be used as a kludged work around, as explained in the man

              Command  that  is  executed  every 30 seconds during
playback via system() -
              i.e. using the shell.

              NOTE: MPlayer uses this command without any checking, it
is  your  responsi-
              bility  to ensure it does not cause security problems
(e.g. make sure to use
              full paths if "." is in your path like on Windows).

              This can be "misused" to disable screensavers that do
not support the proper
              X  API for this.  If you think this is too complicated
ask the author of the
              screensaver program to support the proper X APIs for this.

              EXAMPLE for xscreensaver: mplayer -heartbeat-cmd
"xscreensaver-command  -de-
              activate" file

              EXAMPLE   for   gnome  screensaver:  mplayer
-heartbeat-cmd  "gnome-screen-
              saver-command -p" file

That seems to work, and also properly stops executing that heartbeat
command when the video is paused.  I guess the main reason they use
the term "misused" is that this approach assumes that X is in fact
running on that same machine as mplayer, although that's usually the


More information about the mythtv-users mailing list