[MPlayer-dev-eng] [PATCH] add support for AC3 endianness

Ulion ulion2002 at gmail.com
Mon Sep 17 08:58:23 CEST 2007


> --- ad_hwac3.c
> +    AV_WB16(buf    , 0xF872);   // iec 61937 syncword 1
> +    AV_WB16(buf + 2, 0x4E1F);   // iec 61937 syncword 2
> +    buf[4] = sh_audio->a_in_buffer[5] & 0x7; // bsmod
> +    buf[5] = 0x01;              // data-type ac3
> +    AV_WB16(buf + 6, len << 3); // number of bits in payload

since no byte-order change needed here, maybe we can make it more explicitly.
+ buf[0] = 0xF8;
+ buf[1] = 0x72;
+ buf[2] = 0x4E;
+ buf[3] = 0x1F;
+ buf[4] = sh_audio->a_in_buffer[5] & 0x7; // bsmod
+ buf[5] = 0x01;              // data-type ac3
+ buf[6] = (len >> 5) & 0xFF; // number of bits in payload
+ buf[7] = (len << 3) & 0xFF;

dts part also make samilar changes, or keep the last one AV_WB16 for
length as you like.

I think AV_WB16 is some kind of implicative way to do what we want, it
even use bswap_16 on little-endian byte-order platform, not directly
just as assigning byte by byte ourselves.

-- 
Ulion



More information about the MPlayer-dev-eng mailing list