summaryrefslogtreecommitdiffstats
path: root/mp3lib
diff options
context:
space:
mode:
authorjkeil <jkeil@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-07-12 15:35:52 +0000
committerjkeil <jkeil@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-07-12 15:35:52 +0000
commit45c97f82942528378393d1819eafbcfb351bc60d (patch)
tree5e6a3ddfc4efdedb81f545b2b3adf3681aadcf50 /mp3lib
parent82eac1391ac173cb1723f8bd8dd5e6caa94a66a8 (diff)
downloadmpv-45c97f82942528378393d1819eafbcfb351bc60d.tar.bz2
mpv-45c97f82942528378393d1819eafbcfb351bc60d.tar.xz
Add some preliminary support for non-x86 architectures to mplayer
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1310 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mp3lib')
-rw-r--r--mp3lib/sr1.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/mp3lib/sr1.c b/mp3lib/sr1.c
index 7a124ee9b9..86b28748a1 100644
--- a/mp3lib/sr1.c
+++ b/mp3lib/sr1.c
@@ -123,7 +123,15 @@ LOCAL unsigned int getbits_fast(short number_of_bits)
// 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 void set_pointer(long backstep)
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;
}