AC-3 and DTS decoding support.

This commit is contained in:
LoRd_MuldeR 2010-12-19 23:09:26 +01:00
parent 10cffb46e5
commit 6c139ab640
8 changed files with 205 additions and 8 deletions

View File

@ -298,6 +298,10 @@
RelativePath=".\src\Decoder_Abstract.cpp" RelativePath=".\src\Decoder_Abstract.cpp"
> >
</File> </File>
<File
RelativePath=".\src\Decoder_AC3.cpp"
>
</File>
<File <File
RelativePath=".\src\Decoder_FLAC.cpp" RelativePath=".\src\Decoder_FLAC.cpp"
> >
@ -502,6 +506,10 @@
/> />
</FileConfiguration> </FileConfiguration>
</File> </File>
<File
RelativePath=".\src\Decoder_AC3.h"
>
</File>
<File <File
RelativePath=".\src\Decoder_FLAC.h" RelativePath=".\src\Decoder_FLAC.h"
> >
@ -1007,7 +1015,7 @@
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
Description="MOC &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;" Description="MOC &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
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;" Outputs="&quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
/> />
</FileConfiguration> </FileConfiguration>
@ -1017,7 +1025,7 @@
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
Description="MOC &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;" Description="MOC &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
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;" Outputs="&quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
/> />
</FileConfiguration> </FileConfiguration>
@ -1027,7 +1035,7 @@
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
Description="MOC &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;" Description="MOC &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
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;" Outputs="&quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
/> />
</FileConfiguration> </FileConfiguration>

Binary file not shown.

View File

@ -25,7 +25,7 @@
#define VER_LAMEXP_MAJOR 4 #define VER_LAMEXP_MAJOR 4
#define VER_LAMEXP_MINOR_HI 0 #define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 0 #define VER_LAMEXP_MINOR_LO 0
#define VER_LAMEXP_BUILD 170 #define VER_LAMEXP_BUILD 171
#define VER_LAMEXP_SUFFIX TechPreview #define VER_LAMEXP_SUFFIX TechPreview
/* /*

140
src/Decoder_AC3.cpp Normal file
View File

@ -0,0 +1,140 @@
///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End
// Copyright (C) 2004-2010 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_AC3.h"
#include "Global.h"
#include <QDir>
#include <QProcess>
#include <QRegExp>
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;
}

37
src/Decoder_AC3.h Normal file
View File

@ -0,0 +1,37 @@
///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End
// Copyright (C) 2004-2010 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 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;
};

View File

@ -221,7 +221,7 @@ void AboutDialog::showMoreAbout(void)
{ {
QString moreAboutText; QString moreAboutText;
moreAboutText += "<h3>The following third-party software is used in LameXP:</h3>"; moreAboutText += "<h3>The following third-party software is used in LameXP:</h3>";
moreAboutText += "<div style=\"margin-left:-25px\"><ul>"; moreAboutText += "<div style=\"margin-left:-25px;font-size:8pt\"><ul>";
moreAboutText += VSTR( "<li><b>LAME - OpenSource mp3 Encoder (%1)</b><br>", "lame.exe", "v?.?? a??"); moreAboutText += VSTR( "<li><b>LAME - OpenSource mp3 Encoder (%1)</b><br>", "lame.exe", "v?.?? a??");
moreAboutText += "Released under the terms of the GNU Leser General Public License.<br>"; moreAboutText += "Released under the terms of the GNU Leser General Public License.<br>";
@ -244,6 +244,11 @@ void AboutDialog::showMoreAbout(void)
moreAboutText += LINK("http://flac.sourceforge.net/"); moreAboutText += LINK("http://flac.sourceforge.net/");
moreAboutText += "<br>"; moreAboutText += "<br>";
moreAboutText += VSTR("<li><b>AC3Filter Tools - AC3/DTS Decoder (%1)</b><br>", "valdec.exe", "v?.??");
moreAboutText += "Released under the terms of the GNU Leser General Public License.<br>";
moreAboutText += LINK("http://www.ac3filter.net/projects/tools");
moreAboutText += "<br>";
moreAboutText += VSTR("<li><b>MediaInfo - Media File Analysis Tool (%1)</b><br>", "mediainfo_i386.exe", "v?.?.?"); moreAboutText += VSTR("<li><b>MediaInfo - Media File Analysis Tool (%1)</b><br>", "mediainfo_i386.exe", "v?.?.?");
moreAboutText += "Released under the terms of the GNU Leser General Public License.<br>"; moreAboutText += "Released under the terms of the GNU Leser General Public License.<br>";
moreAboutText += LINK("http://mediainfo.sourceforge.net/"); moreAboutText += LINK("http://mediainfo.sourceforge.net/");
@ -254,6 +259,11 @@ void AboutDialog::showMoreAbout(void)
moreAboutText += LINK("http://sox.sourceforge.net/"); moreAboutText += LINK("http://sox.sourceforge.net/");
moreAboutText += "<br>"; moreAboutText += "<br>";
moreAboutText += VSTR("<li><b>GnuPG - The GNU Privacy Guard (%1)</b><br>", "gpgv.exe", "v?.?.??");
moreAboutText += "Released under the terms of the GNU Leser General Public License.<br>";
moreAboutText += LINK("http://www.gnupg.org/");
moreAboutText += "<br>";
moreAboutText += "<li><b>Silk Icons - Over 700 icons in PNG format (v1.3)</b><br>"; moreAboutText += "<li><b>Silk Icons - Over 700 icons in PNG format (v1.3)</b><br>";
moreAboutText += "<nobr>By Mark James, released under the Creative Commons 'by' License.</nobr><br>"; moreAboutText += "<nobr>By Mark James, released under the Creative Commons 'by' License.</nobr><br>";
moreAboutText += LINK("http://www.famfamfam.com/lab/icons/silk/"); moreAboutText += LINK("http://www.famfamfam.com/lab/icons/silk/");

View File

@ -25,6 +25,7 @@
#include "Decoder_MP3.h" #include "Decoder_MP3.h"
#include "Decoder_Vorbis.h" #include "Decoder_Vorbis.h"
#include "Decoder_FLAC.h" #include "Decoder_FLAC.h"
#include "Decoder_AC3.h"
#include "Decoder_WMA.h" #include "Decoder_WMA.h"
#include "Decoder_Wave.h" #include "Decoder_Wave.h"
@ -37,6 +38,7 @@ AbstractDecoder *DecoderRegistry::lookup(const QString &containerType, const QSt
PROBE_DECODER(MP3Decoder); PROBE_DECODER(MP3Decoder);
PROBE_DECODER(VorbisDecoder); PROBE_DECODER(VorbisDecoder);
PROBE_DECODER(AACDecoder); PROBE_DECODER(AACDecoder);
PROBE_DECODER(AC3Decoder);
PROBE_DECODER(FLACDecoder); PROBE_DECODER(FLACDecoder);
PROBE_DECODER(WMADecoder); PROBE_DECODER(WMADecoder);
PROBE_DECODER(WaveDecoder); PROBE_DECODER(WaveDecoder);

View File

@ -50,7 +50,7 @@ static const struct lamexp_tool_t g_lamexp_tools[] =
{"4ecc017a66fe43092110f11494f384e57d99280d", "elevator.exe", UINT_MAX}, {"4ecc017a66fe43092110f11494f384e57d99280d", "elevator.exe", UINT_MAX},
{"097dd004f44dbda57dbaeb5f15b34a220724ad60", "faad.exe", UINT_MAX}, {"097dd004f44dbda57dbaeb5f15b34a220724ad60", "faad.exe", UINT_MAX},
{"133171ac21f083d565ee9c33ef9cd92fc966811e", "flac.exe", 121}, {"133171ac21f083d565ee9c33ef9cd92fc966811e", "flac.exe", 121},
{"cf379081035ae6bfb6f7bc22f13bfb7ac6302ac5", "gpgv.exe", UINT_MAX}, {"cf379081035ae6bfb6f7bc22f13bfb7ac6302ac5", "gpgv.exe", 1410},
{"d837bf6ee4dab557d8b02d46c75a24e58980fffa", "gpgv.gpg", UINT_MAX}, {"d837bf6ee4dab557d8b02d46c75a24e58980fffa", "gpgv.gpg", UINT_MAX},
{"143fc001a2f6c56fe1b9e6f8a2eb2b53b9e1e504", "lame.exe", 39910}, {"143fc001a2f6c56fe1b9e6f8a2eb2b53b9e1e504", "lame.exe", 39910},
{"775b260b3f64101beaeb317b74746f9bccdab842", "MAC.exe", UINT_MAX}, {"775b260b3f64101beaeb317b74746f9bccdab842", "MAC.exe", UINT_MAX},
@ -68,7 +68,7 @@ static const struct lamexp_tool_t g_lamexp_tools[] =
{"346ce516281c97e92e1b8957ddeca52edcf2d056", "speexdec.exe", UINT_MAX}, {"346ce516281c97e92e1b8957ddeca52edcf2d056", "speexdec.exe", UINT_MAX},
{"8a74b767cfe88bf88c068fdae0de02d65589d25e", "takc.exe", UINT_MAX}, {"8a74b767cfe88bf88c068fdae0de02d65589d25e", "takc.exe", UINT_MAX},
{"1c5cedb56358a0e8c4590a863a97c94d7d7e98b2", "ttaenc.exe", UINT_MAX}, {"1c5cedb56358a0e8c4590a863a97c94d7d7e98b2", "ttaenc.exe", UINT_MAX},
{"7dcf6517aa90ed15737ee8ea50ea00a6dece2d27", "valdec.exe", UINT_MAX}, {"04bac2f01765e10e89e38b3244ee8c4f247dbbfd", "valdec.exe", 31},
{"8159f4e824b3e343ece95ba6dbb5e16da9c4866e", "volumax.exe", UINT_MAX}, {"8159f4e824b3e343ece95ba6dbb5e16da9c4866e", "volumax.exe", UINT_MAX},
{"62e2805d1b2eb2a4d86a5ca6e6ea58010d05d2a7", "wget.exe", UINT_MAX}, {"62e2805d1b2eb2a4d86a5ca6e6ea58010d05d2a7", "wget.exe", UINT_MAX},
{"a17011961aa8696bc935e097b3242d33c38a9842", "wupdate.exe", UINT_MAX}, {"a17011961aa8696bc935e097b3242d33c38a9842", "wupdate.exe", UINT_MAX},