[MPlayer-cvslog] r36259 - trunk/libmpcodecs/ad_hwac3.c

reimar subversion at mplayerhq.hu
Thu May 9 12:53:20 CEST 2013


Author: reimar
Date: Thu May  9 12:53:20 2013
New Revision: 36259

Log:
Avoid using swab()

This is the only place where it is used and it is not
available universally (missing e.g. on Android).

Modified:
   trunk/libmpcodecs/ad_hwac3.c

Modified: trunk/libmpcodecs/ad_hwac3.c
==============================================================================
--- trunk/libmpcodecs/ad_hwac3.c	Thu May  9 12:53:18 2013	(r36258)
+++ trunk/libmpcodecs/ad_hwac3.c	Thu May  9 12:53:20 2013	(r36259)
@@ -20,11 +20,9 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#define _XOPEN_SOURCE 600
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 
 #include "config.h"
 #include "mp_msg.h"
@@ -556,10 +554,16 @@ static int decode_audio_dts(unsigned cha
       memcpy(&buf[8], indata_ptr, fsize);
     else
     {
-      swab(indata_ptr, &buf[8], fsize);
+      int i = fsize >> 1;
+      uint16_t *d = buf16 + 4;
+      uint8_t *s = indata_ptr;
+      while (i--) {
+        *d++ = HAVE_BIGENDIAN ? AV_RL16(s) : AV_RB16(s);
+        s += 2;
+      }
       if (fsize & 1) {
-        buf[8+fsize-1] = 0;
-        buf[8+fsize] = indata_ptr[fsize-1];
+        // treat as if there was an additional 0
+        *d++ = HAVE_BIGENDIAN ? *s : *s << 8;
         fsize++;
       }
     }


More information about the MPlayer-cvslog mailing list