summaryrefslogtreecommitdiff
path: root/graphics/mplayer/patches
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/mplayer/patches')
-rw-r--r--graphics/mplayer/patches/patch-aa29
-rw-r--r--graphics/mplayer/patches/patch-ab196
-rw-r--r--graphics/mplayer/patches/patch-ac31
-rw-r--r--graphics/mplayer/patches/patch-ad11
-rw-r--r--graphics/mplayer/patches/patch-ae11
-rw-r--r--graphics/mplayer/patches/patch-af263
-rw-r--r--graphics/mplayer/patches/patch-ag11
-rw-r--r--graphics/mplayer/patches/patch-ah110
-rw-r--r--graphics/mplayer/patches/patch-ai11
-rw-r--r--graphics/mplayer/patches/patch-aj11
-rw-r--r--graphics/mplayer/patches/patch-ak15
-rw-r--r--graphics/mplayer/patches/patch-al22
-rw-r--r--graphics/mplayer/patches/patch-am22
-rw-r--r--graphics/mplayer/patches/patch-an11
-rw-r--r--graphics/mplayer/patches/patch-ao16
-rw-r--r--graphics/mplayer/patches/patch-ap101
-rw-r--r--graphics/mplayer/patches/patch-aq59
-rw-r--r--graphics/mplayer/patches/patch-ar87
-rw-r--r--graphics/mplayer/patches/patch-as105
-rw-r--r--graphics/mplayer/patches/patch-at83
-rw-r--r--graphics/mplayer/patches/patch-au105
-rw-r--r--graphics/mplayer/patches/patch-av17
-rw-r--r--graphics/mplayer/patches/patch-aw56
-rw-r--r--graphics/mplayer/patches/patch-ax145
-rw-r--r--graphics/mplayer/patches/patch-ay39
-rw-r--r--graphics/mplayer/patches/patch-az10
-rw-r--r--graphics/mplayer/patches/patch-ba11
-rw-r--r--graphics/mplayer/patches/patch-bb201
-rw-r--r--graphics/mplayer/patches/patch-bc11
-rw-r--r--graphics/mplayer/patches/patch-bd61
30 files changed, 1861 insertions, 0 deletions
diff --git a/graphics/mplayer/patches/patch-aa b/graphics/mplayer/patches/patch-aa
new file mode 100644
index 00000000000..1c05a375b1b
--- /dev/null
+++ b/graphics/mplayer/patches/patch-aa
@@ -0,0 +1,29 @@
+--- Makefile.orig Sun Jul 8 04:21:20 2001
++++ Makefile Mon Jul 30 22:13:00 2001
+@@ -16,7 +16,7 @@
+ #prefix = /usr/local
+ BINDIR = ${prefix}/bin
+ # BINDIR = /usr/local/bin
+-SRCS = find_sub.c aviprint.c dll_init.c dec_audio.c dec_video.c aviwrite.c aviheader.c asfheader.c demux_avi.c demux_asf.c demux_mpg.c demuxer.c stream.c codec-cfg.c subreader.c linux/getch2.c linux/timer-lx.c linux/shmem.c xa/xa_gsm.c lirc_mp.c cfgparser.c mixer.c dvdauth.c spudec.c $(STREAM_SRCS)
++SRCS = find_sub.c aviprint.c dll_init.c dec_audio.c dec_video.c aviwrite.c aviheader.c asfheader.c demux_avi.c demux_asf.c demux_mpg.c demuxer.c stream.c codec-cfg.c subreader.c linux/getch2.c linux/timer-lx.c linux/shmem.c xa/xa_gsm.c lirc_mp.c cfgparser.c dvdauth.c spudec.c $(STREAM_SRCS)
+ OBJS = $(SRCS:.c=.o)
+ CFLAGS = $(OPTFLAGS) -Iloader -Ilibvo $(CSS_INC) $(EXTRA_INC) # -Wall
+ A_LIBS = -Lmp3lib -lMP3 -Llibac3 -lac3 $(ALSA_LIB) $(ESD_LIB)
+@@ -85,14 +85,9 @@
+ $(PRG_CFG): version.h codec-cfg.c codec-cfg.h
+ $(CC) $(CFLAGS) -g codec-cfg.c -o $(PRG_CFG) -DCODECS2HTML
+
+-install: $(PRG) $(PRG_FIBMAP)
+- install -D -m 755 -s $(PRG) $(BINDIR)/$(PRG)
+- install -D -m 644 DOCS/mplayer.1 $(prefix)/man/man1/mplayer.1
+- @echo "Following task requires root privs. If it fails don't panic"
+- @echo "however it means you can't use fibmap_mplayer."
+- @echo "Without this (or without running mplayer as root) you won't be"
+- @echo "able to play DVDs."
+- install -D -o root -g root -m 4755 -s $(PRG_FIBMAP) $(BINDIR)/$(PRG_FIBMAP)
++install: $(PRG)
++ install -c -m 755 $(PRG) $(BINDIR)/$(PRG)
++ install -c -m 644 DOCS/mplayer.1 $(prefix)/man/man1/mplayer.1
+
+ clean:
+ rm -f *.o *~ $(OBJS)
diff --git a/graphics/mplayer/patches/patch-ab b/graphics/mplayer/patches/patch-ab
new file mode 100644
index 00000000000..e858a34d241
--- /dev/null
+++ b/graphics/mplayer/patches/patch-ab
@@ -0,0 +1,196 @@
+$NetBSD: patch-ab,v 1.1.1.1 2001/12/21 23:38:52 zuntum Exp $
+
+--- configure.orig Fri Jul 6 22:00:22 2001
++++ configure
+@@ -183,8 +183,12 @@
+ if [ "$system_name" = "FreeBSD" ]; then
+ _archlibs="-rdynamic -pthread"
+ else
++if [ "$system_name" = "NetBSD" ]; then
++_archlibs="-li386 -lpthread -lossaudio"
++else
+ _archlibs="-ldl -lpthread"
+ fi
++fi
+
+ # LGB: temporary files
+
+@@ -236,11 +240,6 @@
+ _x11incdir=-I/usr/X11/include
+ fi
+
+-# Lots of stuff are installed under /usr/local
+-
+-_extralibdir=-L/usr/local/lib
+-_extraincdir=-I/usr/local/include
+-
+ _skip_cc_check=no
+ _skip_as_check=no
+ if [ "$system_name" = "FreeBSD" ]; then
+@@ -280,10 +279,10 @@
+ _sdlconfig=`echo $ac_option | cut -d '=' -f 2`
+ ;;
+ --with-extralibdir=*)
+- _extralibdir=-L`echo $ac_option | cut -d '=' -f 2`
++ _extralibdir=`echo $ac_option | cut -d '=' -f 2`
+ ;;
+ --with-extraincdir=*)
+- _extraincdir=-I`echo $ac_option | cut -d '=' -f 2`
++ _extraincdir=`echo $ac_option | cut -d '=' -f 2`
+ ;;
+ esac
+ done
+@@ -584,13 +583,13 @@
+ #echo "DONE (${proc})."
+
+
+-$_cc $_extraincdir $_extralibdir $TMPC -o $TMPO -lvgagl -lvga > /dev/null 2>&1 && _svga=yes
++$_cc -I$_extraincdir -L$_extralibdir $TMPC -o $TMPO -lvgagl -lvga > /dev/null 2>&1 && _svga=yes
+
+ if [ "$system_name" = "FreeBSD" ]; then
+ $_cc $TMPC -o $TMPO -pthread > /dev/null 2>&1 || \
+ { echo "Lib pthread not found."; rm -f $TMPC $TMPO $TMPS ; exit 1; }
+ else
+-$_cc $TMPC -o $TMPO -lpthread > /dev/null 2>&1 || \
++$_cc $TMPC -I$_extraincdir -L$_extralibdir -o $TMPO -lpthread > /dev/null 2>&1 || \
+ { echo "Lib pthread not found."; rm -f $TMPC $TMPO $TMPS ; exit 1; }
+ fi
+
+@@ -615,12 +614,8 @@
+
+ # Atmosfear: added libcss autodetect
+ _css=no
+-if test -s "/usr/local/lib/libcss.so" ; then
+- _csslibdir="/usr/local/lib/"
+- if test -s "/usr/local/include/css.h" ; then
+- _cssincdir="/usr/local/include"
++if [ -s "$_extralibdir/libcss.so" -a -s "$_extraincdir/css.h" ]; then
+ _css=yes
+- fi
+ else
+ if test -s "/usr/lib/libcss.so" ; then
+ _csslibdir="/usr/lib/"
+@@ -635,7 +630,7 @@
+ $_cc $TMPC -o $TMPO -ltermcap > /dev/null 2>&1 && _termcap=yes
+
+ _png=no
+-$_cc $_extraincdir $_extralibdir $TMPC -o $TMPO -lpng -lz -lm > /dev/null 2>&1 && _png=yes
++$_cc -I$_extraincdir -L$_extralibdir $TMPC -o $TMPO -lpng -lz -lm > /dev/null 2>&1 && _png=yes
+
+ _ggi=no
+ $_cc $TMPC -o $TMPO -lggi > /dev/null 2>&1 && _ggi=yes
+@@ -664,7 +659,6 @@
+
+ if [ $_x11 = yes ]; then
+
+-$_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext -lXdpms $_socklib > /dev/null 2>&1 && _xdpms=yes
+ $_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext -lXv $_socklib > /dev/null 2>&1 && _xv=yes
+ $_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext -lXxf86vm $_socklib > /dev/null 2>&1 && _vm=yes
+
+@@ -682,7 +676,7 @@
+ $_cc $_x11incdir $TMPC -o $TMPO $_x11libdir -lX11 -lXext -lGL -pthread $_socklib > /dev/null 2>&1 || \
+ { _gl=no; echo "GL includes not found!";}
+ else
+-$_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext -lGL $_socklib > /dev/null 2>&1 || \
++$_cc $_x11incdir $TMPC -o $TMPO $_x11libdir -lX11 -lXext -lGL -lm $_socklib > /dev/null 2>&1 || \
+ { _gl=no; echo "GL includes not found!";}
+ fi
+
+@@ -721,7 +715,7 @@
+
+ cat > $TMPC << EOF
+ #include <sys/soundcard.h>
+-int main( void ) { return 0; }
++int main( void ) { int arg = SOUND_VERSION; }
+ EOF
+
+ _sys_soundcard_h=no
+@@ -729,12 +723,16 @@
+
+
+ cat > $TMPC << EOF
+-#include <sys/soundcard.h>
+-int main( void ) { int arg = SNDCTL_DSP_SETFRAGMENT; }
++#include <soundcard.h>
++int main( void ) { int arg = SOUND_VERSION; }
+ EOF
+
++_soundcard_h=no
++$_cc -o $TMPO $TMPC 2> /dev/null && _soundcard_h=yes
++
+ _oss_audio=no
+-$_cc -o $TMPO $TMPC 2> /dev/null && _oss_audio=yes
++test $_sys_soundcard_h = yes && _oss_audio=yes
++test $_soundcard_h = yes && _oss_audio=yes
+
+
+ cat > $TMPC << EOF
+@@ -778,7 +776,7 @@
+ int main( void ){ return 0; }
+ EOF
+
+-$_cc $_extraincdir $_extralibdir -o $TMPO -lesd $TMPC 2> /dev/null || { _esd=no; }
++$_cc -I$_extraincdir -L$_extralibdir -o $TMPO -lesd $TMPC 2> /dev/null || { _esd=no; }
+
+ # ---
+
+@@ -1015,6 +1013,13 @@
+ esac
+ done
+
++_datadir=$_prefix"/share/mplayer"
++
++# Lots of stuff are installed under /usr/local
++
++_extralibdir=${_prefix}/lib
++_extraincdir=${_prefix}/include
++
+ # Checking assembler (_as) compatibility...
+ as_version=`$_as --version 2>&1 | sed -n 's/^.*assembler \([0-9.]*\).*$/\1/p'`
+ echo $_echo_n "Checking assembler ($_as) ... $as_version, $_echo_c"
+@@ -1311,12 +1316,21 @@
+ _sunaudio='#undef USE_SUN_AUDIO'
+ fi
+
++if [ "$system_name" = "NetBSD" ]; then
++ _aosrc="$_aosrc ao_netbsd.c"
++fi
++
+ if [ "$_sys_soundcard_h" = "yes" ]; then
+ _have_soundcard_h='#define HAVE_SYS_SOUNDCARD_H 1'
+ else
+ _have_soundcard_h='#undef HAVE_SYS_SOUNDCARD_H'
+ fi
+
++if [ "$_soundcard_h" = "yes" ]; then
++ _have_soundcard_h='#define HAVE_SOUNDCARD_H 1'
++else
++ _have_soundcard_h='#undef HAVE_SOUNDCARD_H'
++fi
+
+ # Checking for CFLAGS
+ if [ "$_profile" != "" ] || [ "$_debug" != "" ]; then
+@@ -1524,12 +1538,12 @@
+ CC=$_cc
+ # OPTFLAGS=-O4 $_profile $_debug -march=$proc -mcpu=$proc -pipe -fomit-frame-pointer -ffast-math
+ OPTFLAGS=$CFLAGS
+-EXTRA_INC=$_extraincdir
++EXTRA_INC=-I$_extraincdir
+ WIN32_PATH=-DWIN32_PATH=\"$_win32libdir\"
+
+ X11_INC=$_x11incdir
+ X11DIR=$_x11libdir
+-X_LIBS=$_x11libdir $_extralibdir $_gllib $_ggilib $_sdllib $_dgalib $_x11lib $_xvlib $_vmlib $_svgalib $_libpng $_socklib
++X_LIBS=$_x11libdir -L$_extralibdir $_gllib $_ggilib $_sdllib $_dgalib $_x11lib $_xvlib $_vmlib $_svgalib $_libpng $_socklib
+
+ TERMCAP_LIB=$_libtermcap
+ XMM_LIBS = $_xmmplibs
+@@ -1741,7 +1755,7 @@
+
+ EOF
+
+-if [ $_mtrr = yes ]; then
++if [ $_mtrr = yes -a -e /proc/mtrr ]; then
+ echo "Please check mtrr settings at /proc/mtrr (see DOCS/MTRR)"
+ echo
+ fi
diff --git a/graphics/mplayer/patches/patch-ac b/graphics/mplayer/patches/patch-ac
new file mode 100644
index 00000000000..4b36338d749
--- /dev/null
+++ b/graphics/mplayer/patches/patch-ac
@@ -0,0 +1,31 @@
+--- dvdauth.c.orig Thu Jun 21 04:06:40 2001
++++ dvdauth.c Mon Jul 30 22:10:09 2001
+@@ -74,6 +74,14 @@
+ * With the old libcss-0.1 api, we have to find out the LBA for
+ * a title for title authentication.
+ */
++
++int CSSDVDAuthTitlePath(DVDHandle hdl,unsigned char *key_title,char *path)
++{
++ int lba=path_to_lba(path);
++ if (lba==-1) return -1;
++ return CSSAuthTitle(hdl,key_title,lba);
++}
++
+ #ifdef __linux__
+ #include <linux/fs.h>
+ #include <errno.h>
+@@ -121,13 +129,6 @@
+ return lba;
+ }
+
+-
+-int CSSDVDAuthTitlePath(DVDHandle hdl,unsigned char *key_title,char *path)
+-{
+- int lba=path_to_lba(path);
+- if (lba==-1) return -1;
+- return CSSAuthTitle(hdl,key_title,lba);
+-}
+
+
+ #else /*linux*/
diff --git a/graphics/mplayer/patches/patch-ad b/graphics/mplayer/patches/patch-ad
new file mode 100644
index 00000000000..a1fe018f2a8
--- /dev/null
+++ b/graphics/mplayer/patches/patch-ad
@@ -0,0 +1,11 @@
+--- libao2/ao_alsa5.c.orig Tue Jun 12 18:13:26 2001
++++ libao2/ao_alsa5.c Mon Jul 30 22:10:09 2001
+@@ -41,7 +41,7 @@
+ static int alsa_rate = SND_PCM_RATE_CONTINUOUS;
+
+ /* to set/get/query special features/parameters */
+-static int control(int cmd, int arg)
++static int control(int cmd, void* arg)
+ {
+ return(CONTROL_UNKNOWN);
+ }
diff --git a/graphics/mplayer/patches/patch-ae b/graphics/mplayer/patches/patch-ae
new file mode 100644
index 00000000000..1c82bef8fc8
--- /dev/null
+++ b/graphics/mplayer/patches/patch-ae
@@ -0,0 +1,11 @@
+--- libao2/ao_alsa9.c.orig Sat Jun 23 22:59:54 2001
++++ libao2/ao_alsa9.c Mon Jul 30 22:10:09 2001
+@@ -47,7 +47,7 @@
+ static int alsa_fragcount = 8;
+
+ /* to set/get/query special features/parameters */
+-static int control(int cmd, int arg)
++static int control(int cmd, void* arg)
+ {
+ switch(cmd)
+ {
diff --git a/graphics/mplayer/patches/patch-af b/graphics/mplayer/patches/patch-af
new file mode 100644
index 00000000000..629ef8f32b1
--- /dev/null
+++ b/graphics/mplayer/patches/patch-af
@@ -0,0 +1,263 @@
+--- libao2/ao_netbsd.c.orig Thu Jan 1 03:00:00 1970
++++ libao2/ao_netbsd.c Mon Jul 30 22:10:09 2001
+@@ -0,0 +1,260 @@
++#include <stdio.h>
++#include <sys/ioctl.h>
++#include <sys/types.h>
++#include <sys/audioio.h>
++#include <fcntl.h>
++#include <unistd.h>
++
++#include "../config.h"
++
++#include "afmt.h"
++#include "audio_out.h"
++#include "audio_out_internal.h"
++
++static ao_info_t info =
++{
++ "NetBSD audio output",
++ "netbsd",
++ "Sergey Svishchev <svs@ropnet.ru>",
++ ""
++};
++
++LIBAO_EXTERN(netbsd)
++ static char *dsp = "/dev/sound";
++ static int audio_fd = -1;
++ static char *mixer = "/dev/mixer";
++ static int mixer_fd = -1;
++ static audio_info_t audio_info;
++ static mixer_ctrl_t mixer_pcm;
++ static mixer_ctrl_t mixer_master;
++
++ static int control(int cmd, void *arg)
++{
++ int rc;
++ mixer_ctrl_t *mc;
++ ao_control_vol_t *vol;
++
++ switch (cmd) {
++ case AOCONTROL_SET_DEVICE:
++ if (arg) {
++ dsp = strdup((char *) arg);
++ return CONTROL_OK;
++ } else
++ return CONTROL_ERROR;
++ case AOCONTROL_QUERY_FORMAT:
++ return CONTROL_TRUE;
++ case AOCONTROL_SET_MIXER_DEVICE:
++ if (arg) {
++ mixer = strdup((char *) arg);
++ return CONTROL_OK;
++ } else
++ return CONTROL_ERROR;
++ case AOCONTROL_GET_VOLUME:
++ vol = (ao_control_vol_t *) arg;
++ mc = vol->usemaster ? &mixer_master : &mixer_pcm;
++ rc = ioctl(mixer_fd, AUDIO_MIXER_READ, mc);
++ if (rc == -1)
++ return CONTROL_ERROR;
++ switch (mc->un.value.num_channels) {
++ case 1:
++ vol->left = vol->right =
++ (float) mc->un.value.level[AUDIO_MIXER_LEVEL_MONO] / 2.55;
++ break;
++ case 2:
++ vol->left =
++ (float) mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT] / 2.55;
++ vol->right =
++ (float) mc->un.value.level[AUDIO_MIXER_LEVEL_RIGHT] / 2.55;
++ break;
++ default:
++ }
++ return CONTROL_ERROR;
++ case AOCONTROL_SET_VOLUME:
++ vol = (ao_control_vol_t *) arg;
++ mc = vol->usemaster ? &mixer_master : &mixer_pcm;
++ switch (mc->un.value.num_channels) {
++ case 1:
++ vol->left = vol->right =
++ mc->un.value.level[AUDIO_MIXER_LEVEL_MONO] = (u_char)
++ (vol->left + vol->right) * 2.55 / 2.0;
++ break;
++ case 2:
++ mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT] =
++ (u_char) (vol->left * 2.55);
++ mc->un.value.level[AUDIO_MIXER_LEVEL_RIGHT] =
++ (u_char) (vol->right * 2.55);
++ break;
++ default:
++ return CONTROL_ERROR;
++ }
++ rc = ioctl(mixer_fd, AUDIO_MIXER_WRITE, mc);
++ if (rc == -1)
++ return CONTROL_ERROR;
++ default:
++ }
++ return CONTROL_UNKNOWN;
++}
++
++/*
++ * open & setup audio device. returns: 1 = success 0 = fail
++ */
++static int
++init(int rate, int channels, int format, int flags)
++{
++ int rc, mci, mco;
++ mixer_devinfo_t mi;
++
++ audio_fd = open(dsp, O_WRONLY);
++ if (audio_fd < 0) {
++ perror("libao2(netbsd): Can't open audio device");
++ return 0;
++ }
++ rc = ioctl(audio_fd, AUDIO_GETINFO, &audio_info);
++ if (rc < 0) {
++ perror("libao2(netbsd): Can't query device parameters");
++ return 0;
++ }
++ switch (format) {
++ case AFMT_A_LAW:
++ audio_info.play.precision = 8;
++ audio_info.play.encoding = AUDIO_ENCODING_ALAW;
++ break;
++ case AFMT_MU_LAW:
++ audio_info.play.precision = 8;
++ audio_info.play.encoding = AUDIO_ENCODING_ULAW;
++ break;
++ case AFMT_S16_LE:
++ audio_info.play.precision = 16;
++ audio_info.play.encoding = AUDIO_ENCODING_SLINEAR_LE;
++ break;
++ case AFMT_U8:
++ audio_info.play.precision = 8;
++ audio_info.play.encoding = AUDIO_ENCODING_ULINEAR;
++ break;
++ default:
++ printf("libao2(netbsd): unhandled sample format %08x\n", format);
++ return 0;
++ }
++ ao_format = format;
++ ao_buffersize = audio_info.play.buffer_size;
++ audio_info.mode = AUMODE_PLAY | AUMODE_PLAY_ALL;
++ audio_info.play.sample_rate = ao_samplerate = rate;
++ audio_info.play.channels = ao_channels = channels;
++#if 1
++ audio_info.blocksize = ao_buffersize / 12;
++ audio_info.hiwat = 12;
++ audio_info.lowat = 9;
++#endif
++ rc = ioctl(audio_fd, AUDIO_SETINFO, &audio_info);
++ if (rc < 0) {
++ perror("libao2(netbsd): Can't set desired device parameters");
++ return 0;
++ }
++ ao_outburst = audio_info.blocksize;
++
++ mixer_fd = open(mixer, O_RDWR);
++ if (mixer_fd < 0) {
++ perror("libao2(netbsd): Can't open mixer device");
++ goto out;
++ }
++ mi.index = 0;
++ mixer_master.dev = mixer_pcm.dev = -1;
++ mci = mco = -1;
++ rc = ioctl(mixer_fd, AUDIO_MIXER_DEVINFO, &mi);
++ while (rc != -1) {
++ if (mi.type == AUDIO_MIXER_CLASS && !strcmp(mi.label.name, AudioCinputs))
++ mci = mi.index;
++ if (mi.type == AUDIO_MIXER_CLASS && !strcmp(mi.label.name, AudioCoutputs))
++ mco = mi.index;
++ mi.index++;
++ rc = ioctl(mixer_fd, AUDIO_MIXER_DEVINFO, &mi);
++ }
++
++ mi.index = 0;
++ rc = ioctl(mixer_fd, AUDIO_MIXER_DEVINFO, &mi);
++ while (rc != -1) {
++ if (mi.type == AUDIO_MIXER_VALUE && mi.mixer_class == mci &&
++ !strcmp(mi.label.name, AudioNdac)) {
++ mixer_pcm.dev = mi.index;
++ mixer_pcm.type = AUDIO_MIXER_VALUE;
++ mixer_pcm.un.value.num_channels = mi.un.v.num_channels;
++ }
++ if (mi.type == AUDIO_MIXER_VALUE && mi.mixer_class == mco &&
++ !strcmp(mi.label.name, AudioNmaster)) {
++ mixer_master.dev = mi.index;
++ mixer_master.type = AUDIO_MIXER_VALUE;
++ mixer_master.un.value.num_channels = mi.un.v.num_channels;
++ }
++ mi.index++;
++ rc = ioctl(mixer_fd, AUDIO_MIXER_DEVINFO, &mi);
++ }
++ rc = ioctl(mixer_fd, AUDIO_MIXER_READ, &mixer_pcm);
++ rc = ioctl(mixer_fd, AUDIO_MIXER_READ, &mixer_master);
++ /*
++ printf("found mixers: pcm %d (%d channels), master %d (%d channels)\n",
++ mixer_pcm.dev,
++ mixer_pcm.dev == -1 ? -1 : mixer_pcm.un.value.num_channels,
++ mixer_master.dev,
++ mixer_master.dev == -1 ? -1 : mixer_master.un.value.num_channels);
++ */
++
++out:
++ return 1;
++}
++
++static void
++uninit()
++{
++ ioctl(audio_fd, AUDIO_DRAIN);
++ close(audio_fd);
++ audio_fd = -1;
++}
++
++static void
++reset()
++{
++ ioctl(audio_fd, AUDIO_DRAIN);
++}
++
++static void
++audio_pause()
++{
++ ioctl(audio_fd, AUDIO_DRAIN);
++ ioctl(audio_fd, AUDIO_GETINFO, &audio_info);
++ audio_info.play.pause = 1;
++ ioctl(audio_fd, AUDIO_SETINFO, &audio_info);
++}
++
++static void
++audio_resume()
++{
++ ioctl(audio_fd, AUDIO_GETINFO, &audio_info);
++ audio_info.play.pause = 0;
++ audio_info.play.seek = 0;
++ ioctl(audio_fd, AUDIO_SETINFO, &audio_info);
++}
++
++static int
++play(void *data, int len, int flags)
++{
++ len /= ao_outburst;
++ return audio_fd > 0 ? write(audio_fd, data, len * ao_outburst) : -1;
++}
++
++static int
++get_space()
++{
++ audio_info_t ai;
++
++ int rc = ioctl(audio_fd, AUDIO_GETINFO, &ai);
++ return (rc == -1) ? ao_outburst : (ao_buffersize - ai.play.seek);
++}
++
++static int
++get_delay()
++{
++ audio_info_t ai;
++
++ int rc = ioctl(audio_fd, AUDIO_GETINFO, &ai);
++ return (rc == -1) ? 0 : ai.play.seek;
++}
diff --git a/graphics/mplayer/patches/patch-ag b/graphics/mplayer/patches/patch-ag
new file mode 100644
index 00000000000..d783dac0964
--- /dev/null
+++ b/graphics/mplayer/patches/patch-ag
@@ -0,0 +1,11 @@
+--- libao2/ao_null.c.orig Tue Jun 5 22:40:44 2001
++++ libao2/ao_null.c Mon Jul 30 22:10:10 2001
+@@ -23,7 +23,7 @@
+ // ao_buffersize
+
+ // to set/get/query special features/parameters
+-static int control(int cmd,int arg){
++static int control(int cmd,void* arg){
+ return -1;
+ }
+
diff --git a/graphics/mplayer/patches/patch-ah b/graphics/mplayer/patches/patch-ah
new file mode 100644
index 00000000000..9e1bcc4a7d5
--- /dev/null
+++ b/graphics/mplayer/patches/patch-ah
@@ -0,0 +1,110 @@
+--- libao2/ao_oss.c.orig Fri Jun 22 03:07:15 2001
++++ libao2/ao_oss.c Mon Jul 30 22:10:10 2001
+@@ -7,9 +7,14 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
+-#include <sys/soundcard.h>
+
+ #include "../config.h"
++#ifdef HAVE_SYS_SOUNDCARD_H
++#include <sys/soundcard.h>
++#endif
++#ifdef HAVE_SOUNDCARD_H
++#include <soundcard.h>
++#endif
+
+ #include "audio_out.h"
+ #include "audio_out_internal.h"
+@@ -40,56 +45,58 @@
+ static int audio_fd=-1;
+
+ char *oss_mixer_device = "/dev/mixer";
+-int oss_mixer_usemaster = 0;
+
+ // to set/get/query special features/parameters
+-static int control(int cmd,int arg){
++static int control(int cmd,void *arg){
+ switch(cmd){
+ case AOCONTROL_SET_DEVICE:
+- dsp=(char*)arg;
++ if (arg) {
++ dsp = strdup((char *) arg);
+ return CONTROL_OK;
++ } else
++ return CONTROL_ERROR;
+ case AOCONTROL_QUERY_FORMAT:
+ return CONTROL_TRUE;
++ case AOCONTROL_SET_MIXER_DEVICE:
++ if (arg) {
++ oss_mixer_device = strdup((char *) arg);
++ return CONTROL_OK;
++ } else
++ return CONTROL_ERROR;
+ case AOCONTROL_GET_VOLUME:
+ case AOCONTROL_SET_VOLUME:
+ {
+ ao_control_vol_t *vol = (ao_control_vol_t *)arg;
+ int fd, v, mcmd, devs;
+
+- if ((fd = open("/dev/mixer", O_RDONLY)) > 0)
+- {
++ if ((fd = open(oss_mixer_device, O_RDONLY)) > 0) {
+ ioctl(fd, SOUND_MIXER_READ_DEVMASK, &devs);
+- if ((devs & SOUND_MASK_PCM) && (oss_mixer_usemaster == 0))
++ if ((devs & SOUND_MASK_PCM) && (vol->usemaster == 0)) {
+ if (cmd == AOCONTROL_GET_VOLUME)
+ mcmd = SOUND_MIXER_READ_PCM;
+ else
+ mcmd = SOUND_MIXER_WRITE_PCM;
+- else if ((devs & SOUND_MASK_VOLUME) && (oss_mixer_usemaster == 1))
++ } else if ((devs & SOUND_MASK_VOLUME) && (vol->usemaster == 1)) {
+ if (cmd == AOCONTROL_GET_VOLUME)
+ mcmd = SOUND_MIXER_READ_VOLUME;
+ else
+ mcmd = SOUND_MIXER_WRITE_VOLUME;
+- else
+- {
++ } else {
+ close(fd);
+ return CONTROL_ERROR;
+ }
+
+- if (cmd == AOCONTROL_GET_VOLUME)
+- {
+- ioctl(fd, cmd, &v);
+- vol->right = (v & 0xFF00) >> 8;
+- vol->left = v & 0x00FF;
+- }
+- else
+- {
++ if (cmd == AOCONTROL_GET_VOLUME) {
++ ioctl(fd, mcmd, &v);
++ vol->right = (float) ((v & 0xFF00) >> 8);
++ vol->left = (float) (v & 0x00FF);
++ } else {
+ v = ((int)vol->right << 8) | (int)vol->left;
+- ioctl(fd, cmd, &v);
++ ioctl(fd, mcmd, &v);
+ }
+ close(fd);
+ return CONTROL_OK;
+- }
+- else
++ } else
+ return CONTROL_ERROR;
+ }
+ return CONTROL_ERROR;
+@@ -249,10 +256,12 @@
+ // return: how many unplayed bytes are in the buffer
+ static int get_delay(){
+ if(audio_delay_method==2){
++#ifdef SNDCTL_DSP_GETODELAY
+ //
+ int r=0;
+ if(ioctl(audio_fd, SNDCTL_DSP_GETODELAY, &r)!=-1)
+ return r;
++#endif
+ audio_delay_method=1; // fallback if not supported
+ }
+ if(audio_delay_method==1){
diff --git a/graphics/mplayer/patches/patch-ai b/graphics/mplayer/patches/patch-ai
new file mode 100644
index 00000000000..f01327f710e
--- /dev/null
+++ b/graphics/mplayer/patches/patch-ai
@@ -0,0 +1,11 @@
+--- libao2/ao_pcm.c.orig Tue Jun 12 18:37:32 2001
++++ libao2/ao_pcm.c Mon Jul 30 22:10:10 2001
+@@ -68,7 +68,7 @@
+ static FILE *fp = NULL;
+
+ // to set/get/query special features/parameters
+-static int control(int cmd,int arg){
++static int control(int cmd,void* arg){
+ return -1;
+ }
+
diff --git a/graphics/mplayer/patches/patch-aj b/graphics/mplayer/patches/patch-aj
new file mode 100644
index 00000000000..3d71963a338
--- /dev/null
+++ b/graphics/mplayer/patches/patch-aj
@@ -0,0 +1,11 @@
+--- libao2/ao_sdl.c.orig Wed Jun 27 15:40:15 2001
++++ libao2/ao_sdl.c Mon Jul 30 22:10:10 2001
+@@ -120,7 +120,7 @@
+
+
+ // to set/get/query special features/parameters
+-static int control(int cmd,int arg){
++static int control(int cmd,void* arg){
+ return -1;
+ }
+
diff --git a/graphics/mplayer/patches/patch-ak b/graphics/mplayer/patches/patch-ak
new file mode 100644
index 00000000000..e6e170a31a9
--- /dev/null
+++ b/graphics/mplayer/patches/patch-ak
@@ -0,0 +1,15 @@
+--- libao2/ao_sun.c.orig Sat Jun 23 23:40:04 2001
++++ libao2/ao_sun.c Mon Jul 30 22:15:45 2001
+@@ -197,10 +197,10 @@
+ }
+
+ // to set/get/query special features/parameters
+-static int control(int cmd,int arg){
++static int control(int cmd,void* arg){
+ switch(cmd){
+ case AOCONTROL_SET_DEVICE:
+- audio_dev=(char*)arg;
++ audio_dev=strdup((char*)arg);
+ return CONTROL_OK;
+ case AOCONTROL_QUERY_FORMAT:
+ return CONTROL_TRUE;
diff --git a/graphics/mplayer/patches/patch-al b/graphics/mplayer/patches/patch-al
new file mode 100644
index 00000000000..471e585bf06
--- /dev/null
+++ b/graphics/mplayer/patches/patch-al
@@ -0,0 +1,22 @@
+--- libao2/audio_out.c.orig Fri Jun 22 02:34:58 2001
++++ libao2/audio_out.c Mon Jul 30 22:10:10 2001
+@@ -31,6 +31,9 @@
+ #ifdef HAVE_SDL
+ extern ao_functions_t audio_out_sdl;
+ #endif
++#ifdef __NetBSD__
++extern ao_functions_t audio_out_netbsd;
++#endif
+ #ifdef USE_SUN_AUDIO
+ extern ao_functions_t audio_out_sun;
+ #endif
+@@ -57,6 +60,9 @@
+ #endif
+ #ifdef USE_SUN_AUDIO
+ &audio_out_sun,
++#endif
++#ifdef __NetBSD__
++ &audio_out_netbsd,
+ #endif
+ &audio_out_pcm,
+ // &audio_out_pss,
diff --git a/graphics/mplayer/patches/patch-am b/graphics/mplayer/patches/patch-am
new file mode 100644
index 00000000000..ccc490307ef
--- /dev/null
+++ b/graphics/mplayer/patches/patch-am
@@ -0,0 +1,22 @@
+--- libao2/audio_out.h.orig Fri Jun 22 02:34:58 2001
++++ libao2/audio_out.h Mon Jul 30 22:10:10 2001
+@@ -13,7 +13,7 @@
+ typedef struct ao_functions_s
+ {
+ ao_info_t *info;
+- int (*control)(int cmd,int arg);
++ int (*control)(int cmd,void* arg);
+ int (*init)(int rate,int channels,int format,int flags);
+ void (*uninit)();
+ void (*reset)();
+@@ -50,8 +50,10 @@
+ #define AOCONTROL_QUERY_FORMAT 3 /* test for availabilty of a format */
+ #define AOCONTROL_GET_VOLUME 4
+ #define AOCONTROL_SET_VOLUME 5
++#define AOCONTROL_SET_MIXER_DEVICE 6
+
+ typedef struct ao_control_vol_s {
+ float left;
+ float right;
++ int usemaster;
+ } ao_control_vol_t;
diff --git a/graphics/mplayer/patches/patch-an b/graphics/mplayer/patches/patch-an
new file mode 100644
index 00000000000..db9934cebd2
--- /dev/null
+++ b/graphics/mplayer/patches/patch-an
@@ -0,0 +1,11 @@
+--- libao2/audio_out_internal.h.orig Tue Jun 5 22:40:44 2001
++++ libao2/audio_out_internal.h Mon Jul 30 22:10:10 2001
+@@ -1,7 +1,7 @@
+
+ // prototypes:
+ //static ao_info_t info;
+-static int control(int cmd,int arg);
++static int control(int cmd,void* arg);
+ static int init(int rate,int channels,int format,int flags);
+ static void uninit();
+ static void reset();
diff --git a/graphics/mplayer/patches/patch-ao b/graphics/mplayer/patches/patch-ao
new file mode 100644
index 00000000000..1c6d90b923d
--- /dev/null
+++ b/graphics/mplayer/patches/patch-ao
@@ -0,0 +1,16 @@
+--- mixer.c.orig Sat Jun 9 03:33:55 2001
++++ mixer.c Mon Jul 30 21:20:01 2001
+@@ -15,7 +15,13 @@
+ * Mixer interface using OSS style soundcard commands.
+ */
+
++#ifdef HAVE_SYS_SOUNDCARD_H
+ #include <sys/soundcard.h>
++#endif
++
++#ifdef HAVE_SOUNDCARD_H
++#include <soundcard.h>
++#endif
+
+
+ char * mixer_device=DEV_MIXER;
diff --git a/graphics/mplayer/patches/patch-ap b/graphics/mplayer/patches/patch-ap
new file mode 100644
index 00000000000..5b5ee76eb90
--- /dev/null
+++ b/graphics/mplayer/patches/patch-ap
@@ -0,0 +1,101 @@
+--- mp3lib/d_cpu.s.orig Mon Jul 2 12:07:41 2001
++++ mp3lib/d_cpu.s Mon Jul 30 21:20:01 2001
+@@ -1,8 +1,8 @@
+
+-/ ---------------------------------------------------------------------------
+-/ Cpu function detect by Pontscho/fresh!mindworkz (c) 2000 - 2000
+-/ 3dnow-dsp detection by Nick Kurshev (C) 2001
+-/ ---------------------------------------------------------------------------
++# ---------------------------------------------------------------------------
++# Cpu function detect by Pontscho/fresh!mindworkz (c) 2000 - 2000
++# 3dnow-dsp detection by Nick Kurshev (C) 2001
++# ---------------------------------------------------------------------------
+
+ .text
+
+@@ -11,10 +11,10 @@
+ .globl a3dnow
+ .globl isse
+
+-/ ---------------------------------------------------------------------------
+-/ in C: unsigned long CpuDetect( void );
+-/ return: cpu ident number.
+-/ ---------------------------------------------------------------------------
++# ---------------------------------------------------------------------------
++# in C: unsigned long CpuDetect( void );
++# return: cpu ident number.
++# ---------------------------------------------------------------------------
+ CpuDetect:
+ pushl %ebx
+ pushl %ecx
+@@ -44,12 +44,12 @@
+ popl %ebx
+ ret
+
+-/ ---------------------------------------------------------------------------
+-/ in C: unsigled long ipentium( void );
+-/ return: 0 if this processor i386 or i486
+-/ 1 otherwise
+-/ 3 if this cpu supports mmx
+-/ ---------------------------------------------------------------------------
++# ---------------------------------------------------------------------------
++# in C: unsigled long ipentium( void );
++# return: 0 if this processor i386 or i486
++# 1 otherwise
++# 3 if this cpu supports mmx
++# ---------------------------------------------------------------------------
+ ipentium:
+ pushl %ebx
+ pushl %ecx
+@@ -84,12 +84,12 @@
+ popl %ebx
+ ret
+
+-/ ---------------------------------------------------------------------------
+-/ in C: unsigned long a3dnow( void );
+-/ return: 0 if this processor does not support 3dnow!
+-/ 1 otherwise
+-/ 3 if this cpu supports 3dnow-dsp extension
+-/ ---------------------------------------------------------------------------
++# ---------------------------------------------------------------------------
++# in C: unsigned long a3dnow( void );
++# return: 0 if this processor does not support 3dnow!
++# 1 otherwise
++# 3 if this cpu supports 3dnow-dsp extension
++# ---------------------------------------------------------------------------
+ a3dnow:
+ pushl %ebx
+ pushl %edx
+@@ -109,11 +109,11 @@
+ xorl %eax,%eax
+ testl $0x80000000,%edx
+ jz exit2
+-/// eax=1 - K6 3DNow!
++#// eax=1 - K6 3DNow!
+ inc %eax
+ testl $0x40000000,%edx
+ jz exit2
+-/// eax=2 - K7 3DNowEx!
++#// eax=2 - K7 3DNowEx!
+ orl $2, %eax
+ exit2:
+
+@@ -122,12 +122,12 @@
+ popl %ebx
+ ret
+
+-/ ---------------------------------------------------------------------------
+-/ in C: unsigned long isse( void );
+-/ return: 0 if this processor does not support sse
+-/ 1 otherwise
+-/ 3 if this cpu supports sse2 extension
+-/ ---------------------------------------------------------------------------
++# ---------------------------------------------------------------------------
++# in C: unsigned long isse( void );
++# return: 0 if this processor does not support sse
++# 1 otherwise
++# 3 if this cpu supports sse2 extension
++# ---------------------------------------------------------------------------
+ isse:
+ pushl %ebx
+ pushl %edx
diff --git a/graphics/mplayer/patches/patch-aq b/graphics/mplayer/patches/patch-aq
new file mode 100644
index 00000000000..7bde6e9e13a
--- /dev/null
+++ b/graphics/mplayer/patches/patch-aq
@@ -0,0 +1,59 @@
+--- mp3lib/dct36_3dnow.s.orig Sat Feb 24 23:31:08 2001
++++ mp3lib/dct36_3dnow.s Mon Jul 30 21:20:01 2001
+@@ -1,30 +1,30 @@
+-/
+-/ dct36_3dnow.s - 3DNow! optimized dct36()
+-/
+-/ This code based 'dct36_3dnow.s' by Syuuhei Kashiyama
+-/ <squash@mb.kcom.ne.jp>,only two types of changes have been made:
+-/
+-/ - remove PREFETCH instruction for speedup
+-/ - change function name for support 3DNow! automatic detect
+-/
+-/ You can find Kashiyama's original 3dnow! support patch
+-/ (for mpg123-0.59o) at
+-/ http://user.ecc.u-tokyo.ac.jp/~g810370/linux-simd/ (Japanese).
+-/
+-/ by KIMURA Takuhiro <kim@hannah.ipc.miyakyo-u.ac.jp> - until 31.Mar.1999
+-/ <kim@comtec.co.jp> - after 1.Apr.1999
+-/
++#
++# dct36_3dnow.s - 3DNow! optimized dct36()
++#
++# This code based 'dct36_3dnow.s' by Syuuhei Kashiyama
++# <squash@mb.kcom.ne.jp>,only two types of changes have been made:
++#
++# - remove PREFETCH instruction for speedup
++# - change function name for support 3DNow! automatic detect
++#
++# You can find Kashiyama's original 3dnow! support patch
++# (for mpg123-0.59o) at
++# http://user.ecc.u-tokyo.ac.jp/~g810370/linux-simd/ (Japanese).
++#
++# by KIMURA Takuhiro <kim@hannah.ipc.miyakyo-u.ac.jp> - until 31.Mar.1999
++# <kim@comtec.co.jp> - after 1.Apr.1999
++#
+
+-///
+-/// Replacement of dct36() with AMD's 3DNow! SIMD operations support
+-///
+-/// Syuuhei Kashiyama <squash@mb.kcom.ne.jp>
+-///
+-/// The author of this program disclaim whole expressed or implied
+-/// warranties with regard to this program, and in no event shall the
+-/// author of this program liable to whatever resulted from the use of
+-/// this program. Use it at your own risk.
+-///
++#//
++#// Replacement of dct36() with AMD's 3DNow! SIMD operations support
++#//
++#// Syuuhei Kashiyama <squash@mb.kcom.ne.jp>
++#//
++#// The author of this program disclaim whole expressed or implied
++#// warranties with regard to this program, and in no event shall the
++#// author of this program liable to whatever resulted from the use of
++#// this program. Use it at your own risk.
++#//
+
+ .globl dct36_3dnow
+ .type dct36_3dnow,@function
diff --git a/graphics/mplayer/patches/patch-ar b/graphics/mplayer/patches/patch-ar
new file mode 100644
index 00000000000..dfc5dc07663
--- /dev/null
+++ b/graphics/mplayer/patches/patch-ar
@@ -0,0 +1,87 @@
+--- mp3lib/dct36_k7.s.orig Wed May 9 11:59:55 2001
++++ mp3lib/dct36_k7.s Mon Jul 30 21:20:01 2001
+@@ -1,44 +1,44 @@
+-///
+-/// Replacement of dct36() with AMD's 3DNowEx(DSP)! SIMD operations support
+-///
+-/// This code based 'dct36_3dnow.s' by Syuuhei Kashiyama
+-/// <squash@mb.kcom.ne.jp>,only some types of changes have been made:
+-///
+-/// - added new opcode PSWAPD
+-/// - change function name for support 3DNowEx! automatic detect
+-///
+-/// note: because K7 processors are an aggresive out-of-order three-way
+-/// superscalar ones instruction order is not significand for them.
+-///
+-/// Modified by Nick Kurshev <nickols_k@mail.ru>
+-///
+-/
+-/ dct36_3dnow.s - 3DNow! optimized dct36()
+-/
+-/ This code based 'dct36_3dnow.s' by Syuuhei Kashiyama
+-/ <squash@mb.kcom.ne.jp>,only two types of changes have been made:
+-/
+-/ - remove PREFETCH instruction for speedup
+-/ - change function name for support 3DNow! automatic detect
+-/
+-/ You can find Kashiyama's original 3dnow! support patch
+-/ (for mpg123-0.59o) at
+-/ http://user.ecc.u-tokyo.ac.jp/~g810370/linux-simd/ (Japanese).
+-/
+-/ by KIMURA Takuhiro <kim@hannah.ipc.miyakyo-u.ac.jp> - until 31.Mar.1999
+-/ <kim@comtec.co.jp> - after 1.Apr.1999
+-/
++#//
++#// Replacement of dct36() with AMD's 3DNowEx(DSP)! SIMD operations support
++#//
++#// This code based 'dct36_3dnow.s' by Syuuhei Kashiyama
++#// <squash@mb.kcom.ne.jp>,only some types of changes have been made:
++#//
++#// - added new opcode PSWAPD
++#// - change function name for support 3DNowEx! automatic detect
++#//
++#// note: because K7 processors are an aggresive out-of-order three-way
++#// superscalar ones instruction order is not significand for them.
++#//
++#// Modified by Nick Kurshev <nickols_k@mail.ru>
++#//
++#
++# dct36_3dnow.s - 3DNow! optimized dct36()
++#
++# This code based 'dct36_3dnow.s' by Syuuhei Kashiyama
++# <squash@mb.kcom.ne.jp>,only two types of changes have been made:
++#
++# - remove PREFETCH instruction for speedup
++# - change function name for support 3DNow! automatic detect
++#
++# You can find Kashiyama's original 3dnow! support patch
++# (for mpg123-0.59o) at
++# http://user.ecc.u-tokyo.ac.jp/~g810370/linux-simd/ (Japanese).
++#
++# by KIMURA Takuhiro <kim@hannah.ipc.miyakyo-u.ac.jp> - until 31.Mar.1999
++# <kim@comtec.co.jp> - after 1.Apr.1999
++#
+
+-///
+-/// Replacement of dct36() with AMD's 3DNow! SIMD operations support
+-///
+-/// Syuuhei Kashiyama <squash@mb.kcom.ne.jp>
+-///
+-/// The author of this program disclaim whole expressed or implied
+-/// warranties with regard to this program, and in no event shall the
+-/// author of this program liable to whatever resulted from the use of
+-/// this program. Use it at your own risk.
+-///
++#//
++#// Replacement of dct36() with AMD's 3DNow! SIMD operations support
++#//
++#// Syuuhei Kashiyama <squash@mb.kcom.ne.jp>
++#//
++#// The author of this program disclaim whole expressed or implied
++#// warranties with regard to this program, and in no event shall the
++#// author of this program liable to whatever resulted from the use of
++#// this program. Use it at your own risk.
++#//
+
+ .globl dct36_3dnowex
+ .type dct36_3dnowex,@function
diff --git a/graphics/mplayer/patches/patch-as b/graphics/mplayer/patches/patch-as
new file mode 100644
index 00000000000..e8274474196
--- /dev/null
+++ b/graphics/mplayer/patches/patch-as
@@ -0,0 +1,105 @@
+--- mp3lib/dct64_3dnow.s.orig Fri Jul 6 14:59:14 2001
++++ mp3lib/dct64_3dnow.s Mon Jul 30 21:20:01 2001
+@@ -30,7 +30,7 @@
+ orl %ecx,%ecx
+ movl %esp,%ecx
+
+-/* Phase 1*/
++#* Phase 1*/
+ movq (%eax), %mm0
+ movq 8(%eax), %mm4
+ movq %mm0, %mm3
+@@ -147,7 +147,7 @@
+ movd %mm3, 72(%edx)
+ movd %mm7, 64(%edx)
+
+-/* Phase 2*/
++#* Phase 2*/
+
+ movq (%edx), %mm0
+ movq 8(%edx), %mm4
+@@ -207,7 +207,7 @@
+ movd %mm3, 40(%ecx)
+ movd %mm7, 32(%ecx)
+
+-/* Phase 3*/
++#* Phase 3*/
+
+ movq 64(%edx), %mm0
+ movq 72(%edx), %mm4
+@@ -267,7 +267,7 @@
+ movd %mm3, 104(%ecx)
+ movd %mm7, 96(%ecx)
+
+-/* Phase 4*/
++#* Phase 4*/
+
+ movq (%ecx), %mm0
+ movq 8(%ecx), %mm4
+@@ -385,7 +385,7 @@
+ movd %mm3, 120(%edx)
+ movd %mm7, 112(%edx)
+
+-/* Phase 5 */
++#* Phase 5 */
+
+ movq (%edx), %mm0
+ movq 16(%edx), %mm4
+@@ -503,8 +503,8 @@
+ movd %mm3, 104(%ecx)
+ movd %mm7, 120(%ecx)
+
+-/* Phase 6. This is the end of easy road. */
+-/* Code below is coded in scalar mode. Should be optimized */
++#* Phase 6. This is the end of easy road. */
++#* Code below is coded in scalar mode. Should be optimized */
+
+ movd plus_1f, %mm6
+ punpckldq 120(%ebx), %mm6 /* mm6 = 1.0 | 120(%ebx)*/
+@@ -563,7 +563,7 @@
+ movq %mm1, 56(%edx)
+ movq %mm0, 48(%edx)
+
+-/*---*/
++#*---*/
+
+ movd 92(%ecx), %mm1
+ pfsub 88(%ecx), %mm1
+@@ -622,8 +622,8 @@
+
+ jnz .L01
+
+-/* Phase 7*/
+-/* Code below is coded in scalar mode. Should be optimized */
++#* Phase 7*/
++#* Code below is coded in scalar mode. Should be optimized */
+
+ movd (%ecx), %mm0
+ pfadd 4(%ecx), %mm0
+@@ -666,7 +666,7 @@
+ pfadd %mm3, %mm2
+ movd %mm2, 256(%edi)
+
+-/* Phase 8*/
++#* Phase 8*/
+
+ movq 32(%edx), %mm0
+ movq 48(%edx), %mm1
+@@ -741,7 +741,7 @@
+
+ jmp .L_bye
+ .L01:
+-/* Phase 9*/
++#* Phase 9*/
+
+ movq (%ecx), %mm0
+ movq %mm0, %mm1
+@@ -799,7 +799,7 @@
+ movd %mm2, %eax
+ movw %ax, 128(%edi)
+
+-/* Phase 10*/
++#* Phase 10*/
+
+ movq 32(%edx), %mm0
+ movq 48(%edx), %mm1
diff --git a/graphics/mplayer/patches/patch-at b/graphics/mplayer/patches/patch-at
new file mode 100644
index 00000000000..93648cc7147
--- /dev/null
+++ b/graphics/mplayer/patches/patch-at
@@ -0,0 +1,83 @@
+--- mp3lib/dct64_MMX.s.orig Thu Jul 5 13:44:18 2001
++++ mp3lib/dct64_MMX.s Mon Jul 30 21:20:01 2001
+@@ -14,7 +14,7 @@
+ pushl %edi
+ subl $256,%esp
+ movl 280(%esp),%eax
+-/* Phase 1*/
++#* Phase 1*/
+ flds (%eax)
+ leal 128(%esp),%edx
+ fadds 124(%eax)
+@@ -165,7 +165,7 @@
+ fmuls 60(%ebx)
+ fstps 64(%edx)
+
+-/* Phase 2*/
++#* Phase 2*/
+
+ flds (%edx)
+ fadds 60(%edx)
+@@ -239,7 +239,7 @@
+ fmuls 92(%ebx)
+ fstps 32(%ecx)
+
+-/* Phase 3*/
++#* Phase 3*/
+
+ flds 64(%edx)
+ fadds 124(%edx)
+@@ -313,7 +313,7 @@
+ fmuls 92(%ebx)
+ fstps 96(%ecx)
+
+-/* Phase 4*/
++#* Phase 4*/
+
+ flds (%ecx)
+ fadds 28(%ecx)
+@@ -603,7 +603,7 @@
+ fmuls 116(%ebx)
+ fstps 120(%ecx)
+
+-/* Phase 5*/
++#* Phase 5*/
+
+ flds 32(%ecx)
+ fadds 36(%ecx)
+@@ -715,7 +715,7 @@
+ fstps 120(%edx)
+ jnz .L01
+
+-/* Phase 6*/
++#* Phase 6*/
+
+ flds (%ecx)
+ fadds 4(%ecx)
+@@ -755,7 +755,7 @@
+ faddp %st(1)
+ fstps 256(%edi)
+
+-/* Phase 7*/
++#* Phase 7*/
+
+ flds 32(%edx)
+ fadds 48(%edx)
+@@ -852,7 +852,7 @@
+ popl %ebx
+ ret
+ .L01:
+-/* Phase 8*/
++#* Phase 8*/
+
+ flds (%ecx)
+ fadds 4(%ecx)
+@@ -893,7 +893,7 @@
+ faddp %st(1)
+ fistp 128(%edi)
+
+-/* Phase 9*/
++#* Phase 9*/
+
+ flds 32(%edx)
+ fadds 48(%edx)
diff --git a/graphics/mplayer/patches/patch-au b/graphics/mplayer/patches/patch-au
new file mode 100644
index 00000000000..80ef253d705
--- /dev/null
+++ b/graphics/mplayer/patches/patch-au
@@ -0,0 +1,105 @@
+--- mp3lib/dct64_k7.s.orig Fri Jul 6 14:59:14 2001
++++ mp3lib/dct64_k7.s Mon Jul 30 21:20:01 2001
+@@ -31,7 +31,7 @@
+ orl %ecx,%ecx
+ movl %esp,%ecx
+
+-/* Phase 1*/
++#* Phase 1*/
+ movq (%eax), %mm0
+ movq 8(%eax), %mm4
+ movq %mm0, %mm3
+@@ -116,7 +116,7 @@
+ movq %mm3, 72(%edx)
+ movq %mm7, 64(%edx)
+
+-/* Phase 2*/
++#* Phase 2*/
+
+ movq (%edx), %mm0
+ movq 8(%edx), %mm4
+@@ -160,7 +160,7 @@
+ movq %mm3, 40(%ecx)
+ movq %mm7, 32(%ecx)
+
+-/* Phase 3*/
++#* Phase 3*/
+
+ movq 64(%edx), %mm0
+ movq 72(%edx), %mm4
+@@ -204,7 +204,7 @@
+ movq %mm3, 104(%ecx)
+ movq %mm7, 96(%ecx)
+
+-/* Phase 4*/
++#* Phase 4*/
+
+ movq 96(%ebx), %mm2
+ movq 104(%ebx), %mm6
+@@ -293,7 +293,7 @@
+ movq %mm3, 120(%edx)
+ movq %mm7, 112(%edx)
+
+-/* Phase 5 */
++#* Phase 5 */
+
+ movq 112(%ebx), %mm2
+
+@@ -382,8 +382,8 @@
+ movq %mm7, 120(%ecx)
+
+
+-/* Phase 6. This is the end of easy road. */
+-/* Code below is coded in scalar mode. Should be optimized */
++#* Phase 6. This is the end of easy road. */
++#* Code below is coded in scalar mode. Should be optimized */
+
+ movd plus_1f, %mm6
+ punpckldq 120(%ebx), %mm6 /* mm6 = 1.0 | 120(%ebx)*/
+@@ -442,7 +442,7 @@
+ movq %mm1, 56(%edx)
+ movq %mm0, 48(%edx)
+
+-/*---*/
++#*---*/
+
+ movd 92(%ecx), %mm1
+ pfsub 88(%ecx), %mm1
+@@ -501,8 +501,8 @@
+
+ jnz .L01
+
+-/* Phase 7*/
+-/* Code below is coded in scalar mode. Should be optimized */
++#* Phase 7*/
++#* Code below is coded in scalar mode. Should be optimized */
+
+ movd (%ecx), %mm0
+ pfadd 4(%ecx), %mm0
+@@ -545,7 +545,7 @@
+ pfadd %mm3, %mm2
+ movd %mm2, 256(%edi)
+
+-/* Phase 8*/
++#* Phase 8*/
+
+ movq 32(%edx), %mm0
+ movq 48(%edx), %mm1
+@@ -620,7 +620,7 @@
+
+ jmp .L_bye
+ .L01:
+-/* Phase 9*/
++#* Phase 9*/
+
+ movq (%ecx), %mm0
+ movq %mm0, %mm1
+@@ -678,7 +678,7 @@
+ movd %mm2, %eax
+ movw %ax, 128(%edi)
+
+-/* Phase 10*/
++#* Phase 10*/
+
+ movq 32(%edx), %mm0
+ movq 48(%edx), %mm1
diff --git a/graphics/mplayer/patches/patch-av b/graphics/mplayer/patches/patch-av
new file mode 100644
index 00000000000..b8f75fc38ff
--- /dev/null
+++ b/graphics/mplayer/patches/patch-av
@@ -0,0 +1,17 @@
+--- mp3lib/decode_MMX.s.orig Fri Jul 6 16:08:32 2001
++++ mp3lib/decode_MMX.s Mon Jul 30 21:20:02 2001
+@@ -48,10 +48,10 @@
+ .text
+
+ .globl synth_1to1_MMX_s
+-//
+-// void synth_1to1_MMX_s(real *bandPtr, int channel, short *samples,
+-// short *buffs, int *bo);
+-//
++#
++# void synth_1to1_MMX_s(real *bandPtr, int channel, short *samples,
++# short *buffs, int *bo);
++#
+ synth_1to1_MMX_s:
+ pushl %ebp
+ pushl %edi
diff --git a/graphics/mplayer/patches/patch-aw b/graphics/mplayer/patches/patch-aw
new file mode 100644
index 00000000000..951b19a5ebb
--- /dev/null
+++ b/graphics/mplayer/patches/patch-aw
@@ -0,0 +1,56 @@
+--- mp3lib/decode_i586.s.orig Sat Feb 24 23:31:11 2001
++++ mp3lib/decode_i586.s Mon Jul 30 21:20:02 2001
+@@ -1,28 +1,28 @@
+-/
+-/ mpg123_synth_1to1 works the same way as the c version of this
+-/ file. only two types of changes have been made:
+-/ - reordered floating point instructions to
+-/ prevent pipline stalls
+-/ - made WRITE_SAMPLE use integer instead of
+-/ (slower) floating point
+-/ all kinds of x86 processors should benefit from these
+-/ modifications.
+-/
+-/ useful sources of information on optimizing x86 code include:
+-/
+-/ Intel Architecture Optimization Manual
+-/ http://www.intel.com/design/pentium/manuals/242816.htm
+-/
+-/ Cyrix 6x86 Instruction Set Summary
+-/ ftp://ftp.cyrix.com/6x86/6x-dbch6.pdf
+-/
+-/ AMD-K5 Processor Software Development
+-/ http://www.amd.com/products/cpg/techdocs/appnotes/20007e.pdf
+-/
+-/ Stefan Bieschewski <stb@acm.org>
+-/
+-/ $Id: patch-aw,v 1.1.1.1 2001/12/21 23:38:53 zuntum Exp $
+-/
++#
++# mpg123_synth_1to1 works the same way as the c version of this
++# file. only two types of changes have been made:
++# - reordered floating point instructions to
++# prevent pipline stalls
++# - made WRITE_SAMPLE use integer instead of
++# (slower) floating point
++# all kinds of x86 processors should benefit from these
++# modifications.
++#
++# useful sources of information on optimizing x86 code include:
++#
++# Intel Architecture Optimization Manual
++# http://www.intel.com/design/pentium/manuals/242816.htm
++#
++# Cyrix 6x86 Instruction Set Summary
++# ftp://ftp.cyrix.com/6x86/6x-dbch6.pdf
++#
++# AMD-K5 Processor Software Development
++# http://www.amd.com/products/cpg/techdocs/appnotes/20007e.pdf
++#
++# Stefan Bieschewski <stb@acm.org>
++#
++# MPlayer Id: decode_i586.s,v 1.1.1.1 2001/02/24 20:31:11 arpi_esp Exp
++#
+ .bss
+ .comm buffs,4352,4
+ .data
diff --git a/graphics/mplayer/patches/patch-ax b/graphics/mplayer/patches/patch-ax
new file mode 100644
index 00000000000..cbcd8e074f0
--- /dev/null
+++ b/graphics/mplayer/patches/patch-ax
@@ -0,0 +1,145 @@
+--- mplayer.c.orig Sun Jul 8 17:11:01 2001
++++ mplayer.c Mon Jul 30 22:10:10 2001
+@@ -36,6 +36,9 @@
+ #error "============================================="
+ #endif
+
++int mixer_usemaster;
++char * mixer_device;
++
+ #include "cfgparser.h"
+ #include "cfg-mplayer-def.h"
+
+@@ -400,7 +403,6 @@
+ extern int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen);
+
+
+-#include "mixer.h"
+ #include "cfg-mplayer.h"
+
+ void parse_cfgfiles( void )
+@@ -578,7 +580,8 @@
+ fprintf(stderr,"Invalid audio output driver name: %s\nUse '-ao help' to get a list of available audio drivers.\n",audio_driver);
+ return 0;
+ }
+-/*DSP!! if(dsp) audio_out->control(AOCONTROL_SET_DEVICE,(int)dsp);*/
++ if(ao_subdevice) audio_out->control(AOCONTROL_SET_DEVICE,ao_subdevice);
++ audio_out->control(AOCONTROL_SET_MIXER_DEVICE,mixer_device);
+
+ // check codec.conf
+ if(!parse_codec_cfg(get_path("codecs.conf"))){
+@@ -1070,11 +1073,6 @@
+
+ fflush(stdout);
+
+-if(!sh_video){
+- fprintf(stderr,"Sorry, no video stream... it's unplayable yet\n");
+- exit(1);
+-}
+-
+ //================== Init AUDIO (codec) ==========================
+ if(has_audio){
+ // Go through the codec.conf and find the best codec...
+@@ -1108,6 +1106,7 @@
+
+ //================== Init VIDEO (codec & libvo) ==========================
+
++if(!sh_video) goto NOVIDEO;
+ // Go through the codec.conf and find the best codec...
+ sh_video->codec=NULL;
+ while(1){
+@@ -1169,6 +1168,7 @@
+
+ if(verbose) printf("vo_debug2: out_fmt=%s\n",vo_format_name(out_fmt));
+
++NOVIDEO:
+ // ================== Init output files for encoding ===============
+ if(encode_name){
+ // encode file!!!
+@@ -1209,6 +1209,7 @@
+ }
+ #endif
+
++ if(sh_video) {
+ if(screen_size_xy>0){
+ if(screen_size_xy<=8){
+ screen_size_x=screen_size_xy*sh_video->disp_w;
+@@ -1249,6 +1250,7 @@
+ screen_size_x,screen_size_y,
+ fullscreen|(vidmode<<1)|(softzoom<<2)|(flip<<3),
+ title,out_fmt);
++ }
+
+ if(verbose) printf("vo_debug3: out_fmt=%s\n",vo_format_name(out_fmt));
+
+@@ -1261,7 +1263,7 @@
+ }
+ #endif
+
+- if(video_out->init(sh_video->disp_w,sh_video->disp_h,
++ if(sh_video && video_out->init(sh_video->disp_w,sh_video->disp_h,
+ screen_size_x,screen_size_y,
+ fullscreen|(vidmode<<1)|(softzoom<<2)|(flip<<3),
+ title,out_fmt)){
+@@ -1567,6 +1569,7 @@
+
+ //------------------------ frame decoded. --------------------
+
++ if(!sh_video) goto NOVIDEO2;
+ // Increase video timers:
+ num_frames+=frame_time;
+ frame_time*=sh_video->frametime;
+@@ -1590,6 +1593,7 @@
+
+ if(verbose>1) printf("*** ftime=%5.3f ***\n",frame_time);
+
++ NOVIDEO2:
+ if(drop_frame){
+
+ if(has_audio){
+@@ -1600,11 +1604,11 @@
+ if(time_frame>-2*frame_time) {
+ drop_frame=0; // stop dropping frames
+ if (verbose>0) printf("\nstop frame drop %.2f\n", time_frame);
+- }else{
++ } /* else{
+ ++drop_frame_cnt;
+ if (verbose > 0 && drop_frame_cnt%10 == 0)
+ printf("\nstill dropping, %.2f\n", time_frame);
+- }
++ } */
+ }
+
+ } else {
+@@ -1833,21 +1837,23 @@
+ break;
+ case '*':
+ case '/': {
+- float mixer_l, mixer_r;
+- mixer_getvolume( &mixer_l,&mixer_r );
++ ao_control_vol_t v;
++
++ audio_out->control(AOCONTROL_GET_VOLUME, (void *)&v);
+ if(c=='*'){
+- mixer_l++; if ( mixer_l > 100 ) mixer_l = 100;
+- mixer_r++; if ( mixer_r > 100 ) mixer_r = 100;
++ v.left += 1.0; if ( v.left > 100.0 ) v.left = 100.0;
++ v.right+= 1.0; if ( v.right > 100.0 ) v.right = 100.0;
+ } else {
+- mixer_l--; if ( mixer_l < 0 ) mixer_l = 0;
+- mixer_r--; if ( mixer_r < 0 ) mixer_r = 0;
++ v.left -= 1.0; if ( v.left < 0.0 ) v.left = 0.0;
++ v.right-= 1.0; if ( v.right < 0.0 ) v.right = 0.0;
+ }
+- mixer_setvolume( mixer_l,mixer_r );
++ v.usemaster = mixer_usemaster;
++ audio_out->control(AOCONTROL_SET_VOLUME, (void *)&v);
+
+ if(osd_level){
+ osd_visible=sh_video->fps; // 1 sec
+ vo_osd_progbar_type=OSD_VOLUME;
+- vo_osd_progbar_value=(mixer_l+mixer_r)*5/4;
++ vo_osd_progbar_value=(v.left+v.right)*5/4;
+ //printf("volume: %d\n",vo_osd_progbar_value);
+ }
+ }
diff --git a/graphics/mplayer/patches/patch-ay b/graphics/mplayer/patches/patch-ay
new file mode 100644
index 00000000000..07469a15ca3
--- /dev/null
+++ b/graphics/mplayer/patches/patch-ay
@@ -0,0 +1,39 @@
+--- stream.c.orig Thu Jun 21 04:06:40 2001
++++ stream.c Mon Jul 30 22:10:10 2001
+@@ -12,8 +12,12 @@
+ #ifdef __FreeBSD__
+ #include "vcd_read_fbsd.c"
+ #else
++#ifdef __NetBSD__
++#include "vcd_read_nbsd.c"
++#else
+ #include "vcd_read.c"
+ #endif
++#endif
+
+ //=================== STREAMER =========================
+
+@@ -37,6 +41,7 @@
+ s->buf_len=len;
+ s->pos+=len;
+ // printf("[%d]",len);fflush(stdout);
++ if(s->type == STREAMTYPE_VCD) vcd_set_msf(s->pos/VCD_SECTOR_DATA);
+ return len;
+ }
+
+@@ -68,6 +73,7 @@
+ s->pos=newpos; // real seek
+ if(lseek(s->fd,s->pos,SEEK_SET)<0) s->eof=1;
+ break;
++#ifdef HAVE_VCD
+ case STREAMTYPE_VCD:
+ s->pos=newpos; // real seek
+ #ifdef VCD_CACHE
+@@ -76,6 +82,7 @@
+ vcd_set_msf(s->pos/VCD_SECTOR_DATA);
+ #endif
+ break;
++#endif
+ case STREAMTYPE_STREAM:
+ //s->pos=newpos; // real seek
+ if(newpos<s->pos){
diff --git a/graphics/mplayer/patches/patch-az b/graphics/mplayer/patches/patch-az
new file mode 100644
index 00000000000..2f32a07a816
--- /dev/null
+++ b/graphics/mplayer/patches/patch-az
@@ -0,0 +1,10 @@
+--- vcd_read.c.orig Tue Jun 12 10:53:32 2001
++++ vcd_read.c Mon Jul 30 21:23:54 2001
+@@ -8,6 +8,7 @@
+ static int sun_vcd_read(int, int*);
+ #endif
+
++#define HAVE_VCD 1
+
+ static struct cdrom_tocentry vcd_entry;
+
diff --git a/graphics/mplayer/patches/patch-ba b/graphics/mplayer/patches/patch-ba
new file mode 100644
index 00000000000..b556ccc4b61
--- /dev/null
+++ b/graphics/mplayer/patches/patch-ba
@@ -0,0 +1,11 @@
+--- vcd_read_fbsd.c.orig Thu Jun 21 04:06:40 2001
++++ vcd_read_fbsd.c Mon Jul 30 21:24:00 2001
+@@ -1,6 +1,8 @@
+ #include <sys/cdio.h>
+ #include <sys/cdrio.h>
+
++#define HAVE_VCD 1
++
+ //=================== VideoCD ==========================
+ #define CDROM_LEADOUT 0xAA
+
diff --git a/graphics/mplayer/patches/patch-bb b/graphics/mplayer/patches/patch-bb
new file mode 100644
index 00000000000..120f4a39f33
--- /dev/null
+++ b/graphics/mplayer/patches/patch-bb
@@ -0,0 +1,201 @@
+--- vcd_read_nbsd.c.orig Thu Jan 1 03:00:00 1970
++++ vcd_read_nbsd.c Mon Jul 30 22:10:10 2001
+@@ -0,0 +1,198 @@
++#include <sys/types.h>
++#include <sys/inttypes.h>
++#include <sys/cdio.h>
++#include <sys/scsiio.h>
++
++#define HAVE_VCD
++
++#define CDROM_LEADOUT 0xAA
++
++static struct ioc_read_toc_entry vcd_entry;
++static struct cd_toc_entry vcd_entry_data;
++static char vcd_buf[VCD_SECTOR_SIZE];
++
++static inline void
++vcd_set_msf(unsigned int sect)
++{
++ unsigned int s = sect;
++ vcd_entry_data.addr.msf.frame = sect % 75;
++ sect = sect / 75;
++ vcd_entry_data.addr.msf.second = sect % 60;
++ sect = sect / 60;
++ vcd_entry_data.addr.msf.minute = sect;
++}
++
++static inline unsigned int
++vcd_get_msf()
++{
++ return vcd_entry_data.addr.msf.frame +
++ (vcd_entry_data.addr.msf.second +
++ vcd_entry_data.addr.msf.minute * 60) * 75;
++}
++
++int
++vcd_seek_to_track(int fd, int track)
++{
++ vcd_entry.address_format = CD_MSF_FORMAT;
++ vcd_entry.starting_track = track;
++ vcd_entry.data_len = sizeof(struct cd_toc_entry);
++ vcd_entry.data = &vcd_entry_data;
++ if (ioctl(fd, CDIOREADTOCENTRIES, &vcd_entry)) {
++ perror("ioctl dif1");
++ return -1;
++ }
++ return VCD_SECTOR_DATA * vcd_get_msf();
++}
++
++int
++vcd_get_track_end(int fd, int track)
++{
++ struct ioc_toc_header tochdr;
++ if (ioctl(fd, CDIOREADTOCHEADER, &tochdr) == -1) {
++ perror("read CDROM toc header: ");
++ return -1;
++ }
++ vcd_entry.address_format = CD_MSF_FORMAT;
++ vcd_entry.starting_track = track < tochdr.ending_track ? (track + 1) : CDROM_LEADOUT;
++ vcd_entry.data_len = sizeof(struct cd_toc_entry);
++ vcd_entry.data = &vcd_entry_data;
++ if (ioctl(fd, CDIOREADTOCENTRYS, &vcd_entry)) {
++ perror("ioctl dif2");
++ return -1;
++ }
++ return VCD_SECTOR_DATA * vcd_get_msf();
++}
++
++void
++vcd_read_toc(int fd)
++{
++ struct ioc_toc_header tochdr;
++ int i;
++ if (ioctl(fd, CDIOREADTOCHEADER, &tochdr) == -1) {
++ perror("read CDROM toc header: ");
++ return;
++ }
++ for (i = tochdr.starting_track; i <= tochdr.ending_track; i++) {
++ struct ioc_read_toc_entry tocentry;
++ struct cd_toc_entry tocentry_data;
++
++ tocentry.starting_track = i;
++ tocentry.address_format = CD_MSF_FORMAT;
++ tocentry.data_len = sizeof(struct cd_toc_entry);
++ tocentry.data = &tocentry_data;
++
++ if (ioctl(fd, CDIOREADTOCENTRYS, &tocentry) == -1) {
++ perror("read CDROM toc entry: ");
++ return;
++ }
++ printf("track %02d: adr=%d ctrl=%d format=%d %02d:%02d:%02d\n",
++ (int) tocentry.starting_track,
++ (int) tocentry.data->addr_type,
++ (int) tocentry.data->control,
++ (int) tocentry.address_format,
++ (int) tocentry.data->addr.msf.minute,
++ (int) tocentry.data->addr.msf.second,
++ (int) tocentry.data->addr.msf.frame
++ );
++ }
++}
++
++static int
++vcd_read(int fd, char *mem)
++{
++ struct scsireq sc;
++ int lba = vcd_get_msf();
++ int blocks;
++ int sector_type;
++ int sync, header_code, user_data, edc_ecc, error_field;
++ int sub_channel;
++ int rc;
++
++ blocks = 1;
++ sector_type = 5; /* mode2/form2 */
++ sync = 0;
++ header_code = 0;
++ user_data = 1;
++ edc_ecc = 0;
++ error_field = 0;
++ sub_channel = 0;
++
++ memset(&sc, 0, sizeof(sc));
++ sc.cmd[0] = 0xBE;
++ sc.cmd[1] = (sector_type) << 2;
++ sc.cmd[2] = (lba >> 24) & 0xff;
++ sc.cmd[3] = (lba >> 16) & 0xff;
++ sc.cmd[4] = (lba >> 8) & 0xff;
++ sc.cmd[5] = lba & 0xff;
++ sc.cmd[6] = (blocks >> 16) & 0xff;
++ sc.cmd[7] = (blocks >> 8) & 0xff;
++ sc.cmd[8] = blocks & 0xff;
++ sc.cmd[9] = (sync << 7) | (header_code << 5) | (user_data << 4) |
++ (edc_ecc << 3) | (error_field << 1);
++ sc.cmd[10] = sub_channel;
++ sc.cmdlen = 12;
++ sc.databuf = (caddr_t) mem;
++ sc.datalen = 2328;
++ sc.senselen = sizeof(sc.sense);
++ sc.flags = SCCMD_READ;
++ sc.timeout = 10000;
++ rc = ioctl(fd, SCIOCCOMMAND, &sc);
++ if (rc == -1) {
++ perror("SCIOCCOMMAND");
++ return -1;
++ }
++ if (sc.retsts || sc.error) {
++ fprintf(stderr, "scsi command failed: status %d error %d\n", sc.retsts,
++ sc.error);
++ return -1;
++ }
++ return VCD_SECTOR_DATA;
++}
++
++#ifdef VCD_CACHE
++
++static int vcd_cache_size = 0;
++static char *vcd_cache_data = NULL;
++static int *vcd_cache_sectors = NULL;
++static int vcd_cache_index = 0;
++static int vcd_cache_current = -1;
++
++void
++vcd_cache_init(int s)
++{
++ vcd_cache_size = s;
++ vcd_cache_sectors = malloc(s * sizeof(int));
++ vcd_cache_data = malloc(s * VCD_SECTOR_SIZE);
++ memset(vcd_cache_sectors, 255, s * sizeof(int));
++}
++
++static inline void
++vcd_cache_seek(int sect)
++{
++ vcd_cache_current = sect;
++}
++
++int
++vcd_cache_read(int fd, char *mem)
++{
++ int i;
++ char *vcd_buf;
++ for (i = 0; i < vcd_cache_size; i++)
++ if (vcd_cache_sectors[i] == vcd_cache_current) {
++ vcd_buf = &vcd_cache_data[i * VCD_SECTOR_SIZE];
++ ++vcd_cache_current;
++ memcpy(mem, &vcd_buf[VCD_SECTOR_OFFS], VCD_SECTOR_DATA);
++ return VCD_SECTOR_DATA;
++ }
++ vcd_buf = &vcd_cache_data[vcd_cache_index * VCD_SECTOR_SIZE];
++ vcd_cache_sectors[vcd_cache_index] = vcd_cache_current;
++ ++vcd_cache_index;
++ if (vcd_cache_index >= vcd_cache_size)
++ vcd_cache_index = 0;
++ vcd_set_msf(vcd_cache_current);
++ memcpy(vcd_buf, &vcd_entry_data.addr.msf, sizeof(vcd_entry_data.addr.msf));
++ ++vcd_cache_current;
++ memcpy(mem, &vcd_buf[VCD_SECTOR_OFFS], VCD_SECTOR_DATA);
++ return VCD_SECTOR_DATA;
++}
++#endif
diff --git a/graphics/mplayer/patches/patch-bc b/graphics/mplayer/patches/patch-bc
new file mode 100644
index 00000000000..992ae56868a
--- /dev/null
+++ b/graphics/mplayer/patches/patch-bc
@@ -0,0 +1,11 @@
+--- loader/Makefile.orig Thu Jul 12 21:02:55 2001
++++ loader/Makefile Tue Jul 31 14:45:12 2001
+@@ -26,7 +19,7 @@
+ distclean: clean
+
+ .c.o: $@
+- $(CC) $(CFLAGS) $(DEFINES) -c $<
++ $(CC) $(CFLAGS) $(DEFINES) $(EXTRA_INC) -c $<
+
+ libloader.a: $(LIB_OBJECTS) stubs.s
+ $(CC) -c ./stubs.s -o stubs.o
diff --git a/graphics/mplayer/patches/patch-bd b/graphics/mplayer/patches/patch-bd
new file mode 100644
index 00000000000..45942ddd7a2
--- /dev/null
+++ b/graphics/mplayer/patches/patch-bd
@@ -0,0 +1,61 @@
+$NetBSD: patch-bd,v 1.1.1.1 2001/12/21 23:38:52 zuntum Exp $
+
+--- libvo/x11_common.c.orig Wed Jul 4 01:23:55 2001
++++ libvo/x11_common.c
+@@ -17,9 +17,6 @@
+ #include <X11/Xutil.h>
+ #include <X11/Xatom.h>
+
+-#include <X11/extensions/dpms.h>
+-
+-static int dpms_disabled=0;
+ static int timeout_save=0;
+
+ char* mDisplayName=NULL;
+@@ -279,25 +276,6 @@
+ void saver_on(Display *mDisplay) {
+
+ int nothing;
+- if (dpms_disabled)
+- {
+- if (DPMSQueryExtension(mDisplay, &nothing, &nothing))
+- {
+- if (!DPMSEnable(mDisplay)) { // restoring power saving settings
+- printf("DPMS not available?\n");
+- } else {
+- // DPMS does not seem to be enabled unless we call DPMSInfo
+- BOOL onoff;
+- CARD16 state;
+- DPMSInfo(mDisplay, &state, &onoff);
+- if (onoff) {
+- printf ("Successfully enabled DPMS\n");
+- } else {
+- printf ("Could not enable DPMS\n");
+- }
+- }
+- }
+- }
+
+ if (timeout_save)
+ {
+@@ -313,20 +291,6 @@
+
+ int interval, prefer_blank, allow_exp, nothing;
+
+- if (DPMSQueryExtension(mDisplay, &nothing, &nothing))
+- {
+- BOOL onoff;
+- CARD16 state;
+- DPMSInfo(mDisplay, &state, &onoff);
+- if (onoff)
+- {
+- Status stat;
+- printf ("Disabling DPMS\n");
+- dpms_disabled=1;
+- stat = DPMSDisable(mDisplay); // monitor powersave off
+- printf ("stat: %d\n", stat);
+- }
+- }
+ XGetScreenSaver(mDisplay, &timeout_save, &interval, &prefer_blank, &allow_exp);
+ if (timeout_save)
+ XSetScreenSaver(mDisplay, 0, interval, prefer_blank, allow_exp);