Added support for Avisynth input (audio only!) using the 'avs2wav' tool. This is a stripped-down and cleaned-up version of the tool by Jory Stone <jcsston@toughguy.net>.
This commit is contained in:
parent
0db0a70232
commit
773576b3a4
@ -232,6 +232,7 @@ del "$(TargetDir)imageformats\q???d4.dll"
|
||||
<ClCompile Include="src\Decoder_AC3.cpp" />
|
||||
<ClCompile Include="src\Decoder_ADPCM.cpp" />
|
||||
<ClCompile Include="src\Decoder_ALAC.cpp" />
|
||||
<ClCompile Include="src\Decoder_Avisynth.cpp" />
|
||||
<ClCompile Include="src\Decoder_FLAC.cpp" />
|
||||
<ClCompile Include="src\Decoder_MAC.cpp" />
|
||||
<ClCompile Include="src\Decoder_MP3.cpp" />
|
||||
@ -377,6 +378,7 @@ del "$(TargetDir)imageformats\q???d4.dll"
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">$(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
<ClInclude Include="src\Decoder_Avisynth.h" />
|
||||
<ClInclude Include="tmp\UIC_CueSheetImport.h" />
|
||||
<ClInclude Include="tmp\UIC_DropBox.h" />
|
||||
<ClInclude Include="tmp\UIC_LogViewDialog.h" />
|
||||
|
@ -307,6 +307,9 @@
|
||||
<ClCompile Include="tmp\MOC_Thread_CueSplitter.cpp">
|
||||
<Filter>Generated Files\MOC</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Decoder_Avisynth.cpp">
|
||||
<Filter>Source Files\Decoders</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\Config.h">
|
||||
@ -426,6 +429,9 @@
|
||||
<ClInclude Include="tmp\UIC_CueSheetImport.h">
|
||||
<Filter>Generated Files\UIC</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Decoder_Avisynth.h">
|
||||
<Filter>Header Files\Decoders</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="LameXP.rc" />
|
||||
|
@ -21,6 +21,7 @@ a:visited { color: #0000EE; }
|
||||
<li>Dropping support for Windows 2000 and for Windows XP RTM/SP1, Windows XP needs SP2 or SP3 now!
|
||||
<li>Added Cue Sheet import wizard, which allows splitting and importing tracks from Cue Sheet images
|
||||
<li>Added ATSC A/52 (AC-3) encoding support, based on Aften encoder v0.0.8+ (Git Master)
|
||||
<li>Added Avisynth input (audio only!) using 'avs2wav' tool, partly based on code by Jory Stone
|
||||
<li>Added one new translation: Korean
|
||||
<li>Added a method to use custom tools instead of the "built-in" ones (see <a href="FAQ.html#3d6684e9" target="_blank">FAQ doc</a> for details)
|
||||
<li>Updated Qt runtime libraries to v4.7.3
|
||||
|
@ -5,6 +5,7 @@
|
||||
<file>tools/aften.sse2.exe</file>
|
||||
<file>tools/aften.x64.exe</file>
|
||||
<file>tools/alac.exe</file>
|
||||
<file>tools/avs2wav.exe</file>
|
||||
<file>tools/elevator.exe</file>
|
||||
<file>tools/faad.exe</file>
|
||||
<file>tools/flac.exe</file>
|
||||
|
BIN
res/tools/avs2wav.exe
Normal file
BIN
res/tools/avs2wav.exe
Normal file
Binary file not shown.
@ -29,8 +29,8 @@
|
||||
#define VER_LAMEXP_MINOR_HI 0
|
||||
#define VER_LAMEXP_MINOR_LO 2
|
||||
#define VER_LAMEXP_TYPE Beta
|
||||
#define VER_LAMEXP_PATCH 1
|
||||
#define VER_LAMEXP_BUILD 534
|
||||
#define VER_LAMEXP_PATCH 2
|
||||
#define VER_LAMEXP_BUILD 536
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Tools versions
|
||||
|
131
src/Decoder_Avisynth.cpp
Normal file
131
src/Decoder_Avisynth.cpp
Normal 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_Avisynth.h"
|
||||
|
||||
#include "Global.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QProcess>
|
||||
#include <QRegExp>
|
||||
|
||||
AvisynthDecoder::AvisynthDecoder(void)
|
||||
:
|
||||
m_binary(lamexp_lookup_tool("avs2wav.exe"))
|
||||
{
|
||||
if(m_binary.isEmpty())
|
||||
{
|
||||
throw "Error initializing Avisynth decoder. Tool 'avs2wav.exe' is not registred!";
|
||||
}
|
||||
}
|
||||
|
||||
AvisynthDecoder::~AvisynthDecoder(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool AvisynthDecoder::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;
|
||||
|
||||
QRegExp regExp("please wait: (\\d+)/(\\d+) \\[(\\d+)%\\]");
|
||||
|
||||
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("AVS2WAV process timed out <-- killing!");
|
||||
emit messageLogged("\nPROCESS TIMEOUT !!!");
|
||||
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(3).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 AvisynthDecoder::isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion)
|
||||
{
|
||||
if(containerType.compare("Avisynth", Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
if(formatType.compare("Avisynth", Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
QStringList AvisynthDecoder::supportedTypes(void)
|
||||
{
|
||||
return QStringList() << "Avisynth Script (*.avs)";
|
||||
}
|
38
src/Decoder_Avisynth.h
Normal file
38
src/Decoder_Avisynth.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 AvisynthDecoder : public AbstractDecoder
|
||||
{
|
||||
public:
|
||||
AvisynthDecoder(void);
|
||||
~AvisynthDecoder(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;
|
||||
};
|
@ -25,6 +25,7 @@
|
||||
#include "Decoder_AC3.h"
|
||||
#include "Decoder_ADPCM.h"
|
||||
#include "Decoder_ALAC.h"
|
||||
#include "Decoder_Avisynth.h"
|
||||
#include "Decoder_FLAC.h"
|
||||
#include "Decoder_MAC.h"
|
||||
#include "Decoder_MP3.h"
|
||||
@ -62,6 +63,7 @@ AbstractDecoder *DecoderRegistry::lookup(const QString &containerType, const QSt
|
||||
PROBE_DECODER(WMADecoder);
|
||||
PROBE_DECODER(ADPCMDecoder);
|
||||
PROBE_DECODER(WaveDecoder);
|
||||
PROBE_DECODER(AvisynthDecoder);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -85,6 +87,7 @@ QStringList DecoderRegistry::getSupportedTypes(void)
|
||||
types << GET_FILETYPES(ALACDecoder);
|
||||
types << GET_FILETYPES(WMADecoder);
|
||||
types << GET_FILETYPES(ADPCMDecoder);
|
||||
types << GET_FILETYPES(AvisynthDecoder);
|
||||
|
||||
QStringList extensions;
|
||||
extensions << QString(PlaylistImporter::supportedExtensions).split(" ", QString::SkipEmptyParts);
|
||||
|
@ -119,6 +119,14 @@ void FileAnalyzer::run()
|
||||
qWarning("Cue Sheet file detected, skipping!");
|
||||
m_filesCueSheet++;
|
||||
}
|
||||
else if(!QFileInfo(currentFile).suffix().compare("avs", Qt::CaseInsensitive))
|
||||
{
|
||||
qWarning("Added an potential Avisynth script file!");
|
||||
file.setFormatAudioType("Avisynth");
|
||||
file.setFormatContainerType("Avisynth");
|
||||
m_filesAccepted++;
|
||||
emit fileAnalyzed(file);
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug64("Rejected file of unknown type: %1", file.filePath());
|
||||
|
@ -56,6 +56,7 @@ g_lamexp_tools[] =
|
||||
{"22253052acba92a0088bbf0aa82a8c505c07b854", CPU_TYPE_SSE, "aften.sse2.exe", 8},
|
||||
{"2996a48b01b65a2c1806482654beeea7ffcf1f80", CPU_TYPE_X64, "aften.x64.exe", 8},
|
||||
{"3b41f85dde8d4a5a0f4cd5f461099d0db24610ba", CPU_TYPE_ALL, "alac.exe", 20},
|
||||
{"ed7c9a69690f649bc63080ef18dba5c130a1120e", CPU_TYPE_ALL, "avs2wav.exe", 11},
|
||||
{"fb74ac8b73ad8cba2c3b4e6e61f23401d630dc22", CPU_TYPE_ALL, "elevator.exe", UINT_MAX},
|
||||
{"80e372d8b20be24102c18284286fcdf5fa14bd86", CPU_TYPE_ALL, "faad.exe", 27},
|
||||
{"d33cd86f04bd4067e244d2804466583c7b90a4e2", CPU_TYPE_ALL, "flac.exe", 121},
|
||||
|
Loading…
Reference in New Issue
Block a user