Displaying Video on an EPIA ME6000 on alternate TV-Out

(Part of the BuildingFreevo set.)

Using a PVR-350 on an EPIA ME-6000 board works great for hardware-accelerated MPEG1/2 playback, but cannot keep up with any type of software decoding (for AVI/XviD playback).

Solution: use the VIA onboard CLE266 graphics chip and mplayer's "xv" support, which is fast enough, use its S-Video out, and run an X server on this output only when it is required.

This allows the PVR-350 tv-out to be the main interface in MythTV, and then the user can switch to the other tv-out when they watch video files in MythVideo.

/usr/local/bin/viamplayer (alternative mplayer script which displays on the other tv-out):

#!/bin/sh

set -x

file="$*"

# ensure there isn't one running, just to be sure
sudo /usr/local/etc/kill_video_xserver
rm /tmpfs/:1.pid

# display a nice message on the PVR-350 tv out
echo '

  wm title . "Switch Video Input"
  label .lbl -text "Video file is now playing on the other video input."
  pack .lbl -side top -padx 10 -pady 10

' > /tmpfs/busy.scr ; wish -f /tmpfs/busy.scr &

wishpid=$!

sudo /usr/local/etc/start_video_xserver &
sleep 1

while [ ! -f /tmpfs/:1.pid ] ; do
  sleep 1
done
pid=`cat /tmpfs/:1.pid`

xauth merge /tmpfs/:1.auth

mplayer -fs -zoom -quiet -framedrop \
        -ao oss:/dev/dsp \
        -vo xv -display :1 "$file"

status=$!

sudo /usr/local/etc/kill_video_xserver
kill $wishpid

exit $status

/usr/local/etc/start_video_xserver:

#!/bin/sh

xinit /usr/local/etc/start_video_clients -- :1 \
        -br -noreset -nolisten tcp -v \
        -xf86config /etc/X11/XF86Config-4.via

/usr/local/etc/start_video_clients:

#!/bin/sh

set -x

echo $$ > /tmpfs/:1.pid
tmpf=/tmpfs/:1.auth
xauth extract - :1 > $tmpf
chmod 644 $tmpf /tmpfs/:1.pid
chown mythtv /tmpfs/:1.pid /tmpfs/:1.auth

xset s off

# wait for the X server to be killed before we exit
while true ; do
  sleep 60
  if xdpyinfo ; then
    echo "X is still running, not quitting client script"
  else
    echo "X no longer running, done"
    exit
  fi
done

/usr/local/etc/kill_video_xserver:

#!/bin/sh

pkill -f " :1 "

/etc/X11/XF86Config-4.via:

Section "ServerLayout"
        Identifier     "XFree86 Configured"
        Screen  0 "TV Screen"
        InputDevice    "PS/2 Mouse" "CorePointer"
        InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "ServerFlags"
        Option "AllowMouseOpenFail"  "true"

EndSection

Section "Files"
        RgbPath      "/usr/X11R6/lib/X11/rgb"
        ModulePath   "/usr/X11R6/lib/modules"
        FontPath     "/usr/X11R6/lib/X11/fonts/misc:unscaled"
        FontPath     "/usr/X11R6/lib/X11/fonts/misc"
        FontPath     "/usr/X11R6/lib/X11/fonts/75dpi:unscaled"
        FontPath     "/usr/X11R6/lib/X11/fonts/75dpi"
        FontPath     "/usr/X11R6/lib/X11/fonts/100dpi:unscaled"
        FontPath     "/usr/X11R6/lib/X11/fonts/100dpi"
        FontPath     "/usr/X11R6/lib/X11/fonts/Speedo"
        FontPath     "/usr/X11R6/lib/X11/fonts/PEX"
# Additional fonts: Locale, Gimp, TTF...
        FontPath     "/usr/X11R6/lib/X11/fonts/cyrillic"
#       FontPath     "/usr/X11R6/lib/X11/fonts/latin2/75dpi"
#       FontPath     "/usr/X11R6/lib/X11/fonts/latin2/100dpi"
# True type and type1 fonts are also handled via xftlib, see /etc/X11/XftConfig!
        FontPath     "/usr/X11R6/lib/X11/fonts/Type1"
        FontPath     "/usr/share/fonts/ttf/western"
        FontPath     "/usr/share/fonts/ttf/decoratives"
        FontPath     "/usr/share/fonts/truetype"
        FontPath     "/usr/share/fonts/truetype/openoffice"
        FontPath     "/usr/share/fonts/truetype/ttf-bitstream-vera"
        FontPath     "/usr/share/fonts/latex-ttf-fonts"
        FontPath     "/usr/X11R6/lib/X11/fonts/defoma/CID"
        FontPath     "/usr/X11R6/lib/X11/fonts/defoma/TrueType"
EndSection

Section "Module"
        #Load  "ddc"  # ddc probing of monitor
#       Load  "GLcore"
        #Load  "v4l"
        Load  "dbe"
        Load  "extmod"
#       Load  "glx"
        #Load  "bitmap" # bitmap-fonts
        #Load  "speedo"
        Load  "type1"
        Load  "freetype"
        Load  "record"
EndSection

Section "InputDevice"
        Identifier  "Keyboard0"
        Driver      "keyboard"
        Option      "CoreKeyboard"
        Option "XkbRules" "xfree86"
        Option "XkbModel" "pc105"
        Option "XkbLayout" "us"

EndSection

Section "InputDevice"
        Identifier  "Serial Mouse"
        Driver      "mouse"
        Option      "Protocol" "Microsoft"
        Option      "Device" "/dev/ttyS0"
        Option      "Emulate3Buttons" "true"
        Option      "Emulate3Timeout" "70"
        Option      "SendCoreEvents"  "true"
EndSection

Section "InputDevice"
        Identifier  "PS/2 Mouse"
        Driver      "mouse"
        Option      "Protocol" "auto"
Option          "ZAxisMapping"          "4 5"
        Option      "Device" "/dev/psaux"
        Option      "Emulate3Buttons" "true"
        Option      "Emulate3Timeout" "70"
        Option      "SendCoreEvents"  "true"
EndSection

Section "InputDevice"
        Identifier      "USB Mouse"
        Driver          "mouse"
        Option          "Device"                "/dev/input/mice"
        Option          "SendCoreEvents"        "true"
        Option          "Protocol"              "IMPS/2"
        Option          "ZAxisMapping"          "4 5"
        Option          "Buttons"               "5"
EndSection

Section "Monitor"
        Identifier  "NTSC Monitor"

        HorizSync  30-50
        VertRefresh 60
        # http://knoppmythwiki.homelinux.org/index.php?page=KnoppMythR5PreviewInstall

        # HorizSync  30-68
        # VertRefresh 50-120
        Mode "720x480"
          # D: 34.563 MHz, H: 37.244 kHz, V: 73.897 Hz
          DotClock 34.564
          HTimings 720 752 840 928
          VTimings 480 484 488 504
          Flags    "-HSync" "-VSync"
        EndMode
EndSection

Section "Device"
        Identifier  "VIA CLE266 Framebuffer"
        Driver      "via"
        VendorName      "Via"
        BoardName       "cle266"
        VideoRam    32768
        Option      "ActiveDevice" "CRT,TV"
        Option      "TVType" "NTSC"
        Option      "TVOutput" "S-Video"
        Option      "PciRetry" "true"
EndSection

Section "Screen"
        Identifier  "TV Screen"
        Device      "VIA CLE266 Framebuffer"
        Monitor     "NTSC Monitor"
        DefaultDepth 24
        DefaultFbbpp 32
        Subsection "Display"
          Depth 24
          FbBpp 32
          Modes "720x480"
        EndSubsection
EndSection

Section "DRI"
        Mode 0666
EndSection

PvrDoubleTvOut (last edited 2005-05-01 21:48:43 by c-24-126-25-181)