Monday, October 03, 2022

Re: xine's ffmpegaudio doesn't downmix, sio_getpar() reports 6 channels instead of 2

On Thu, Sep 29, 2022 at 04:03:31PM +0000, adr wrote:
> > From sio_open(3):
>
> If the device is exposed by the sndiod(8) server, which is the default
> configuration, a transparent emulation layer will automatically be set
> up, and in this case any combination of rate, encoding and numbers of
> channels is supported.
>
> Apparently the emulation layer (which I don't know anything about)
> is downmixing badly the channels (the sound downmixed by xine
> forcing stereo is perfect).

Proper downmixing (and upmixing, btw) requires knowledge of speaker
position, which sndiod hasn't. The current code simply routes the
signal to the speakers, which is appropriate for music applications
but wrong to route surround channels

> Anyway I think it is a good idea
> to add the audio.output.speaker_arrangement option to the driver,
> so I'm going to contact the xine devs.
>
> I would prefer to hear first if not from the maintainer, at least
> from some other dev, so I'll try again: any thoughts?

You could try to get some feedback from testers, make this diff part
of the ports tree and upstream it then

Alternatively, you could try to handle this in sndiod:

in usr.bin/sndiod/dev.c, the dev_mix_badd() function does the play
conversions.

At first glance, adding surround conversions is a matter of adding the
proper cmap_add() calls. Basically, cmap_add() routes (i.e. mixes) any
number of input channels to any number of output channels.

This would require some plumbing, most probably add more "cmap"
converters to the slot structure, modify slot_initconv() to setup
them, add a command-line option to enable surround (a parameter to the
-j option?).

No comments:

Post a Comment