Ticket #8239: ac3_48k.diff

File ac3_48k.diff, 1.7 KB (added by foobum <foobum@…>, 16 years ago)
  • mythtv/libs/libmyth/audiooutputbase.cpp

    diff --git a/mythtv/libs/libmyth/audiooutputbase.cpp b/mythtv/libs/libmyth/audiooutputbase.cpp
    index 6db02f2..e77f0b0 100644
    a b void AudioOutputBase::Reconfigure(const AudioSettings &orig_settings)  
    305305            resample = false;
    306306    }
    307307
     308    // Force resampling if we are encoding to AC3 and sr > 48k
     309    if (audio_enc && audio_samplerate > 48000)
     310    {
     311        VERBOSE(VB_AUDIO, LOC + "Forcing resample to 48k for AC3 encode");
     312        if (src_quality < 0)
     313            src_quality = 1;
     314        resample = true;
     315    }
     316
    308317    if (resample && src_quality >= 0)
    309318    {
    310319        int error;
    311320        audio_samplerate = rates.back();
     321        // Limit sr to 48k if we are encoding to AC3
     322        if (audio_enc && audio_samplerate > 48000) {
     323            VERBOSE(VB_AUDIO, LOC + "Limiting samplerate to 48k for AC3 encode");
     324            audio_samplerate = 48000;
     325        }
    312326        VERBOSE(VB_GENERAL, LOC + QString("Using resampler. From: %1 to %2")
    313327            .arg(settings.samplerate).arg(audio_samplerate));
    314328        src_ctx = src_new(2-src_quality, source_audio_channels, &error);
    void AudioOutputBase::Reconfigure(const AudioSettings &orig_settings)  
    332346        encoder = new AudioOutputDigitalEncoder();
    333347        if (!encoder->Init(CODEC_ID_AC3, 448000, audio_samplerate, audio_channels))
    334348        {
    335             VERBOSE(VB_AUDIO, LOC + "Can't create AC-3 encoder");
     349            VERBOSE(VB_IMPORTANT, LOC + "Can't create AC-3 encoder");
    336350            delete encoder;
    337351            encoder = NULL;
     352            audio_enc = false;
    338353        }
    339354    }
    340355