Added support for Musepack input.

This commit is contained in:
LoRd_MuldeR 2011-01-29 22:50:37 +01:00
parent 199d132eb7
commit f2e5fa49a4
16 changed files with 215 additions and 11 deletions

View File

@ -322,6 +322,10 @@
RelativePath=".\src\Decoder_MP3.cpp"
>
</File>
<File
RelativePath=".\src\Decoder_Musepack.cpp"
>
</File>
<File
RelativePath=".\src\Decoder_TTA.cpp"
>
@ -570,6 +574,10 @@
RelativePath=".\src\Decoder_MP3.h"
>
</File>
<File
RelativePath=".\src\Decoder_Musepack.h"
>
</File>
<File
RelativePath=".\src\Decoder_TTA.h"
>
@ -1353,7 +1361,7 @@
<Tool
Name="VCCustomBuildTool"
Description="PerfMOC &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;orming Custom Build Step"
CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;"
CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
Outputs="&quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
/>
</FileConfiguration>
@ -1363,7 +1371,7 @@
<Tool
Name="VCCustomBuildTool"
Description="PerfMOC &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;orming Custom Build Step"
CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;"
CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
Outputs="&quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
/>
</FileConfiguration>
@ -1373,7 +1381,7 @@
<Tool
Name="VCCustomBuildTool"
Description="PerfMOC &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;orming Custom Build Step"
CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;"
CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
Outputs="&quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
/>
</FileConfiguration>

View File

@ -91,10 +91,10 @@ if "%LAMEXP_REDIST%"=="1" (
)
REM ------------------------------------------
for %%f in ("%TMP_PATH%\*.exe") do (
"%PATH_UPXBIN%\upx.exe" --best --lzma "%%f"
"%PATH_UPXBIN%\upx.exe" --best "%%f"
)
for %%f in ("%TMP_PATH%\*.dll") do (
"%PATH_UPXBIN%\upx.exe" --best --lzma "%%f"
"%PATH_UPXBIN%\upx.exe" --best "%%f"
)
REM ------------------------------------------
if exist _postproc.bat (

View File

@ -131,6 +131,10 @@
<source>Completely open audio compression format.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Musepack &amp;minus; Living Audio Compression</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Monkey&apos;s Audio &amp;minus; Lossless Audio Compressor</source>
<translation type="unfinished"></translation>

View File

@ -175,6 +175,10 @@
<source>Nero AAC Reference MPEG-4 Encoder</source>
<translation>Nero AAC Referenz MPEG-4 Kodierer</translation>
</message>
<message>
<source>Musepack &amp;minus; Living Audio Compression</source>
<translation></translation>
</message>
</context>
<context>
<name>AudioFileModel</name>

View File

@ -176,6 +176,10 @@
<source>Nero AAC Reference MPEG-4 Encoder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Musepack &amp;minus; Living Audio Compression</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AudioFileModel</name>

View File

@ -176,6 +176,10 @@
<source>Nero AAC Reference MPEG-4 Encoder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Musepack &amp;minus; Living Audio Compression</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AudioFileModel</name>

View File

@ -175,6 +175,10 @@
<source>Nero AAC Reference MPEG-4 Encoder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Musepack &amp;minus; Living Audio Compression</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AudioFileModel</name>

View File

@ -14,6 +14,7 @@
..\..\src\Decoder_FLAC.cpp
..\..\src\Decoder_MAC.cpp
..\..\src\Decoder_MP3.cpp
..\..\src\Decoder_Musepack.cpp
..\..\src\Decoder_TTA.cpp
..\..\src\Decoder_Vorbis.cpp
..\..\src\Decoder_Wave.cpp
@ -67,6 +68,7 @@
..\..\src\Decoder_FLAC.h
..\..\src\Decoder_MAC.h
..\..\src\Decoder_MP3.h
..\..\src\Decoder_Musepack.h
..\..\src\Decoder_TTA.h
..\..\src\Decoder_Vorbis.h
..\..\src\Decoder_Wave.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 277
#define VER_LAMEXP_BUILD 278
#define VER_LAMEXP_SUFFIX Beta-2
/*

126
src/Decoder_Musepack.cpp Normal file
View File

@ -0,0 +1,126 @@
///////////////////////////////////////////////////////////////////////////////
// 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_Musepack.h"
#include "Global.h"
#include <QDir>
#include <QProcess>
#include <QRegExp>
#include <QUuid>
MusepackDecoder::MusepackDecoder(void)
:
m_binary(lamexp_lookup_tool("mpcdec.exe"))
{
if(m_binary.isEmpty())
{
throw "Error initializing WavPack decoder. Tool 'mpcdec.exe' is not registred!";
}
}
MusepackDecoder::~MusepackDecoder(void)
{
}
bool MusepackDecoder::decode(const QString &sourceFile, const QString &outputFile, volatile bool *abortFlag)
{
QProcess process;
QStringList args;
args << QDir::toNativeSeparators(sourceFile);
args << QDir::toNativeSeparators(outputFile);
if(!startProcess(process, m_binary, args))
{
return false;
}
bool bTimeout = false;
bool bAborted = false;
//The Musepack Decoder doesn't actually send any status updates :-[
emit statusUpdated(20 + (QUuid::createUuid().data1 % 80));
while(process.state() != QProcess::NotRunning)
{
if(*abortFlag)
{
process.kill();
bAborted = true;
emit messageLogged("\nABORTED BY USER !!!");
break;
}
process.waitForReadyRead(180000);
if(!process.bytesAvailable() && process.state() == QProcess::Running)
{
process.kill();
qWarning("MpcDec process timed out <-- killing!");
bTimeout = true;
break;
}
while(process.bytesAvailable() > 0)
{
QByteArray line = process.readLine();
QString text = QString::fromUtf8(line.constData()).simplified();
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 MusepackDecoder::isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion)
{
if(containerType.compare("Musepack SV8", Qt::CaseInsensitive) == 0 || containerType.compare("Musepack SV7", Qt::CaseInsensitive) == 0)
{
if(formatType.compare("Musepack SV8", Qt::CaseInsensitive) == 0 || formatType.compare("Musepack SV7", Qt::CaseInsensitive) == 0)
{
return true;
}
}
return false;
}
QStringList MusepackDecoder::supportedTypes(void)
{
return QStringList() << "Musepack (*.mpc *.mpp *.mp+)";
}

38
src/Decoder_Musepack.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 MusepackDecoder : public AbstractDecoder
{
public:
MusepackDecoder(void);
~MusepackDecoder(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

@ -300,10 +300,6 @@ void AboutDialog::showMoreAbout(void)
tr("Released under the terms of the GNU Lesser General Public License."),
"http://www.ac3filter.net/projects/tools"
);
moreAboutText += QString
(
"</ul></td><td><ul>"
);
moreAboutText += makeToolText
(
tr("WavPack &minus; Hybrid Lossless Compression"),
@ -311,6 +307,17 @@ void AboutDialog::showMoreAbout(void)
tr("Completely open audio compression format."),
"http://www.wavpack.com/"
);
moreAboutText += QString
(
"</ul></td><td><ul>"
);
moreAboutText += makeToolText
(
tr("Musepack &minus; Living Audio Compression"),
"mpcdec.exe", "r???",
tr("Released under the terms of the GNU Lesser General Public License."),
"http://www.musepack.net/"
);
moreAboutText += makeToolText
(
tr("Monkey's Audio &minus; Lossless Audio Compressor"),

View File

@ -28,6 +28,7 @@
#include "Decoder_FLAC.h"
#include "Decoder_MAC.h"
#include "Decoder_MP3.h"
#include "Decoder_Musepack.h"
#include "Decoder_TTA.h"
#include "Decoder_Vorbis.h"
#include "Decoder_Wave.h"
@ -49,6 +50,7 @@ AbstractDecoder *DecoderRegistry::lookup(const QString &containerType, const QSt
PROBE_DECODER(AC3Decoder);
PROBE_DECODER(FLACDecoder);
PROBE_DECODER(WavPackDecoder);
PROBE_DECODER(MusepackDecoder);
PROBE_DECODER(MACDecoder);
PROBE_DECODER(TTADecoder);
PROBE_DECODER(ALACDecoder);
@ -70,6 +72,7 @@ QStringList DecoderRegistry::getSupportedTypes(void)
types << GET_FILETYPES(AC3Decoder);
types << GET_FILETYPES(FLACDecoder);
types << GET_FILETYPES(WavPackDecoder);
types << GET_FILETYPES(MusepackDecoder);
types << GET_FILETYPES(MACDecoder);
types << GET_FILETYPES(TTADecoder);
types << GET_FILETYPES(ALACDecoder);

View File

@ -57,7 +57,7 @@ g_lamexp_tools[] =
{"a4e929cfaa42fa2e61a3d0c6434c77a06d45aef3", "mac.exe", 406},
{"ec235c6404caa31e7975e9bbf9ba59599258ae1d", "mediainfo_i386.exe", 741},
{"72d7efdcafc2dee3b534f27ab6e01916d02ba470", "mediainfo_x64.exe", 741},
{"55c293a80475f7aeccf449ac9487a4626e5139cb", "mpcdec.exe", UINT_MAX},
{"aa89763a5ba4d1a5986549b9ee53e005c51940c1", "mpcdec.exe", 435},
{"6b6913a54cac08b22d5b468aaed83550fc9ae5b4", "mpg123.exe", 1131},
{"8dd7138714c3bcb39f5a3213413addba13d06f1e", "oggdec.exe", UINT_MAX},
{"ecd15abe103184aca96e406f5f1c82c6fb2e665d", "oggenc2_i386.exe", 287},