[mythtv] [mythtv-commits] Ticket #5900: AO: Generalise upmix and AC-3 encoding

foo bar foobum at gmail.com
Mon Nov 10 19:24:48 UTC 2008


> Modern ALSA will automatically resample to 48, but only for cards
> that need it.  Mine does not.

Modern ALSA does software mixing by default and resamples to 48k
before doing so.
That the card supports the original sample rate makes no difference.

> How are you defining SNR?  There is no way you can resample a
> 44.1KHz source into 48KHz and have it be "accurate".

I would venture that it's inaudibly inaccurate.
Details of the resampler, including SNR definition, here:
http://www.mega-nerd.com/SRC/
We use SRC_SINC_BEST_QUALITY.

> Yeah, I just mean *that* feature of the patch.  It would be nice if
> foo could identify which part of the patch I would need to revert.
> The rest of it could be useful.

Assuming your card/receiver can do both 44.1k AC-3 and PCM, the
following should do what you want:

--- libs/libmyth/audiooutputbase.cpp    2008-11-10 19:08:28.000000000 +0000
+++ libs/libmyth/audiooutputbase.cpp    2008-11-10 19:09:41.000000000 +0000
@@ -252,7 +252,7 @@
     {
         VERBOSE(VB_AUDIO, LOC + "Creating AC-3 Encoder");
         encoder = new AudioOutputDigitalEncoder();
-        if (!encoder->Init(CODEC_ID_AC3, 448000, 48000,
+        if (!encoder->Init(CODEC_ID_AC3, 448000, audio_samplerate,
                            configured_audio_channels, audio_reenc))
         {
             VERBOSE(VB_AUDIO, LOC + "Can't create AC-3 encoder");
@@ -272,7 +272,7 @@

     // Always resample to 48k - many cards can't do anything else
     // and ALSA will do it with linear interpolation (yuk) if we don't anyway
-    if (audio_samplerate != 48000)
+    if (0)
     {
         int error;
         audio_samplerate = 48000;


More information about the mythtv-dev mailing list