Added support for WavPack input.

This commit is contained in:
LoRd_MuldeR 2011-01-17 20:52:54 +01:00
parent 4ddaeaeed1
commit 0be92d0f53
15 changed files with 232 additions and 2 deletions

View File

@ -326,6 +326,10 @@
RelativePath=".\src\Decoder_Wave.cpp"
>
</File>
<File
RelativePath=".\src\Decoder_WavPack.cpp"
>
</File>
<File
RelativePath=".\src\Decoder_WMA.cpp"
>
@ -546,6 +550,10 @@
RelativePath=".\src\Decoder_Wave.h"
>
</File>
<File
RelativePath=".\src\Decoder_WavPack.h"
>
</File>
<File
RelativePath=".\src\Decoder_WMA.h"
>

View File

@ -111,6 +111,14 @@
<source>AC3Filter Tools - AC3/DTS Decoder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WavPack - Hybrid Lossless Compression</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Completely open audio compression format.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Monkey&apos;s Audio - Lossless Audio Compressor</source>
<translation type="unfinished"></translation>

View File

@ -147,6 +147,14 @@
<source>Freely available source code, simple SDK and non-restrictive licensing.</source>
<translation>Frei verfügbarer Quellcode, einfaches SDK und nicht-restriktive Lizenz.</translation>
</message>
<message>
<source>WavPack - Hybrid Lossless Compression</source>
<translation></translation>
</message>
<message>
<source>Completely open audio compression format.</source>
<translation>Komplett offenes Audio Kompressionsformat.</translation>
</message>
</context>
<context>
<name>AudioFileModel</name>

View File

@ -148,6 +148,14 @@
<source>Freely available source code, simple SDK and non-restrictive licensing.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WavPack - Hybrid Lossless Compression</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Completely open audio compression format.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AudioFileModel</name>

View File

@ -150,6 +150,14 @@
<source>Freely available source code, simple SDK and non-restrictive licensing.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WavPack - Hybrid Lossless Compression</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Completely open audio compression format.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AudioFileModel</name>

View File

@ -147,6 +147,14 @@
<source>Freely available source code, simple SDK and non-restrictive licensing.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WavPack - Hybrid Lossless Compression</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Completely open audio compression format.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AudioFileModel</name>

View File

@ -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

Binary file not shown.

Binary file not shown.

View File

@ -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
/*

131
src/Decoder_WavPack.cpp Normal file
View File

@ -0,0 +1,131 @@
///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End
// Copyright (C) 2004-2011 LoRd_MuldeR <MuldeR2@GMX.de>
//
// 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 <QDir>
#include <QProcess>
#include <QRegExp>
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)";
}

38
src/Decoder_WavPack.h Normal file
View File

@ -0,0 +1,38 @@
///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End
// Copyright (C) 2004-2011 LoRd_MuldeR <MuldeR2@GMX.de>
//
// 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;
};

View File

@ -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"),

View File

@ -30,6 +30,7 @@
#include "Decoder_AC3.h"
#include "Decoder_WMA.h"
#include "Decoder_Wave.h"
#include "Decoder_WavPack.h"
#include <QString>
#include <QStringList>
@ -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);

View File

@ -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}
};