Sunday, May 15, 2005

ALSA and passthru

: "Perhaps I can clear up some mystification about AC3 passthrough in
general and mplayer in special:

To get the external decoder solution working, it must be fed with data
which is bitidentical to the chunks in the source ac3 file (compressed
data is very picky about bit errors). Additionally - or better to say
'historically' - the non-audio bit should be set in the spdif status
fields to prevent old spdif hardware from reproducing ugly scratchy
noise. Note: for current decoders (probably those with DTS capability)
this safety bit isn't needed anymore. At least I can state that for my
Sherwood RVD-6095RDS. I think it is due to DTS because DTS sound can
reside on a ordinary AudioCD and an ordinary AudioCD-Player will always
have it's audio-bit set.

The sample format of the data must be 2channel 16bit (little endian
IIRC). Samplerates are 48kHz - although my receiver also accepts
44100Hz. I do not know if this is due to an over-compatability of my
receiver or if 44100 is also possible in the ac3 specs. For safety's
sake lets keep this at 48000Hz. AC3 data chunks are inserted into the
stream every 0x1600 bytes (don't bite me on that, look into
'ac3-iec958.c': 'ac3_iec958_build_burst').

To come back to the problem: data must be played bit-identically through
the soundcard at the correct samplerate and should optionally have it's
non-audio bit set. There are two ways to accomplish this:

1) Some OSS guy invented the format AFMT_AC3. Soundcard drivers
implementing this format should therefore adjust it's mixers and
switches to produce the desired output. Unfortunately some soundcard
drivers do not support this format correctly and most do not even
support it at all (including ALSA)."

0 Comments:

Post a Comment

<< Home