multimedia/MPlayer: Initial import

This commit is contained in:
Robby Workman 2010-05-11 15:00:24 +02:00 committed by Michiel van Wessem
parent 52a1b2b0ea
commit 2fca01658b
7 changed files with 313 additions and 0 deletions

View file

@ -0,0 +1,174 @@
#!/bin/sh
# Slackware build script for MPlayer
# Copyright 2006-2007 Robby Workman (http://rlworkman.net)
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Thanks to Niki Kovaks for some suggestions on this
# Thanks to Eric Hameleers for suggestions (and some code examples) :)
PRGNAM=MPlayer
VERSION=1.0rc1
PKGVERSION=$VERSION # This may change later in the script
ARCH=${ARCH:-custom}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
# If you installed the codecs package according to the instructions at
# the MPlayer website, you'll probably want to change this variable
# to /usr/local/lib/codecs. Otherwise, you'll want to leave it alone
# (if you installed the codecs using our SlackBuild script for them)
# unless you placed the codecs in a non-standard location.
CODECSDIR=${CODECSDIR:-/usr/lib/codecs}
# The default MPlayer theme is Blue
# http://www.mplayerhq.hu/MPlayer/skins/Blue-1.7.tar.bz2
# Others may work fine here, but the script has not been tested with them
# Even so, it's probably better to leave this alone and install additional
# themes to $HOME/.mplayer/skins/
THEME=Blue
THEME_VERSION=1.7
# The fonts listed below should exist on a stock Slackware 11.0 system.
# If you want to change the default font after installation, that is probably
# best done by making a link to your preferred font in $HOME/.mplayer/ by:
# cd $HOME/.mplayer
# ln -s /path/to/preferred/font subfont.ttf
OSDFONTS="Arialuni.ttf arial.ttf DejaVuSans.ttf Vera.ttf"
# This will build documentation for all languages - if you don't want some
# of the, either change this or pass what you do want on the command line
# when running the script: LANGUAGES=en ./MPlayer.SlackBuild
LANGUAGES=${LANGUAGES:-"en nl fr de es"}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
fi
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP || exit 1
rm -rf $PRGNAM-$VERSION
tar -xjvf $CWD/$PRGNAM-$VERSION.tar.bz2 || exit 1
cd $PRGNAM-$VERSION || exit 1
chown -R root:root .
chmod -R a-s,u+rw,go+r-w .
# Fix a security problem and increment package version to try2
# http://www.debian.org/security/2006/dsa-1244
patch -p0 < $CWD/asmrules_fix_20061231.diff || exit 1
PKGVERSION=${VERSION}try2
# Fix a security problem and increment package version to try3
# http://secunia.com/product/2255/
# http://svn.mplayerhq.hu/mplayer/trunk/stream/stream_cddb.c?r1=23287&r2=23470&diff_format=u
patch -p1 < $CWD/stream.cddb_fix_20070606.diff || exit 1
PKGVERSION=${VERSION}try3
# The MPlayer developers will not support and/or deal with bug reports
# if you don't allow it to automatically determine compiler flags,
# so modify this at your own risk
CFLAGS= \
./configure \
--prefix=/usr \
--confdir=/etc/mplayer \
--enable-gui \
--enable-menu \
--enable-runtime-cpudetection \
--enable-largefiles \
--with-codecsdir="$CODECSDIR" \
--language="$LANGUAGES" \
|| exit 1
make || exit 1
make install DESTDIR=$PKG || exit 1
( cd $PKG
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
)
( cd $PKG/usr/man
find . -type f -exec gzip -9 {} \;
for i in $( find . -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
)
mkdir -p $PKG/usr/share/mplayer/skins
if [ -r $CWD/$THEME-$THEME_VERSION.tar.bz2 ]; then
( cd $PKG/usr/share/mplayer/skins
tar -xjf $CWD/$THEME-$THEME_VERSION.tar.bz2
ln -s $THEME default
) || exit 1
else
echo A usable theme tarball does not appear to exist in $CWD
echo \(or you didn't edit the script to reflect it, or something
echo else is broken\)
echo The script will continue to build a package, but some manual
echo setup may be required after installation.
echo
echo Type \'exit\' to quit or any other key to continue the script.
read _continue
if [ "$_continue" = "exit" ]; then
exit 1
fi
fi
# Fix path to icon in desktop file so that the icon will display in kde
sed -i 's%Icon=mplayer.xpm%Icon=/usr/share/pixmaps/mplayer.xpm%' \
$PKG/usr/share/applications/mplayer.desktop || exit 1
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a AUTHORS ChangeLog Copyright LICENSE README DOCS/* \
$PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
# Don't clobber an existing config file
cat etc/example.conf > $PKG/etc/mplayer/mplayer.conf.new
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
# We'll link to one of the standard ttf fonts defined above
# Thanks to Eric Hameleers for this code snippet
cat << EOF >> $PKG/install/doinst.sh
# Symlink a default TrueType font for OSD:
if [ ! -f usr/share/mplayer/subfont.ttf ]; then
for font in $OSDFONTS ; do
if [ -f usr/X11R6/lib/X11/fonts/TTF/\$font ]; then
( cd usr/share/mplayer
ln -fs /usr/X11R6/lib/X11/fonts/TTF/\$font subfont.ttf
)
break
fi
done
fi
EOF
cd $PKG
chown -R root:root . # Some files in /usr/share/mplayer are 103:99
/sbin/makepkg -l y -c n -p $OUTPUT/$PRGNAM-$PKGVERSION-$ARCH-$BUILD$TAG.tgz

View file

@ -0,0 +1,8 @@
PRGNAM="MPlayer"
VERSION="1.0rc1"
HOMEPAGE="http://www.mplayerhq.hu/"
DOWNLOAD="http://www4.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc1.tar.bz2"
MD5SUM="18c05d88e22c3b815a43ca8d7152ccdc"
MAINTAINER="Robby Workman"
EMAIL="rw@rlworkman.net"
APPROVED="BP{k}"

19
multimedia/MPlayer/README Normal file
View file

@ -0,0 +1,19 @@
MPlayer plays most MPEG, VOB, AVI, OGG/OGM, VIVO, ASF/WMA/WMV, QT/MOV/MP4,
FLI, RM, NuppelVideo, YUV4MPEG, FILM, RoQ, PVA files, supported by many
native, XAnim, and Win32 DLL codecs. You can watch VideoCD, SVCD, DVD, 3ivx,
DivX 3/4/5 and even WMV movies, too (without the avifile library).
The required codecs are available from the MPlayer site, and we have a
SlackBuild script for them as well. If you have already installed the
codecs on your own, then make sure the CODECSDIR variable in the script
is defined correctly (or pass the correct value on the command line when
running the SlackBuild script).
This script is written to install the default "Blue" theme for MPlayer, and
it will print an error (but allow you to continue) if you don't have the
theme tarball in the build directory. You can obtain the Blue theme here:
http://www.mplayerhq.hu/MPlayer/skins/Blue-1.7.tar.bz2
If you want to install some other theme, the script is written to support
that, but other themes have not been tested with it. The best option for
using additional themes/skins is to install them in $HOME/.mplayer by
following the directions on the MPlayer homepage.

View file

@ -0,0 +1,51 @@
Index: stream/realrtsp/asmrp.c
===================================================================
--- stream/realrtsp/asmrp.c (revision 20381)
+++ stream/realrtsp/asmrp.c (working copy)
@@ -40,6 +40,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include "asmrp.h"
/*
#define LOG
@@ -645,8 +646,10 @@
#ifdef LOG
printf ("rule #%d is true\n", rule_num);
#endif
- matches[num_matches] = rule_num;
- num_matches++;
+ if(num_matches < MAX_RULEMATCHES - 1)
+ matches[num_matches++] = rule_num;
+ else
+ printf("Ignoring matched asm rule %d, too many matched rules.\n", rule_num);
}
rule_num++;
Index: stream/realrtsp/real.c
===================================================================
--- stream/realrtsp/real.c (revision 20381)
+++ stream/realrtsp/real.c (working copy)
@@ -271,7 +271,7 @@
int j=0;
int n;
char b[64];
- int rulematches[16];
+ int rulematches[MAX_RULEMATCHES];
#ifdef LOG
printf("calling asmrp_match with:\n%s\n%u\n", desc->stream[i]->asm_rule_book, bandwidth);
Index: stream/realrtsp/asmrp.h
===================================================================
--- stream/realrtsp/asmrp.h (revision 20381)
+++ stream/realrtsp/asmrp.h (working copy)
@@ -40,6 +40,8 @@
#ifndef HAVE_ASMRP_H
#define HAVE_ASMRP_H
+#define MAX_RULEMATCHES 16
+
int asmrp_match (const char *rules, int bandwidth, int *matches) ;
#endif

View file

@ -0,0 +1,20 @@
config() {
NEW="$1"
OLD="`dirname $NEW`/`basename $NEW .new`"
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then
# toss the redundant copy
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}
config etc/mplayer/mplayer.conf.new
if [ -x usr/bin/update-desktop-database ]; then
usr/bin/update-desktop-database -q usr/share/applications
fi

View file

@ -0,0 +1,11 @@
MPlayer: MPlayer Media player for linux
MPlayer:
MPlayer: Media player for linux (runs on many other Unices, and non-x86
MPlayer: CPUs, see the documentation) It plays most MPEG, VOB, AVI,
MPlayer: OGG/OGM, VIVO, ASF/WMA/WMV, QT/MOV/MP4, FLI, RM, NuppelVideo,
MPlayer: YUV4MPEG, FILM, RoQ, PVA files, supported by many native, XAnim,
MPlayer: and Win32 DLL codecs. You can watch VideoCD, SVCD, DVD, 3ivx,
MPlayer: DivX 3/4/5 and even WMV movies, too (without the avifile library).
MPlayer:
MPlayer:
MPlayer:

View file

@ -0,0 +1,30 @@
--- trunk/stream/stream_cddb.c 2007/05/10 11:43:39 23287
+++ trunk/stream/stream_cddb.c 2007/06/05 11:13:32 23470
@@ -377,7 +377,7 @@
switch(status) {
case 210:
- ret = sscanf( http_hdr->body, "%d %s %08lx", &status, category, &disc_id);
+ ret = sscanf( http_hdr->body, "%d %99s %08lx", &status, category, &disc_id);
if( ret!=3 ) {
mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_ParseError);
return -1;
@@ -438,7 +438,7 @@
ptr++;
// We have a list of exact/inexact matches, so which one do we use?
// So let's take the first one.
- ret = sscanf(ptr, "%s %08lx %s", cddb_data->category, &(cddb_data->disc_id), album_title);
+ ret = sscanf(ptr, "%99s %08lx %99s", cddb_data->category, &(cddb_data->disc_id), album_title);
if( ret!=3 ) {
mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_ParseError);
return -1;
@@ -475,7 +475,7 @@
switch(status) {
case 200:
// Found exact match
- ret = sscanf(http_hdr->body, "%d %s %08lx %s", &status, cddb_data->category, &(cddb_data->disc_id), album_title);
+ ret = sscanf(http_hdr->body, "%d %99s %08lx %99s", &status, cddb_data->category, &(cddb_data->disc_id), album_title);
if( ret!=4 ) {
mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_ParseError);
return -1;