diff --git a/LameXP.vcproj b/LameXP.vcproj index c6214ec0..c94e5285 100644 --- a/LameXP.vcproj +++ b/LameXP.vcproj @@ -298,6 +298,10 @@ RelativePath=".\src\Decoder_Abstract.cpp" > + + @@ -502,6 +506,10 @@ /> + + @@ -1007,7 +1015,7 @@ @@ -1017,7 +1025,7 @@ @@ -1027,7 +1035,7 @@ diff --git a/res/tools/valdec.exe b/res/tools/valdec.exe index d310fa60..18abbedd 100644 Binary files a/res/tools/valdec.exe and b/res/tools/valdec.exe differ diff --git a/src/Config.h b/src/Config.h index 2194f0e9..302234b8 100644 --- a/src/Config.h +++ b/src/Config.h @@ -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 170 +#define VER_LAMEXP_BUILD 171 #define VER_LAMEXP_SUFFIX TechPreview /* diff --git a/src/Decoder_AC3.cpp b/src/Decoder_AC3.cpp new file mode 100644 index 00000000..6d7ecc13 --- /dev/null +++ b/src/Decoder_AC3.cpp @@ -0,0 +1,140 @@ +/////////////////////////////////////////////////////////////////////////////// +// LameXP - Audio Encoder Front-End +// Copyright (C) 2004-2010 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_AC3.h" + +#include "Global.h" + +#include +#include +#include + +AC3Decoder::AC3Decoder(void) +: + m_binary(lamexp_lookup_tool("valdec.exe")) +{ + if(m_binary.isEmpty()) + { + throw "Error initializing Valib decoder. Tool 'valdec.exe' is not registred!"; + } +} + +AC3Decoder::~AC3Decoder(void) +{ +} + +bool AC3Decoder::decode(const QString &sourceFile, const QString &outputFile, volatile bool *abortFlag) +{ + QProcess process; + QStringList args; + + args << QDir::toNativeSeparators(sourceFile); + args << "-w" << QDir::toNativeSeparators(outputFile); + + if(!startProcess(process, m_binary, args)) + { + return false; + } + + bool bTimeout = false; + bool bAborted = false; + + QRegExp regExp("\\[(\\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("Valdec 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 AC3Decoder::isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion) +{ + if(containerType.compare("AC-3", Qt::CaseInsensitive) == 0) + { + if(formatType.compare("AC-3", Qt::CaseInsensitive) == 0) + { + return true; + } + } + else if(containerType.compare("DTS", Qt::CaseInsensitive) == 0) + { + if(formatType.compare("DTS", Qt::CaseInsensitive) == 0) + { + return true; + } + } + else if(containerType.compare("Wave", Qt::CaseInsensitive) == 0) + { + if(formatType.compare("AC-3", Qt::CaseInsensitive) == 0 || formatType.compare("DTS", Qt::CaseInsensitive) == 0) + { + return true; + } + } + + return false; +} + diff --git a/src/Decoder_AC3.h b/src/Decoder_AC3.h new file mode 100644 index 00000000..954bc35e --- /dev/null +++ b/src/Decoder_AC3.h @@ -0,0 +1,37 @@ +/////////////////////////////////////////////////////////////////////////////// +// LameXP - Audio Encoder Front-End +// Copyright (C) 2004-2010 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 AC3Decoder : public AbstractDecoder +{ +public: + AC3Decoder(void); + ~AC3Decoder(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); + +private: + const QString m_binary; +}; diff --git a/src/Dialog_About.cpp b/src/Dialog_About.cpp index 7ddd00c9..b5d0b2c5 100644 --- a/src/Dialog_About.cpp +++ b/src/Dialog_About.cpp @@ -221,7 +221,7 @@ void AboutDialog::showMoreAbout(void) { QString moreAboutText; moreAboutText += "

The following third-party software is used in LameXP:

"; - moreAboutText += "
    "; + moreAboutText += "
      "; moreAboutText += VSTR( "
    • LAME - OpenSource mp3 Encoder (%1)
      ", "lame.exe", "v?.?? a??"); moreAboutText += "Released under the terms of the GNU Leser General Public License.
      "; @@ -243,7 +243,12 @@ void AboutDialog::showMoreAbout(void) moreAboutText += "Open and patent-free lossless audio compression technology.
      "; moreAboutText += LINK("http://flac.sourceforge.net/"); moreAboutText += "
      "; - + + moreAboutText += VSTR("
    • AC3Filter Tools - AC3/DTS Decoder (%1)
      ", "valdec.exe", "v?.??"); + moreAboutText += "Released under the terms of the GNU Leser General Public License.
      "; + moreAboutText += LINK("http://www.ac3filter.net/projects/tools"); + moreAboutText += "
      "; + moreAboutText += VSTR("
    • MediaInfo - Media File Analysis Tool (%1)
      ", "mediainfo_i386.exe", "v?.?.?"); moreAboutText += "Released under the terms of the GNU Leser General Public License.
      "; moreAboutText += LINK("http://mediainfo.sourceforge.net/"); @@ -254,6 +259,11 @@ void AboutDialog::showMoreAbout(void) moreAboutText += LINK("http://sox.sourceforge.net/"); moreAboutText += "
      "; + moreAboutText += VSTR("
    • GnuPG - The GNU Privacy Guard (%1)
      ", "gpgv.exe", "v?.?.??"); + moreAboutText += "Released under the terms of the GNU Leser General Public License.
      "; + moreAboutText += LINK("http://www.gnupg.org/"); + moreAboutText += "
      "; + moreAboutText += "
    • Silk Icons - Over 700 icons in PNG format (v1.3)
      "; moreAboutText += "By Mark James, released under the Creative Commons 'by' License.
      "; moreAboutText += LINK("http://www.famfamfam.com/lab/icons/silk/"); diff --git a/src/Registry_Decoder.cpp b/src/Registry_Decoder.cpp index c42ba328..4255034d 100644 --- a/src/Registry_Decoder.cpp +++ b/src/Registry_Decoder.cpp @@ -25,6 +25,7 @@ #include "Decoder_MP3.h" #include "Decoder_Vorbis.h" #include "Decoder_FLAC.h" +#include "Decoder_AC3.h" #include "Decoder_WMA.h" #include "Decoder_Wave.h" @@ -37,6 +38,7 @@ AbstractDecoder *DecoderRegistry::lookup(const QString &containerType, const QSt PROBE_DECODER(MP3Decoder); PROBE_DECODER(VorbisDecoder); PROBE_DECODER(AACDecoder); + PROBE_DECODER(AC3Decoder); PROBE_DECODER(FLACDecoder); PROBE_DECODER(WMADecoder); PROBE_DECODER(WaveDecoder); diff --git a/src/Thread_Initialization.cpp b/src/Thread_Initialization.cpp index 03175c23..a6b4a536 100644 --- a/src/Thread_Initialization.cpp +++ b/src/Thread_Initialization.cpp @@ -50,7 +50,7 @@ static const struct lamexp_tool_t g_lamexp_tools[] = {"4ecc017a66fe43092110f11494f384e57d99280d", "elevator.exe", UINT_MAX}, {"097dd004f44dbda57dbaeb5f15b34a220724ad60", "faad.exe", UINT_MAX}, {"133171ac21f083d565ee9c33ef9cd92fc966811e", "flac.exe", 121}, - {"cf379081035ae6bfb6f7bc22f13bfb7ac6302ac5", "gpgv.exe", UINT_MAX}, + {"cf379081035ae6bfb6f7bc22f13bfb7ac6302ac5", "gpgv.exe", 1410}, {"d837bf6ee4dab557d8b02d46c75a24e58980fffa", "gpgv.gpg", UINT_MAX}, {"143fc001a2f6c56fe1b9e6f8a2eb2b53b9e1e504", "lame.exe", 39910}, {"775b260b3f64101beaeb317b74746f9bccdab842", "MAC.exe", UINT_MAX}, @@ -68,7 +68,7 @@ static const struct lamexp_tool_t g_lamexp_tools[] = {"346ce516281c97e92e1b8957ddeca52edcf2d056", "speexdec.exe", UINT_MAX}, {"8a74b767cfe88bf88c068fdae0de02d65589d25e", "takc.exe", UINT_MAX}, {"1c5cedb56358a0e8c4590a863a97c94d7d7e98b2", "ttaenc.exe", UINT_MAX}, - {"7dcf6517aa90ed15737ee8ea50ea00a6dece2d27", "valdec.exe", UINT_MAX}, + {"04bac2f01765e10e89e38b3244ee8c4f247dbbfd", "valdec.exe", 31}, {"8159f4e824b3e343ece95ba6dbb5e16da9c4866e", "volumax.exe", UINT_MAX}, {"62e2805d1b2eb2a4d86a5ca6e6ea58010d05d2a7", "wget.exe", UINT_MAX}, {"a17011961aa8696bc935e097b3242d33c38a9842", "wupdate.exe", UINT_MAX},