#!/bin/sh
#
# configure MPlayer's video settings
#
# runlevels: geexbox, debug, configure

echo "### Configuring MPlayer's video settings ###"

# set mplayer for X server
if [ -f /usr/bin/Xorg -a -f /var/use_xorg ]; then
  mp_set_option vo "xv,xvidix,x11"
  mp_set_option display ":0"
  mp_set_option vsync "no"
  mp_set_option fixed-vo "no"
  mp_set_option nomouseinput "yes"
  mp_set_option nograbpointer "yes"
  mp_set_option stop-xscreensaver "yes"
  exit 0
fi

# include tvout configuration file
[ -f /etc/tvout ] && . /etc/tvout

# set mplayer resolution when using offb
if [ -e /dev/fb0 ]; then
  RES=`/usr/sbin/fbset | sed -n 's/mode "\(.*\)-.*"/\1/p'`
  RESX=`echo $RES | cut -f1 -dx`
  RESY=`echo $RES | cut -f2 -dx`
  mp_set_option screenw "$RESX"
  mp_set_option screenh "$RESY"
else
  mp_set_option screenw 640
  mp_set_option screenh 480
fi
mp_set_option vf "expand=-1:-1:-1:-1:1" concat

# set double to no for nvidia, sis and Kyro cards and VMWare
#for i in '0300: 10de:' '0300: 1039:' '0300: 104a:0010' '0300: 15ad:'; do
#  if grep -q "$i" /tmp/pci; then
#    if [ "$i" = '0300: 10de:' -a ! -f /etc/mplayer/no_unstable_vidix ]; then
#      # except if we want to try nvidia vidix
#      mp_set_option vf "format=yuy2" concat
#    elif [ "$i" = '0300: 1039:' -a ! -f /etc/mplayer/no_unstable_vidix ]; then
#      # or if we want to try sis vidix
#      echo > /dev/null # need a no-op here
#    else
#      mp_set_option vo "vesa"
#      mp_set_option double "no"
#      mp_set_option vf "expand=-1:-1:-1:-1:1" concat
#    fi
#  fi
#done

# Force -vo vesa for some ATI Mobility Radeons
#if grep -q '0300: 1002:4c59' /tmp/pci; then
#  mp_set_option vo "vesa"
#fi

# do not use VESA Direct Graphic Access on Intel cards
#grep -q -e '0300: 8086:' /tmp/pci && mp_set_option vo "vesa:nodga"

# set the tvout aspect
mp_set_option monitoraspect "4:3"

exit 0
