diff --git a/LameXP_VS2010.vcxproj b/LameXP_VS2010.vcxproj index 9c3e62f8..806f81e6 100644 --- a/LameXP_VS2010.vcxproj +++ b/LameXP_VS2010.vcxproj @@ -232,6 +232,7 @@ del "$(TargetDir)imageformats\q???d4.dll" + @@ -377,6 +378,7 @@ del "$(TargetDir)imageformats\q???d4.dll" $(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs) $(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs) + diff --git a/LameXP_VS2010.vcxproj.filters b/LameXP_VS2010.vcxproj.filters index dc022bfe..17533262 100644 --- a/LameXP_VS2010.vcxproj.filters +++ b/LameXP_VS2010.vcxproj.filters @@ -307,6 +307,9 @@ Generated Files\MOC + + Source Files\Decoders + @@ -426,6 +429,9 @@ Generated Files\UIC + + Header Files\Decoders + diff --git a/doc/Changelog.html b/doc/Changelog.html index cfdfa33a..b743eb5d 100644 --- a/doc/Changelog.html +++ b/doc/Changelog.html @@ -21,6 +21,7 @@ a:visited { color: #0000EE; }
  • Dropping support for Windows 2000 and for Windows XP RTM/SP1, Windows XP needs SP2 or SP3 now!
  • Added Cue Sheet import wizard, which allows splitting and importing tracks from Cue Sheet images
  • Added ATSC A/52 (AC-3) encoding support, based on Aften encoder v0.0.8+ (Git Master) +
  • Added Avisynth input (audio only!) using 'avs2wav' tool, partly based on code by Jory Stone
  • Added one new translation: Korean
  • Added a method to use custom tools instead of the "built-in" ones (see FAQ doc for details)
  • Updated Qt runtime libraries to v4.7.3 diff --git a/res/Tools.qrc b/res/Tools.qrc index 6c1642ce..395752ad 100644 --- a/res/Tools.qrc +++ b/res/Tools.qrc @@ -5,6 +5,7 @@ tools/aften.sse2.exe tools/aften.x64.exe tools/alac.exe + tools/avs2wav.exe tools/elevator.exe tools/faad.exe tools/flac.exe diff --git a/res/tools/avs2wav.exe b/res/tools/avs2wav.exe new file mode 100644 index 00000000..cbe8537e Binary files /dev/null and b/res/tools/avs2wav.exe differ diff --git a/src/Config.h b/src/Config.h index 8a66baa0..bc6511de 100644 --- a/src/Config.h +++ b/src/Config.h @@ -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 diff --git a/src/Decoder_Avisynth.cpp b/src/Decoder_Avisynth.cpp new file mode 100644 index 00000000..9a6d4f85 --- /dev/null +++ b/src/Decoder_Avisynth.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_Avisynth.h" + +#include "Global.h" + +#include +#include +#include + +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)"; +} diff --git a/src/Decoder_Avisynth.h b/src/Decoder_Avisynth.h new file mode 100644 index 00000000..18c7e67b --- /dev/null +++ b/src/Decoder_Avisynth.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 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; +}; diff --git a/src/Registry_Decoder.cpp b/src/Registry_Decoder.cpp index 8ab2c160..56e7e437 100644 --- a/src/Registry_Decoder.cpp +++ b/src/Registry_Decoder.cpp @@ -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); diff --git a/src/Thread_FileAnalyzer.cpp b/src/Thread_FileAnalyzer.cpp index 96dc2bd0..18d89d96 100644 --- a/src/Thread_FileAnalyzer.cpp +++ b/src/Thread_FileAnalyzer.cpp @@ -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()); diff --git a/src/Thread_Initialization.cpp b/src/Thread_Initialization.cpp index b5390628..15dae70e 100644 --- a/src/Thread_Initialization.cpp +++ b/src/Thread_Initialization.cpp @@ -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},