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

Ulion ulion2002 at gmail.com
Mon Sep 17 03:18:07 CEST 2007


> --- libaf/af_format.h
> ...
> +#define AF_FORMAT_IS_AC3(fmt) ((fmt & AF_FORMAT_SPECIAL_MASK) == AF_FORMAT_AC3)

should be
+#define AF_FORMAT_IS_AC3(fmt) (((fmt) & AF_FORMAT_SPECIAL_MASK) ==
AF_FORMAT_AC3)

> --- libao2/ao_alsa.c
> @@ -539,6 +536,9 @@
>           mp_msg(MSGT_AO,MSGL_INFO,
>                 MSGTR_AO_ALSA_FormatNotSupportedByHardware, af_fmt2str_short(format));
>           alsa_format = SND_PCM_FORMAT_S16_LE;
> +         if (AF_FORMAT_IS_AC3(ao_data.format))
> +           ao_data.format = AF_FORMAT_AC3_LE;
> +         else          ao_data.format = AF_FORMAT_S16_LE;
>        }

I do known alsa also support AC3_BE for some card on some platform, so
set ao_data.format to AF_FORMAT_AC3_LE is not correctly.
The behavior should be: No matter what byte-order input ac3 stream is
using, if the test failed, try change the endian and continue. So
maybe this is better if it not cause a dead loop.

> +         if (ao_data.format == AF_FORMAT_AC3_BE)
> +           ao_data.format = AF_FORMAT_AC3_LE;
> +         else if (ao_data.format == AF_FORMAT_AC3_LE)
> +           ao_data.format = AF_FORMAT_AC3_BE;
> +         else ao_data.format = AF_FORMAT_S16_LE;

Other parts still not reviewed.

-- 
Ulion



More information about the MPlayer-dev-eng mailing list