[Mplayer-cvslog] CVS: main bswap.h,NONE,1.1 Makefile,1.50,1.51 aviheader.c,1.15,1.16 configure,1.100,1.101 dec_audio.c,1.19,1.20 dec_video.c,1.2,1.3 demuxer.h,1.5,1.6 dll_init.c,1.21,1.22

Jürgen Keil jkeil at mplayer.dev.hu
Thu Jul 12 17:35:53 CEST 2001


Update of /cvsroot/mplayer/main
In directory mplayer:/var/tmp.root/cvs-serv21650

Modified Files:
	Makefile aviheader.c configure dec_audio.c dec_video.c 
	demuxer.h dll_init.c 
Added Files:
	bswap.h 
Log Message:
Add some preliminary support for non-x86 architectures to mplayer


--- NEW FILE ---
#include "libac3/bswap.h"

Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/Makefile,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- Makefile	8 Jul 2001 00:21:20 -0000	1.50
+++ Makefile	12 Jul 2001 15:35:51 -0000	1.51
@@ -16,12 +16,21 @@
 #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 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)
 OBJS = $(SRCS:.c=.o)
 CFLAGS = $(OPTFLAGS) -Iloader -Ilibvo $(CSS_INC) $(EXTRA_INC) # -Wall
 A_LIBS = -Lmp3lib -lMP3 -Llibac3 -lac3 $(ALSA_LIB) $(ESD_LIB)
 VO_LIBS = -Llibvo -lvo $(X_LIBS)
 
+ifeq ($(TARGET_ARCH_X86),yes)
+SRCS += dll_init.c
+LOADER_DEP = loader/libloader.a $(DS_DEP)
+LIB_LOADER = -Lloader -lloader $(DS_LIB)
+else
+LOADER_DEP =
+endif
+
+
 .SUFFIXES: .c .o
 
 # .PHONY: all clean
@@ -64,11 +73,12 @@
 encore/libencore.a:
 	$(MAKE) -C encore
 
-mplayerwithoutlink:	version.h mplayer.o $(OBJS) loader/libloader.a $(DS_DEP) libmpeg2/libmpeg2.a opendivx/libdecore.a $(COMMONLIBS) encore/libencore.a
-	@for a in mp3lib libac3 libmpeg2 libvo opendivx encore loader/DirectShow ; do $(MAKE) -C $$a all ; done
 
-$(PRG):	version.h mplayer.o $(OBJS) loader/libloader.a $(DS_DEP) libmpeg2/libmpeg2.a opendivx/libdecore.a $(COMMONLIBS) encore/libencore.a
-	$(CC) $(CFLAGS) -o $(PRG) mplayer.o $(OBJS) $(XMM_LIBS) $(LIRC_LIBS) $(A_LIBS) -lm $(TERMCAP_LIB) -Lloader -lloader $(DS_LIB) -Llibmpeg2 -lmpeg2 -Lopendivx -ldecore -Llibao2 -lao2 $(VO_LIBS) $(CSS_LIB) -Lencore -lencore $(ARCH_LIBS)
+mplayerwithoutlink:	version.h mplayer.o $(OBJS) $(LOADER_DEP) $(AV_DEP) libmpeg2/libmpeg2.a opendivx/libdecore.a $(COMMONLIBS) encore/libencore.a
+	@for a in mp3lib libac3 libmpeg2 libvo opendivx libavcodec encore loader/DirectShow ; do $(MAKE) -C $$a all ; done
+
+$(PRG):	version.h mplayer.o $(OBJS) $(LOADER_DEP) $(AV_DEP) libmpeg2/libmpeg2.a opendivx/libdecore.a $(COMMONLIBS) encore/libencore.a
+	$(CC) $(CFLAGS) -o $(PRG) mplayer.o $(OBJS) $(XMM_LIBS) $(LIRC_LIBS) $(A_LIBS) -lm $(TERMCAP_LIB) $(LIB_LOADER) $(AV_LIB) -Llibmpeg2 -lmpeg2 -Lopendivx -ldecore -Llibao2 -lao2 $(VO_LIBS) $(CSS_LIB) -Lencore -lencore $(ARCH_LIBS)
 
 $(PRG_FIBMAP): fibmap_mplayer.o
 	$(CC) -o $(PRG_FIBMAP) fibmap_mplayer.o
@@ -98,7 +108,7 @@
 	rm -f *.o *~ $(OBJS)
 
 distclean:
-	@for a in mp3lib libac3 libmpeg2 opendivx encore libvo libao2 loader loader/DirectShow drivers drivers/syncfb ; do $(MAKE) -C $$a distclean ; done
+	@for a in mp3lib libac3 libmpeg2 opendivx libavcodec encore libvo libao2 loader loader/DirectShow drivers drivers/syncfb ; do $(MAKE) -C $$a distclean ; done
 	rm -f *~ $(PRG) $(PRG_FIBMAP) $(PRG_HQ) $(PRG_AVIP) $(PRG_TV) $(OBJS) *.o *.a .depend
 
 dep:	depend
@@ -106,7 +116,7 @@
 depend:
 	./version.sh
 	$(CC) -MM $(CFLAGS) mplayer.c $(SRCS) 1>.depend
-	@for a in mp3lib libac3 libmpeg2 libvo libao2 opendivx encore loader/DirectShow ; do $(MAKE) -C $$a dep ; done
+	@for a in mp3lib libac3 libmpeg2 libvo libao2 opendivx libavcodec encore loader/DirectShow ; do $(MAKE) -C $$a dep ; done
 
 # ./configure must be run if it changed in CVS
 config.h: configure

Index: aviheader.c
===================================================================
RCS file: /cvsroot/mplayer/main/aviheader.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- aviheader.c	7 Jul 2001 18:46:15 -0000	1.15
+++ aviheader.c	12 Jul 2001 15:35:51 -0000	1.16
@@ -1,5 +1,5 @@
 
-
+#include "config.h"
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -13,10 +13,89 @@
 #include "wine/vfw.h"
 
 #include "codec-cfg.h"
+#include "bswap.h"
 #include "stheader.h"
 
 #define MIN(a,b) (((a)<(b))?(a):(b))
 
+/*
+ * Some macros to swap little endian structures read from an AVI file
+ * into machine endian format
+ */
+#ifdef WORDS_BIGENDIAN
+#define	le2me_MainAVIHeader(h) {					\
+    (h)->dwMicroSecPerFrame = le2me_32((h)->dwMicroSecPerFrame);	\
+    (h)->dwMaxBytesPerSec = le2me_32((h)->dwMaxBytesPerSec);		\
+    (h)->dwPaddingGranularity = le2me_32((h)->dwPaddingGranularity);	\
+    (h)->dwFlags = le2me_32((h)->dwFlags);				\
+    (h)->dwTotalFrames = le2me_32((h)->dwTotalFrames);			\
+    (h)->dwInitialFrames = le2me_32((h)->dwInitialFrames);		\
+    (h)->dwStreams = le2me_32((h)->dwStreams);				\
+    (h)->dwSuggestedBufferSize = le2me_32((h)->dwSuggestedBufferSize);	\
+    (h)->dwWidth = le2me_32((h)->dwWidth);				\
+    (h)->dwHeight = le2me_32((h)->dwHeight);				\
+}
+
+#define	le2me_AVIStreamHeader(h) {					\
+    (h)->fccType = le2me_32((h)->fccType);				\
+    (h)->fccHandler = le2me_32((h)->fccHandler);			\
+    (h)->dwFlags = le2me_32((h)->dwFlags);				\
+    (h)->wPriority = le2me_16((h)->wPriority);				\
+    (h)->wLanguage = le2me_16((h)->wLanguage);				\
+    (h)->dwInitialFrames = le2me_32((h)->dwInitialFrames);		\
+    (h)->dwScale = le2me_32((h)->dwScale);				\
+    (h)->dwRate = le2me_32((h)->dwRate);				\
+    (h)->dwStart = le2me_32((h)->dwStart);				\
+    (h)->dwLength = le2me_32((h)->dwLength);				\
+    (h)->dwSuggestedBufferSize = le2me_32((h)->dwSuggestedBufferSize);	\
+    (h)->dwQuality = le2me_32((h)->dwQuality);				\
+    (h)->dwSampleSize = le2me_32((h)->dwSampleSize);			\
+    le2me_RECT(&(h)->rcFrame);						\
+}
+#define	le2me_RECT(h) {							\
+    (h)->left = le2me_16((h)->left);					\
+    (h)->top = le2me_16((h)->top);					\
+    (h)->right = le2me_16((h)->right);					\
+    (h)->bottom = le2me_16((h)->bottom);				\
+}
+#define le2me_BITMAPINFOHEADER(h) {					\
+    (h)->biSize = le2me_32((h)->biSize);				\
+    (h)->biWidth = le2me_32((h)->biWidth);				\
+    (h)->biHeight = le2me_32((h)->biHeight);				\
+    (h)->biPlanes = le2me_16((h)->biPlanes);				\
+    (h)->biBitCount = le2me_16((h)->biBitCount);			\
+    (h)->biCompression = le2me_32((h)->biCompression);			\
+    (h)->biSizeImage = le2me_32((h)->biSizeImage);			\
+    (h)->biXPelsPerMeter = le2me_32((h)->biXPelsPerMeter);		\
+    (h)->biYPelsPerMeter = le2me_32((h)->biYPelsPerMeter);		\
+    (h)->biClrUsed = le2me_32((h)->biClrUsed);				\
+    (h)->biClrImportant = le2me_32((h)->biClrImportant);		\
+}
+#define le2me_WAVEFORMATEX(h) {						\
+    (h)->wFormatTag = le2me_16((h)->wFormatTag);			\
+    (h)->nChannels = le2me_16((h)->nChannels);				\
+    (h)->nSamplesPerSec = le2me_32((h)->nSamplesPerSec);		\
+    (h)->nAvgBytesPerSec = le2me_32((h)->nAvgBytesPerSec);		\
+    (h)->nBlockAlign = le2me_16((h)->nBlockAlign);			\
+    (h)->wBitsPerSample = le2me_16((h)->wBitsPerSample);		\
+    (h)->cbSize = le2me_16((h)->cbSize);				\
+}
+#define le2me_AVIINDEXENTRY(h) {					\
+    (h)->ckid = le2me_32((h)->ckid);					\
+    (h)->dwFlags = le2me_32((h)->dwFlags);				\
+    (h)->dwChunkOffset = le2me_32((h)->dwChunkOffset);			\
+    (h)->dwChunkLength = le2me_32((h)->dwChunkLength);			\
+}
+#else
+#define	le2me_MainAVIHeader(h)	    /**/
+#define le2me_AVIStreamHeader(h)    /**/
+#define le2me_RECT(h)		    /**/
+#define le2me_BITMAPINFOHEADER(h)   /**/
+#define le2me_WAVEFORMATEX(h)	    /**/
+#define le2me_AVIINDEXENTRY(h)	    /**/
+#endif
+
+
 static MainAVIHeader avih;
 
 extern void print_avih(MainAVIHeader *h);
@@ -61,12 +140,14 @@
   switch(id){
     case ckidAVIMAINHDR:          // read 'avih'
       stream_read(demuxer->stream,(char*) &avih,MIN(size2,sizeof(avih)));
+      le2me_MainAVIHeader(&avih); // swap to machine endian
       chunksize-=MIN(size2,sizeof(avih));
       if(verbose) print_avih(&avih);
       break;
     case ckidSTREAMHEADER: {      // read 'strh'
       AVIStreamHeader h;
       stream_read(demuxer->stream,(char*) &h,MIN(size2,sizeof(h)));
+      le2me_AVIStreamHeader(&h);  // swap to machine endian
       chunksize-=MIN(size2,sizeof(h));
       ++stream_id;
       if(h.fccType==streamtypeVIDEO){
@@ -86,6 +167,7 @@
 //        sh_video->bih=malloc(chunksize); memset(sh_video->bih,0,chunksize);
         if(verbose>=1) printf("found 'bih', %d bytes of %d\n",chunksize,sizeof(BITMAPINFOHEADER));
         stream_read(demuxer->stream,(char*) sh_video->bih,chunksize);
+	le2me_BITMAPINFOHEADER(sh_video->bih);  // swap to machine endian
         chunksize=0;
 //        sh_video->fps=(float)sh_video->video.dwRate/(float)sh_video->video.dwScale;
 //        sh_video->frametime=(float)sh_video->video.dwScale/(float)sh_video->video.dwRate;
@@ -116,6 +198,7 @@
 //        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);
+	le2me_WAVEFORMATEX(sh_audio->wf);
 	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);
@@ -127,11 +210,14 @@
       break;
     }
     case ckidAVINEWINDEX: if(index_mode){
+      int i;
       demuxer->idx_size=size2>>4;
       if(verbose>=1) printf("Reading INDEX block, %d chunks for %ld frames\n",
         demuxer->idx_size,avih.dwTotalFrames);
       demuxer->idx=malloc(demuxer->idx_size<<4);
       stream_read(demuxer->stream,(char*)demuxer->idx,demuxer->idx_size<<4);
+      for (i = 0; i < demuxer->idx_size; i++)	// swap index to machine endian
+	le2me_AVIINDEXENTRY((AVIINDEXENTRY*)demuxer->idx + i);
       chunksize-=demuxer->idx_size<<4;
       if(verbose>=2) print_index(demuxer->idx,demuxer->idx_size);
       break;

Index: configure
===================================================================
RCS file: /cvsroot/mplayer/main/configure,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -r1.100 -r1.101
--- configure	6 Jul 2001 20:00:22 -0000	1.100
+++ configure	12 Jul 2001 15:35:51 -0000	1.101
@@ -6,6 +6,11 @@
 #
 # Changes in reversed order:
 #
+# 2001/07/12 by Juergen Keil
+#  - add support for non-x86 targets
+#  - add autoconf checks for loader/wine
+#  - fix linux 2.2.x kernel check vs. SSE usage
+#
 # 2001/07/04 by Juergen Keil
 #  - autodetect the assembler binary used by the GCC C compiler
 #
@@ -172,18 +177,32 @@
 exit 0
 fi
 
+
 # LGB: Some inital help
 
 echo "You can get detailed help on configure with: $0 --help"
 echo "Please wait while ./configure discovers your software and hardware environment!"
 
+
+system_name=`uname -s 2>&1` # name of operating system: Linux, FreeBSD, NetBSD, SunOS
+host_arch=`uname -p 2>&1`   # host's instruction set or processor type
+case "$host_arch" in
+unknown)		    # Linux returns "unknown" for the processor type
+    case "`uname -m 2>&1`" in
+    i[3-9]86)
+	host_arch=i386;;
+    ppc)
+	host_arch=ppc;;
+    esac
+    ;;
+esac
+
 # Determine our OS name and OS dependent libs
 
-system_name=`uname -s 2>&1`
 if [ "$system_name" = "FreeBSD" ]; then
-_archlibs="-rdynamic -pthread"
+    _archlibs="-rdynamic -pthread"
 else
-_archlibs="-ldl -lpthread"
+    _archlibs="-ldl -lpthread"
 fi
 
 # LGB: temporary files
@@ -206,6 +225,10 @@
 	TMPS="/tmp/${TMPS}"
 fi
 
+cat > $TMPC << EOF
+int main( void ) { return 0; }
+EOF
+
 # ---
 
 # config files
@@ -324,29 +347,34 @@
 fi
 
 
-if [ -r /proc/cpuinfo ]; then
+if [ "$host_arch" = i386 ]; then
+    if [ -r /proc/cpuinfo ]; then
 	# linux with /proc mounted, extract cpu information from it
 	_cpuinfo="cat /proc/cpuinfo"
-elif [ -r /compat/linux/proc/cpuinfo ]; then
+    elif [ -r /compat/linux/proc/cpuinfo ]; then
         # FreeBSD with linux emulation /proc mounted, 
 	# extract cpu information from it
         _cpuinfo="cat /compat/linux/proc/cpuinfo"
-else
+    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
+    fi
 
-pname=`$_cpuinfo | grep 'model name' | cut -d ':' -f 2`
-pparam=`$_cpuinfo | grep 'features' | cut -d ':' -f 2`
-if [ -z "$pparam" ]; then
-  pparam=`$_cpuinfo | grep 'flags' | cut -d ':' -f 2`
-fi
-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`
+    pname=`$_cpuinfo | grep 'model name' | cut -d ':' -f 2`
+    pparam=`$_cpuinfo | grep 'features' | cut -d ':' -f 2`
+    if [ -z "$pparam" ]; then
+	pparam=`$_cpuinfo | grep 'flags' | cut -d ':' -f 2`
+    fi
+    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`
+else
+    # not an x86 host, cpuinfo stuff is not relevant
+    pname= pparam= pvendor= pfamily= pmodel= pstepping=
+fi
 
 _mmx=no
 _mmx2=no
@@ -371,10 +399,11 @@
 _dga2=no
 _svga=no
 _fbdev=no
-[ x`uname -s` = xLinux ] && _fbdev=yes
+[ "$system_name" = Linux ] && _fbdev=yes
 _lirc=no
 _css=no
 _dshow=yes
+[ "$host_arch" != i386 ] && _dshow=no
 _fastmemcpy=yes
 _streaming=no
 _libavcodec=no
@@ -396,7 +425,7 @@
 _alsa=yes
 _esd=yes
 
-for i in `echo $pparam`; do
+for i in $pparam; do
 
  case "$i" in
   3dnow)
@@ -427,161 +456,208 @@
 
 
 _win32libdirnotify=no
-if [ -d /usr/lib/win32 ]; then
- _win32libdir=/usr/lib/win32
-else
- if [ -d /usr/local/lib/win32 ]; then
-  _win32libdir=/usr/local/lib/win32
- else
-# This is our default:
-  _win32libdir=/usr/lib/win32
-  _win32libdirnotify=yes
- fi
+if [ "$host_arch" = i386 ]; then
+    if [ -d /usr/lib/win32 ]; then
+	_win32libdir=/usr/lib/win32
+    elif [ -d /usr/local/lib/win32 ]; then
+	_win32libdir=/usr/local/lib/win32
+    else
+	# This is our default:
+	_win32libdir=/usr/lib/win32
+	_win32libdirnotify=yes
+    fi
 fi
 
-if [ -d libavcodec ]; then
- if [ -f libavcodec/Makefile ]; then
-  _libavcodec=yes
- fi
+
+if [ -d libavcodec -a -f libavcodec/Makefile ]; then
+    _libavcodec=yes
 fi
 
+
 if [ -c /dev/mga_vid ]; then
  _mga=yes
  _syncfb=yes
 fi
 
-proc=pentium
-iproc=586
-
-case "$pvendor" in
- AuthenticAMD)
-   case "$pfamily" in
-    3)
-      proc=i386
-      iproc=386
-      ;;
-    4)
-      proc=i486
-      iproc=486
-      ;;
-    5)
-      if [ $pmodel -ge 6 ]; then	# LGB: models are: K5/SSA5 K5 K5 K5 ? ? K6 K6 K6-2 K6-3 
-    	    proc=k6
-      else
-    	    proc=k5
-      fi
-      iproc=586
-      ;;
-    6|7)				# LGB: Though it seems Athlon CPUs returns with "6"
-      proc=k7
-      iproc=686
-      ;;
-    *)
-      proc=pentium
-      iproc=586
-      ;;
-   esac
-   ;;
- GenuineIntel)
-   case "$pfamily" in
-    3)
-      proc=i386
-      iproc=386
-      ;;
-    4)
-      proc=i486
-      iproc=486
-      ;;
-    5)
-      proc=pentium
-      iproc=586
-      ;;
-    6)
-      proc=i686
-      iproc=686
-      ;;
-    *)
-      proc=pentium
-      iproc=586
-      ;;
-   esac
-   ;;
- unknown)              # added by Gabucino - upon Tibcu's request
-   case "$pfamily" in
-    3)
-      proc=i386
-      iproc=386
-      ;;
-    4)
-      proc=i486
-      iproc=486
-      ;;
-    *)
-      proc=pentium
-      iproc=586
-      ;;
-   esac
-   ;;
- *)
-   proc=pentium
-   iproc=586
-   ;;
-esac
 
-# ---
 
-cat > $TMPC << EOF
-int main( void ) { return 0; }
-EOF
+case "$host_arch" in
+i386)
+    _arch="#define ARCH_X86 1"
+    _target_arch="TARGET_ARCH_X86=yes"
+    _words_endian="#undef WORDS_BIGENDIAN"
+    proc=pentium
+    iproc=586
+
+    case "$pvendor" in
+    AuthenticAMD)
+	case "$pfamily" in
+	3)
+	    proc=i386
+	    iproc=386
+	    ;;
+	4)
+	    proc=i486
+	    iproc=486
+	    ;;
+	5)
+	    if [ $pmodel -ge 6 ]; then	# LGB: models are: K5/SSA5 K5 K5 K5 ? ? K6 K6 K6-2 K6-3 
+		proc=k6
+	    else
+		proc=k5
+	    fi
+	    iproc=586
+	    ;;
+	6|7)				# LGB: Though it seems Athlon CPUs returns with "6"
+	    proc=k7
+	    iproc=686
+	    ;;
+	*)
+	    proc=pentium
+	    iproc=586
+	    ;;
+	esac
+	;;
+    GenuineIntel)
+	case "$pfamily" in
+	3)
+	    proc=i386
+	    iproc=386
+	    ;;
+	4)
+	    proc=i486
+	    iproc=486
+	    ;;
+	5)
+	    proc=pentium
+	    iproc=586
+	    ;;
+	6)
+	    proc=i686
+	    iproc=686
+	    ;;
+	*)
+	    proc=pentium
+	    iproc=586
+	    ;;
+	esac
+	;;
+    unknown)              # added by Gabucino - upon Tibcu's request
+	case "$pfamily" in
+	3)
+	    proc=i386
+	    iproc=386
+	    ;;
+	4)
+	    proc=i486
+	    iproc=486
+	    ;;
+	*)
+	    proc=pentium
+	    iproc=586
+	    ;;
+	esac
+	;;
+    *)
+	proc=pentium
+	iproc=586
+	;;
+    esac
 
-# check that gcc supports our cpu, if not, fallback to pentium
-# LGB: check -mcpu and -march swithing step by step with enabling
-# to fall back till 386.
-
-#echo -n "Checking your GCC CPU optimalization abilities: "
-if [ "$proc" = "k7" ]; then
-#	echo -n "trying k7  "
+    # check that gcc supports our cpu, if not, fallback to pentium
+    # LGB: check -mcpu and -march swithing step by step with enabling
+    # to fall back till 386.
+
+    #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 2>&1 || proc=athlon
-fi
-if [ "$proc" = "athlon" ]; then
-#	echo -n "trying athlon  "
+    fi
+    if [ "$proc" = "athlon" ]; then
+	#echo -n "trying athlon  "
 	$_cc $TMPC -o $TMPO -march=$proc -mcpu=$proc > /dev/null 2>&1 || proc=pentiumpro
-fi
-if [ "$proc" = "k6" ]; then
-#	echo -n "trying k6  "
+    fi
+    if [ "$proc" = "k6" ]; then
+	#echo -n "trying k6  "
 	$_cc $TMPC -o $TMPO -march=$proc -mcpu=$proc > /dev/null 2>&1 || proc=k5
-fi
-if [ "$proc" = "k5" ]; then
-#	echo -n "trying k5  "
+    fi
+    if [ "$proc" = "k5" ]; then
+	#echo -n "trying k5  "
 	$_cc $TMPC -o $TMPO -march=$proc -mcpu=$proc > /dev/null 2>&1 || proc=pentium
-fi
-if [ "$proc" = "i686" ]; then
-#	echo -n "trying i686  "
+    fi
+    if [ "$proc" = "i686" ]; then
+	#echo -n "trying i686  "
 	$_cc $TMPC -o $TMPO -march=$proc -mcpu=$proc > /dev/null 2>&1 || proc=pentiumpro
-fi
-if [ "$proc" = "pentiumpro" ]; then
-#	echo -n "trying pentiumpro  "
+    fi
+    if [ "$proc" = "pentiumpro" ]; then
+	#echo -n "trying pentiumpro  "
 	$_cc $TMPC -o $TMPO -march=$proc -mcpu=$proc > /dev/null 2>&1 || proc=pentium
-fi
-if [ "$proc" = "pentium" ]; then
-#	echo -n "trying pentium  "
+    fi
+    if [ "$proc" = "pentium" ]; then
+	#echo -n "trying pentium  "
 	$_cc $TMPC -o $TMPO -march=$proc -mcpu=$proc > /dev/null 2>&1 || proc=i486
-fi
-if [ "$proc" = "i486" ]; then
-#	echo -n "trying i486  "
+    fi
+    if [ "$proc" = "i486" ]; then
+	#echo -n "trying i486  "
 	$_cc $TMPC -o $TMPO -march=$proc -mcpu=$proc > /dev/null 2>&1 || proc=i386
-fi
-if [ "$proc" = "i386" ]; then
-#	echo -n "trying i386  "
+    fi
+    if [ "$proc" = "i386" ]; then
+	#echo -n "trying i386  "
 	$_cc $TMPC -o $TMPO -march=$proc -mcpu=$proc > /dev/null 2>&1 || proc=error
-fi
-if [ "$proc" = "error" ]; then
+    fi
+    if [ "$proc" = "error" ]; then
 	echo
 	echo "Your gcc does not support even \"i386\" for '-march' and '-mcpu'." >&2
 	rm -f $TMPC $TMPO $TMPS
 	exit
-fi
-#echo "DONE (${proc})."
+    fi
+
+    _march="-march=$proc"
+    _mcpu="-mcpu=$proc"
+    #echo "DONE (${proc})."
+    ;;
+
+
+sparc)
+    _arch="#define ARCH_SPARC 1"
+    _target_arch="TARGET_ARCH_SPARC=yes"
+    _words_endian="#define WORDS_BIGENDIAN 1"
+    iproc=sparc
+    proc=v8
+    _march=""
+    _mcpu="-mcpu=$proc"
+    ;;
+
+# Untested:
+#ppc)
+#    _arch="#define ARCH_PPC 1"
+#    _target_arch="TARGET_ARCH_PPC=yes"
+#    _words_endian="#define WORDS_BIGENDIAN 1"
+#    iproc=ppc
+#    proc=
+#    _march=""
+#    _mcpu=""
+#    ;;
+
+# Untested:
+#alpha)
+#    _arch="#define ARCH_ALPHA 1"
+#    _target_arch="TARGET_ARCH_ALPHA=yes"
+#    _words_endian="#undef WORDS_BIGENDIAN"
+#    iproc=alpha
+#    proc=
+#    _march=""
+#    _mcpu=""
+#    ;;
+
+*)
+    echo "The architecture of your CPU ($host_arch) is not supported by this configure script"
+    exit 1
+    ;;
+esac
+
+# ---
+
 
 
 $_cc $_extraincdir $_extralibdir $TMPC -o $TMPO -lvgagl -lvga > /dev/null 2>&1 && _svga=yes
@@ -717,7 +793,43 @@
 
 
 # ---
-# try to detect type of audio supported on this machine
+# check availability of some header files
+
+cat > $TMPC << EOF
+#include <malloc.h>
+int main( void ) { return 0; }
+EOF
+
+_malloc_h=no
+$_cc -o $TMPO $TMPC 2> /dev/null && _malloc_h=yes
+
+
+cat > $TMPC << EOF
+#include <alloca.h>
+int main( void ) { return 0; }
+EOF
+
+_alloca_h=no
+$_cc -o $TMPO $TMPC 2> /dev/null && _alloca_h=yes
+
+
+cat > $TMPC << EOF
+#include <sys/mman.h>
+int main( void ) { return 0; }
+EOF
+
+_sys_mman_h=no
+$_cc -o $TMPO $TMPC 2> /dev/null && _sys_mman_h=yes
+
+
+cat > $TMPC << EOF
+#include <dlfcn.h>
+int main( void ) {  return 0; }
+EOF
+
+_libdl=no
+$_cc -o $TMPO $TMPC -ldl 2> /dev/null && _libdl=yes
+
 
 cat > $TMPC << EOF
 #include <sys/soundcard.h>
@@ -728,6 +840,9 @@
 $_cc -o $TMPO $TMPC 2> /dev/null && _sys_soundcard_h=yes
 
 
+# ---
+# try to detect type of audio supported on this machine
+
 cat > $TMPC << EOF
 #include <sys/soundcard.h>
 int main( void ) {  int arg = SNDCTL_DSP_SETFRAGMENT; }
@@ -1085,24 +1200,24 @@
 fi
 
 # Checking kernel version...
-_k_verc_problem=no
-if [ "$system_name" != "FreeBSD" ];then
-kernel_version=`uname -r 2>&1`
-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])
-	_k_verc_problem=yes;;
-esac
-if [ $_k_verc_problem = 'yes' ] && [ $_sse = 'yes' ]; then
-_k_verc_fail=yes
-fi
-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
-echo "$kernel_version, ok"
-fi
+if [ "$system_name" = "Linux" ];then
+    _k_verc_problem=no
+    kernel_version=`uname -r 2>&1`
+    echo $_echo_n "Checking $system_name kernel version ... $_echo_c"
+    case "$kernel_version" in
+	'') kernel_version="?.??"; _k_verc_fail=yes;;
+	[0-1].[0-9].[0-9]*|2.[0-3].[0-9]*)
+	    _k_verc_problem=yes;;
+    esac
+    if [ $_k_verc_problem = 'yes' ] && [ "$_sse" = 'yes' ]; then
+	_k_verc_fail=yes
+    fi
+    if [ ! -z "$_k_verc_fail" ]; then
+	echo "$kernel_version, fail"
+	echo "WARNING! If you want to run mplayer on this system, be prepared for problems"
+    else
+	echo "$kernel_version, ok"
+    fi
 fi
 
 if [ "$_xmga" = "autodetect" ]; then
@@ -1115,15 +1230,19 @@
 
 # to screen.
 echo "Install prefix: $_prefix"
-echo "Checking for cpu vendor ... $pvendor ( $pfamily:$pmodel:$pstepping )"
-echo "Checking for cpu type ... $pname"
+if [ "$host_arch" = i386 ]; then
+    echo "Checking for cpu vendor ... $pvendor ( $pfamily:$pmodel:$pstepping )"
+    echo "Checking for cpu type ... $pname"
+fi
 echo "Optimizing to ... $proc"
-echo "Checking for mmx support ... $_mmx"
-echo "Checking for mmx2 support ... $_mmx2"
-echo "Checking for 3dnow support ... $_3dnow"
-echo "Checking for 3dnowex support ... $_3dnowex"
-echo "Checking for sse support ... $_sse"
-echo "Checking for mtrr support ... $_mtrr"
+if [ "$host_arch" = i386 ]; then
+    echo "Checking for mmx support ... $_mmx"
+    echo "Checking for mmx2 support ... $_mmx2"
+    echo "Checking for 3dnow support ... $_3dnow"
+    echo "Checking for 3dnowex support ... $_3dnowex"
+    echo "Checking for sse support ... $_sse"
+    echo "Checking for mtrr support ... $_mtrr"
+fi
 echo "Screen size ... ${_x}x${_y}"
 echo "Checking for X11 libs ... $_x11libdir"
 echo "Checking for X11 headers ... $_x11incdir"
@@ -1257,9 +1376,9 @@
 fi
 
 if [ "$_kstat" = "yes" ]; then
-  _have_kstat="#define	HAVE_KSTAT 1"
+  _have_libkstat="#define HAVE_LIBKSTAT 1"
 else
-  _have_kstat="#undef	HAVE_KSTAT"
+  _have_libkstat="#undef HAVE_LIBKSTAT"
 fi
 
 if [ "$_xmmp" = "yes" ]; then
@@ -1317,13 +1436,37 @@
  _have_soundcard_h='#undef  HAVE_SYS_SOUNDCARD_H'
 fi
 
+if [ "$_malloc_h" = "yes" ]; then
+ _have_malloc_h='#define HAVE_MALLOC_H 1'
+else
+ _have_malloc_h='#undef  HAVE_MALLOC_H'
+fi
+
+if [ "$_alloca_h" = "yes" ]; then
+ _have_alloca_h='#define HAVE_ALLOCA_H 1'
+else
+ _have_alloca_h='#undef  HAVE_ALLOCA_H'
+fi
+
+if [ "$_sys_mman_h" = "yes" ]; then
+ _have_mman_h='#define HAVE_SYS_MMAN_H 1'
+else
+ _have_mman_h='#undef  HAVE_SYS_MMAN_H'
+fi
+
+if [ "$_libdl" = "yes" ]; then
+ _have_libdl='#define HAVE_LIBDL 1'
+else
+ _have_libdl='#undef  HAVE_LIBDL'
+fi
+
 
 # Checking for CFLAGS
 if [ "$_profile" != "" ] || [ "$_debug" != "" ]; then
- CFLAGS="-W -Wall -O2 -march=$proc -mcpu=$proc $_debug $_profile"
+ CFLAGS="-W -Wall -O2 $_march $_mcpu $_debug $_profile"
 else
 if test -z "$CFLAGS"; then
- CFLAGS="-O4 -march=$proc -mcpu=$proc -pipe -ffast-math -fomit-frame-pointer"
+ CFLAGS="-O4 $_march $_mcpu -pipe -ffast-math -fomit-frame-pointer"
 fi
 fi
 # Under FreeBSD (maybe other systems as well?) we have to add to CFLAGS
@@ -1522,7 +1665,7 @@
 prefix = $_prefix
 AR=ar
 CC=$_cc
-# OPTFLAGS=-O4 $_profile $_debug -march=$proc -mcpu=$proc -pipe -fomit-frame-pointer -ffast-math
+# OPTFLAGS=-O4 $_profile $_debug $_march $_mcpu -pipe -fomit-frame-pointer -ffast-math
 OPTFLAGS=$CFLAGS
 EXTRA_INC=$_extraincdir
 WIN32_PATH=-DWIN32_PATH=\"$_win32libdir\"
@@ -1537,15 +1680,17 @@
 CSS_LIB = $_csslib
 CSS_INC = $_cssinc
 SDL_INC = $_sdlcflags
-DS_DEP = $_dshowdep $_lavcdep
-DS_LIB = $_dshowlib $_lavclib
+DS_DEP = $_dshowdep
+DS_LIB = $_dshowlib
+AV_DEP = $_lavcdep
+AV_LIB = $_lavclib
 ALSA_LIB = $_alsalib
 ESD_LIB = $_esdlib
 ARCH_LIBS = $_archlibs
 STREAM_SRCS = $_streamingsrcs
 
 # --- Some stuff for autoconfigure ----
-TARGET_ARCH_X86=yes
+$_target_arch
 TARGET_CPU=$iproc
 TARGET_MMX=$_cfg_mmx
 TARGET_MMX2=$_cfg_mmx2
@@ -1609,10 +1754,21 @@
 /* Define this if your system has the header file for the OSS sound interface */
 $_have_soundcard_h
 
+/* Define this if your system has the "malloc.h" header file */
+$_have_malloc_h
+
+/* Define this if your system has the "alloca.h" header file */
+$_have_alloca_h
+
+/* Define this if your system has the "sys/mman.h" header file */
+$_have_mman_h
 
-/* Define this if you have the kstat kernel statistics library */
-$_have_kstat
 
+/* Define this if you have the elf dynamic linker -ldl library */
+$_have_libdl
+
+/* Define this if you have the kstat kernel statistics library */
+$_have_libkstat
 
 /* LIRC (remote control, see www.lirc.org) support: */
 $_lircdefs
@@ -1649,9 +1805,9 @@
 
 /* Define if your processor stores words with the most significant
    byte first (like Motorola and SPARC, unlike Intel and VAX).  */
-/* #define WORDS_BIGENDIAN */
+$_words_endian
 
-#define ARCH_X86
+$_arch
 
 /* Define this to any prefered value from 386 up to infinity with step 100 */
 #define __CPU__ $iproc
@@ -1756,13 +1912,19 @@
  echo "version might work. Use --enable-sdl to force usage of libSDL."
 fi
 
-if [ $_win32libdirnotify = yes ]; then
- echo "Failed to find a WIN32 codecs dir at $_win32libdir!"
- echo "Create it and copy the DLL files there! (You can get them from your windows"
- echo "directory or download them from:"
- echo "ftp://thot.banki.hu/esp-team/linux/MPlayer/w32codec.zip"
-else
- echo "Ok, found Win32 codecs directory at $_win32libdir."
+if [ "$host_arch" = i386 ]; then
+    if [ $_win32libdirnotify = yes ]; then
+	echo "Failed to find a WIN32 codecs dir at $_win32libdir!"
+	echo "Create it and copy the DLL files there! (You can get them from your windows"
+	echo "directory or download them from:"
+	echo "ftp://thot.banki.hu/esp-team/linux/MPlayer/w32codec.zip"
+    else
+	echo "Ok, found Win32 codecs directory at $_win32libdir."
+    fi
+else
+    echo "NOTE: WIN32 codec DLLs are not supported on your CPU ($host_arch)."
+    echo "You may encounter a few AVI files that cannot be played due to"
+    echo "missing opensource video/audio codec support."
 fi
 
 # Last move:

Index: dec_audio.c
===================================================================
RCS file: /cvsroot/mplayer/main/dec_audio.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- dec_audio.c	8 Jul 2001 00:21:20 -0000	1.19
+++ dec_audio.c	12 Jul 2001 15:35:51 -0000	1.20
@@ -75,6 +75,10 @@
 
 switch(driver){
 case 4:
+#ifndef	ARCH_X86
+  printf("Win32/ACM audio codec unavailable on non-x86 CPU -> force nosound :(\n");
+  driver=0;
+#else
   // Win32 ACM audio codec:
   if(init_acm_audio_codec(sh_audio)){
     sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec;
@@ -88,6 +92,7 @@
     printf("Could not load/initialize Win32/ACM AUDIO codec (missing DLL file?)\n");
     driver=0;
   }
+#endif
   break;
 case 7:
 #ifndef USE_DIRECTSHOW
@@ -149,6 +154,7 @@
 sh_audio->a_buffer_len=0;
 
 switch(driver){
+#ifdef ARCH_X86
 case 4: {
     int ret=acm_decode_audio(sh_audio,sh_audio->a_buffer,4096,sh_audio->a_buffer_size);
     if(ret<0){
@@ -158,6 +164,7 @@
     sh_audio->a_buffer_len=ret;
     break;
 }
+#endif
 case 2: {
     // AVI PCM Audio:
     WAVEFORMATEX *h=sh_audio->wf;
@@ -320,6 +327,7 @@
         }
         //printf("{3:%d}",avi_header.idx_pos);fflush(stdout);
         break;
+#ifdef ARCH_X86
       case 4:
 //        len=sh_audio->audio_out_minsize; // optimal decoded fragment size
 //        if(len<minlen) len=minlen; else
@@ -327,6 +335,7 @@
 //        len=acm_decode_audio(sh_audio,buf,len);
         len=acm_decode_audio(sh_audio,buf,minlen,maxlen);
         break;
+#endif
 
 #ifdef USE_DIRECTSHOW
       case 7: // DirectShow

Index: dec_video.c
===================================================================
RCS file: /cvsroot/mplayer/main/dec_video.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- dec_video.c	8 Jul 2001 17:20:21 -0000	1.2
+++ dec_video.c	12 Jul 2001 15:35:51 -0000	1.3
@@ -76,6 +76,7 @@
 unsigned int out_fmt=sh_video->codec->outfmt[sh_video->outfmtidx];
 
 switch(sh_video->codec->driver){
+#ifdef ARCH_X86
  case 2: {
    if(!init_video_codec(sh_video,0)) {
 //     GUI_MSG( mplUnknowError )
@@ -142,6 +143,13 @@
    break;
 #endif
  }
+#else	/* !ARCH_X86 */
+ case 2:
+ case 4:
+ case 6:
+   fprintf(stderr,"MPlayer does not support win32 codecs on non-x86 platforms!\n");
+   return 0;
+#endif	/* !ARCH_X86 */
  case 3: {  // OpenDivX
    if(verbose) printf("OpenDivX video codec\n");
    { DEC_PARAM dec_param;
@@ -319,7 +327,9 @@
   }
 #endif
   case 6:
-  case 2: {
+  case 2:
+#ifdef ARCH_X86
+  {
     HRESULT ret;
     unsigned int t=GetTimer();
     unsigned int t2;
@@ -368,6 +378,10 @@
     }
     break;
   }
+#else
+    printf("Win32 video codec unavailable on non-x86 CPU -> force nosound :(\n");
+    break;
+#endif
   case 1: {
         int in_frame=0;
         int t=0;

Index: demuxer.h
===================================================================
RCS file: /cvsroot/mplayer/main/demuxer.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- demuxer.h	3 Jun 2001 23:34:59 -0000	1.5
+++ demuxer.h	12 Jul 2001 15:35:51 -0000	1.6
@@ -1,4 +1,6 @@
 
+#include "config.h"
+
 #define MAX_PACKS 4096
 #define MAX_PACK_BYTES 0x800000
 
@@ -143,7 +145,11 @@
 static inline int avi_stream_id(unsigned int id){
   unsigned char *p=(unsigned char *)&id;
   unsigned char a,b;
+#if WORDS_BIGENDIAN
+  a=p[3]-'0'; b=p[2]-'0';
+#else
   a=p[0]-'0'; b=p[1]-'0';
+#endif
   if(a>9 || b>9) return 100; // invalid ID
   return a*10+b;
 }

Index: dll_init.c
===================================================================
RCS file: /cvsroot/mplayer/main/dll_init.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- dll_init.c	8 Jul 2001 17:20:21 -0000	1.21
+++ dll_init.c	12 Jul 2001 15:35:51 -0000	1.22
@@ -11,7 +11,7 @@
 
 #include "loader.h"
 //#include "wine/mmreg.h"
-//#include "wine/vfw.h"
+#include "wine/vfw.h"
 #include "wine/avifmt.h"
 
 #include "codec-cfg.h"




More information about the MPlayer-cvslog mailing list