Alexandre Ratchov:

> > I would, but there shouldn't be anything required to make it work.
> > The point of AC3/DTS pass-through mode is that it sends what looks
> > like 16-bit stereo audio at the S/PDIF level.  It's only the receiver
> > that, on seeing a signature bit pattern, re-interprets the data and
> > decodes it according to AC3 or DTS.
> 
> So, I don't even understand how AC3 would work at all. I mean, a lot
> of programs (ie all using sio_onmove(3)) expect that one second of
> s16le at 48kHz be exactly 192000 bytes of data. If AC3 is used, that
> wouldn't be true anymore (AC3 is 320kbit/s iirc) and audio would be
> broken.

Padding, of course.  A video player like MPlayer will format the
AC3 or DTS audio (both of which support numerous bit rates) in such
a way that the result is a 192000 byte/s stream.

The data on a DTS CD is already preformatted to 176400 byte/s and
just needs to be passed through.  I put the disk in, "cdio cdplay",
and the drive, cdio(1), and azalia(4) all think they are dealing
with 44.1 kHz 16-bit stereo audio when in fact it is 6-channel DTS.

As designed, S/PDIF only transmits 20(!)-bit stereo audio at various
sample rates.  However, ISO/IEC 61937 specifies how to carry various
non-PCM audio formats over S/PDIF by formatting them like a 16-bit
stereo stream.  This is widely implemented for AC3 and DTS, rarely
for MPEG audio.

> And this can't be fixed without adding AC3 specific code.

It is handled at the application level.  Check out libmpcodecs/ad_hwac3.c
in the MPlayer source.  There is nothing OpenBSD-specific about
this.  It's the same for FreeBSD, Linux, and probably others.

> > We don't use any "AC3 mode" for azalia(4) either and pass-through
> > works there.
> 
> I bet it only works in few special cases, probably because the clock
> is not involved

And you will lose that bet.  There is no theoretical reason why it
shouldn't work, and in practice it does with everything I've thrown at
it:
* DVD audio tracks, AC3 (2.0, 4.1, 5.1; 192/224/384/448 kbit/s) and
  DTS (5.1; 768 and 1536 kbit/s)
* DTS CD (44.1 kHz)
* AC3 from digital television (2.0 and 5.1; 192/256/384/448 kbit/s)
* DTS extracted from Blu-ray (at the maximum 1536 kbit/s)

-- 
Christian "naddy" Weisgerber                          na...@mips.inka.de

Reply via email to