diff --git a/LameXP.vcproj b/LameXP.vcproj index 2a669ec3..0f7f6953 100644 --- a/LameXP.vcproj +++ b/LameXP.vcproj @@ -326,6 +326,10 @@ RelativePath=".\src\Decoder_Wave.cpp" > + + @@ -546,6 +550,10 @@ RelativePath=".\src\Decoder_Wave.h" > + + diff --git a/etc/Translation/Blank.ts b/etc/Translation/Blank.ts index c8653e2f..ea7f8dcb 100644 --- a/etc/Translation/Blank.ts +++ b/etc/Translation/Blank.ts @@ -111,6 +111,14 @@ AC3Filter Tools - AC3/DTS Decoder + + WavPack - Hybrid Lossless Compression + + + + Completely open audio compression format. + + Monkey's Audio - Lossless Audio Compressor diff --git a/etc/Translation/LameXP_DE.ts b/etc/Translation/LameXP_DE.ts index 2a916e84..13b36cb9 100644 --- a/etc/Translation/LameXP_DE.ts +++ b/etc/Translation/LameXP_DE.ts @@ -147,6 +147,14 @@ Freely available source code, simple SDK and non-restrictive licensing. Frei verfügbarer Quellcode, einfaches SDK und nicht-restriktive Lizenz. + + WavPack - Hybrid Lossless Compression + + + + Completely open audio compression format. + Komplett offenes Audio Kompressionsformat. + AudioFileModel diff --git a/etc/Translation/LameXP_ES.ts b/etc/Translation/LameXP_ES.ts index d624a945..d1524adf 100644 --- a/etc/Translation/LameXP_ES.ts +++ b/etc/Translation/LameXP_ES.ts @@ -148,6 +148,14 @@ Freely available source code, simple SDK and non-restrictive licensing. + + WavPack - Hybrid Lossless Compression + + + + Completely open audio compression format. + + AudioFileModel diff --git a/etc/Translation/LameXP_FR.ts b/etc/Translation/LameXP_FR.ts index 6a4bbcf5..785463c1 100644 --- a/etc/Translation/LameXP_FR.ts +++ b/etc/Translation/LameXP_FR.ts @@ -150,6 +150,14 @@ Freely available source code, simple SDK and non-restrictive licensing. + + WavPack - Hybrid Lossless Compression + + + + Completely open audio compression format. + + AudioFileModel diff --git a/etc/Translation/LameXP_IT.ts b/etc/Translation/LameXP_IT.ts index 331cda27..cd6422de 100644 --- a/etc/Translation/LameXP_IT.ts +++ b/etc/Translation/LameXP_IT.ts @@ -147,6 +147,14 @@ Freely available source code, simple SDK and non-restrictive licensing. + + WavPack - Hybrid Lossless Compression + + + + Completely open audio compression format. + + AudioFileModel diff --git a/etc/Translation/update.lst b/etc/Translation/update.lst index c481f438..54ddaf07 100644 --- a/etc/Translation/update.lst +++ b/etc/Translation/update.lst @@ -15,6 +15,7 @@ ..\..\src\Decoder_MP3.cpp ..\..\src\Decoder_Vorbis.cpp ..\..\src\Decoder_Wave.cpp +..\..\src\Decoder_WavPack.cpp ..\..\src\Decoder_WMA.cpp ..\..\src\Dialog_About.cpp ..\..\src\Dialog_DropBox.cpp @@ -61,6 +62,7 @@ ..\..\src\Decoder_MP3.h ..\..\src\Decoder_Vorbis.h ..\..\src\Decoder_Wave.h +..\..\src\Decoder_WavPack.h ..\..\src\Decoder_WMA.h ..\..\src\Dialog_About.h ..\..\src\Dialog_DropBox.h diff --git a/res/localization/LameXP_DE.qm b/res/localization/LameXP_DE.qm index 5ca32491..69d0550c 100644 Binary files a/res/localization/LameXP_DE.qm and b/res/localization/LameXP_DE.qm differ diff --git a/res/tools/wvunpack.exe b/res/tools/wvunpack.exe index 6b1a3700..d7912ca4 100644 Binary files a/res/tools/wvunpack.exe and b/res/tools/wvunpack.exe differ diff --git a/src/Config.h b/src/Config.h index 6d956a1d..6bc0e903 100644 --- a/src/Config.h +++ b/src/Config.h @@ -25,7 +25,7 @@ #define VER_LAMEXP_MAJOR 4 #define VER_LAMEXP_MINOR_HI 0 #define VER_LAMEXP_MINOR_LO 0 -#define VER_LAMEXP_BUILD 236 +#define VER_LAMEXP_BUILD 237 #define VER_LAMEXP_SUFFIX TechPreview /* diff --git a/src/Decoder_WavPack.cpp b/src/Decoder_WavPack.cpp new file mode 100644 index 00000000..b8c5ae63 --- /dev/null +++ b/src/Decoder_WavPack.cpp @@ -0,0 +1,131 @@ +/////////////////////////////////////////////////////////////////////////////// +// LameXP - Audio Encoder Front-End +// Copyright (C) 2004-2011 LoRd_MuldeR +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// http://www.gnu.org/licenses/gpl-2.0.txt +/////////////////////////////////////////////////////////////////////////////// + +#include "Decoder_WavPack.h" + +#include "Global.h" + +#include +#include +#include + +WavPackDecoder::WavPackDecoder(void) +: + m_binary(lamexp_lookup_tool("wvunpack.exe")) +{ + if(m_binary.isEmpty()) + { + throw "Error initializing WavPack decoder. Tool 'wvunpack.exe' is not registred!"; + } +} + +WavPackDecoder::~WavPackDecoder(void) +{ +} + +bool WavPackDecoder::decode(const QString &sourceFile, const QString &outputFile, volatile bool *abortFlag) +{ + QProcess process; + QStringList args; + + args << "-y" << "-w"; + args << QDir::toNativeSeparators(sourceFile); + args << QDir::toNativeSeparators(outputFile); + + if(!startProcess(process, m_binary, args)) + { + return false; + } + + bool bTimeout = false; + bool bAborted = false; + + QRegExp regExp("\\s(\\d+)% done"); + + while(process.state() != QProcess::NotRunning) + { + if(*abortFlag) + { + process.kill(); + bAborted = true; + emit messageLogged("\nABORTED BY USER !!!"); + break; + } + process.waitForReadyRead(); + if(!process.bytesAvailable() && process.state() == QProcess::Running) + { + process.kill(); + qWarning("WvUnpack process timed out <-- killing!"); + bTimeout = true; + break; + } + while(process.bytesAvailable() > 0) + { + QByteArray line = process.readLine(); + QString text = QString::fromUtf8(line.constData()).simplified(); + if(regExp.lastIndexIn(text) >= 0) + { + bool ok = false; + int progress = regExp.cap(1).toInt(&ok); + if(ok) emit statusUpdated(progress); + } + else if(!text.isEmpty()) + { + emit messageLogged(text); + } + } + } + + process.waitForFinished(); + if(process.state() != QProcess::NotRunning) + { + process.kill(); + process.waitForFinished(-1); + } + + emit statusUpdated(100); + emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode())); + + if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit || QFileInfo(outputFile).size() == 0) + { + return false; + } + + return true; +} + +bool WavPackDecoder::isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion) +{ + if(containerType.compare("WavPack", Qt::CaseInsensitive) == 0) + { + if(formatType.compare("WavPack", Qt::CaseInsensitive) == 0) + { + return true; + } + } + + return false; +} + +QStringList WavPackDecoder::supportedTypes(void) +{ + return QStringList() << "WavPack Hybrid Lossless Audio (*.wv)"; +} diff --git a/src/Decoder_WavPack.h b/src/Decoder_WavPack.h new file mode 100644 index 00000000..8f06ed95 --- /dev/null +++ b/src/Decoder_WavPack.h @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////// +// LameXP - Audio Encoder Front-End +// Copyright (C) 2004-2011 LoRd_MuldeR +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// http://www.gnu.org/licenses/gpl-2.0.txt +/////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "Decoder_Abstract.h" + +class WavPackDecoder : public AbstractDecoder +{ +public: + WavPackDecoder(void); + ~WavPackDecoder(void); + + virtual bool decode(const QString &sourceFile, const QString &outputFile, volatile bool *abortFlag); + static bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion); + static QStringList supportedTypes(void); + +private: + const QString m_binary; +}; diff --git a/src/Dialog_About.cpp b/src/Dialog_About.cpp index a4c0bbfb..fa90031e 100644 --- a/src/Dialog_About.cpp +++ b/src/Dialog_About.cpp @@ -281,6 +281,13 @@ void AboutDialog::showMoreAbout(void) tr("Released under the terms of the GNU Lesser General Public License."), "http://www.ac3filter.net/projects/tools" ); + moreAboutText += makeToolText + ( + tr("WavPack - Hybrid Lossless Compression"), + "wvunpack.exe", "v?.??.?", + tr("Completely open audio compression format."), + "http://www.wavpack.com/" + ); moreAboutText += makeToolText ( tr("Monkey's Audio - Lossless Audio Compressor"), diff --git a/src/Registry_Decoder.cpp b/src/Registry_Decoder.cpp index d116d5be..a0d55cde 100644 --- a/src/Registry_Decoder.cpp +++ b/src/Registry_Decoder.cpp @@ -30,6 +30,7 @@ #include "Decoder_AC3.h" #include "Decoder_WMA.h" #include "Decoder_Wave.h" +#include "Decoder_WavPack.h" #include #include @@ -45,10 +46,12 @@ AbstractDecoder *DecoderRegistry::lookup(const QString &containerType, const QSt PROBE_DECODER(AACDecoder); PROBE_DECODER(AC3Decoder); PROBE_DECODER(FLACDecoder); + PROBE_DECODER(WavPackDecoder); PROBE_DECODER(MACDecoder); PROBE_DECODER(WMADecoder); PROBE_DECODER(ADPCMDecoder); PROBE_DECODER(WaveDecoder); + return NULL; } @@ -62,6 +65,7 @@ QStringList DecoderRegistry::getSupportedTypes(void) types << GET_FILETYPES(AACDecoder); types << GET_FILETYPES(AC3Decoder); types << GET_FILETYPES(FLACDecoder); + types << GET_FILETYPES(WavPackDecoder); types << GET_FILETYPES(MACDecoder); types << GET_FILETYPES(WMADecoder); types << GET_FILETYPES(ADPCMDecoder); diff --git a/src/Thread_Initialization.cpp b/src/Thread_Initialization.cpp index d25574c8..bb24fcbe 100644 --- a/src/Thread_Initialization.cpp +++ b/src/Thread_Initialization.cpp @@ -73,7 +73,7 @@ static const struct lamexp_tool_t g_lamexp_tools[] = {"8159f4e824b3e343ece95ba6dbb5e16da9c4866e", "volumax.exe", UINT_MAX}, {"62e2805d1b2eb2a4d86a5ca6e6ea58010d05d2a7", "wget.exe", UINT_MAX}, {"a17011961aa8696bc935e097b3242d33c38a9842", "wupdate.exe", UINT_MAX}, - {"4d018ac7f6a42abd53faacfae5055c2a3c176430", "wvunpack.exe", UINT_MAX}, + {"b7d14b3540d24df13119a55d97623a61412de6e3", "wvunpack.exe", 4601}, {NULL, NULL, NULL} };