[Mplayer-cvslog] CVS: main/mp3lib sr1.c,1.11,1.12

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


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

Modified Files:
	sr1.c 
Log Message:
Add some preliminary support for non-x86 architectures to mplayer


Index: sr1.c
===================================================================
RCS file: /cvsroot/mplayer/main/mp3lib/sr1.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- sr1.c	4 Jul 2001 20:54:09 -0000	1.11
+++ sr1.c	12 Jul 2001 15:35:52 -0000	1.12
@@ -123,7 +123,15 @@
 //  if(MP3_frames>=7741) printf("getbits_fast: bits=%d  bitsleft=%d  wordptr=%x\n",number_of_bits,bitsleft,wordpointer);
   if((bitsleft-=number_of_bits)<0) return 0;
   if(!number_of_bits) return 0;
+#if	ARCH_X86
   rval = bswap_16(*((unsigned short *)wordpointer));
+#else
+  /*
+   * we may not be able to address unaligned 16-bit data on non-x86 cpus.
+   * Fall back to some portable code.
+   */
+  rval = wordpointer[0] << 8 | wordpointer[1];
+#endif
          rval <<= bitindex;
          rval &= 0xffff;
          bitindex += number_of_bits;
@@ -158,7 +166,19 @@
 
 LOCAL int stream_head_read(unsigned char *hbuf,unsigned long *newhead){
   if(mp3_read(hbuf,4) != 4) return FALSE;
+#if ARCH_X86
   *newhead = bswap_32(*((unsigned long *)hbuf));
+#else
+  /*
+   * we may not be able to address unaligned 32-bit data on non-x86 cpus.
+   * Fall back to some portable code.
+   */
+  *newhead = 
+      hbuf[0] << 24 |
+      hbuf[1] << 16 |
+      hbuf[2] <<  8 |
+      hbuf[3];
+#endif
   return TRUE;
 }
 




More information about the MPlayer-cvslog mailing list