[mythtv] Channel ordering wrong in 5.1 (at least for me)

Jean-Yves Avenard jyavenard at gmail.com
Sun Apr 4 10:29:05 UTC 2010


Hi

On 4 April 2010 19:30, Ed W <lists at wildgooses.com> wrote:
> OK, understood.  I just checked the alsa code and I see:
> "ReorderSmpteToAlsa6ch"

That's right...

ALSA uses a different channel order than the SMPTE standard (used by
AC3 and DTS).

So when outputting audio via the analog audio, and as such 100% ALSA ;
we have to re-order the channels to map the ALSA order...

You would need to do the same via JACK when outputting analog...

If you look at where ReorderSmpteToAlsa6ch is called ; it's right
before writing to the sound card audio buffer.
Make the same change for JACK, submit it as a ticket, and I will apply
it (if you don't confuse == with = :) )


>
> OK, so my understanding is that on linux at least (possibly everything
> except windows in fact), the channel ordering for analogue output should
> always be the "re-ordered" version?  I would need to look at the code for

It all depends at what the audio software/hardware interface expect. I
know what it is with ALSA, AC3 and DTS. But JACK ? I don't :P

> the spdif encoder (presumably you already know?) but wouldn't be surprised
> to find that it also wants the re-ordered channels?
>

No, if using AC3 or DTS passthrough (or re-encoded AC3) ; SMPTE is
what your amplifier would be expecting ; so leave it as-is

> With that in mind can I suggest that the reordering function be moved to the
> base class so that we don't re-implement it everywhere?

I disagree there...
Each software audio interface have their own order ; SMPTE is what
mythtv now works with.

So far, only ALSA required a re-order ; so you say JACK needs one ;
then move it there. It's up to the JACK code to do so ; not the base
class.

The base class deals with SMPTE channels ; how else could it do it ? A
standard order has to be set: SMPTE

> - Specialist audio filters.  eg I use Brutefir which allows me to apply very
> long FIR filters to the audio in near realtime. It takes a bunch of very
> clever maths, but basically I can measure the parameters of my audio system
> and then apply a correction to fix some of the measured deficiencies.  This
> allows you to get a very high quality audio system and for example apply
> speaker crossovers digitally.  I use DRC to help me calculate global system
> corrections, this is then output directly to a bunch of power amplifiers
> which are hooked up to a bunch of big speakers


correction and high quality audio in the same sentence ? :)

> Great if we can tidy this up a bit and try to get it as solid as possible?
>  For example I'm wondering if we can't move the re-ordering into the point
> where we feed in new samples to the output layer? The driver could indicate
> the format it desires and the base class could do all the re-ordering?  What
> do you think?

I think that it's not up to the base class to do the re-ordering ; it
feeds to the sub-interface class SMPTE ... Much simpler that way ;
it's also what we get from ffmpeg too !

It's less complicated that way, and would require very little rework
to get proper channel ordering in JACK
Just one extra call and one extra function.

Jean-Yves


More information about the mythtv-dev mailing list