diff --git a/etc/Translation/Blank.ts b/etc/Translation/Blank.ts index 1c1895fe..ddb82243 100644 --- a/etc/Translation/Blank.ts +++ b/etc/Translation/Blank.ts @@ -199,6 +199,10 @@ n/a + + Aften &minus; A/52 audio encoder + + AudioFileModel @@ -596,10 +600,6 @@ Custom Encoder Parameters - - LAME: - - OggEnc2: @@ -1276,6 +1276,14 @@ Aften A/52 + + Lame MP3: + + + + Aften A/52: + + MetaInfo diff --git a/etc/Translation/LameXP_DE.ts b/etc/Translation/LameXP_DE.ts index cf374a41..93e8808a 100644 --- a/etc/Translation/LameXP_DE.ts +++ b/etc/Translation/LameXP_DE.ts @@ -199,6 +199,10 @@ Note: This demo (pre-release) version of LameXP will expire at %1. Still %2 days left. Hinweise: Diese Demo (Test) Version von LameXP läuft am %1 ab. Noch %2 Tage übrig. + + Aften &minus; A/52 audio encoder + + AudioFileModel @@ -1133,10 +1137,6 @@ Custom Encoder Parameters Benutzerdefinierte Parameter - - LAME: - - OggEnc2: @@ -1277,6 +1277,14 @@ Aften A/52 + + Lame MP3: + + + + Aften A/52: + + MetaInfo diff --git a/etc/Translation/LameXP_ES.ts b/etc/Translation/LameXP_ES.ts index a400b29e..c7de8712 100644 --- a/etc/Translation/LameXP_ES.ts +++ b/etc/Translation/LameXP_ES.ts @@ -199,6 +199,10 @@ Note: This demo (pre-release) version of LameXP will expire at %1. Still %2 days left. Nota: Esta es una versión demo (pre-final) de LameXP que expirará el %1. Quedan %2 días restantes. + + Aften &minus; A/52 audio encoder + + AudioFileModel @@ -1132,10 +1136,6 @@ Custom Encoder Parameters Personalizar parámetros de codificación - - LAME: - LAME: - OggEnc2: QggEnc2: @@ -1276,6 +1276,14 @@ Aften A/52 + + Lame MP3: + Lame MP3: + + + Aften A/52: + + MetaInfo diff --git a/etc/Translation/LameXP_FR.ts b/etc/Translation/LameXP_FR.ts index 545b18cd..1a70a382 100644 --- a/etc/Translation/LameXP_FR.ts +++ b/etc/Translation/LameXP_FR.ts @@ -203,6 +203,10 @@ Note: This demo (pre-release) version of LameXP will expire at %1. Still %2 days left. + + Aften &minus; A/52 audio encoder + + AudioFileModel @@ -1141,10 +1145,6 @@ Sélection automatique (par défaut) Custom Encoder Parameters Paramètres d'encodage personnalisés - - LAME: - LAME : - OggEnc2: OggEnc2 : @@ -1286,6 +1286,14 @@ Ouvrir le dossier récursivement... Aften A/52 + + Lame MP3: + Lame MP3: + + + Aften A/52: + + MetaInfo diff --git a/etc/Translation/LameXP_IT.ts b/etc/Translation/LameXP_IT.ts index 7ab0fe7d..ad2d1043 100644 --- a/etc/Translation/LameXP_IT.ts +++ b/etc/Translation/LameXP_IT.ts @@ -199,6 +199,10 @@ Note: This demo (pre-release) version of LameXP will expire at %1. Still %2 days left. + + Aften &minus; A/52 audio encoder + + AudioFileModel @@ -1133,10 +1137,6 @@ Custom Encoder Parameters - - LAME: - - OggEnc2: @@ -1277,6 +1277,14 @@ Aften A/52 + + Lame MP3: + Lame MP3: + + + Aften A/52: + + MetaInfo diff --git a/etc/Translation/LameXP_KR.ts b/etc/Translation/LameXP_KR.ts index fc2923a9..330f8f3b 100644 --- a/etc/Translation/LameXP_KR.ts +++ b/etc/Translation/LameXP_KR.ts @@ -199,6 +199,10 @@ Note: This demo (pre-release) version of LameXP will expire at %1. Still %2 days left. + + Aften &minus; A/52 audio encoder + + AudioFileModel @@ -596,10 +600,6 @@ Custom Encoder Parameters 인코더 사용자 매개 변수 - - LAME: - LAME: - OggEnc2: OggEnc2: @@ -1276,6 +1276,14 @@ Aften A/52 + + Lame MP3: + + + + Aften A/52: + + MetaInfo diff --git a/etc/Translation/LameXP_RU.ts b/etc/Translation/LameXP_RU.ts index 6541ec4b..33b1b010 100644 --- a/etc/Translation/LameXP_RU.ts +++ b/etc/Translation/LameXP_RU.ts @@ -199,6 +199,10 @@ Note: This demo (pre-release) version of LameXP will expire at %1. Still %2 days left. + + Aften &minus; A/52 audio encoder + + AudioFileModel @@ -596,10 +600,6 @@ Custom Encoder Parameters Пользовательские параметры кодера - - LAME: - - OggEnc2: @@ -1278,6 +1278,14 @@ Aften A/52 + + Lame MP3: + + + + Aften A/52: + + MetaInfo diff --git a/etc/Translation/LameXP_UK.ts b/etc/Translation/LameXP_UK.ts index 3cfd6033..58384439 100644 --- a/etc/Translation/LameXP_UK.ts +++ b/etc/Translation/LameXP_UK.ts @@ -199,6 +199,10 @@ Note: This demo (pre-release) version of LameXP will expire at %1. Still %2 days left. + + Aften &minus; A/52 audio encoder + + AudioFileModel @@ -1132,10 +1136,6 @@ Custom Encoder Parameters Користувацькі параметри кодування - - LAME: - LAME: - OggEnc2: OggEnc2: @@ -1276,6 +1276,14 @@ Aften A/52 + + Lame MP3: + + + + Aften A/52: + + MetaInfo diff --git a/res/localization/LameXP_DE.qm b/res/localization/LameXP_DE.qm index 34523e29..9e5b5a23 100644 Binary files a/res/localization/LameXP_DE.qm and b/res/localization/LameXP_DE.qm differ diff --git a/res/localization/LameXP_ES.qm b/res/localization/LameXP_ES.qm index 86284ae9..18feb6cf 100644 Binary files a/res/localization/LameXP_ES.qm and b/res/localization/LameXP_ES.qm differ diff --git a/res/localization/LameXP_FR.qm b/res/localization/LameXP_FR.qm index cb94d297..fb5753ba 100644 Binary files a/res/localization/LameXP_FR.qm and b/res/localization/LameXP_FR.qm differ diff --git a/res/localization/LameXP_IT.qm b/res/localization/LameXP_IT.qm index 2df7e9cf..373a3f2e 100644 Binary files a/res/localization/LameXP_IT.qm and b/res/localization/LameXP_IT.qm differ diff --git a/res/localization/LameXP_KR.qm b/res/localization/LameXP_KR.qm index 062500e4..ad346727 100644 Binary files a/res/localization/LameXP_KR.qm and b/res/localization/LameXP_KR.qm differ diff --git a/res/localization/LameXP_UK.qm b/res/localization/LameXP_UK.qm index e9d8d5c8..ca60b842 100644 Binary files a/res/localization/LameXP_UK.qm and b/res/localization/LameXP_UK.qm differ diff --git a/src/Config.h b/src/Config.h index 86eccd7d..9b8f8f3e 100644 --- a/src/Config.h +++ b/src/Config.h @@ -29,8 +29,8 @@ #define VER_LAMEXP_MINOR_HI 0 #define VER_LAMEXP_MINOR_LO 2 #define VER_LAMEXP_TYPE Alpha -#define VER_LAMEXP_PATCH 10 -#define VER_LAMEXP_BUILD 485 +#define VER_LAMEXP_PATCH 12 +#define VER_LAMEXP_BUILD 488 /////////////////////////////////////////////////////////////////////////////// // Tools versions diff --git a/src/Encoder_AC3.cpp b/src/Encoder_AC3.cpp index 7627cb6d..98196f6d 100644 --- a/src/Encoder_AC3.cpp +++ b/src/Encoder_AC3.cpp @@ -135,6 +135,12 @@ QString AC3Encoder::extension(void) return "ac3"; } +const unsigned int *AC3Encoder::requiresDownsample(void) +{ + static const unsigned int supportedRates[] = {48000, 44100, 32000, NULL}; + return supportedRates; +} + bool AC3Encoder::isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion) { if(containerType.compare("Wave", Qt::CaseInsensitive) == 0) diff --git a/src/Encoder_AC3.h b/src/Encoder_AC3.h index 47503fa1..679279aa 100644 --- a/src/Encoder_AC3.h +++ b/src/Encoder_AC3.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 *requiresDownsample(void); private: const QString m_binary; diff --git a/src/Encoder_Abstract.cpp b/src/Encoder_Abstract.cpp index 791dcd6e..9f6786f5 100644 --- a/src/Encoder_Abstract.cpp +++ b/src/Encoder_Abstract.cpp @@ -45,11 +45,19 @@ void AbstractEncoder::setCustomParams(const QString &customParams) { m_configCus /* * Default implementation */ + +// Does encoder require the input to be downmixed to stereo? bool AbstractEncoder::requiresDownmix(void) { return false; } +// Does encoder require the input to be downsampled? (NULL-terminated array of supported sampling rates) +const unsigned int *AbstractEncoder::requiresDownsample(void) +{ + return NULL; +} + /* * Helper functions */ diff --git a/src/Encoder_Abstract.h b/src/Encoder_Abstract.h index cb9fe6ec..6b6cd102 100644 --- a/src/Encoder_Abstract.h +++ b/src/Encoder_Abstract.h @@ -41,6 +41,7 @@ public: 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 *requiresDownsample(void); //Common setter methods void setBitrate(int bitrate); diff --git a/src/Thread_Process.cpp b/src/Thread_Process.cpp index 20d748c0..be4f6089 100644 --- a/src/Thread_Process.cpp +++ b/src/Thread_Process.cpp @@ -28,6 +28,7 @@ #include "Decoder_Abstract.h" #include "Filter_Abstract.h" #include "Filter_Downmix.h" +#include "Filter_Resample.h" #include "Registry_Decoder.h" #include "Model_Settings.h" @@ -40,6 +41,9 @@ #include #include +#include + +#define DIFF(X,Y) ((X > Y) ? (X-Y) : (Y-X)) QMutex *ProcessThread::m_mutex_genFileName = NULL; @@ -83,6 +87,10 @@ ProcessThread::~ProcessThread(void) LAMEXP_DELETE(m_encoder); } +//////////////////////////////////////////////////////////// +// Thread Entry Point +//////////////////////////////////////////////////////////// + void ProcessThread::run() { try @@ -117,7 +125,13 @@ void ProcessThread::processFile() emit processStateFinished(m_jobId, outFileName, false); return; } - + + //Do we need to take of downsampling the input? + if(m_encoder->requiresDownsample()) + { + insertDownsampleFilter(); + } + //Do we need Stereo downmix? if(m_audioFile.formatAudioChannels() > 2 && m_encoder->requiresDownmix()) { @@ -324,6 +338,50 @@ QString ProcessThread::generateTempFileName(void) return tempFileName; } +void ProcessThread::insertDownsampleFilter(void) +{ + bool applyDownsampling = true; + + //Check if downsampling filter is already in the chain + for(int i = 0; i < m_filters.count(); i++) + { + if(dynamic_cast(m_filters.at(i))) + { + qWarning("Encoder requires downsampling, but user has already set resamling filter!"); + applyDownsampling = false; + } + } + + //Now add the downsampling filter, if needed + if(applyDownsampling) + { + const unsigned int *supportedRates = m_encoder->requiresDownsample(); + const unsigned int inputRate = m_audioFile.formatAudioSamplerate(); + unsigned int currentDiff = UINT_MAX, minimumDiff = UINT_MAX, bestRate = UINT_MAX; + + //Find the most suitable supported sampling rate + for(int i = 0; supportedRates[i]; i++) + { + currentDiff = DIFF(inputRate, supportedRates[i]); + if(currentDiff < minimumDiff) + { + bestRate = supportedRates[i]; + minimumDiff = currentDiff; + if(!(minimumDiff > 0)) break; + } + } + + if(bestRate != inputRate) + { + m_filters.prepend(new ResampleFilter((bestRate != UINT_MAX) ? bestRate : supportedRates[0])); + } + } +} + +//////////////////////////////////////////////////////////// +// PUBLIC FUNCTIONS +//////////////////////////////////////////////////////////// + void ProcessThread::addFilter(AbstractFilter *filter) { m_filters.append(filter); diff --git a/src/Thread_Process.h b/src/Thread_Process.h index c10e8c72..f9f5eb7b 100644 --- a/src/Thread_Process.h +++ b/src/Thread_Process.h @@ -67,6 +67,7 @@ private: void processFile(); QString generateOutFileName(void); QString generateTempFileName(void); + void insertDownsampleFilter(void); const QUuid m_jobId; AudioFileModel m_audioFile;