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

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Thu Nov 15 12:49:44 CET 2007


Hello,
On Wed, Sep 19, 2007 at 11:19:12PM +0800, Ulion wrote:
[...]
> And also, in ao_alsa.c need more fix here to make ao alsa work
> correctly when input format is either AC3_LE or AC3_BE.
> 
> > +         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;
> > +           alsa_format = SND_PCM_FORMAT_S16_BE;
> > +         }
> > +         else ao_data.format = AF_FORMAT_S16_LE;

What exactly does this fix? You said before it should try big-endian AC3
as fallback well, but the current code doesn't do that either.
So does this actually fix a regression? If not, it should be in a
different patch.

> The ao oss part of patch also has problem, here's part of a working
> patch fixed and tested by me.
> 
> Index: libao2/ao_oss.c
> ===================================================================
> @@ -294,14 +294,17 @@
>  #if defined(FD_CLOEXEC) && defined(F_SETFD)
>    fcntl(audio_fd, F_SETFD, FD_CLOEXEC);
>  #endif
> -
> -  if(format == AF_FORMAT_AC3) {
> +
> +  if (AF_FORMAT_IS_AC3(format)) {
> +    format = AF_FORMAT_AC3_NE;
> +    ao_data.format=format;
>      ao_data.samplerate=rate;
>      ioctl (audio_fd, SNDCTL_DSP_SPEED, &ao_data.samplerate);
>    }
> 
>  ac3_retry:
> -  ao_data.format=format;
> +  if (!AF_FORMAT_IS_AC3(ao_data.format))
> +    ao_data.format=format;
>    oss_format=format2oss(format);
>    if (oss_format == -1) {
>  #ifdef WORDS_BIGENDIAN
> @@ -323,14 +326,15 @@
>         mp_msg(MSGT_AO,MSGL_WARN,"WARNING! Your soundcard does NOT
> support %s sample format! Broken audio or bad playback speed are
> possible! Try with '-af format'\n",audio_out_format_name(format));
>  #endif
> 
> -  ao_data.format = oss2format(oss_format);
> +  if (!AF_FORMAT_IS_AC3(ao_data.format))
> +    ao_data.format = oss2format(oss_format);
>    if (ao_data.format == -1) return 0;
> 
>    mp_msg(MSGT_AO,MSGL_V,"audio_setup: sample format: %s (requested: %s)\n",

I can't even seen what this patch does _different_ than mine, except
that it might work when OSS does not define AFMT_AC3, but that would
actually be a bug??

Greetings,
Reimar Döffinger



More information about the MPlayer-dev-eng mailing list