#!/bin/sh

# hdmi_mplayer.sh
# 2013-12-13
# by Gernot Walzl

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

# ftp://download.nvidia.com/XFree86/Linux-x86/290.10/README/xconfigoptions.html
# ftp://download.nvidia.com/XFree86/gpu-hdmi-audio-document/gpu-hdmi-audio.html

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

# /etc/X11/xorg.conf
#
#Section "Monitor"
#    Identifier "MONITOR_HDMI"
#EndSection
#
#Section "Device"
#    Identifier "NVIDIA_HDMI"
#    Driver "nvidia"
#    Option "ConnectedMonitor" "DFP-1"
#    Option "UseDisplayDevice" "DFP-1"
#    Option "UseEdidDpi" "false"
#    Option "DPI" "125 x 125"
#EndSection
#
#Section "Screen"
#    Identifier "SCREEN_HDMI"
#    Device "NVIDIA_HDMI"
#    Monitor "MONITOR_HDMI"
#    DefaultDepth 24
#EndSection
#
#Section "ServerLayout"
#    Identifier "HDMI"
#    Screen "SCREEN_HDMI"
#    InputDevice "Mouse1" "CorePointer"
#    InputDevice "Keyboard1" "CoreKeyboard"
#EndSection

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