[mythtv-users] mplayer still not in focus
Mike Green
mikey at linuxwiz.org
Mon Jul 25 16:22:07 EDT 2005
I asked this question a while back and never came across an answer. I tried
everything, including all of the various -fstype switches to mplayer.
Nothing would give mplayer the focus.
I eventually settled for a hack that involves running mplayer in a separate
X session and using chvt to switch back and forth. I created two shell
scripts, one to launch the new X session, another to get rid of the blue
band that appears behind mplayer when using an nvidia card. Here are my
scripts.
------------------ cut below -----------------
#!/bin/sh
# This is /usr/local/bin/watchvideo
#
# Note that /usr/bin/chvt must be suid root (chmod u+s /usr/bin/chvt) if
# mythfrontend is not being run as root.
#
# verify args
if [ $# -ne 1 ]; then
echo "usage: watchvideo /path/to/video/video.mpg"
exit 1
else
video="$*"
fi
if [ ! -f "$video" ]; then
echo "failure: invalid video: $video"
exit 1
fi
#
# switch over to different terminal, start new X session.
#
/usr/bin/chvt 8
X :2 vt8 &
sleep 5
export DISPLAY=:2
xhost +
#
# only needed if using nvidia drivers and you get the blue band
#
/usr/local/bin/setcolorkey >/dev/null 2>&1 &
#
# Start mplayer in the 2nd X session. Change mplayer options to
# what you need, particularly the -ao and -vo switches.
#
/usr/bin/mplayer -fs -zoom -quiet -vo xv -ao alsa "$video"
#
# Ugly hack - kill the 2nd X session, change back to mythfrontend on vt7
#
kill -9 `cat /tmp/.X2-lock`
sleep 5
/usr/bin/chvt 7
------------------ cut above -----------------
Here is my /usr/local/bin/setcolorkey, in case you need it.
------------------ cut below -----------------
#!/bin/sh
# setcolorkey - remove the blue band that shows up with nvidia cards
# when using mplayer and the nvidia binary drivers. This requires
# the xvattr utility. Note if not running as root, xvattr needs to
# be suid root (chmod u+s /usr/bin/xvattr).
#
export DISPLAY=:2
# Give mplayer time to start up.
sleep 5
# Fix the blue band
/usr/bin/xvattr -a XV_COLORKEY -v 66048
------------------ cut above -----------------
Plug /usr/local/bin/watchvideo into your setup for watching videos, instead
of directly calling mplayer.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-users/attachments/20050725/e1f96f55/attachment.pgp
More information about the mythtv-users
mailing list