]> git.sesse.net Git - mlt/blob - demo/demo
demo framework added
[mlt] / demo / demo
1 #!/bin/bash
2
3 function show_menu( )
4 {
5         sed 's/\t\+/\t/g' < demo.ini |
6         awk -F '\t' '{ printf( "%2d. %-30.30s", ++ i, $2 ); if ( i % 2 == 0 ) printf( "\n" ); }'
7 }
8
9 function check_dependencies( )
10 {
11         option=$1
12         if [ $option -gt 0 ]
13         then
14                 deps=`sed 's/\t\+/\t/g' < demo.ini | cut -f 3 | head -n $option | tail -n -1`
15                 if [ "$deps" != "" ]
16                 then
17                         echo "$deps" | 
18                         tr ',' '\n' | 
19                         while read dep 
20                         do
21                                 ls $dep > /dev/null 2>&1
22                                 val=$?
23                                 [ $val != 0 ] && echo Failed to find $dep >&2 && echo $val
24                         done
25                 fi
26                 echo 0
27         fi
28 }
29
30 function get_demo( )
31 {
32         option=$1
33         if [ $option -gt 0 ]
34         then
35                 cut -f 1 demo.ini | head -n $option | tail -n -1
36         fi
37 }
38
39 while [ 1 ]
40 do
41
42 cat << "eof"
43 Select Consumer
44
45 1. Play with Inigo half size
46 2. Play with Inigo full size
47 3. Serialise with Westley to terminal
48 4. Play with Westley
49
50 0. Exit
51
52 eof
53
54         echo -n "Option: "
55         read option
56         echo
57
58         export MLT_CONSUMER=
59
60         case "$option" in
61                 "0" ) exit 0 ;;
62                 "1" ) export MLT_CONSUMER="sdl:360x288 buffer=1" ;;
63                 "2" ) export MLT_CONSUMER="sdl" ;;
64                 "3" ) export MLT_CONSUMER="westley" ;;
65                 "4" ) export MLT_CONSUMER="westley:" ;;
66                 "5" ) export MLT_CONSUMER="mcdv:NTSC target=/dev/dv1394 rescale=nearest" ;;
67                 "6" ) export MLT_CONSUMER="bluefish:NTSC" ;;
68                 "7" ) export MLT_CONSUMER="sdl rescale=none" ;;
69         esac
70
71         while [ $option != 0 -a "$MLT_CONSUMER" != "" ]
72         do
73                 echo Choose Demo
74                 echo
75         
76                 show_menu
77         
78                 echo
79                 echo -n "Option: "
80                 read option
81                 echo
82         
83                 demo=`get_demo $option`
84                 usable=`check_dependencies $option`
85         
86                 if [ "$usable" = "0" -a "$demo" != "" ]
87                 then
88                         if [ "$MLT_CONSUMER" == "westley:" ]
89                         then    export WESTLEY_CONSUMER="westley:$demo.westley"
90                                         bash $demo -consumer $WESTLEY_CONSUMER
91                                         inigo +$demo.txt out=100 $demo.westley $demo.westley -filter watermark:watermark1.png composite.fill=true
92                         elif [ "$MLT_CONSUMER" == "westley" ]
93                         then    bash $demo -consumer $MLT_CONSUMER | less
94                         else    bash $demo -consumer $MLT_CONSUMER
95                         fi
96                 elif [ "$usable" != "" ]
97                 then
98                         echo 
99                         echo Unable to locate suitable files for the demo - please provide them.
100                         read pause
101                 fi
102         
103                 stty sane
104         done
105
106 done