alsa-project / alsa-plugins

The Advanced Linux Sound Architecture (ALSA) - plugins
GNU Lesser General Public License v2.1
41 stars 28 forks source link

A52 documentation in need of updates. #29

Closed quequotion closed 2 years ago

quequotion commented 3 years ago

a52.txt hasn't been changed in fifteen years.

In that time, a preconfiguration has been supplied that ends up getting merged into a dysfunctional mess if users add a manual configuration to their asound.conf without prepending an exclamation point to override it, and more recently more sample formats have been added.

This file needs some attention.

perexg commented 3 years ago

Volunteer?

nbryant42 commented 3 years ago

I'd love to see some attention paid to documenting the setup process when transmitting an A52 bitstream over HDMI; the default setup (on my distro, at least) only seems to support S/PDIF.

We know HDMI is fully supported at the kernel level, because various media players, such as mplayer, can pass A52 through, but there's something about the plugin stack (either the default config, or the internal implementation) that doesn't handle that use case correctly (for general usage via pulseaudio, etc)

It caused me no end of hair pulling last time I tried to figure it out.

(This arises because some TVs only accept 2-channel PCM but support surround in bitstream compressed formats. I'd send 5.1 channel L-PCM if I could, but that won't work when my TV is directly connected to my HDMI port and attempting to relay to the receiver over ARC.)

quequotion commented 3 years ago

I could give a crack at this, but there's a lot I don't understand, and we need someone with the hardware to test a52 over HDMI to demonstrate it working.

First question:

Where are the strings that users can define for "format" in a manual configuration defined? The example is written when only s16 was supported, so mentions "S16_LE" and “S16_BE". Isn't it possible now to define "S32_LE/BE" and "FLOAT" (or "FLTP"?)

tiwai commented 3 years ago

No, the format parameter in a52 config is about the output format, and this is only 16bit format per definition of AC3. The input format is fixed, you can't change anything in the configuration. The text about the input format needs correction, though (formerly only native endian S16, but now only native endian S32 with the recent ffmpeg).

There shouldn't be too much difference between HDMI output and SPDIF output, and the likely reason of non-working case is the lack of proper IEC958 status bits (especially the non-audio bit). It's often that an SPDIF receiver accepts raw signals even if you forget to set the non-audio bit in IEC958 status control, while it's mandatory for HDMI.

perexg commented 3 years ago

The input format is fixed, you can't change anything in the configuration. The text about the input format needs correction, though (formerly only native endian S16, but now only native endian S32 with the recent ffmpeg).

The input float stream is also supported now (if you force the ac3 encoder instead ac3_fixed using new avcodec field or if the fixed encoder is not enabled in the ffmpeg library).

perexg commented 3 years ago

Clarification, this was changed:

1) input format is fixed according the format used in the ffmpeg library (codec ac3_fixed: s16 for old, s32 for recent, codec ac3: float) 2) a global configuration /usr/share/alsa/alsa.conf.d/60-a52-encoder.conf was introduced which defines the a52 PCM (see source https://github.com/alsa-project/alsa-plugins/blob/4219f4b3fded74d7b07a54c3ba8661d7a18c3b6c/a52/60-a52-encoder.conf for accepted arguments)

quequotion commented 3 years ago

It's often that an SPDIF receiver accepts raw signals even if you forget to set the non-audio bit in IEC958 status control, while it's mandatory for HDMI.

Somewhat off-topic for this thread, but do you think then, that a user wishing to pipe the a52 plugin's output over HDMI could use the iecset utility to get the autoconfiguration working for their device by setting that bit?

perexg commented 2 years ago

PR was merged. Thank you.