summaryrefslogtreecommitdiff
path: root/extra/xine-mplayer-sh/mplayer.sh
blob: c7c9829d05315b60c20d97cd84c72f9251029d5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/sh
#
# mplayer.sh for x-vdr and xine
# Marc Wernecke - www.zulu-entertainment.de
# 28.09.2005
#
# This script is called from VDR to start mplayer
#
# argument 1: the file to play
# argument 2: (optional) the phrase SLAVE if SlaveMode is enabled
# argument 3: (optional) the phrase AID x to select audio stream x

# Where to find mplayer
MPLAYER="mplayer"

# mplayer options
OPTS="-fs -vo xv -ao oss -cache 4096"

# mplayer options for SlaveMode
SLAVE="-slave -quiet -nolirc"

# DVD-Device
DVD="/dev/dvd"

# What languages do your DVD's use ?
DVDLANG="de"

# extra DVD options
DVDOPTIONS="-af list=volume:volume=170"

####################################################################################

FILE=$1
type=`file "$FILE"`

while shift; do
  if [ "$1" = "SLAVE" ]; then
    sopt=$SLAVE
  elif [ "$1" = "AID" ]; then
    aopt="-aid $2"
    shift
  fi
done

CMDLINE="$MPLAYER $OPTS $sopt $aopt"

# get the file extension of the video
SUFFIX=$(echo -e "${FILE:$[${#FILE}-4]:4}" | tr [A-Z] [a-z])

# for debug only
echo "MPLayer command: $CMDLINE" 2>&1 |logger

case $SUFFIX in
	.iso ) DISPLAY=:0.0 $CMDLINE -alang $DVDLANG $DVDOPTIONS -dvd-device "$FILE" dvd:// 2>&1 |logger;;
	/dvd ) DISPLAY=:0.0 $CMDLINE -alang $DVDLANG $DVDOPTIONS -dvd-device $DVD dvd:// 2>&1 |logger ;;
	/vcd ) DISPLAY=:0.0 $CMDLINE -cdrom-device $DVD vcd:// 2>&1 |logger;;
	.cue ) DISPLAY=:0.0 $CMDLINE -cdrom-device $DVD cue://"$FILE":2  2>&1 |logger ;;
	* )    DISPLAY=:0.0 $CMDLINE "$FILE" 2>&1 |logger ;;
esac 

exit

####################################################################################