[MPlayer-dev-eng] simple patch to get hwac3 working

Marcus Blomenkamp Marcus.Blomenkamp at epost.de
Wed Jan 30 21:15:33 CET 2002


Hi folks.
I spend some time fiddling with ac3 passthrough in mplayer. The
traditional way of setting the output format to AFMT_AC3 was no ideal
solution since not all digital io cards/drivers supported this format or
honoured it to set the spdif non-audio bit. To make it short, it only
worked with oss sblive driver IIRC.

Inspired by alsa's ac3dec program I found an alternative way by
inspecting to which format the alsa device had been set. Suprise: it was
simple 16bit_le 2_channel pcm. So setting the non-audio bit doesn't
necessarily mean the point. The only important thing seems to be
bit-identical output at the correct samplerate. Modern AV-Receivers seem
to be quite tolerant/compatible.


So I changed the output format of hwac3 from

AFMT_AC3 channels=1
   to
AFMT_S16_LE channels=2

and corrected the absolute time calculation. That was all to get it
running for me.

At least theoretically. Practically I had to add a dummy instruction
into ac3-iec958.c. I absolutely don't know why ac3_iec958_build_burst()
misbehaves if the dummy is missing. Inside xxx_burst() a spdif ac3
preambel is written in front of the ac3 frame, but outside of the
function (for the caller) this portion of the buffer shows reproducibly
wrong content. Only the preambel is wrong, not the rest of the frame.
Again, I don't know why, but a dummy printf("") works fine.

I did not yet produce a patch since I don't know whether against 0.6 or 
CVS. Instead I'll list the neccessary four modifications against 0.6 here:

A) dec_audio.c

case AFM_HWAC3: (.. some lines ..)
line 398: sh_audio->sample_format = AFMT_S16_LE;

case AFM_HWAC3: (.. some lines ..)
line 618: sh_audio->channels = 2;
line 619: sh_audio->samplesize = 2;

B) ac3-iec958.c
line 89: printf(""); /* between variable declaration and memcpy() */


Please do also cc directly to me since I'm not on the list. Gonna work 
on a CVS patch now.

cu Marcus




More information about the MPlayer-dev-eng mailing list