#!/bin/sh

# tvout_mplayer.sh
# 2013-12-14
# by Gernot Walzl

# TV-out script for NVIDIA cards
# Starts mplayer on a separate X screen on TV

# DVD ISO Playback
# mplayer dvd:// -dvd-device /path/to/IMAGE.ISO

# /etc/X11/xorg.conf
#
#Section "Monitor"
#    Identifier "MONITOR_TV"
#    VertRefresh 60
#    HorizSync 30-50
#EndSection
#
#Section "Device"
#    # http://de.download.nvidia.com/XFree86/Linux-x86/195.36.31/README/configtvout.html
#    Identifier "NVIDIA_TV"
#    Driver "nvidia"
#    Option "TVStandard" "PAL-B"
#    Option "UseDisplayDevice" "TV"
#    Option "TVOutFormat" "COMPOSITE"
#EndSection
#
#Section "Screen"
#    Identifier "SCREEN_TV"
#    Device "NVIDIA_TV"
#    Monitor "MONITOR_TV"
#    DefaultDepth 24
#    Subsection "Display"
#        Depth 24
#        Modes "800x600"
#    EndSubsection
#EndSection
#
#Section "ServerLayout"
#    Identifier "TV"
#    Screen "SCREEN_TV"
#    InputDevice "Mouse1" "CorePointer"
#    InputDevice "Keyboard1" "CoreKeyboard"
#EndSection

X -layout TV :1 -ac &
sleep 3
DISPLAY=:1 mplayer -fs "$@"
kill $(ps -C X -f | awk '/TV/ {print $2}')