Added support for Shorten input.
This commit is contained in:
parent
f2e5fa49a4
commit
e9a1ba9b06
@ -326,6 +326,10 @@
|
||||
RelativePath=".\src\Decoder_Musepack.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Decoder_Shorten.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Decoder_TTA.cpp"
|
||||
>
|
||||
@ -578,6 +582,10 @@
|
||||
RelativePath=".\src\Decoder_Musepack.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Decoder_Shorten.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Decoder_TTA.h"
|
||||
>
|
||||
|
@ -143,6 +143,10 @@
|
||||
<source>Freely available source code, simple SDK and non-restrictive licensing.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Shorten &minus; Lossless Audio Compressor</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>The True Audio &minus; Lossless Audio Codec</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -179,6 +179,10 @@
|
||||
<source>Musepack &minus; Living Audio Compression</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Shorten &minus; Lossless Audio Compressor</source>
|
||||
<translation>Shorten &minus; Verlustfreie Audio Kompression</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AudioFileModel</name>
|
||||
|
@ -180,6 +180,10 @@
|
||||
<source>Musepack &minus; Living Audio Compression</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Shorten &minus; Lossless Audio Compressor</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AudioFileModel</name>
|
||||
|
@ -180,6 +180,10 @@
|
||||
<source>Musepack &minus; Living Audio Compression</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Shorten &minus; Lossless Audio Compressor</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AudioFileModel</name>
|
||||
|
@ -179,6 +179,10 @@
|
||||
<source>Musepack &minus; Living Audio Compression</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Shorten &minus; Lossless Audio Compressor</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AudioFileModel</name>
|
||||
|
@ -15,6 +15,7 @@
|
||||
..\..\src\Decoder_MAC.cpp
|
||||
..\..\src\Decoder_MP3.cpp
|
||||
..\..\src\Decoder_Musepack.cpp
|
||||
..\..\src\Decoder_Shorten.cpp
|
||||
..\..\src\Decoder_TTA.cpp
|
||||
..\..\src\Decoder_Vorbis.cpp
|
||||
..\..\src\Decoder_Wave.cpp
|
||||
@ -69,6 +70,7 @@
|
||||
..\..\src\Decoder_MAC.h
|
||||
..\..\src\Decoder_MP3.h
|
||||
..\..\src\Decoder_Musepack.h
|
||||
..\..\src\Decoder_Shorten.h
|
||||
..\..\src\Decoder_TTA.h
|
||||
..\..\src\Decoder_Vorbis.h
|
||||
..\..\src\Decoder_Wave.h
|
||||
|
Binary file not shown.
Binary file not shown.
@ -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 278
|
||||
#define VER_LAMEXP_BUILD 279
|
||||
#define VER_LAMEXP_SUFFIX Beta-2
|
||||
|
||||
/*
|
||||
|
127
src/Decoder_Shorten.cpp
Normal file
127
src/Decoder_Shorten.cpp
Normal file
@ -0,0 +1,127 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// 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_Shorten.h"
|
||||
|
||||
#include "Global.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QProcess>
|
||||
#include <QRegExp>
|
||||
#include <QUuid>
|
||||
|
||||
ShortenDecoder::ShortenDecoder(void)
|
||||
:
|
||||
m_binary(lamexp_lookup_tool("shorten.exe"))
|
||||
{
|
||||
if(m_binary.isEmpty())
|
||||
{
|
||||
throw "Error initializing WavPack decoder. Tool 'shorten.exe' is not registred!";
|
||||
}
|
||||
}
|
||||
|
||||
ShortenDecoder::~ShortenDecoder(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool ShortenDecoder::decode(const QString &sourceFile, const QString &outputFile, volatile bool *abortFlag)
|
||||
{
|
||||
QProcess process;
|
||||
QStringList args;
|
||||
|
||||
args << "-x";
|
||||
args << QDir::toNativeSeparators(sourceFile);
|
||||
args << QDir::toNativeSeparators(outputFile);
|
||||
|
||||
if(!startProcess(process, m_binary, args))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool bTimeout = false;
|
||||
bool bAborted = false;
|
||||
|
||||
//The Shorten 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 ShortenDecoder::isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion)
|
||||
{
|
||||
if(containerType.compare("Shorten", Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
if(formatType.compare("Shorten", Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
QStringList ShortenDecoder::supportedTypes(void)
|
||||
{
|
||||
return QStringList() << "Shorten (*.shn)";
|
||||
}
|
38
src/Decoder_Shorten.h
Normal file
38
src/Decoder_Shorten.h
Normal 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 ShortenDecoder : public AbstractDecoder
|
||||
{
|
||||
public:
|
||||
ShortenDecoder(void);
|
||||
~ShortenDecoder(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;
|
||||
};
|
@ -326,6 +326,13 @@ void AboutDialog::showMoreAbout(void)
|
||||
"http://www.monkeysaudio.com/"
|
||||
);
|
||||
moreAboutText += makeToolText
|
||||
(
|
||||
tr("Shorten − Lossless Audio Compressor"),
|
||||
"shorten.exe", "v?.?.?",
|
||||
tr("Released under the terms of the GNU Lesser General Public License."),
|
||||
"http://etree.org/shnutils/shorten/"
|
||||
);
|
||||
moreAboutText += makeToolText
|
||||
(
|
||||
tr("The True Audio − Lossless Audio Codec"),
|
||||
"ttaenc.exe", "v?.?.?",
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "Decoder_MAC.h"
|
||||
#include "Decoder_MP3.h"
|
||||
#include "Decoder_Musepack.h"
|
||||
#include "Decoder_Shorten.h"
|
||||
#include "Decoder_TTA.h"
|
||||
#include "Decoder_Vorbis.h"
|
||||
#include "Decoder_Wave.h"
|
||||
@ -51,6 +52,7 @@ AbstractDecoder *DecoderRegistry::lookup(const QString &containerType, const QSt
|
||||
PROBE_DECODER(FLACDecoder);
|
||||
PROBE_DECODER(WavPackDecoder);
|
||||
PROBE_DECODER(MusepackDecoder);
|
||||
PROBE_DECODER(ShortenDecoder);
|
||||
PROBE_DECODER(MACDecoder);
|
||||
PROBE_DECODER(TTADecoder);
|
||||
PROBE_DECODER(ALACDecoder);
|
||||
@ -73,6 +75,7 @@ QStringList DecoderRegistry::getSupportedTypes(void)
|
||||
types << GET_FILETYPES(FLACDecoder);
|
||||
types << GET_FILETYPES(WavPackDecoder);
|
||||
types << GET_FILETYPES(MusepackDecoder);
|
||||
types << GET_FILETYPES(ShortenDecoder);
|
||||
types << GET_FILETYPES(MACDecoder);
|
||||
types << GET_FILETYPES(TTADecoder);
|
||||
types << GET_FILETYPES(ALACDecoder);
|
||||
|
@ -63,7 +63,7 @@ g_lamexp_tools[] =
|
||||
{"ecd15abe103184aca96e406f5f1c82c6fb2e665d", "oggenc2_i386.exe", 287},
|
||||
{"ffe0fbd73352396dc3752ac9d484dbfc754a226d", "oggenc2_sse2.exe", 287},
|
||||
{"a8c50872e544a55495a824426e9378984f2ae01d", "oggenc2_x64.exe", 287},
|
||||
{"ffeaa70bd6321185eafcb067ab2dc441650038bf", "shorten.exe", UINT_MAX},
|
||||
{"0d9035bb62bdf46a2785261f8be5a4a0972abd15", "shorten.exe", 361},
|
||||
{"2d08c3586f9cf99f2e4c89ac54eeb595f63aef61", "sox.exe", 1431},
|
||||
{"346ce516281c97e92e1b8957ddeca52edcf2d056", "speexdec.exe", UINT_MAX},
|
||||
{"8a74b767cfe88bf88c068fdae0de02d65589d25e", "takc.exe", UINT_MAX},
|
||||
|
Loading…
Reference in New Issue
Block a user