[MPlayer-dev-eng] [PATCH] bigendian fix for hwac3

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Sep 15 10:16:00 CEST 2007


Hello,
On Sat, Sep 15, 2007 at 08:17:28AM +0800, Ulion wrote:
[...]
> I made a patch according to your sample code, here it is.

I already did this yesterday, but I lack information if the same is
necessary for AC3. And I am actually surprised that odd size is allowed
at all since both AC3 and DTS are formats based on 16bit samples AFAICT.
Btw.: the comment still didn't apply anymore, since the last byte was
copied with the code as is, it just wasn't copied the right way.

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libmpcodecs/ad_hwac3.c
===================================================================
--- libmpcodecs/ad_hwac3.c	(revision 24459)
+++ libmpcodecs/ad_hwac3.c	(working copy)
@@ -168,6 +169,11 @@
     memcpy(buf + 8, sh_audio->a_in_buffer, len);
 #else
     swab(sh_audio->a_in_buffer, buf + 8, len);
+    if (len & 1) {
+      buf[8+len-1] = 0;
+      buf[8+len] = sh_audio->a_in_buffer[len-1];
+      len++;
+    }
 #endif
     memset(buf + 8 + len, 0, 6144 - 8 - len);
 
@@ -361,8 +366,11 @@
   memcpy(&buf[8], indata_ptr, fsize);
 #else
   swab(indata_ptr, &buf[8], fsize);
-  if (fsize & 1)
-    buf[8+fsize-1] = indata_ptr[fsize-1];
+  if (fsize & 1) {
+    buf[8+fsize-1] = 0;
+    buf[8+fsize] = indata_ptr[fsize-1];
+    fsize++;
+  }
 #endif
   memset(&buf[fsize + 8], 0, nr_samples * 2 * 2 - (fsize + 8));
 


More information about the MPlayer-dev-eng mailing list