diff --git a/res/tools/dcaenc.exe b/res/tools/dcaenc.exe new file mode 100644 index 00000000..d9852ee1 Binary files /dev/null and b/res/tools/dcaenc.exe differ diff --git a/src/Config.h b/src/Config.h index 12f2d8f6..ca1576d7 100644 --- a/src/Config.h +++ b/src/Config.h @@ -30,7 +30,7 @@ #define VER_LAMEXP_MINOR_LO 4 #define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_PATCH 12 -#define VER_LAMEXP_BUILD 830 +#define VER_LAMEXP_BUILD 832 /////////////////////////////////////////////////////////////////////////////// // Tool versions (minimum expected versions!) diff --git a/src/Encoder_Abstract.cpp b/src/Encoder_Abstract.cpp index e23e5dc5..a96e2010 100644 --- a/src/Encoder_Abstract.cpp +++ b/src/Encoder_Abstract.cpp @@ -47,9 +47,9 @@ void AbstractEncoder::setCustomParams(const QString &customParams) { m_configCus */ // Does encoder require the input to be downmixed to stereo? -bool AbstractEncoder::requiresDownmix(void) +const unsigned int *AbstractEncoder::supportedChannelCount(void) { - return false; + return NULL; } // Does encoder require the input to be downsampled? (NULL-terminated array of supported sampling rates) diff --git a/src/Encoder_Abstract.h b/src/Encoder_Abstract.h index d34ae5e8..7f0ce712 100644 --- a/src/Encoder_Abstract.h +++ b/src/Encoder_Abstract.h @@ -40,8 +40,8 @@ public: virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag) = 0; virtual bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion) = 0; virtual QString extension(void) = 0; - virtual bool requiresDownmix(void); virtual const unsigned int *supportedSamplerates(void); + virtual const unsigned int *supportedChannelCount(void); virtual const unsigned int *supportedBitdepths(void); //Common setter methods diff --git a/src/Encoder_DCA.cpp b/src/Encoder_DCA.cpp index 91bfd1cc..516b8258 100644 --- a/src/Encoder_DCA.cpp +++ b/src/Encoder_DCA.cpp @@ -139,6 +139,12 @@ bool DCAEncoder::isFormatSupported(const QString &containerType, const QString & return false; } +const unsigned int *DCAEncoder::supportedChannelCount(void) +{ + static const unsigned int supportedChannels[] = {1, 2, 4, 5, 6, NULL}; + return supportedChannels; +} + const unsigned int *DCAEncoder::supportedSamplerates(void) { static const unsigned int supportedRates[] = {48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, NULL}; diff --git a/src/Encoder_DCA.h b/src/Encoder_DCA.h index a941e21a..a0ece24a 100644 --- a/src/Encoder_DCA.h +++ b/src/Encoder_DCA.h @@ -36,6 +36,7 @@ public: virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag); virtual bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion); virtual QString extension(void); + virtual const unsigned int *supportedChannelCount(void); virtual const unsigned int *supportedBitdepths(void); virtual const unsigned int *supportedSamplerates(void); diff --git a/src/Encoder_MP3.cpp b/src/Encoder_MP3.cpp index c9cb0723..720c7eb6 100644 --- a/src/Encoder_MP3.cpp +++ b/src/Encoder_MP3.cpp @@ -231,9 +231,10 @@ bool MP3Encoder::isFormatSupported(const QString &containerType, const QString & return false; } -bool MP3Encoder::requiresDownmix(void) +const unsigned int *MP3Encoder::supportedChannelCount(void) { - return true; + static const unsigned int supportedChannels[] = {1, 2, NULL}; + return supportedChannels; } void MP3Encoder::setAlgoQuality(int value) diff --git a/src/Encoder_MP3.h b/src/Encoder_MP3.h index 8070ca4e..666a7f98 100644 --- a/src/Encoder_MP3.h +++ b/src/Encoder_MP3.h @@ -36,7 +36,7 @@ public: virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag); virtual bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion); virtual QString extension(void); - virtual bool requiresDownmix(void); + virtual const unsigned int *supportedChannelCount(void); //Advanced options virtual void setAlgoQuality(int value); diff --git a/src/Thread_Process.cpp b/src/Thread_Process.cpp index b7842246..ce58b2fb 100644 --- a/src/Thread_Process.cpp +++ b/src/Thread_Process.cpp @@ -177,7 +177,7 @@ void ProcessThread::processFile() //------------------------------------ if(bSuccess && IS_WAVE(m_audioFile)) { - if(m_encoder->supportedSamplerates() || m_encoder->supportedBitdepths() || m_encoder->requiresDownmix()) + if(m_encoder->supportedSamplerates() || m_encoder->supportedBitdepths() || m_encoder->supportedChannelCount()) { m_currentStep = AnalyzeStep; bSuccess = m_propDetect->detect(sourceFile, &m_audioFile, &m_aborted); @@ -187,7 +187,7 @@ void ProcessThread::processFile() handleMessage("\n-------------------------------\n"); //Do we need to take care if Stereo downmix? - if(m_encoder->requiresDownmix()) + if(m_encoder->supportedChannelCount()) { insertDownmixFilter(); } @@ -477,6 +477,7 @@ void ProcessThread::insertDownmixFilter(void) if(dynamic_cast(m_filters.at(i))) { qWarning("Encoder requires Stereo downmix, but user has already forced downmix!"); + handleMessage("WARNING: Encoder may need downmixning, but already using downmixning filter. Encoding *may* fail!\n"); applyDownmixing = false; } } @@ -484,8 +485,20 @@ void ProcessThread::insertDownmixFilter(void) //Now add the downmixing filter, if needed if(applyDownmixing) { + bool requiresDownmix = true; + const unsigned int *supportedChannels = m_encoder->supportedChannelCount(); unsigned int channels = m_audioFile.formatAudioChannels(); - if((channels == 0) || (channels > 2)) + + for(int i = 0; supportedChannels[i]; i++) + { + if(supportedChannels[i] == channels) + { + requiresDownmix = false; + break; + } + } + + if(requiresDownmix) { m_filters.append(new DownmixFilter()); } diff --git a/src/Tools.h b/src/Tools.h index 080e621e..95211c4c 100644 --- a/src/Tools.h +++ b/src/Tools.h @@ -56,7 +56,7 @@ g_lamexp_tools[] = {"29da0d3e810bc3e8d2cddb3db452325eefca0d0c1fff1379fa17806ad447752be1b88e2f", CPU_TYPE_X64_ALL, "aften.x64.exe", 8}, {"1cca303fabd889a18fc01c32a7fd861194cfcac60ba63740ea2d7c55d049dbf8f59259fa", CPU_TYPE_ALL_ALL, "alac.exe", 20}, {"6d22d4bbd7ce2162e38f70ac9187bc84eb28233b36ee6c0492d0a6195318782d7f05c444", CPU_TYPE_ALL_ALL, "avs2wav.exe", 13}, - {"d94bea403cbd24a890d91f55a4e4fed47898b21b62de3ba1202da55dc0917187304171f6", CPU_TYPE_ALL_ALL, "dcaenc.exe", 20111222}, + {"28d8cd9eac2f5eaa0871623d616a9dc912de2bbedf06a9f50a3e8f87766dcf2e3d25bd73", CPU_TYPE_ALL_ALL, "dcaenc.exe", 20111222}, {"e53a787d4a0319453f4fe48c3145f190fcce7ac4802e521db908771437f6250746116e6c", CPU_TYPE_ALL_ALL, "elevator.exe", UINT_MAX}, {"9ae98a3fc779f69ee876a3b477fbc35a709ba5066823b2eb62eeb015057c38807e4be51f", CPU_TYPE_ALL_ALL, "faad.exe", 27}, {"446054f9a7f705f1aadc9053ca7b8a86a775499ef159978954ebdea92de056c34f8841f7", CPU_TYPE_ALL_ALL, "flac.exe", 121},