summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/SOLARIS5
-rw-r--r--TOOLS/cpuinfo.c195
-rw-r--r--aviheader.c7
-rw-r--r--cfg-mplayer.h2
-rwxr-xr-xconfigure199
-rw-r--r--dec_audio.c17
-rw-r--r--libao2/Makefile4
-rw-r--r--libao2/ao_alsa5.c12
-rw-r--r--libao2/ao_null.c12
-rw-r--r--libao2/ao_oss.c79
-rw-r--r--libao2/ao_sdl.c32
-rw-r--r--libao2/audio_out.c33
-rw-r--r--libao2/audio_out.h8
-rw-r--r--libao2/audio_out_internal.h6
-rw-r--r--libvo/Makefile2
-rw-r--r--libvo/vo_sdl.c19
-rw-r--r--libvo/x11_common.c2
-rw-r--r--linux/getch2.c24
-rw-r--r--loader/stubs.s16
-rw-r--r--loader/win32.c27
-rw-r--r--mixer.c96
-rw-r--r--mixer.h8
-rw-r--r--mplayer.c93
-rw-r--r--stream.c15
-rw-r--r--vcd_read.h187
-rw-r--r--vcd_read_fbsd.h3
-rwxr-xr-xversion.sh8
27 files changed, 838 insertions, 273 deletions
diff --git a/DOCS/SOLARIS b/DOCS/SOLARIS
new file mode 100644
index 0000000000..0a9ef23798
--- /dev/null
+++ b/DOCS/SOLARIS
@@ -0,0 +1,5 @@
+Notes for Solaris users
+=======================
+
+1. To build the package you will need GNU make (gmake, /opt/sfw/gmake),
+native Solaris make will not work.
diff --git a/TOOLS/cpuinfo.c b/TOOLS/cpuinfo.c
new file mode 100644
index 0000000000..c5a290198e
--- /dev/null
+++ b/TOOLS/cpuinfo.c
@@ -0,0 +1,195 @@
+
+#include <stdio.h>
+#include <sys/time.h>
+
+#ifdef M_UNIX
+typedef long long int64_t;
+#define MISSING_USLEEP
+#else
+#include <inttypes.h>
+#endif
+
+
+typedef struct cpuid_regs {
+ unsigned int eax;
+ unsigned int ebx;
+ unsigned int ecx;
+ unsigned int edx;
+} cpuid_regs_t;
+
+static cpuid_regs_t
+cpuid(int func) {
+ cpuid_regs_t regs;
+#define CPUID ".byte 0x0f, 0xa2; "
+ asm("movl %4,%%eax; " CPUID
+ "movl %%eax,%0; movl %%ebx,%1; movl %%ecx,%2; movl %%edx,%3"
+ : "=m" (regs.eax), "=m" (regs.ebx), "=m" (regs.ecx), "=m" (regs.edx)
+ : "g" (func)
+ : "%eax", "%ebx", "%ecx", "%edx");
+ return regs;
+}
+
+
+static int64_t
+rdtsc(void)
+{
+ unsigned int i, j;
+#define RDTSC ".byte 0x0f, 0x31; "
+ asm(RDTSC : "=a"(i), "=d"(j) : );
+ return ((int64_t)j<<32) + (int64_t)i;
+}
+
+
+static void
+store32(char *d, unsigned int v)
+{
+ d[0] = v & 0xff;
+ d[1] = (v >> 8) & 0xff;
+ d[2] = (v >> 16) & 0xff;
+ d[3] = (v >> 24) & 0xff;
+}
+
+
+int
+main(int argc, char **argv)
+{
+ cpuid_regs_t regs, regs_ext;
+ char idstr[13];
+ unsigned max_cpuid;
+ unsigned max_ext_cpuid;
+ unsigned int amd_flags;
+ char *model_name = "Unknown CPU";
+ int i;
+ char processor_name[49];
+
+ regs = cpuid(0);
+ max_cpuid = regs.eax;
+ /* printf("%d CPUID function codes\n", max_cpuid+1); */
+
+ store32(idstr+0, regs.ebx);
+ store32(idstr+4, regs.edx);
+ store32(idstr+8, regs.ecx);
+ idstr[12] = 0;
+ printf("vendor_id\t: %s\n", idstr);
+
+ if (strcmp(idstr, "GenuineIntel") == 0)
+ model_name = "Unknown Intel CPU";
+ else if (strcmp(idstr, "AuthenticAMD") == 0)
+ model_name = "Unknown AMD CPU";
+
+ regs_ext = cpuid((1<<31) + 0);
+ max_ext_cpuid = regs_ext.eax;
+ if (max_ext_cpuid >= (1<<31) + 1) {
+ regs_ext = cpuid((1<<31) + 1);
+ amd_flags = regs_ext.edx;
+
+ if (max_ext_cpuid >= (1<<31) + 4) {
+ for (i = 2; i <= 4; i++) {
+ regs_ext = cpuid((1<<31) + i);
+ store32(processor_name + (i-2)*16, regs_ext.eax);
+ store32(processor_name + (i-2)*16 + 4, regs_ext.ebx);
+ store32(processor_name + (i-2)*16 + 8, regs_ext.ecx);
+ store32(processor_name + (i-2)*16 + 12, regs_ext.edx);
+ }
+ processor_name[48] = 0;
+ model_name = processor_name;
+ }
+ } else {
+ amd_flags = 0;
+ }
+
+ if (max_cpuid >= 1) {
+ static struct {
+ int bit;
+ char *desc;;
+ char *description;
+ } cap[] = {
+ { 0, "fpu", "Floating-point unit on-chip" },
+ { 1, "vme", "Virtual Mode Enhancements" },
+ { 2, "de", "Debugging Extension" },
+ { 3, "pse", "Page Size Extension" },
+ { 4, "tsc", "Time Stamp Counter" },
+ { 5, "msr", "Pentium Processor MSR" },
+ { 6, "pae", "Physical Address Extension" },
+ { 7, "mce", "Machine Check Exception" },
+ { 8, "cx8", "CMPXCHG8B Instruction Supported" },
+ { 9, "apic", "On-chip CPIC Hardware Enabled" },
+ { 11, "sep", "SYSENTER and SYSEXIT" },
+ { 12, "mtrr", "Memory Type Range Registers" },
+ { 13, "pge", "PTE Global Bit" },
+ { 14, "mca", "Machine Check Architecture" },
+ { 15, "cmov", "Conditional Move/Compare Instruction" },
+ { 16, "pat", "Page Attribute Table" },
+ { 17, "pse", "Page Size Extension" },
+ { 18, "psn", "Processor Serial Number" },
+ { 19, "cflsh", "CFLUSH instruction" },
+ { 21, "ds", "Debug Store" },
+ { 22, "acpi", "Thermal Monitor and Clock Ctrl" },
+ { 23, "mmx", "MMX Technology" },
+ { 24, "fxsr", "FXSAVE/FXRSTOR" },
+ { 25, "sse", "SSE Extensions" },
+ { 26, "sse2", "SSE2 Extensions" },
+ { 27, "ss", "Self Snoop" },
+ { 29, "tm", "Therm. Monitor" },
+ { -1 }
+ };
+ static struct {
+ int bit;
+ char *desc;;
+ char *description;
+ } cap_amd[] = {
+ { 22, "mmxext","MMX Technology (AMD Extensions)" },
+ { 30, "3dnowext","3Dnow! Extensions" },
+ { 31, "3dnow", "3Dnow!" },
+ { -1 }
+ };
+ int i;
+
+ regs = cpuid(1);
+ printf("cpu family\t: %d\n"
+ "model\t\t: %d\n"
+ "stepping\t: %d\n" ,
+ (regs.eax >> 8) & 0xf,
+ (regs.eax >> 4) & 0xf,
+ regs.eax & 0xf);
+
+ printf("flags\t\t:");
+ for (i = 0; cap[i].bit >= 0; i++) {
+ if (regs.edx & (1 << cap[i].bit)) {
+ printf(" %s", cap[i].desc);
+ }
+ }
+ for (i = 0; cap_amd[i].bit >= 0; i++) {
+ if (amd_flags & (1 << cap_amd[i].bit)) {
+ printf(" %s", cap_amd[i].desc);
+ }
+ }
+ printf("\n");
+
+ if (regs.edx & (1 << 4)) {
+ int64_t tsc_start, tsc_end;
+ struct timeval tv_start, tv_end;
+ int usec_delay;
+
+ tsc_start = rdtsc();
+ gettimeofday(&tv_start, NULL);
+#ifdef MISSING_USLEEP
+ sleep(1);
+#else
+ usleep(100000);
+#endif
+ tsc_end = rdtsc();
+ gettimeofday(&tv_end, NULL);
+
+ usec_delay = 1000000 * (tv_end.tv_sec - tv_start.tv_sec)
+ + (tv_end.tv_usec - tv_start.tv_usec);
+
+ printf("cpu MHz\t\t: %.3f\n",
+ (double)(tsc_end-tsc_start) / usec_delay);
+ }
+ }
+
+ printf("model name\t: %s\n", model_name);
+
+ exit(0);
+}
diff --git a/aviheader.c b/aviheader.c
index ab232d4166..702967b048 100644
--- a/aviheader.c
+++ b/aviheader.c
@@ -111,10 +111,15 @@ while(1){
}
} else
if(last_fccType==streamtypeAUDIO){
- sh_audio->wf=calloc((chunksize<sizeof(WAVEFORMATEX))?sizeof(WAVEFORMATEX):chunksize,1);
+ int wf_size = chunksize<sizeof(WAVEFORMATEX)?sizeof(WAVEFORMATEX):chunksize;
+ sh_audio->wf=calloc(wf_size,1);
// sh_audio->wf=malloc(chunksize); memset(sh_audio->wf,0,chunksize);
if(verbose>=1) printf("found 'wf', %d bytes of %d\n",chunksize,sizeof(WAVEFORMATEX));
stream_read(demuxer->stream,(char*) sh_audio->wf,chunksize);
+ if (sh_audio->wf->cbSize != 0 &&
+ wf_size < sizeof(WAVEFORMATEX)+sh_audio->wf->cbSize) {
+ sh_audio->wf=realloc(sh_audio->wf, sizeof(WAVEFORMATEX)+sh_audio->wf->cbSize);
+ }
chunksize=0;
if(verbose>=1) print_wave_header(sh_audio->wf);
// if(demuxer->audio->id==-1) demuxer->audio->id=stream_id;
diff --git a/cfg-mplayer.h b/cfg-mplayer.h
index 8ca7978b1c..05c3a9f130 100644
--- a/cfg-mplayer.h
+++ b/cfg-mplayer.h
@@ -40,10 +40,10 @@ struct config conf[]={
{"ao", &audio_driver, CONF_TYPE_STRING, 0, 0, 0},
{"dsp", &dsp, CONF_TYPE_STRING, 0, 0, 0},
{"mixer", &mixer_device, CONF_TYPE_STRING, 0, 0, 0},
+ {"master", &mixer_usemaster, CONF_TYPE_FLAG, 0, 0, 1},
#ifdef HAVE_X11
{"display", &mDisplayName, CONF_TYPE_STRING, 0, 0, 0},
#endif
- {"master", &mixer_usemaster, CONF_TYPE_FLAG, 0, 0, 1},
{"osdlevel", &osd_level, CONF_TYPE_INT, CONF_RANGE, 0, 2 },
#ifdef HAVE_LIBCSS
{"dvdauth", &dvd_auth_device, CONF_TYPE_STRING, 0, 0, 0},
diff --git a/configure b/configure
index eab2c74a10..3ca87e98a6 100755
--- a/configure
+++ b/configure
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#
# MPlayer configurator. (C) 2000 Pontscho/fresh!mindworkz
@@ -82,6 +82,13 @@
# --
+# Check how echo works in this /bin/sh
+case `echo -n` in
+-n) _echo_n= _echo_c='\c';;
+*) _echo_n=-n _echo_c=;;
+esac
+
+
# LGB: Help moved here.
if [ "$1" = "--help" -o "$1" = "-help" -o "$1" = "-h" ]; then
@@ -117,8 +124,10 @@ params:
--enable-xmmp use XMMP audio drivers
--enable-lirc enable LIRC (remote control) support
- --disable-alsa disable alsa support [autodetect]
+ --disable-oss disable OSS sound support [autodetect]
+ --disable-alsa disable alsa sound support [autodetect]
--disable-esd disable esd sound support [autodetect]
+ --disable-sun disable Sun sound support [autodetect]
--disable-gcc-checking disable gcc version checking
@@ -179,6 +188,7 @@ MCONF='config.mak'
# --- Check for C compiler:
_cc=gcc
+_as=as
_x11=auto
_x11libdir=
@@ -200,6 +210,9 @@ do
--cc=*)
_cc=`echo $ac_option | cut -d '=' -f 2`
;;
+ --as=*)
+ _as=`echo $ac_option | cut -d '=' -f 2`
+ ;;
--disable-gcc-checking)
_skip_cc_check=yes
;;
@@ -221,13 +234,15 @@ do
esac
done
+# ---
+
# Checking CC version...
# Q: what's with egcs, pgcc? - Atmos
# A: same as with agcc! These compilers always were introduced as experimental
# ones. Now gcc-3.0 should introduce all features of these compilers.
# Since 3.0 is almost released we don't need to support them. - Nick 05 jun 2001
if test "$_skip_cc_check" != "yes"; then
-echo -n "Checking version of $_cc ... "
+echo $_echo_n "Checking version of $_cc ... $_echo_c"
cc_version=`$_cc -v 2>&1 | sed -n 's/^.*version \([aegcygnustp-]*[0-9.]*\).*$/\1/p'`
case $cc_version in
'') cc_version="v. ?.??, bad"; cc_verc_fail=yes;;
@@ -236,7 +251,7 @@ case $cc_version in
*) cc_version="$cc_version, bad"; cc_verc_fail=yes;;
esac
echo "$cc_version"
-if ! test -z "$cc_verc_fail"; then
+if [ ! -z "$cc_verc_fail" ] ; then
echo "Please downgrade(upgrade) gcc compiler to gcc-2.95.2+ or gcc-3.0+ version"
exit
fi
@@ -245,15 +260,26 @@ echo "YOU'VE SELECTED '--disable-gcc-checking'. PLEASE DON'T SEND US ANY BUGREPO
fi
# ---
-pname=`cat /proc/cpuinfo | grep 'model name' | cut -d ':' -f 2`
-pparam=`cat /proc/cpuinfo | grep 'features' | cut -d ':' -f 2`
+
+if [ -r /proc/cpuinfo ]; then
+ # linux with /proc mounted, extract cpu information from it
+ _cpuinfo="cat /proc/cpuinfo"
+else
+ # all other OS try to extract cpu information from a small helper
+ # program TOOLS/cpuinfo instead
+ $_cc -o TOOLS/cpuinfo TOOLS/cpuinfo.c
+ _cpuinfo="TOOLS/cpuinfo"
+fi
+
+pname=`$_cpuinfo | grep 'model name' | cut -d ':' -f 2`
+pparam=`$_cpuinfo | grep 'features' | cut -d ':' -f 2`
if [ -z "$pparam" ]; then
- pparam=`cat /proc/cpuinfo | grep 'flags' | cut -d ':' -f 2`
+ pparam=`$_cpuinfo | grep 'flags' | cut -d ':' -f 2`
fi
-pvendor=`cat /proc/cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2`
-pfamily=`cat /proc/cpuinfo | grep 'cpu family' | cut -d ':' -f 2 | cut -d ' ' -f 2`
-pmodel=`cat /proc/cpuinfo |grep -v 'model name'| grep "model" | cut -d ':' -f 2 | cut -d ' ' -f 2`
-pstepping=`cat /proc/cpuinfo | grep 'stepping' | cut -d ':' -f 2 | cut -d ' ' -f 2`
+pvendor=`$_cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2`
+pfamily=`$_cpuinfo | grep 'cpu family' | cut -d ':' -f 2 | cut -d ' ' -f 2`
+pmodel=`$_cpuinfo | grep -v 'model name' | grep 'model' | cut -d ':' -f 2 | cut -d ' ' -f 2`
+pstepping=`$_cpuinfo | grep 'stepping' | cut -d ':' -f 2 | cut -d ' ' -f 2`
_mmx=no
_mmx2=no
@@ -276,7 +302,8 @@ _xmga=no
_dga=no
_dga2=no
_svga=no
-_fbdev=yes
+_fbdev=no
+[ x`uname -s` = xLinux ] && _fbdev=yes
_lirc=no
_css=no
_dshow=yes
@@ -287,6 +314,7 @@ _y=1
_gllib=
_sdllib=
+_sdlcflags=
_xvlib=
_x11lib=
@@ -448,39 +476,39 @@ EOF
#echo -n "Checking your GCC CPU optimalization abilities: "
if [ "$proc" = "k7" ]; then
# echo -n "trying k7 "
- $_cc $TMPC -o $TMPO -march=$proc -mcpu=$proc &> /dev/null || proc=athlon
+ $_cc $TMPC -o $TMPO -march=$proc -mcpu=$proc > /dev/null 2>&1 || proc=athlon
fi
if [ "$proc" = "athlon" ]; then
# echo -n "trying athlon "
- $_cc $TMPC -o $TMPO -march=$proc -mcpu=$proc &> /dev/null || proc=k6
+ $_cc $TMPC -o $TMPO -march=$proc -mcpu=$proc > /dev/null 2>&1 || proc=k6
fi
if [ "$proc" = "k6" ]; then
# echo -n "trying k6 "
- $_cc $TMPC -o $TMPO -march=$proc -mcpu=$proc &> /dev/null || proc=k5
+ $_cc $TMPC -o $TMPO -march=$proc -mcpu=$proc > /dev/null 2>&1 || proc=k5
fi
if [ "$proc" = "k5" ]; then
# echo -n "trying k5 "
- $_cc $TMPC -o $TMPO -march=$proc -mcpu=$proc &> /dev/null || proc=pentium
+ $_cc $TMPC -o $TMPO -march=$proc -mcpu=$proc > /dev/null 2>&1 || proc=pentium
fi
if [ "$proc" = "i686" ]; then
# echo -n "trying i686 "
- $_cc $TMPC -o $TMPO -march=$proc -mcpu=$proc &> /dev/null || proc=pentiumpro
+ $_cc $TMPC -o $TMPO -march=$proc -mcpu=$proc > /dev/null 2>&1 || proc=pentiumpro
fi
if [ "$proc" = "pentiumpro" ]; then
# echo -n "trying pentiumpro "
- $_cc $TMPC -o $TMPO -march=$proc -mcpu=$proc &> /dev/null || proc=pentium
+ $_cc $TMPC -o $TMPO -march=$proc -mcpu=$proc > /dev/null 2>&1 || proc=pentium
fi
if [ "$proc" = "pentium" ]; then
# echo -n "trying pentium "
- $_cc $TMPC -o $TMPO -march=$proc -mcpu=$proc &> /dev/null || proc=i486
+ $_cc $TMPC -o $TMPO -march=$proc -mcpu=$proc > /dev/null 2>&1 || proc=i486
fi
if [ "$proc" = "i486" ]; then
# echo -n "trying i486 "
- $_cc $TMPC -o $TMPO -march=$proc -mcpu=$proc &> /dev/null || proc=i386
+ $_cc $TMPC -o $TMPO -march=$proc -mcpu=$proc > /dev/null 2>&1 || proc=i386
fi
if [ "$proc" = "i386" ]; then
# echo -n "trying i386 "
- $_cc $TMPC -o $TMPO -march=$proc -mcpu=$proc &> /dev/null || proc=error
+ $_cc $TMPC -o $TMPO -march=$proc -mcpu=$proc > /dev/null 2>&1 || proc=error
fi
if [ "$proc" = "error" ]; then
echo
@@ -491,16 +519,17 @@ fi
#echo "DONE (${proc})."
-$_cc $TMPC -o $TMPO -lvgagl -lvga &> /dev/null && _svga=yes
+$_cc $TMPC -o $TMPO -lvgagl -lvga > /dev/null 2>&1 && _svga=yes
-$_cc $TMPC -o $TMPO -lpthread &> /dev/null || \
+$_cc $TMPC -o $TMPO -lpthread > /dev/null 2>&1 || \
{ echo "Lib pthread not found."; rm -f $TMPC $TMPO $TMPS ; exit 1; }
# Atmosfear: added SDL versioncheck and autodetect; removed warnings.
_sdl=no
-if $_cc $TMPC -o $TMPO `$_sdlconfig --libs` &> /dev/null ; then
- if test `$_sdlconfig --version | sed s/[^0-9]//g` -gt 116 ; then
- if test `$_sdlconfig --version | sed s/[^0-9]//g` -lt 121 ; then
+if $_cc `$_sdlconfig --cflags` $TMPC -o $TMPO `$_sdlconfig --libs` > /dev/null 2>&1 ; then
+ _sdlversion=`$_sdlconfig --version | sed 's/[^0-9]//g'`
+ if test "$_sdlversion" -gt 116 ; then
+ if test "$_sdlversion" -lt 121 ; then
_sdlbuggy='#define BUGGY_SDL'
else
@@ -514,16 +543,16 @@ fi
# Atmosfear: added libcss autodetect
_css=no
-if test -e "/usr/local/lib/libcss.so" ; then
+if test -s "/usr/local/lib/libcss.so" ; then
_csslibdir="/usr/local/lib/"
- if test -e "/usr/local/include/css.h" ; then
+ if test -s "/usr/local/include/css.h" ; then
_cssincdir="/usr/local/include"
_css=yes
fi
else
- if test -e "/usr/lib/libcss.so" ; then
+ if test -s "/usr/lib/libcss.so" ; then
_csslibdir="/usr/lib/"
- if test -e "/usr/include/css.h" ; then
+ if test -s "/usr/include/css.h" ; then
_cssincdir="/usr/include/"
_css=yes
fi
@@ -531,16 +560,17 @@ else
fi
_termcap=no
-$_cc $TMPC -o $TMPO -ltermcap &> /dev/null && _termcap=yes
+$_cc $TMPC -o $TMPO -ltermcap > /dev/null 2>&1 && _termcap=yes
_png=no
-$_cc $TMPC -o $TMPO -lpng -lz -lm &> /dev/null && _png=yes
+$_cc $TMPC -o $TMPO -lpng -lz -lm > /dev/null 2>&1 && _png=yes
_binutils=no
-as libac3/downmix/downmix_i386.S -o $TMPO &> /dev/null && _binutils=yes
+$_as libac3/downmix/downmix_i386.S -o $TMPO > /dev/null 2>&1 && _binutils=yes
# echo binutils: $_binutils
+
# ----------- Check X11 and related libs (GL, Xxf86vm, Xv, DGA) --------------
# for Solaris:
@@ -549,22 +579,22 @@ $_cc $TMPC -o $TMPO -lsocket >/dev/null 2>&1 && _socklib=-lsocket
if [ $_x11 = auto ]; then
_x11=no
- $_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext $_socklib &> /dev/null && _x11=yes
+ $_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext $_socklib > /dev/null 2>&1 && _x11=yes
fi
if [ $_x11 = yes ]; then
-$_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext -lXdpms $_socklib &> /dev/null && _xdpms=yes
-$_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext -lXv $_socklib &> /dev/null && _xv=yes
-$_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext -lXxf86vm $_socklib &> /dev/null && _vm=yes
+$_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
-$_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext -lGL $_socklib &> /dev/null && _gl=yes
+$_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext -lGL $_socklib > /dev/null 2>&1 && _gl=yes
cat > $TMPC << EOF
#include <GL/gl.h>
int main( void ) { return 0; }
EOF
-$_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext -lGL $_socklib &> /dev/null || \
+$_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext -lGL $_socklib > /dev/null 2>&1 || \
{ _gl=no; echo "GL includes not found!";}
cat > $TMPC << EOF
@@ -574,7 +604,7 @@ cat > $TMPC << EOF
int main (void) { return 0;}
EOF
-$_cc $TMPC -o $TMPO -L/usr/X11R6/lib -L/usr/X11/lib -lX11 -lXext -lXxf86dga -lXxf86vm $_socklib &> /dev/null && _dga=yes
+$_cc $TMPC -o $TMPO -L/usr/X11R6/lib -L/usr/X11/lib -lX11 -lXext -lXxf86dga -lXxf86vm $_socklib > /dev/null 2>&1 && _dga=yes
# Note: the -lXxf86vm library is the VideoMode extension and though it's
# not needed for DGA, AFAIK every distribution packages together with DGA
# stuffs named 'X extensions' or something similar. This check can be usefull
@@ -590,12 +620,22 @@ int main (void) { XDGAMode mode; XDGADevice device; return 0;}
EOF
_dga2=no
-$_cc $TMPC -o $TMPO -L/usr/X11R6/lib -L/usr/X11/lib -lX11 -lXext -lXxf86dga -lXxf86vm $_socklib &> /dev/null && _dga2=yes
+$_cc $TMPC -o $TMPO -L/usr/X11R6/lib -L/usr/X11/lib -lX11 -lXext -lXxf86dga -lXxf86vm $_socklib > /dev/null 2>&1 && _dga2=yes
fi
rm -f $TMPC $TMPO
+
+# ---
+# try to detect type of audio supported on this machine
+
+_oss_audio=no
+[ -c /dev/dsp ] && _oss_audio=yes
+
+_sun_audio=no
+[ -c /dev/audio -a -c /dev/audioctl ] && _sun_audio=yes
+
# ---
cat > $TMPC << EOF
@@ -606,9 +646,9 @@ EOF
_alsaver='not found'
$_cc -o $TMPO -lasound $TMPC 2> /dev/null || _alsa=no
-[ $_alsa == 'yes' ] && $TMPO && { _alsaver='0.5.x'; }
+[ $_alsa = 'yes' ] && $TMPO && { _alsaver='0.5.x'; }
-if [ "$_alsaver" == 'not found' ]; then
+if [ "$_alsaver" = 'not found' ]; then
cat > $TMPC << EOF
#include <sys/asoundlib.h>
#include <sys/soundcard.h>
@@ -617,7 +657,7 @@ EOF
_alsaver='not found'
$_cc -o $TMPO -lasound $TMPC 2> /dev/null || _alsa=no
-[ $_alsa == 'yes' ] && $TMPO && { _alsaver='0.9.x'; }
+[ $_alsa = 'yes' ] && $TMPO && { _alsaver='0.9.x'; }
fi
# ---
@@ -645,7 +685,7 @@ do
_debug='-g'
;;
--enable-debug=*)
- _debug=`echo -n '-g'; echo $ac_option | cut -d '=' -f 2`
+ _debug=`echo '-g'; echo $ac_option | cut -d '=' -f 2`
;;
--enable-css)
_css=yes
@@ -717,6 +757,12 @@ do
--enable-xmmp)
_xmmp=yes
;;
+ --enable-ossaudio)
+ _oss_audio=yes
+ ;;
+ --enable-sunaudio)
+ _sun_audio=yes
+ ;;
--enable-lirc)
_lirc=yes
;;
@@ -807,6 +853,12 @@ do
--disable-esd)
_esd=no
;;
+ --disable-ossaudio)
+ _oss_audio=no
+ ;;
+ --disable-sunaudio)
+ _sun_audio=no
+ ;;
--with-win32libdir=*)
_win32libdir=`echo $ac_option | cut -d '=' -f 2`
_win32libdirnotify=no
@@ -832,21 +884,27 @@ do
;;
--cc=*)
;;
+ --as=*)
+ ;;
esac
done
-# Checking assembler (as) compatibility...
-as_version=`as --version 2>&1 | sed -n 's/^.*assembler \([0-9.]*\).*$/\1/p'`
-echo -n "Checking assembler (as) ... $as_version, "
+# 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"
_pref_as_version='2.9.1'
### this test disabled, see _binutils test above! --A'rpi
# cat > astest.S <<EOF
# filds -2(%ebp)
# EOF
-# as astest.S -o astest.o &> /dev/null || as_verc_fail=yes
+# $_as astest.S -o astest.o > /dev/null 2>&1 || as_verc_fail=yes
-if [ $_mmx = 'yes' ]; then
cat > $TMPS <<EOF
+nop
+EOF
+
+if [ $_mmx = 'yes' ]; then
+cat >> $TMPS <<EOF
emms
EOF
fi
@@ -885,7 +943,7 @@ fi
#xorpd %xmm0, %xmm0
#EOF
#fi
-as $TMPS -o $TMPO &> /dev/null || as_verc_fail=yes
+$_as $TMPS -o $TMPO > /dev/null 2>&1 || as_verc_fail=yes
rm -f $TMPS $TMPO $TMPC
if test "$as_verc_fail" != "yes"; then
@@ -900,7 +958,7 @@ fi
_k_verc_problem=no
system_name=`uname -s 2>&1`
kernel_version=`uname -r 2>&1`
-echo -n "Checking $system_name kernel version ... "
+echo $_echo_n "Checking $system_name kernel version ... $_echo_c"
case $kernel_version in
'') kernel_version="?.??"; _k_verc_fail=yes;;
[0-1].[0-99].[0-99]|2.[0-3].[0-99])
@@ -909,7 +967,7 @@ esac
if [ $_k_verc_problem = 'yes' ] && [ $_sse = 'yes' ]; then
_k_verc_fail=yes
fi
-if ! test -z "$_k_verc_fail"; then
+if [ ! -z "$_k_verc_fail" ]; then
echo "$kernel_version, fail"
echo "WARNING! You want to run mplayer on this system then be prepared for problems"
else
@@ -946,12 +1004,14 @@ echo "Checking for DGA 2.0 .. $_dga2"
echo "Checking for Xf86VM ... $_vm"
echo "Checking for SVGAlib ... $_svga"
echo "Checking for FBDev ... $_fbdev"
+echo "Checking for OSS Audio ... $_oss_audio"
+echo "Checking for ALSA Audio ... $_alsaver"
+echo "Checking for ESD Audio ... $_esd"
+echo "Checking for Sun Audio ... $_sun_audio"
echo "Checking for DeCSS support ... $_css"
echo "Checking for PNG support ... $_png"
echo "Checking for DirectShow ... $_dshow"
echo "Checking for fastmemcpy ... $_fastmemcpy"
-echo "Checking for alsa ... $_alsaver"
-echo "Checking for esd ... $_esd"
# write conf files.
if [ $_gl = yes ]; then
@@ -1006,6 +1066,7 @@ fi
if [ $_sdl = yes ]; then
_sdllib=`$_sdlconfig --libs`
+ _sdlcflags=`$_sdlconfig --cflags`
fi
if [ $_dga = yes ]; then
@@ -1051,18 +1112,32 @@ _aosrc=''
_alsa5='#undef HAVE_ALSA5'
_alsa9='#undef HAVE_ALSA9'
-if [ $_alsa == 'yes' ]; then
- [ $_alsaver == '0.5.x' ] && { _aosrc="$_aosrc ao_alsa5.c"; _alsa5='#define HAVE_ALSA5'; _alsalib='-lasound'; }
- # [ $_alsaver == '0.9.x' ] && { _aosrc="$_aosrc ao_alsa9.c"; _alsa9='#define HAVE_ALSA9'; _alsalib='-lasound'; }
+if [ $_alsa = 'yes' ]; then
+ [ $_alsaver = '0.5.x' ] && { _aosrc="$_aosrc ao_alsa5.c"; _alsa5='#define HAVE_ALSA5'; _alsalib='-lasound'; }
+ # [ $_alsaver = '0.9.x' ] && { _aosrc="$_aosrc ao_alsa9.c"; _alsa9='#define HAVE_ALSA9'; _alsalib='-lasound'; }
fi
_esdd='#undef HAVE_ESD'
-#if [ $_esd == 'yes' ]; then
+#if [ $_esd = 'yes' ]; then
# _esdd='#define HAVE_ESD'
# _aosrc="$_aosrc ao_esd.c"
# _esdlib='-lesd'
#fi
+if [ "$_oss_audio" = "yes" ]; then
+ _ossaudio='#define USE_OSS_AUDIO'
+ _aosrc="$_aosrc ao_oss.c"
+else
+ _ossaudio='#undef USE_OSS_AUDIO'
+fi
+
+if [ "$_sun_audio" = "yes" ]; then
+ _sunaudio='#define USE_SUN_AUDIO'
+ _aosrc="$_aosrc ao_sun.c"
+else
+ _sunaudio='#undef USE_SUN_AUDIO'
+fi
+
# Checking for CFLAGS
if [ "$_profile" != "" ] || [ "$_debug" != "" ]; then
CFLAGS="-O2 -march=$proc -mcpu=$proc $_debug $_profile"
@@ -1089,6 +1164,8 @@ XMM_LIBS = $_xmmplibs
LIRC_LIBS = $_lirclibs
CSS_LIB = $_csslib
CSS_INC = $_cssinc
+SDL_LIB = $_sdllib
+SDL_INC = $_sdlcflags
WIN32_PATH=-DWIN32_PATH=\"$_win32libdir\"
DS_DEP = $_dshowdep
DS_LIB = $_dshowlib
@@ -1288,6 +1365,10 @@ $_select
You can still change it runtime using -afm 1 (mpg123) or -afm 4 (l3codeca)*/
$_mpg123
+/* AUDIO Support */
+$_ossaudio
+$_sunaudio
+
/* XMMP support: (test code) */
$_xmmpaudio
#define LIBDIR "/usr/local/lib"
diff --git a/dec_audio.c b/dec_audio.c
index d13b68fb30..0d6baa6480 100644
--- a/dec_audio.c
+++ b/dec_audio.c
@@ -2,19 +2,21 @@
#include <stdio.h>
#include <stdlib.h>
-#ifdef __sun
+#include "config.h"
+
+#ifdef USE_OSS_AUDIO
+#include <sys/soundcard.h>
+#endif
+#ifdef USE_SUN_AUDIO
+#include <sys/types.h>
#include <sys/audioio.h>
#define AFMT_MU_LAW AUDIO_ENCODING_ULAW
#define AFMT_A_LAW AUDIO_ENCODING_ALAW
#define AFMT_S16_LE AUDIO_ENCODING_LINEAR
#define AFMT_IMA_ADPCM AUDIO_ENCODING_DVI
#define AFMT_U8 AUDIO_ENCODING_LINEAR8
-#else
-#include <sys/soundcard.h>
#endif
-#include "config.h"
-
extern int verbose; // defined in mplayer.c
#ifdef USE_FAKE_MONO
@@ -40,6 +42,7 @@ int fakemono=0;
#include "loader/DirectShow/DS_AudioDec.h"
+
static sh_audio_t* ac3_audio_sh=NULL;
// AC3 decoder buffer callback:
@@ -169,8 +172,10 @@ case 2: {
switch(sh_audio->format){ // hardware formats:
case 0x6: sh_audio->sample_format=AFMT_A_LAW;break;
case 0x7: sh_audio->sample_format=AFMT_MU_LAW;break;
+#if !defined(__NetBSD__)
case 0x11: sh_audio->sample_format=AFMT_IMA_ADPCM;break;
-#ifndef __sun
+#endif
+#if !defined(__sun) && !defined(__NetBSD__)
case 0x50: sh_audio->sample_format=AFMT_MPEG;break;
#endif
// case 0x2000: sh_audio->sample_format=AFMT_AC3;
diff --git a/libao2/Makefile b/libao2/Makefile
index 267078ff63..433962639b 100644
--- a/libao2/Makefile
+++ b/libao2/Makefile
@@ -4,10 +4,10 @@ include config.mak
LIBNAME = libao2.a
# TODO: moveout ao_sdl.c so it's only used when SDL is detected
-SRCS=audio_out.c ao_oss.c ao_null.c $(OPTIONAL_SRCS)
+SRCS=audio_out.c ao_null.c $(OPTIONAL_SRCS)
OBJS=$(SRCS:.c=.o)
-CFLAGS = $(OPTFLAGS) -I. -I..
+CFLAGS = $(OPTFLAGS) -I. -I.. $(SDL_INC)
# -I/usr/X11R6/include/
.SUFFIXES: .c .o
diff --git a/libao2/ao_alsa5.c b/libao2/ao_alsa5.c
index 2039dacd26..f058d2c829 100644
--- a/libao2/ao_alsa5.c
+++ b/libao2/ao_alsa5.c
@@ -265,6 +265,18 @@ static void reset()
}
}
+/* stop playing, keep buffers (for pause) */
+static void audio_pause()
+{
+ /* for now, just call reset(); */
+ reset();
+}
+
+/* resume playing, after audio_pause() */
+static void audio_resume()
+{
+}
+
/*
plays 'len' bytes of 'data'
returns: number of bytes played
diff --git a/libao2/ao_null.c b/libao2/ao_null.c
index 4ec360fea6..53f59236be 100644
--- a/libao2/ao_null.c
+++ b/libao2/ao_null.c
@@ -46,6 +46,18 @@ static void reset(){
}
+// stop playing, keep buffers (for pause)
+static void audio_pause()
+{
+ // for now, just call reset();
+ reset();
+}
+
+// resume playing, after audio_pause()
+static void audio_resume()
+{
+}
+
// return: how many bytes can be played without blocking
static int get_space(){
diff --git a/libao2/ao_oss.c b/libao2/ao_oss.c
index c04626c2fd..de50dc77f3 100644
--- a/