[mythtv] Internal DVD Player multichannel support

Mark Spieth mark at dclabs.com.au
Mon May 1 11:23:45 UTC 2006

> I have reviewed this patch and it's not actually quite what I was
> talking about.  I guess I had forgotten that many people use a surround
> sound amp for multichannel.
> What I am after is N channel decoding in Myth, with output to N channels
> of my soundcard.  I don't have a surround amp, I just have a big pile
> (8) of stereo amplifiers which are wired up to the speakers and the PC
> (nothing else).  In this way I was able to build an extremely high end
> system for less than the price of a decent surround amp.

this is what it does.
previously in afd and lavc the channels were always set to 2. thus when the 
decoder is created we have to set the number of channels to decode to N. 
thus lavc and hence afd generate N channel audio instead of 2 channel audio.
then in audiobase (and a config in alsa for num out chans and any other 
audio I/F) it handles the N channel audio out as analog to the alsa (or 
other except at least oss which doesnt work :) as N channel. this works 
fine. there are a few people using it this way. timetretch supported of 
if AC# passthru is on, then it reencodes the N chan audio to AC3 (and 
eventually DTS) for those that want a dig link to their fancy amp which I 
dont have one of.

> Some of the bits of the patch look very interesting.  Can I suggest that
> the best way to proceed is to split the patch out and get some bits into
> SVN now and then it will be easier to work on the complicated parts.
> For example the multichannel timestretch seems like an easy one to break
> out and submit (also submit upstream?).  I think if this went in then at
> least it would be easier to develop the other multichannel aspects
> without having to lug around a big chunk of patch to that file?

yes the timestretch bit is done and its easy to extract by editing the 
latest patch.

> I was a bit nervous about all the changes in avformatdecoder - isn't
> this derived from upstream lavc?  Are we not reproducing stuff that is
> already written elsewhere (eg the conversion from 8 to 16 to 32 bit
> samples, etc?)

reasons explained above.

>>what I wanted to do was incorporate some way of the audio layer handling 
>>number of source channels without being explicitly configured for them.
>>output channels (analog) I thought just limit to 2 and 6 which alsa can
> Well, I was wondering a bit about where the AC3 re-encoding was being
> introduced actually.  I wonder if it might make more sense to
> re-introduce this into the audiobase class instead of partly in
> avformatdecoder?  The fact that it looks like a two channel stereo
> digital output (for example) is something that we probably want to hide?

you can do this too. I was just supporting what people wanted. works fine.
AC3 reencoding is in audiobase only. however I needed to pass some info 
between the layers.
this is part of my rethink but it is necessary in some way. Ideally the 
audio layer should control the decode parameters instead of being pushed 
from decoder to audio layer. its a bit nasty.
no point reencoding if its already AC3 and no timestretch is being used. 
just wastes CPU. and it does use a fair bit.

> It would be a total bodge, but note also that there is a Jack to AC3
> decoder which could be used to patch in temporary AC3 output into Myth,
> and also the code may be worth examining for any clues on implementing
> this stuff.

yes I know. I have it and it helped me do the patch.

> However, it would seem to be one possible option to spit out 6 channel
> audio to the audio library and then have some plugin *there* either
> downmix it to stereo, 2.1, 4.1, 5.1, dolby, etc.

the decoders downmix the audio quite nicely and why do it twice if a more 
optimal once is enough.
the only compromise I did was choice between 2 and 6 channel mode. only AC3 
and DTS decoders AFIAK support 6 ch mode.
note since there is no DTS encoder, a DTS decode to 6 chans is reencoded to 
AC3 for those that want dig passthrough.

> Any chance you could break out the timestretch bits and try to get them
> submitted and I will have a look at working on the core audio routines?

Ill do this. not much point without the rest though.


More information about the mythtv-dev mailing list