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

Arpi arpi at thot.banki.hu
Wed Jan 30 22:57:59 CET 2002


Hi,

> 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.
mplayer's hwac3 never worked wiht sblive :(
it did with a cmedia card.

> 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
huh.

> 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.
unfortunatelly no one of mplayer developers have external ac3 decoder, so we
couldn't fix it.

> So I changed the output format of hwac3 from
> 
> AFMT_AC3 channels=1
>    to
> AFMT_S16_LE channels=2
it's the default.

> 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:
always for cvs.

> 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;

ok i've applied these changes, we'll see if it help for others.

> B) ac3-iec958.c
> line 89: printf(""); /* between variable declaration and memcpy() */
ehh. hmm.
it seem sto be some uninitialized stack variable, but i cannot find where.
or just a buggy C compiler... did you used 2.95 or something buggier?
i've 'unrolled' the array+memcpy, maybe it will help. check please.


A'rpi / Astral & ESP-team

--
mailto:arpi at thot.banki.hu
http://esp-team.scene.hu



More information about the MPlayer-dev-eng mailing list