equal
deleted
inserted
replaced
|
1 #!/bin/bash |
|
2 # |
|
3 # This script is called from VDR to start MPlayer |
|
4 # |
|
5 # argument 1: the file to play |
|
6 # argument 2: (optional) the phrase SLAVE if SlaveMode is enabled |
|
7 # argument 3: (optional) the phrase AID x to select audio stream x |
|
8 |
|
9 # where to find mplayer |
|
10 MPLAYER="mplayer" |
|
11 |
|
12 # mplayer options, -vc will be added below |
|
13 # add "-lircconf <lircrc>" to enable LIRC support |
|
14 OPTS="-vo mpegpes" |
|
15 |
|
16 # mplayer options for SlaveMode |
|
17 SLAVE="-slave -quiet -nolirc" |
|
18 |
|
19 ##################### |
|
20 |
|
21 FILE=$1 |
|
22 case "$FILE" in |
|
23 *.pls | *.m3u) |
|
24 popt="-playlist" |
|
25 first=`grep -v -m1 "^#" $FILE` |
|
26 type=`file "$first"` |
|
27 ;; |
|
28 *) |
|
29 type=`file "$FILE"` |
|
30 ;; |
|
31 esac |
|
32 |
|
33 while shift; do |
|
34 if [ "$1" = "SLAVE" ]; then |
|
35 sopt=$SLAVE |
|
36 elif [ "$1" = "AID" ]; then |
|
37 aopt="-aid $2" |
|
38 shift |
|
39 fi |
|
40 done |
|
41 |
|
42 case "$type" in |
|
43 *AVI*) |
|
44 VC="ffdivx" |
|
45 ;; |
|
46 *MPEG*) |
|
47 VC="mpegpes" |
|
48 ;; |
|
49 *) |
|
50 echo "Unknown video file format $type" |
|
51 echo "Edit mplayer.sh to support this file type" |
|
52 exit 1 |
|
53 ;; |
|
54 esac |
|
55 |
|
56 exec $MPLAYER $OPTS -vc $VC $sopt $aopt $popt "$FILE" |
|
57 |