[MPlayer-dev-eng] first draft of an mplayer installation script

C.Straehle at urz.uni-heidelberg.de C.Straehle at urz.uni-heidelberg.de
Tue Mar 11 18:47:13 CET 2003


Hi, 
i'm using MPlayer quite some time now, and i want to contribute somehow. 
this is a little bit difficult since i'm no c-coder. I thought about the  
ugliest thing in MPlayer, and this is by far the difficult installation and  
configuration process. So here is my Idea : 
why not distribute a script that will take care of downloading codecs, fonts,  
gui and of course MPlayer compile and install everything correctly to take  
this heavy;-) burden from the user. Since i don't have any experience in  
shell-scripting either my script is at least complete bullshit, but maybe you  
guys  can modify and improve it or at least consider the general idea of an  
installation script  ? 
What my script does : 
 
-download codecs,font,standard gui, and MPlayer 
-extracts them  
-configures MPlayer for gui, menu and those codecs 
-compiles MPlayer 
-looks for the echo 1024 > maxuserfrq stuff in /etc/rc.d/rc.sysinit - if it's  
not there it will ask to add this line 
-if it detects an nVidia grahpics card : questions you to download&install  
nvtv for tv-out support and installs a NTSC/PAL detection wrapper script for  
playing movies on the TV without stuttering 
-if it detects KDE it questions you to integrate MPlayer into it (if you have  
nvtv downloaded it will integrate this too ...) 
 
since i'm no gnome matrox ati or other stuff user i don't know how to add 
configuration for those - everyone could add config stuff for special  
software/hardware configurations he uses. Everyone would benefit from it. 
 
here is my script : 
 
#!/bin/bash 
#improvements tips and bugs to c.straehle at urz.uni-heidelberg.de 
####################################################################################### 
####################################################################################### 
# 
# 
# 
#                       preconfiguration 
# 
# 
# 
######################################################################################## 
####################################################################################### 
BACKTITLE="MPlayer installation" 
DIR=~/.mplayer_install 
 
dialog --backtitle "$BACKTITLE" \ 
        --title "MPLayer installation path" \ 
        --inputbox "where do you want to install MPlayer" \ 
        10 75 "/usr/local" \ 
2>/tmp/dialog.ans 
if [ "$?" != "0" ] 
then 
exit 0 
fi 
 
PREFIX=$(cat /tmp/dialog.ans) 
 
SUBDIR_SKINS=/Skin 
SUBDIR_FONTS=/releases/fonts 
SUBDIR_RELEASES=/releases 
SUBDIR_CODECS=/releases/codecs 
CODEC_DIR=$PREFIX/lib/mplayer/codecs 
VERSION=MPlayer-0.90rc4 
CONFIGURE_OPTIONS="--enable-menu --enable-gui --with-extralibdir=$CODEC_DIR  
--with-reallibdir=$CODEC_DIR/rp9codecs/" 
 
OLDDIR=`pwd` 
 
mkdir $DIR 
mkdir $DIR$SUBDIR_SKINS 
mkdir $DIR$SUBDIR_RELEASES 
mkdir $DIR$SUBDIR_CODECS 
mkdir $DIR$SUBDIR_FONTS 
 
 
####################################################################################### 
####################################################################################### 
# 
# 
# 
#                       codec selection 
# 
# 
# 
######################################################################################## 
####################################################################################### 
dialog  --separate-output --backtitle "$BACKTITLE" \ 
        --title "MPLayer codec selection" \ 
        --checklist "Select the MPlayer codec-packs you want to install on  
your  
system" 20 55 15 \ 
        win32codecs "Win32" on \ 
        qt6dlls "Quicktime6 DLL's" on \ 
        qtextras "Quicktime Extra DLL's" on \ 
        rp9codecs "Realplayer9 codecs" on \ 
        xanimdlls "XAnim DLL's" on \ 
        dmocodecs "Win32/DMO codecs (WMA9/WMV9)" on \ 
        mjpeg2kdlls "MJPEG2000 DLLs (Imagepower and Morgan)" on \ 
2>/tmp/dialog.ans 
if [ "$?" != "0" ] 
then 
exit 0 
fi 
CODECS=$(cat /tmp/dialog.ans) 
 
 
####################################################################################### 
####################################################################################### 
# 
# 
# 
#                       ./configure options 
# 
# 
# 
######################################################################################## 
####################################################################################### 
TEMP=$(cat $DIR/configure_options) 
if [ -z "$TEMP" ] 
then 
TEMP=$CONFIGURE_OPTIONS 
fi 
 
CONFIGURE_OPTIONS=$TEMP 
dialog --backtitle "$BACKTITLE" \ 
        --title "MPLayer configure options" \ 
        --inputbox "edit the MPlayer configure options to your needs" \ 
        10 75 "$CONFIGURE_OPTIONS" \ 
2>$DIR/configure_options 
if [ "$?" != "0" ] 
then 
exit 0 
fi 
CONFIGURE_OPTIONS=$(cat $DIR/configure_options) 
 
 
####################################################################################### 
####################################################################################### 
# 
# 
# 
#                       download everything from the web 
# 
# 
# 
######################################################################################## 
####################################################################################### 
dialog  --backtitle "$BACKTITLE" \ 
        --title "MPLayer mirror selection" \ 
        --radiolist "Select the MPlayer mirror you want to use" 20 55 15 \ 
        "ftp://ftp1.mplayerhq.hu/MPlayer" "HUN1" on \ 
        "ftp://ftp2.mplayerhq.hu/MPlayer" "HUN2" off \ 
        "ftp://ftp.lug.udel.edu/MPlayer"  "USA1" off \ 
        "ftp://mirrors.xmission.com/MPlayer" "USA2" off \ 
2>/tmp/dialog.ans 
if [ "$?" != "0" ] 
then 
exit 0 
fi 
MIRROR=$(cat /tmp/dialog.ans) 
echo $CODECS 
echo $MIRROR 
 
cd $DIR$SUBDIR_CODECS 
for FILE in $CODECS 
do 
wget $MIRROR$SUBDIR_CODECS/$FILE.tar.bz2 --continue 
done 
 
cd $DIR$SUBDIR_RELEASES 
wget $MIRROR$SUBDIR_RELEASES/$VERSION.tar.bz2 --continue 
cd $DIR$SUBDIR_SKINS 
wget $MIRROR$SUBDIR_SKINS/default-1.7.tar.bz2 --continue 
cd $DIR$SUBDIR_FONTS 
wget $MIRROR$SUBDIR_FONTS/font-arial-cp1250.tar.bz2 --continue 
 
####################################################################################### 
####################################################################################### 
# 
# 
# 
#                       extracting and installing files 
# 
# 
# 
######################################################################################## 
####################################################################################### 
mkdir $PREFIX/lib/mplayer 
mkdir $CODEC_DIR 
mkdir $PREFIX/share/mplayer 
mkdir $PREFIX/share/mplayer/Skin 
mkdir $PREFIX/etc/mplayer 
 
cd $DIR$SUBDIR_CODECS 
for FILE in $CODECS 
do 
tar -xvjf $FILE.tar.bz2 -C $CODEC_DIR 
done 
 
cd $DIR$SUBDIR_SKINS 
tar -xvjf default-1.7.tar.bz2 -C $PREFIX/share/mplayer/Skin 
 
cd $DIR$SUBDIR_FONTS 
tar -xvjf font-arial-cp1250.tar.bz2 -C $PREFIX/share/mplayer 
ln -s $PREFIX/share/mplayer/cp1250/arial-16 $PREFIX/share/mplayer/font 
 
cd $DIR$SUBDIR_RELEASES 
tar -xvjf $VERSION.tar.bz2 
cp $VERSION/etc/input.conf $PREFIX/etc/mplayer/ 
echo "m menu up" >> $PREFIX/etc/mplayer/input.conf 
cp $VERSION/etc/menu.conf $PREFIX/etc/mplayer/ 
 
echo "vop=pp" > $PREFIX/etc/mplayer/mplayer.conf 
echo "autoq=5" >> $PREFIX/etc/mplayer/mplayer.conf 
echo "cache=4096" >> $PREFIX/etc/mplayer/mplayer.conf 
echo "menu=1" >> $PREFIX/etc/mplayer/mplayer.conf 
 
 
####################################################################################### 
####################################################################################### 
# 
# 
# 
#                       ./configure,make,make install 
# 
# 
# 
######################################################################################## 
####################################################################################### 
cd $DIR$SUBDIR_RELEASES/$VERSION 
 
./configure --prefix=$PREFIX $CONFIGURE_OPTIONS 
make 
 
#if the build process completed successfully remove older mplayer versions  
before install 
if [ "$?" = "0" ] 
then 
rm /usr/bin/mplayer 
rm /usr/bin/gmplayer 
rm /usr/local/bin/mplayer 
rm /usr/local/bin/gmplayer 
fi 
make install 
 
####################################################################################### 
####################################################################################### 
# 
# 
# 
#                       /dev/rtc setup 
# 
# 
# 
####################################################################################### 
######################################################################################## 
TEMP=`cat /etc/rc.d/rc.sysinit | grep "echo 1024 >  
/proc/sys/dev/rtc/max-user-freq"` 
if [ "$TEMP" = "" ] 
then 
dialog --backtitle "$BACKTITLE" \ 
       --title "MPlayer /dev/rtc configuration" \ 
       --yesno 'Do you want to add this missing line to /etc/rc.d/rc.sysinit :   
"echo 1024 > /proc/sys/dev/rtc/max-user-freq"  
this will allow MPlayer to use the precise /dev/rtc clock for av-sync' 20 55 
 if [ "$?" = "0" ] 
 then 
 echo "" >> /etc/rc.d/rc.sysinit 
 echo "echo 1024 > /proc/sys/dev/rtc/max-user-freq" >> /etc/rc.d/rc.sysinit 
 fi 
fi 
 
 
####################################################################################### 
####################################################################################### 
# 
# 
# 
#                       Nvidia configuration (including TV-Out) 
# 
# 
# 
####################################################################################### 
######################################################################################## 
TEMP=`cat /proc/pci | grep nVidia` 
if [ "$TEMP" != "" ] 
then 
 
dialog --backtitle "$BACKTITLE" \ 
       --title "MPlayer nVidia Configuration" \ 
       --yesno "Do you want to setup MPlayer to use the XVideo extension with  
double buffering and direct rendering ? these faster settings seem to work  
well with nVidia Cards." 20 55 
 if [ "$?" = "0" ] 
 then 
 echo "vo=xv" >> $PREFIX/etc/mplayer/mplayer.conf 
 echo "double=1" >> $PREFIX/etc/mplayer/mplayer.conf 
 echo "dr=1" >> $PREFIX/etc/mplayer/mplayer.conf 
 fi 
 
 
dialog --backtitle "$BACKTITLE" \ 
       --title "MPlayer TV-Out configuration" \ 
       --yesno "Do you want to install nvtv  
(http://www.sf.net/projects/nv-tv-out)to be able to watch movies on TV from  
your nVidia Graphics Card using its TV-Out ?" 20 55 
 if [ "$?" = "0" ] 
 then 
 NVIDIA_TV="on" 
 cd $DIR 
 wget  
http://belnet.dl.sourceforge.net/sourceforge/nv-tv-out/nvtv-bin-0.4.3.tar.gz  
--continue 
 tar -xvzf nvtv-bin-0.4.3.tar.gz 
 cp nvtv-bin-0.4.3/nvtv $PREFIX/bin 
 cp nvtv-bin-0.4.3/nvtvd $PREFIX/bin 
 
echo ' 
EDIT YOUR SETTINGS HERE :  
##################################################### 
TV=4:3   #4:3 or 16:9 are valid values 
 
PAL_SIZE=Large   
PAL_X=768        
PAL_Y=576        
PAL_SYSTEM=PAL   
 
NTSC_SIZE=Large 
NTSC_X=800 
NTSC_Y=600 
NTSC_SYSTEM=NTSC  # NTSC/PAL-60 whatever your tv supports ...  
 
# "mplayer->menu->open" starts in this directory  
START_DIRECTORY="/usr/local/movies"  
 
################################################################################################## 
 
cd $START_DIRECTORY 
 
#decide PAL or NTSC format : 
if test -z "`mplayer -identify "$1" | grep ID_VIDEO_FPS | grep 25`" 
  
# it seems to be a NTSC movie 
then  
 echo "NTSC movie detected - using NTSC specific settings" 
 nvtv -S $NTSC_SYSTEM -r $NTSC_X,$NTSC_Y -s $NTSC_SIZE -t 
 mplayer  -screenw $NTSC_X -screenh $NTSC_Y -monitoraspect $TV -fs "$1" "$2"  
"$3" "$4" "$5" "$6" "$7" "$8" "$9"  
 
# it seems to be a PAL movie 
else 
 echo "PAL movie detected - using PAL specific settings" 
 nvtv -S $PAL_SYSTEM -r $PAL_X,$PAL_Y -s $PAL_SIZE -t  
 mplayer  -screenw $PAL_X -screenh $PAL_Y -monitoraspect $TV -fs "$1" "$2"  
"$3" "$4" "$5" "$6" "$7" "$8" "$9"  
fi 
 
#switch the monitor back on  
nvtv -m 
' > $PREFIX/bin/playontv 
chmod +x $PREFIX/bin/playontv 
 
dialog --backtitle "$BACKTITLE" \ 
       --title "MPLayer playontv Script" \ 
       --msgbox "installed playontv as a wrapper script for nvtv and MPlayer \ 
       for playing movie files on TV. Edit $PREFIX/bin/playontv to your  
needs." 20 55 
 fi 
 
fi 
 
 
####################################################################################### 
####################################################################################### 
# 
# 
# 
#                       KDE integration 
# 
# 
# 
######################################################################################## 
####################################################################################### 
if [ -z "$KDEDIR" ] 
then  
echo "KDE not found ..." 
else 
echo "KDE found at $KDEDIR" 
dialog --backtitle "$BACKTITLE" \ 
       --title "MPLayer KDE integration" \ 
       --yesno "Do you want to integrate/register MPlayer in KDE ?" 20 55 
if [ "$?" = "0" ] 
then 
echo ' 
[Desktop Entry] 
Comment= 
Comment[en_US]= 
Exec=gmplayer "%F" 
GenericName=Movie Player 
GenericName[en_US]=Movie Player 
Icon=noatun2 
InitialPreference=10 
MimeType=video/mpeg;video/quicktime;video/x-msvideo;Application 
Name=MPlayer 
Name[en_US]=MPlayer 
ServiceTypes= 
SwallowExec= 
SwallowTitle= 
Terminal=false 
TerminalOptions= 
Type=Application 
X-KDE-StartupNotify=false ' > $KDEDIR/share/applnk/Multimedia/mplayer.desktop 
 
if [ "$NVIDIA_TV" ] 
then 
echo ' 
[Desktop Entry] 
Comment= 
Comment[en_US]= 
Exec=playontv "%F" 
GenericName= 
GenericName[en_US]= 
Icon=tv 
InitialPreference=9 
MimeType=video/mpeg;video/quicktime;video/x-msvideo;Application 
Name=MPlayer on TV 
Name[en_US]=MPlayer on TV 
ServiceTypes= 
SwallowExec= 
SwallowTitle= 
Terminal=true 
TerminalOptions= 
Type=Application 
X-KDE-StartupNotify=false 
' > $KDEDIR/share/applnk/Multimedia/mplayer-playontv.desktop 
fi 
fi 
fi 
cd $OLDDIR 


More information about the MPlayer-dev-eng mailing list