changeset 17923:ad7675dee42c

Fix for playing RealVideo on PPC/big endian processors. Patch by Emanuele Giaquinta (emanuele ! giaquinta () gmail ! com).
author mosu
date Wed, 22 Mar 2006 18:58:03 +0000
parents ee014d7dbaff
children 0eac85e451cb
files libmpdemux/demux_mkv.c
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_mkv.c	Wed Mar 22 18:25:21 2006 +0000
+++ b/libmpdemux/demux_mkv.c	Wed Mar 22 18:58:03 2006 +0000
@@ -2724,12 +2724,26 @@
   dp_hdr_t *hdr;
   uint8_t chunks;
   int isize;
+#ifdef WORDS_BIGENDIAN
+  uint8_t *p;
+  int i;
+#endif
 
   chunks = *buffer++;
   isize = --size - (chunks+1)*8;
   dp = new_demux_packet (sizeof (*hdr) + size);
   memcpy (dp->buffer + sizeof(*hdr), buffer + (chunks+1)*8, isize);
+#ifdef WORDS_BIGENDIAN
+  p = (uint8_t *)(dp->buffer + sizeof(*hdr) + isize);
+  for (i = 0; i<(chunks+1)*8; i+=4) {
+    p[i] = *((uint8_t *)buffer+i+3);
+    p[i+1] = *((uint8_t *)buffer+i+2);
+    p[i+2] = *((uint8_t *)buffer+i+1);
+    p[i+3] = *((uint8_t *)buffer+i);
+  }
+#else
   memcpy (dp->buffer + sizeof(*hdr) + isize, buffer, (chunks+1)*8);
+#endif
 
   hdr = (dp_hdr_t *) dp->buffer;
   hdr->len = isize;