[pulseaudio-discuss] {PATCH][RFC] AC3 passthrough support

Michael Rans mcarans at yahoo.co.uk
Sun Jul 11 10:40:36 PDT 2010


Thanks for this detailed reply.

Would I be right in saying that for this to happen, you cannot define your own 
sinks in default.pa using load-module module-alsa-sink ... but must use the 
moduel detection?

Or can profiles be made to work with the load-module module-alsa-sink ... lines?

Cheers,
Mike




________________________________
From: Tanu Kaskinen <tanuk at iki.fi>
To: pulseaudio-discuss at mail.0pointer.de
Sent: Sun, 11 July, 2010 12:23:25
Subject: Re: [pulseaudio-discuss] {PATCH][RFC] AC3 passthrough support

On Sun, 2010-07-11 at 09:26 +0000, Michael Rans wrote:
> That's the the problem - as you put it "both sinks (spdif/stereo and
> spdif/a52) can't exist at the same time".
> 
> If A52 encoding occurred in Pulseaudio, there would only be one sink,
> hence the switch between stereo and A52 would be transparent and could
> occur even while the music is playing (with a small interruption).

No, doing the encoding in pulseaudio wouldn't change the situation.
There must be separate sinks for stereo and surround modes, because
sinks can't change their channel map on the fly. (Of course that could
be changed, but I don't think such change gets lots of support from the
developers.) What do you mean by "transparent"? You can change the
profile while music plays, that's not a problem.

> Is the A52 profile in Ubuntu Lucid 10.04LTS?

Most likely yes.

I now actually checked what's the situation with the a52 profile on my
own machine. I don't have the profile available, even though I have
other spdif profiles, so I looked at the initialization to see what's
wrong, and found this:

D: alsa-mixer.c: Looking at profile output:iec958-ac3-surround-40
D: alsa-mixer.c: Checking for playback on Digital Surround 4.0 (IEC958/AC3) 
(iec958-ac3-surround-40)
D: alsa-util.c: Trying a52:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)pcm.c: Unknown PCM a52:0
I: alsa-util.c: Error opening PCM device a52:0: No such file or directory

So alsa doesn't find the a52 device at all, even though I do seem to
have the plugin installed (this file
exists: /usr/lib/alsa-lib/libasound/libasound_module_pcm_a52.so). I
don't feel like experimenting, but I would guess that device string
"a52" instead of "a52:0" would work better.

...nah, I did feel like experimenting after all, since all I had to do
was to edit one file
(/usr/local/share/pulseaudio/alsa-mixer/profile-sets/default.conf) and
do some pulseaudio restarting. It turned out that plain a52 didn't work
any better, so what's wrong? Well, at least on Debian there is no device
configured by default that would use the a52 plugin, so I had to add
this to ~/.asoundrc:

pcm.a52 {
    type a52
}

Now I got further:

D: alsa-mixer.c: Looking at profile output:iec958-ac3-surround-40
D: alsa-mixer.c: Checking for playback on Digital Surround 4.0 (IEC958/AC3) 
(iec958-ac3-surround-40)
D: alsa-util.c: Trying a52:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)conf.c: Unknown parameters 0
I: (alsa-lib)pcm.c: Unknown PCM a52:0
I: alsa-util.c: Error opening PCM device a52:0: Invalid argument
D: alsa-util.c: Trying a52 with SND_PCM_NO_AUTO_FORMAT ...
D: alsa-util.c: Managed to open a52
D: alsa-util.c: snd_pcm_hw_params_set_channels(4) failed: Invalid argument
D: alsa-util.c: Trying a52 without SND_PCM_NO_AUTO_FORMAT ...
D: alsa-util.c: Managed to open a52
D: alsa-util.c: snd_pcm_hw_params_set_channels(4) failed: Invalid argument
D: alsa-util.c: Trying plug:a52 with SND_PCM_NO_AUTO_FORMAT ...
D: alsa-util.c: Managed to open plug:a52
D: alsa-util.c: snd_pcm_hw_params_set_channels(4) failed: Invalid argument
D: alsa-util.c: Trying plug:a52 without SND_PCM_NO_AUTO_FORMAT ...
D: alsa-util.c: Managed to open plug:a52
D: alsa-util.c: snd_pcm_hw_params_set_channels(4) failed: Invalid argument
I: alsa-util.c: Failed to set hardware parameters on plug:a52: Invalid argument

That looks good (that's the 4.0 profile, and by default the a52 plugin
uses the 5.1 channel configuration, so the failure is expected). From
that log we can see that indeed, "a52:0" doesn't work, but "a52" does.
That means that you don't have the profile available, because you don't
have the modification in your profile set configuration.

So, what about the 5.1 profile?

D: alsa-mixer.c: Looking at profile output:iec958-ac3-surround-51
D: alsa-mixer.c: Checking for playback on Digital Surround 5.1 (IEC958/AC3) 
(iec958-ac3-surround-51)
D: alsa-util.c: Trying a52:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)conf.c: Unknown parameters 0
I: (alsa-lib)pcm.c: Unknown PCM a52:0
I: alsa-util.c: Error opening PCM device a52:0: Invalid argument
D: alsa-util.c: Trying a52 with SND_PCM_NO_AUTO_FORMAT ...
D: alsa-util.c: Managed to open a52
D: alsa-util.c: Maximum hw buffer size is 320 ms
D: alsa-util.c: Set buffer size first (to 4797 samples), period size second (to 
1199 samples).
I: alsa-util.c: Device a52 doesn't support 44100 Hz, changed to 48000 Hz.
D: alsa-mixer.c: Profile output:iec958-ac3-surround-51 supported.

Whee, it works! I don't have anything to connect the digital output,
though, so I didn't test actual playback, but at least the profile is
now available.

So, the first problem when trying to make the a52 alsa plugin work out
of the box with pulseaudio is that (at least on all distros) the a52
device isn't configured by default. I think it's the job for the
distributions to automatically configure the device when the a52 plugin
is installed.

The second problem is that the a52 device doesn't support the card
argument. I would imagine that the a52 plugin can actually be configured
to use certain card, but passing that configuration just doesn't work
with the simple configuration that I used. It might be possible to come
up with a more complex definition for the a52 device that passes the
parameter correctly to the plugin, but my asoundrc skills are not that
good. In case the a52 plugin really can't be configured to use certain
card, then that's a bug in the plugin.

After those two problems we get to the problems with assertion failures
and too fast playback speed etc...

-- 
Tanu Kaskinen


_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss at mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20100711/97ebabfd/attachment.htm>


More information about the pulseaudio-discuss mailing list