diff options
author | arpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-06-05 18:40:44 +0000 |
---|---|---|
committer | arpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-06-05 18:40:44 +0000 |
commit | 5c50d3e7dd839be03468e5058ce7d5eb60dfe1d8 (patch) | |
tree | 5c630dd1bec808dfe785e27b47615982d84040ad | |
parent | 49ea21d07367275022349403cb4a60f8316e5634 (diff) |
applied solaris8/netbsd/other fixes patch by Jürgen Keil <jk@tools.de>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1039 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | DOCS/SOLARIS | 5 | ||||
-rw-r--r-- | TOOLS/cpuinfo.c | 195 | ||||
-rw-r--r-- | aviheader.c | 7 | ||||
-rw-r--r-- | cfg-mplayer.h | 2 | ||||
-rwxr-xr-x | configure | 199 | ||||
-rw-r--r-- | dec_audio.c | 17 | ||||
-rw-r--r-- | libao2/Makefile | 4 | ||||
-rw-r--r-- | libao2/ao_alsa5.c | 12 | ||||
-rw-r--r-- | libao2/ao_null.c | 12 | ||||
-rw-r--r-- | libao2/ao_oss.c | 79 | ||||
-rw-r--r-- | libao2/ao_sdl.c | 32 | ||||
-rw-r--r-- | libao2/audio_out.c | 33 | ||||
-rw-r--r-- | libao2/audio_out.h | 8 | ||||
-rw-r--r-- | libao2/audio_out_internal.h | 6 | ||||
-rw-r--r-- | libvo/Makefile | 2 | ||||
-rw-r--r-- | libvo/vo_sdl.c | 19 | ||||
-rw-r--r-- | libvo/x11_common.c | 2 | ||||
-rw-r--r-- | linux/getch2.c | 24 | ||||
-rw-r--r-- | loader/stubs.s | 16 | ||||
-rw-r--r-- | loader/win32.c | 27 | ||||
-rw-r--r-- | mixer.c | 96 | ||||
-rw-r--r-- | mixer.h | 8 | ||||
-rw-r--r-- | mplayer.c | 93 | ||||
-rw-r--r-- | stream.c | 15 | ||||
-rw-r--r-- | vcd_read.h | 187 | ||||
-rw-r--r-- | vcd_read_fbsd.h | 3 | ||||
-rwxr-xr-x | version.sh | 8 |
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}, @@ -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/libao2/ao_oss.c +++ b/libao2/ao_oss.c @@ -7,11 +7,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#ifdef __sun -#include <sys/audioio.h> -#else #include <sys/soundcard.h> -#endif #include "../config.h" @@ -36,13 +32,8 @@ LIBAO_EXTERN(oss) // ao_outburst // ao_buffersize -#ifdef __sun -static char *dsp="/dev/audio"; -static int queued_bursts = 0; -#else static char *dsp="/dev/dsp"; static audio_buf_info zz; -#endif static int audio_fd=-1; // to set/get/query special features/parameters @@ -69,22 +60,6 @@ static int init(int rate,int channels,int format,int flags){ return 0; } -#ifdef __sun - { - audio_info_t info; - ioctl(audio_fd, AUDIO_GETINFO, &info); - ioctl(audio_fd, AUDIO_DRAIN, 0); - info.play.encoding = ao_format = format; - info.play.precision = (format==AUDIO_ENCODING_LINEAR? AUDIO_PRECISION_16:AUDIO_PRECISION_8); - info.play.channels = ao_channels = channels; - --ao_channels; - info.play.sample_rate = ao_samplerate = rate; - if(ioctl (audio_fd, AUDIO_SETINFO, &info)<0) - printf("audio_setup: your card doesn't support %d Hz samplerate\n",rate); - ao_outburst=8192; - queued_bursts = 0; - } -#else ao_format=format; ioctl (audio_fd, SNDCTL_DSP_SETFMT, &ao_format); printf("audio_setup: sample format: 0x%X (requested: 0x%X)\n",ao_format,format); @@ -112,7 +87,6 @@ static int init(int rate,int channels,int format,int flags){ if(ao_buffersize==-1) ao_buffersize=zz.bytes; ao_outburst=zz.fragsize; } -#endif if(ao_buffersize==-1){ // Measuring buffer size: @@ -135,9 +109,6 @@ static int init(int rate,int channels,int format,int flags){ printf("Recompile mplayer with #undef HAVE_AUDIO_SELECT in config.h !\n\n"); return 0; } -#ifdef __sun - ioctl(audio_fd, AUDIO_DRAIN, 0); -#endif #endif } @@ -161,26 +132,25 @@ static void reset(){ return; } -#ifdef __sun - { - audio_info_t info; - ioctl(audio_fd, AUDIO_GETINFO, &info); - ioctl(audio_fd, AUDIO_DRAIN, 0); - info.play.encoding = ao_format; - info.play.precision = (ao_format==AUDIO_ENCODING_LINEAR? AUDIO_PRECISION_16:AUDIO_PRECISION_8); - info.play.channels = ao_channels+1; - info.play.sample_rate = ao_samplerate; - ioctl (audio_fd, AUDIO_SETINFO, &info); - queued_bursts = 0; - } -#else ioctl (audio_fd, SNDCTL_DSP_SETFMT, &ao_format); ioctl (audio_fd, SNDCTL_DSP_STEREO, &ao_channels); ioctl (audio_fd, SNDCTL_DSP_SPEED, &ao_samplerate); -#endif } +// 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(){ int playsize=ao_outburst; @@ -204,14 +174,6 @@ static int get_space(){ } #endif -#ifdef __sun - { - audio_info_t info; - ioctl(audio_fd, AUDIO_GETINFO, &info); - if(queued_bursts - info.play.eof > 2) - return 0; - } -#endif return ao_outburst; } @@ -221,12 +183,6 @@ static int get_space(){ static int play(void* data,int len,int flags){ len/=ao_outburst; len=write(audio_fd,data,len*ao_outburst); -#ifdef __sun - if(len>0) { - queued_bursts ++; - write(audio_fd,data,0); - } -#endif return len; } @@ -234,14 +190,6 @@ static int audio_delay_method=2; // return: how many unplayed bytes are in the buffer static int get_delay(){ -#ifdef __sun - { - int q; - audio_info_t info; - ioctl(audio_fd, AUDIO_GETINFO, &info); - return (queued_bursts - info.play.eof) * ao_outburst; - } -#else if(audio_delay_method==2){ // int r=0; @@ -256,6 +204,5 @@ static int get_delay(){ audio_delay_method=0; // fallback if not supported } return ao_buffersize; -#endif } diff --git a/libao2/ao_sdl.c b/libao2/ao_sdl.c index bdd11ab4c4..717a63e9da 100644 --- a/libao2/ao_sdl.c +++ b/libao2/ao_sdl.c @@ -11,6 +11,7 @@ */ #include <stdio.h> +#include <stdlib.h> #include "audio_out.h" #include "audio_out_internal.h" @@ -57,6 +58,7 @@ static unsigned int buf_write_pos=0; static int full_buffers=0; static int buffered_bytes=0; + static int write_buffer(unsigned char* data,int len){ int len2=0; int x; @@ -105,6 +107,23 @@ static int read_buffer(unsigned char* data,int len){ #include <SDL/SDL.h> #endif +#if defined(sun) && defined(__svr4__) +/* setenv is missing on solaris */ +static void setenv(const char *name, const char *val, int _xx) +{ + int len = strlen(name) + strlen(val) + 2; + char *env = malloc(len); + + if (env != NULL) { + strcpy(env, name); + strcat(env, "="); + strcat(env, val); + putenv(env); + } +} +#endif + + // to set/get/query special features/parameters static int control(int cmd,int arg){ return -1; @@ -196,6 +215,19 @@ 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(){ return (NUM_BUFS-full_buffers)*BUFFSIZE - buf_write_pos; diff --git a/libao2/audio_out.c b/libao2/audio_out.c index afa239ccd8..3f7ae08656 100644 --- a/libao2/audio_out.c +++ b/libao2/audio_out.c @@ -5,7 +5,30 @@ #include "audio_out.h" +#ifdef USE_OSS_AUDIO #include <sys/soundcard.h> /* AFMT_* */ +#endif + + +#ifndef AFMT_U8 +# define AFMT_MU_LAW 0x00000001 +# define AFMT_A_LAW 0x00000002 +# define AFMT_IMA_ADPCM 0x00000004 +# define AFMT_U8 0x00000008 +# define AFMT_S16_LE 0x00000010 /* Little endian signed +16*/ +# define AFMT_S16_BE 0x00000020 /* Big endian signed 16 +*/ +# define AFMT_S8 0x00000040 +# define AFMT_U16_LE 0x00000080 /* Little endian U16 */ +# define AFMT_U16_BE 0x00000100 /* Big endian U16 */ +# define AFMT_MPEG 0x00000200 /* MPEG (2) audio */ + +/* 32 bit formats (MSB aligned) formats */ +# define AFMT_S32_LE 0x00001000 +# define AFMT_S32_BE 0x00002000 +#endif + // there are some globals: int ao_samplerate=0; @@ -15,7 +38,9 @@ int ao_bps=0; int ao_outburst=OUTBURST; // config.h default int ao_buffersize=-1; +#ifdef USE_OSS_AUDIO extern ao_functions_t audio_out_oss; +#endif //extern ao_functions_t audio_out_ossold; extern ao_functions_t audio_out_null; #ifdef HAVE_ALSA5 @@ -32,10 +57,15 @@ extern ao_functions_t audio_out_null; #ifdef HAVE_SDL extern ao_functions_t audio_out_sdl; #endif +#ifdef USE_SUN_AUDIO +extern ao_functions_t audio_out_sun; +#endif ao_functions_t* audio_out_drivers[] = { +#ifdef USE_OSS_AUDIO &audio_out_oss, +#endif &audio_out_null, #ifdef HAVE_ALSA5 &audio_out_alsa5, @@ -51,6 +81,9 @@ ao_functions_t* audio_out_drivers[] = #ifdef HAVE_SDL &audio_out_sdl, #endif +#ifdef USE_SUN_AUDIO + &audio_out_sun, +#endif NULL }; diff --git a/libao2/audio_out.h b/libao2/audio_out.h index cdd58dc7d4..b730d7cf8f 100644 --- a/libao2/audio_out.h +++ b/libao2/audio_out.h @@ -43,6 +43,14 @@ typedef struct ao_functions_s { */ int (*get_delay)(); + /* + */ + void (*pause)(); + + /* + */ + void (*resume)(); + } ao_functions_t; // NULL terminated array of all drivers diff --git a/libao2/audio_out_internal.h b/libao2/audio_out_internal.h index 5899270af2..5867d91d6c 100644 --- a/libao2/audio_out_internal.h +++ b/libao2/audio_out_internal.h @@ -8,6 +8,8 @@ static void reset(); static int get_space(); static int play(void* data,int len,int flags); static int get_delay(); +static void audio_pause(); +static void audio_resume(); #define LIBAO_EXTERN(x) ao_functions_t audio_out_##x =\ {\ @@ -18,6 +20,8 @@ static int get_delay(); reset,\ get_space,\ play,\ - get_delay\ + get_delay,\ + audio_pause,\ + audio_resume\ }; diff --git a/libvo/Makefile b/libvo/Makefile index 556d918dcd..55861d43ca 100644 --- a/libvo/Makefile +++ b/libvo/Makefile @@ -6,7 +6,7 @@ LIBNAME = libvo.a SRCS=aclib.c osd.c font_load.c rgb15to16mmx.c yuv2rgb_mmx.c yuv2rgb.c video_out.c vo_null.c vo_pgm.c vo_md5.c vo_odivx.c x11_common.c $(OPTIONAL_SRCS) OBJS=$(SRCS:.c=.o) -CFLAGS = $(OPTFLAGS) -I. -I.. -DMPG12PLAY +CFLAGS = $(OPTFLAGS) -I. -I.. -DMPG12PLAY $(SDL_INC) # -I/usr/X11R6/include/ .SUFFIXES: .c .o diff --git a/libvo/vo_sdl.c b/libvo/vo_sdl.c index 27a7a87150..8bbe90db9c 100644 --- a/libvo/vo_sdl.c +++ b/libvo/vo_sdl.c @@ -136,12 +136,31 @@ static vo_info_t vo_info = "" }; + #ifdef __FreeBSD__ #include <SDL11/SDL.h> #else #include <SDL/SDL.h> #endif + +#if defined(sun) && defined(__svr4__) +/* setenv is missing on solaris */ +static void setenv(const char *name, const char *val, int _xx) +{ + int len = strlen(name) + strlen(val) + 2; + char *env = malloc(len); + + if (env != NULL) { + strcpy(env, name); + strcat(env, "="); + strcat(env, val); + putenv(env); + } +} +#endif + + #define FS 0x01 #define VM 0x02 #define ZOOM 0x04 diff --git a/libvo/x11_common.c b/libvo/x11_common.c index b33cf7874f..8e6d77d102 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -176,7 +176,7 @@ int vo_x11_check_events(Display *mydisplay){ XEvent Event; char buf[100]; KeySym keySym; - XComposeStatus stat; + static XComposeStatus stat; // unsigned long vo_KeyTable[512]; #ifdef HAVE_GUI diff --git a/linux/getch2.c b/linux/getch2.c index 871eef1704..c962abf683 100644 --- a/linux/getch2.c +++ b/linux/getch2.c @@ -201,27 +201,33 @@ found: void getch2_enable(){ struct termios tio_new; -#ifdef __FreeBSD__ - ioctl(0,TIOCGETA,&tio_orig); /* tcgetattr(0,&tio_orig); */ +#if defined(__NetBSD__) || defined(__svr4__) + tcgetattr(0,&tio_orig); +#elif defined(__FreeBSD__) + ioctl(0,TIOCGETA,&tio_orig); #else - ioctl(0,TCGETS,&tio_orig); /* tcgetattr(0,&tio_orig); */ + ioctl(0,TCGETS,&tio_orig); #endif tio_new=tio_orig; tio_new.c_lflag &= ~(ICANON|ECHO); /* Clear ICANON and ECHO. */ tio_new.c_cc[VMIN] = 1; tio_new.c_cc[VTIME] = 0; -#ifdef __FreeBSD__ - ioctl(0,TIOCSETA,&tio_new); /* tcsetattr(0,TCSANOW,&tio_new); */ +#if defined(__NetBSD__) || defined(__svr4__) + tcsetattr(0,TCSANOW,&tio_new); +#elif defined(__FreeBSD__) + ioctl(0,TIOCSETA,&tio_new); #else - ioctl(0,TCSETS,&tio_new); /* tcsetattr(0,TCSANOW,&tio_new); */ + ioctl(0,TCSETS,&tio_new); #endif } void getch2_disable(){ -#ifdef __FreeBSD__ - ioctl(0,TIOCSETA,&tio_orig); /* tcsetattr(0,TCSANOW,&tio_orig); */ +#if defined(__NetBSD__) || defined(__svr4__) + tcsetattr(0,TCSANOW,&tio_orig); +#elif defined(__FreeBSD__) + ioctl(0,TIOCSETA,&tio_orig); #else - ioctl(0,TCSETS,&tio_orig); /* tcsetattr(0,TCSANOW,&tio_orig); */ + ioctl(0,TCSETS,&tio_orig); #endif } diff --git a/loader/stubs.s b/loader/stubs.s index dd2d5db931..d2ca312594 100644 --- a/loader/stubs.s +++ b/loader/stubs.s @@ -1,13 +1,7 @@ - .file "stubs.c" - .version "01.01" -gcc2_compiled.: -.section .rodata -.LC0: - .string "Called unk_%s\n" -.data + .data +.LC0: .string "Called unk_%s\n" .align 4 .globl unk_exp1 - .type unk_exp1,@function unk_exp1: pushl %ebp movl %esp,%ebp @@ -26,11 +20,5 @@ unk_exp1: call printf addl $8,%esp xorl %eax,%eax - jmp .L1 - .align 4 -.L1: leave ret -.Lfe1: - .size unk_exp1,.Lfe1-unk_exp1 - .ident "GCC: (GNU) egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)" diff --git a/loader/win32.c b/loader/win32.c index 105f8afc1f..323c99b1ad 100644 --- a/loader/win32.c +++ b/loader/win32.c @@ -702,12 +702,29 @@ void WINAPI expGetSystemInfo(SYSTEM_INFO* si) cachedsi.wProcessorLevel = 5; /* pentium */ cachedsi.wProcessorRevision = 0x0101; -#if defined(__FreeBSD__) || defined(__NetBSD__) - cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM; - cachedsi.wProcessorLevel= 5; - PF[PF_COMPARE_EXCHANGE_DOUBLE] = TRUE; +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__svr4__) do_cpuid(regs); - if (regs[3] & 0x00800000) + switch ((regs[0] >> 8) & 0xf) { // cpu family + case 3: cachedsi.dwProcessorType = PROCESSOR_INTEL_386; + cachedsi.wProcessorLevel= 3; + break; + case 4: cachedsi.dwProcessorType = PROCESSOR_INTEL_486; + cachedsi.wProcessorLevel= 4; + break; + case 5: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM; + cachedsi.wProcessorLevel= 5; + break; + case 6: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM; + cachedsi.wProcessorLevel= 5; + break; + default:cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM; + cachedsi.wProcessorLevel= 5; + break; + } + cachedsi.wProcessorRevision = regs[0] & 0xf; // stepping + if (regs[3] & (1 << 8)) + PF[PF_COMPARE_EXCHANGE_DOUBLE] = TRUE; + if (regs[3] & (1 << 23)) PF[PF_MMX_INSTRUCTIONS_AVAILABLE] = TRUE; cachedsi.dwNumberOfProcessors=1; #else @@ -1,36 +1,34 @@ #include <string.h> #include <sys/ioctl.h> -#ifdef __sun -#include <sys/audioio.h> -#else -#include <sys/soundcard.h> -#endif #include <fcntl.h> #include <stdio.h> #include <unistd.h> -#include "mixer.h" +#include "config.h" -#ifdef __sun -char * mixer_device="/dev/audioctl"; -#else -char * mixer_device="/dev/mixer"; +#ifdef USE_OSS_AUDIO +#include <sys/soundcard.h> #endif + +#ifdef USE_SUN_AUDIO +#include <sys/audioio.h> +#endif + +#include "mixer.h" + +#if defined(USE_OSS_AUDIO) + +char * mixer_device=DEV_MIXER; int mixer_usemaster=0; -void mixer_getvolume( int *l,int *r ) +void mixer_getvolume( float *l,float *r ) { int fd,v,cmd,devs; fd=open( mixer_device,O_RDONLY ); if ( fd != -1 ) { -#ifdef __sun - audio_info_t info; - ioctl( fd,AUDIO_GETINFO,&info ); - *r=*l=(info.play.gain * 100 + (AUDIO_MAX_GAIN-1))/AUDIO_MAX_GAIN; -#else ioctl( fd,SOUND_MIXER_READ_DEVMASK,&devs ); if ( ( devs & SOUND_MASK_PCM ) && ( mixer_usemaster==0 ) ) cmd=SOUND_MIXER_READ_PCM; else @@ -43,24 +41,17 @@ void mixer_getvolume( int *l,int *r ) ioctl( fd,cmd,&v ); *r=( v & 0xFF00 ) >> 8; *l=( v & 0x00FF ); -#endif close( fd ); } } -void mixer_setvolume( int l,int r ) +void mixer_setvolume( float l,float r ) { int fd,v,cmd,devs; fd=open( mixer_device,O_RDONLY ); if ( fd != -1 ) { -#ifdef __sun - audio_info_t info; - ioctl( fd,AUDIO_GETINFO,&info ); - info.play.gain = ((l+r)*AUDIO_MAX_GAIN+199)/200; - ioctl( fd,AUDIO_SETINFO,&info ); -#else ioctl( fd,SOUND_MIXER_READ_DEVMASK,&devs ); if ( ( devs & SOUND_MASK_PCM ) && ( mixer_usemaster==0 ) ) cmd=SOUND_MIXER_WRITE_PCM; else @@ -70,33 +61,74 @@ void mixer_setvolume( int l,int r ) close( fd ); return; } - v=( r << 8 ) | l; + v=( (int)r << 8 ) | (int)l; ioctl( fd,cmd,&v ); -#endif close( fd ); } } +#elif defined(USE_SUN_AUDIO) + +char * mixer_device="/dev/audioctl"; +int mixer_usemaster=0; + +void mixer_getvolume( float *l,float *r ) +{ + int fd,v,cmd,devs; + + fd=open( mixer_device,O_RDONLY ); + if ( fd != -1 ) + { + struct audio_info info; + + ioctl( fd,AUDIO_GETINFO,&info); + *r=info.play.gain * 100. / AUDIO_MAX_GAIN; + *l=info.play.gain * 100. / AUDIO_MAX_GAIN; + close( fd ); + } +} + +void mixer_setvolume( float l,float r ) +{ + int fd,v,cmd,devs; + + fd=open( mixer_device,O_RDONLY ); + if ( fd != -1 ) + { + struct audio_info info; + AUDIO_INITINFO(&info); + info.play.gain = (r+l) * AUDIO_MAX_GAIN / 100 / 2; + ioctl( fd,AUDIO_SETINFO,&info ); + close( fd ); + } +} +#endif -int mixer_l=0; int mixer_r=0; void mixer_incvolume( void ) { + float mixer_l, mixer_r; mixer_getvolume( &mixer_l,&mixer_r ); - if ( mixer_l < 100 ) mixer_l++; - if ( mixer_r < 100 ) mixer_r++; + mixer_l++; + if ( mixer_l > 100 ) mixer_l = 100; + mixer_r++; + if ( mixer_r > 100 ) mixer_r = 100; mixer_setvolume( mixer_l,mixer_r ); } void mixer_decvolume( void ) { + float mixer_l, mixer_r; mixer_getvolume( &mixer_l,&mixer_r ); - if ( mixer_l > 0 ) mixer_l--; - if ( mixer_r > 0 ) mixer_r--; + mixer_l--; + if ( mixer_l < 0 ) mixer_l = 0; + mixer_r--; + if ( mixer_r < 0 ) mixer_r = 0; mixer_setvolume( mixer_l,mixer_r ); } -int mixer_getbothvolume( void ) +float mixer_getbothvolume( void ) { + float mixer_l, mixer_r; mixer_getvolume( &mixer_l,&mixer_r ); return ( mixer_l + mixer_r ) / 2; } @@ -7,13 +7,13 @@ extern int mixer_usemaster; extern char * mixer_device; -extern void mixer_getvolume( int *l,int *r ); -extern void mixer_setvolume( int l,int r ); +extern void mixer_getvolume( float *l,float *r ); +extern void mixer_setvolume( float l,float r ); extern void mixer_incvolume( void ); extern void mixer_decvolume( void ); -extern int mixer_getbothvolume( void ); +extern float mixer_getbothvolume( void ); //extern void mixer_setbothvolume( int v ); #define mixer_setbothvolume( v ) mixer_setvolume( v,v ) -#endif
\ No newline at end of file +#endif @@ -16,15 +16,22 @@ #include <sys/time.h> #include <sys/stat.h> #include <fcntl.h> -#ifdef __sun -#include <sys/audioio.h> -#else -#include <sys/soundcard.h> -#endif #include "version.h" #include "config.h" +#if defined(USE_OSS_AUDIO) +#include <sys/soundcard.h> +#elif defined(USE_SUN_AUDIO) +#endif + +#if defined(sun) +#define DEFAULT_CDROM_DEVICE "/vol/dev/aliases/cdrom0" +#else +#define DEFAULT_CDROM_DEVICE "/dev/cdrom" +#endif + + #ifndef MAX_OUTBURST #error "=============================================" #error "Please re-run ./configure and then try again!" @@ -65,6 +72,10 @@ //extern int vo_screenwidth; +int audio_fd=-1; + +extern int vo_screenwidth; + extern char* win32_codec_name; // must be set before calling DrvOpen() !!! extern int errno; @@ -86,6 +97,7 @@ extern int errno; static URL_t* url; #endif + #define DEBUG if(0) #ifdef HAVE_GUI int nogui=1; @@ -97,6 +109,19 @@ int verbose=0; static subtitle* subtitles=NULL; void find_sub(subtitle* subtitles,int key); +static int +usec_sleep(int usec_delay) +{ +#if 1 + struct timespec ts; + ts.tv_sec = usec_delay / 1000000; + ts.tv_nsec = (usec_delay % 1000000) * 1000; + return nanosleep(&ts, NULL); +#else + return usleep(usec_delay); +#endif +} + //**************************************************************************// // Config file //**************************************************************************// @@ -269,7 +294,7 @@ extern void avi_fixate(); #ifdef HAVE_GUI #include "../Gui/mplayer/psignal.h" - #define GUI_MSG(x) if ( !nogui ) { mplSendMessage( x ); usleep( 10000 ); } + #define GUI_MSG(x) if ( !nogui ) { mplSendMessage( x ); usec_sleep( 10000 ); } #else #define GUI_MSG(x) #endif @@ -297,6 +322,8 @@ void exit_player(char* how){ #endif getch2_disable(); video_out->uninit(); + audio_out->reset(); + audio_out->uninit(); if(encode_name) avi_fixate(); #ifdef HAVE_LIRC #ifdef HAVE_GUI @@ -403,6 +430,8 @@ int sub_auto = 1; char *dsp=NULL; +float rel_seek_secs=0; + #include "mixer.h" #include "cfg-mplayer.h" @@ -505,11 +534,7 @@ int f; // filedes #endif if(!filename){ -#ifdef __sun - if(vcd_track) filename="/vol/dev/aliases/cdrom0"; -#else - if(vcd_track) filename="/dev/cdrom"; -#endif + if(vcd_track) filename=DEFAULT_CDROM_DEVICE; else { printf("%s",help_text); exit(0); } @@ -642,6 +667,7 @@ if(vcd_track){ } if (dvd_auth_device) { if (dvd_auth(dvd_auth_device,f)) { +// if (dvd_auth(dvd_auth_device,filename)) { GUI_MSG( mplErrorDVDAuth ) exit(0); } @@ -1073,7 +1099,7 @@ while(1){ { mplShMem->items.videodata.format=sh_video->format; mplSendMessage( mplCantFindCodecForVideoFormat ); - usleep( 10000 ); + usec_sleep( 10000 ); } #endif exit(1); @@ -1137,7 +1163,7 @@ switch(sh_video->codec->driver){ { strcpy( mplShMem->items.videodata.codecdll,sh_video->codec->dll ); mplSendMessage( mplDSCodecNotFound ); - usleep( 10000 ); + usec_sleep( 10000 ); } #endif exit(1); @@ -1508,11 +1534,11 @@ while(has_audio){ time_frame=0; } else { while(time_frame>0.022){ - usleep(time_frame-0.022); + usec_sleep(time_frame-0.022); time_frame-=GetRelativeTime(); } while(time_frame>0.007){ - usleep(0); + usec_sleep(1000); // sleeps 1 clock tick (10ms)! time_frame-=GetRelativeTime(); } } @@ -1744,7 +1770,14 @@ switch(sh_video->codec->driver){ if(verbose>1)printf("delay=%d\n",delay); time_frame=v_frame; time_frame-=a_frame-(float)delay/(float)sh_audio->o_bps; - if(time_frame>-2*frame_time) drop_frame=0; // stop dropping frames + if(time_frame>-2*frame_time) { + drop_frame=0; // stop dropping frames + if (verbose>0) printf("\nstop frame drop %.2f\n", time_frame); + }else{ + ++drop_frame_cnt; + if (verbose > 0 && drop_frame_cnt%10 == 0) + printf("\nstill dropping, %.2f\n", time_frame); + } } } else { @@ -1762,6 +1795,7 @@ switch(sh_video->codec->driver){ if(time_frame<-2*frame_time){ drop_frame=frame_dropping; // tricky! ++drop_frame_cnt; + if (verbose>0) printf("\nframe drop %d, %.2f\n", drop_frame, time_frame); } } else { if(time_frame<-3*frame_time || time_frame>3*frame_time) time_frame=0; @@ -1771,15 +1805,15 @@ switch(sh_video->codec->driver){ while(time_frame>0.005){ if(time_frame<=0.020) - usleep(0); // sleep 10ms + usec_sleep(10000); // sleeps 1 clock tick (10ms)! else - usleep(1000000*(time_frame-0.002)); + usec_sleep(1000000*(time_frame-0.002)); time_frame-=GetRelativeTime(); } current_module="flip_page"; video_out->flip_page(); -// usleep(50000); // test only! +// usec_sleep(50000); // test only! } @@ -1845,7 +1879,7 @@ switch(sh_video->codec->driver){ else max_pts_correction=sh_video->frametime*0.10; // +-10% of time a_frame+=x; c_total+=x; - printf(" ct:%7.3f %3d %2d%% %2d%% %3.1f%% %d\r",c_total, + printf(" ct:%7.3f %3d %2d%% %2d%% %4.1f%% %d\r",c_total, (int)num_frames, (v_frame>0.5)?(int)(100.0*video_time_usage/(double)v_frame):0, (v_frame>0.5)?(int)(100.0*vout_time_usage/(double)v_frame):0, @@ -1886,7 +1920,7 @@ switch(sh_video->codec->driver){ if(osd_function==OSD_PAUSE){ printf("\n------ PAUSED -------\r");fflush(stdout); - audio_out->reset(); // stop audio + audio_out->pause(); // pause audio, keep data if possible #ifdef HAVE_GUI if ( nogui ) { @@ -1897,12 +1931,13 @@ switch(sh_video->codec->driver){ #endif (!f || getch2(20)<=0) && mplayer_get_key()<=0){ video_out->check_events(); - if(!f) usleep(1000); // do not eat the CPU + if(!f) usec_sleep(1000); // do not eat the CPU } osd_function=OSD_PLAY; #ifdef HAVE_GUI - } else while( osd_function != OSD_PLAY ) usleep( 1000 ); + } else while( osd_function != OSD_PLAY ) usec_sleep( 1000 ); #endif + audio_out->resume(); // resume audio } @@ -1967,14 +2002,14 @@ switch(sh_video->codec->driver){ break; case '*': case '/': { - int mixer_l=0; int mixer_r=0; + float mixer_l, mixer_r; mixer_getvolume( &mixer_l,&mixer_r ); if(c=='*'){ - if ( mixer_l < 100 ) mixer_l++; - if ( mixer_r < 100 ) mixer_r++; + mixer_l++; if ( mixer_l > 100 ) mixer_l = 100; + mixer_r++; if ( mixer_r > 100 ) mixer_r = 100; } else { - if ( mixer_l > 0 ) mixer_l--; - if ( mixer_r > 0 ) mixer_r--; + mixer_l--; if ( mixer_l < 0 ) mixer_l = 0; + mixer_r--; if ( mixer_r < 0 ) mixer_r = 0; } mixer_setvolume( mixer_l,mixer_r ); @@ -2258,7 +2293,7 @@ switch(file_format){ current_module=NULL; - audio_out->reset(); // stop audio + audio_out->reset(); // stop audio, throwing away buffered data c_total=0; // kell ez? printf("A:%6.1f V:%6.1f A-V:%7.3f",d_audio->pts,d_video->pts,0.0f); @@ -5,21 +5,6 @@ #include <sys/ioctl.h> #include <unistd.h> -//#include <sys/types.h> -//#include <sys/stat.h> -//#include <fcntl.h> - -#ifdef __FreeBSD__ -#include <sys/cdio.h> -#include <sys/cdrio.h> -#else -#ifdef __sun -#include <sys/cdio.h> -#else -#include <linux/cdrom.h> -#endif -#endif - #include "stream.h" extern int verbose; // defined in mplayer.c diff --git a/vcd_read.h b/vcd_read.h index 3cecf74ac7..8bd0d017c6 100644 --- a/vcd_read.h +++ b/vcd_read.h @@ -1,4 +1,14 @@ //=================== VideoCD ========================== +#if defined(linux) || defined(sun) + +#if defined(linux) +#include <linux/cdrom.h> +#elif defined(sun) +#include <sys/cdio.h> +static int sun_vcd_read(int, int*); +#endif + + static struct cdrom_tocentry vcd_entry; static inline void vcd_set_msf(unsigned int sect){ @@ -65,34 +75,128 @@ void vcd_read_toc(int fd){ } } + static char vcd_buf[VCD_SECTOR_SIZE]; static int vcd_read(int fd,char *mem){ -#ifdef __sun - struct cdrom_cdxa xa; - xa.cdxa_addr = vcd_get_msf(); - xa.cdxa_length = CDROM_BLK_2352; - xa.cdxa_data = vcd_buf; - xa.cdxa_format = CDROM_XA_SECTOR_DATA; - if(ioctl(fd,CDROMCDXA,&xa)==-1) return 0; // EOF? -#else - memcpy(vcd_buf,&vcd_entry.cdte_addr.msf,sizeof(struct cdrom_msf)); - if(ioctl(fd,CDROMREADRAW,vcd_buf)==-1) return 0; // EOF? +#if defined(linux) + memcpy(vcd_buf,&vcd_entry.cdte_addr.msf,sizeof(struct cdrom_msf)); + if(ioctl(fd,CDROMREADRAW,vcd_buf)==-1) return 0; // EOF? + memcpy(mem,&vcd_buf[VCD_SECTOR_OFFS],VCD_SECTOR_DATA); +#elif defined(sun) + { + int offset; + if (sun_vcd_read(fd, &offset) <= 0) return 0; + memcpy(mem,&vcd_buf[offset],VCD_SECTOR_DATA); + } #endif - vcd_entry.cdte_addr.msf.frame++; - if (vcd_entry.cdte_addr.msf.frame==75){ - vcd_entry.cdte_addr.msf.frame=0; - vcd_entry.cdte_addr.msf.second++; - if (vcd_entry.cdte_addr.msf.second==60){ - vcd_entry.cdte_addr.msf.second=0; - vcd_entry.cdte_addr.msf.minute++; - } - } + vcd_entry.cdte_addr.msf.frame++; + if (vcd_entry.cdte_addr.msf.frame==75){ + vcd_entry.cdte_addr.msf.frame=0; + vcd_entry.cdte_addr.msf.second++; + if (vcd_entry.cdte_addr.msf.second==60){ + vcd_entry.cdte_addr.msf.second=0; + vcd_entry.cdte_addr.msf.minute++; + } + } + + return VCD_SECTOR_DATA; +} - memcpy(mem,&vcd_buf[VCD_SECTOR_OFFS],VCD_SECTOR_DATA); - return VCD_SECTOR_DATA; + +#ifdef sun +#include <sys/scsi/generic/commands.h> +#include <sys/scsi/impl/uscsi.h> + +#define SUN_XAREAD 1 /*fails on atapi drives*/ +#define SUN_MODE2READ 2 /*fails on atapi drives*/ +#define SUN_SCSIREAD 3 +#define SUN_VCDREAD SUN_SCSIREAD + +static int sun_vcd_read(int fd, int *offset) +{ +#if SUN_VCDREAD == SUN_XAREAD + struct cdrom_cdxa cdxa; + cdxa.cdxa_addr = vcd_get_msf(); + cdxa.cdxa_length = 1; + cdxa.cdxa_data = vcd_buf; + cdxa.cdxa_format = CDROM_XA_SECTOR_DATA; + + if(ioctl(fd,CDROMCDXA,&cdxa)==-1) { + perror("CDROMCDXA"); + return 0; + } + *offset = 0; +#elif SUN_VCDREAD == SUN_MODE2READ + struct cdrom_read cdread; + cdread.cdread_lba = 4*vcd_get_msf(); + cdread.cdread_bufaddr = vcd_buf; + cdread.cdread_buflen = 2336; + + if(ioctl(fd,CDROMREADMODE2,&cdread)==-1) { + perror("CDROMREADMODE2"); + return 0; + } + *offset = 8; +#elif SUN_VCDREAD == SUN_SCSIREAD + struct uscsi_cmd sc; + union scsi_cdb cdb; + int lba = vcd_get_msf(); + int blocks = 1; + int sector_type; + int sync, header_code, user_data, edc_ecc, error_field; + int sub_channel; + + /* sector_type = 3; /* mode2 */ + sector_type = 5; /* mode2/form2 */ + sync = 0; + header_code = 0; + user_data = 1; + edc_ecc = 0; + error_field = 0; + sub_channel = 0; + + memset(&cdb, 0, sizeof(cdb)); + memset(&sc, 0, sizeof(sc)); + cdb.scc_cmd = 0xBE; + cdb.cdb_opaque[1] = (sector_type) << 2; + cdb.cdb_opaque[2] = (lba >> 24) & 0xff; + cdb.cdb_opaque[3] = (lba >> 16) & 0xff; + cdb.cdb_opaque[4] = (lba >> 8) & 0xff; + cdb.cdb_opaque[5] = lba & 0xff; + cdb.cdb_opaque[6] = (blocks >> 16) & 0xff; + cdb.cdb_opaque[7] = (blocks >> 8) & 0xff; + cdb.cdb_opaque[8] = blocks & 0xff; + cdb.cdb_opaque[9] = (sync << 7) | + (header_code << 5) | + (user_data << 4) | + (edc_ecc << 3) | + (error_field << 1); + cdb.cdb_opaque[10] = sub_channel; + + sc.uscsi_cdb = &cdb; + sc.uscsi_cdblen = 12; + sc.uscsi_bufaddr = vcd_buf; + sc.uscsi_buflen = 2336; + sc.uscsi_flags = USCSI_ISOLATE | USCSI_READ; + sc.uscsi_timeout = 20; + if (ioctl(fd, USCSICMD, &sc)) { + perror("USCSICMD: READ CD"); + return -1; + } + if (sc.uscsi_status) { + fprintf(stderr, "scsi command failed with status %d\n", sc.uscsi_status); + return -1; + } + *offset = 0; + return 1; +#else +#error SUN_VCDREAD +#endif } +#endif /*sun*/ + //================== VCD CACHE ======================= #ifdef VCD_CACHE @@ -115,8 +219,9 @@ static inline void vcd_cache_seek(int sect){ } int vcd_cache_read(int fd,char* mem){ -int i; -char* vcd_buf; + int i; + char* vcd_buf; + for(i=0;i<vcd_cache_size;i++) if(vcd_cache_sectors[i]==vcd_cache_current){ // found in the cache! :) @@ -131,11 +236,43 @@ char* vcd_buf; ++vcd_cache_index;if(vcd_cache_index>=vcd_cache_size)vcd_cache_index=0; // read data! vcd_set_msf(vcd_cache_current); +#if defined(linux) memcpy(vcd_buf,&vcd_entry.cdte_addr.msf,sizeof(struct cdrom_msf)); if(ioctl(fd,CDROMREADRAW,vcd_buf)==-1) return 0; // EOF? - ++vcd_cache_current; memcpy(mem,&vcd_buf[VCD_SECTOR_OFFS],VCD_SECTOR_DATA); +#elif defined(sun) + { + int offset; + if (sun_vcd_read(fd, &offset) <= 0) return 0; + memcpy(mem,&vcd_buf[offset],VCD_SECTOR_DATA); + } +#endif + ++vcd_cache_current; return VCD_SECTOR_DATA; } - #endif + +#else /* linux || sun */ + +int vcd_seek_to_track(int fd,int track) +{ + return -1; +} + +int vcd_get_track_end(int fd,int track) +{ + return -1; +} + +void vcd_read_toc(int fd) +{ +} + +static char vcd_buf[VCD_SECTOR_SIZE]; + +static int vcd_read(int fd,char *mem) +{ + return -1; +} + +#endif /* !linux && !sun */ diff --git a/vcd_read_fbsd.h b/vcd_read_fbsd.h index b5de6e6866..46d6e6b59a 100644 --- a/vcd_read_fbsd.h +++ b/vcd_read_fbsd.h @@ -1,3 +1,6 @@ +#include <sys/cdio.h> +#include <sys/cdrio.h> + //=================== VideoCD ========================== #define CDROM_LEADOUT 0xAA diff --git a/version.sh b/version.sh index 4ba53e8d09..d9c35fad26 100755 --- a/version.sh +++ b/version.sh @@ -1,4 +1,8 @@ #!/bin/sh -echo "#define VERSION \"0.17cvs-"`date -r CVS/Entries +%y%m%d-%H:%M`"\"" >version.h - +last_cvs_update=`date -r CVS/Entries +%y%m%d-%H:%M 2>/dev/null` +if [ $? -ne 0 ]; then + # probably no gnu date installed(?), use current date + last_cvs_update=`date +%y%m%d-%H:%M` +fi +echo "#define VERSION \"0.17cvs-${last_cvs_update}\"" >version.h |