///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End
-// Copyright (C) 2004-2011 LoRd_MuldeR <MuldeR2@GMX.de>
+// Copyright (C) 2004-2012 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
#include "Global.h"
#include "Model_Settings.h"
+#include <math.h>
#include <QProcess>
#include <QDir>
-#define max(a,b) (((a) > (b)) ? (a) : (b))
-#define min(a,b) (((a) < (b)) ? (a) : (b))
-
-inline int round(double x) { return static_cast<int>(floor((x < 0.0) ? x - 0.5 : x + 0.5)); }
-
FHGAACEncoder::FHGAACEncoder(void)
:
m_binary_enc(lamexp_lookup_tool("fhgaacenc.exe")),
switch(m_configRCMode)
{
case SettingsModel::CBRMode:
- args << "--cbr" << QString::number(max(32, min(maxBitrate, (m_configBitrate * 8))));
+ args << "--cbr" << QString::number(qMax(32, qMin(maxBitrate, (m_configBitrate * 8))));
break;
case SettingsModel::VBRMode:
- args << "--vbr" << QString::number(round(static_cast<double>(m_configBitrate) / 5.0) + 1);
+ args << "--vbr" << QString::number(qRound(static_cast<double>(m_configBitrate) / 5.0) + 1);
break;
default:
throw "Bad rate-control mode!";
args << "--dll" << m_binary_dll;
+ if(!m_configCustomParams.isEmpty()) args << m_configCustomParams.split(" ", QString::SkipEmptyParts);
+
args << QDir::toNativeSeparators(sourceFile);
args << QDir::toNativeSeparators(outputFile);
bool bTimeout = false;
bool bAborted = false;
+ int prevProgress = -1;
QRegExp regExp("Progress:\\s*(\\d+)%");
{
bool ok = false;
int progress = regExp.cap(1).toInt(&ok);
- if(ok) emit statusUpdated(progress);
+ if(ok && (progress > prevProgress))
+ {
+ emit statusUpdated(progress);
+ prevProgress = qMin(progress + 2, 99);
+ }
}
else if(!text.isEmpty())
{
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
- if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit)
+ if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS)
{
return false;
}
return false;
}
+const unsigned int *FHGAACEncoder::supportedChannelCount(void)
+{
+ static const unsigned int supportedChannels[] = {1, 2, 4, 5, 6, NULL};
+ return supportedChannels;
+}
+
+const unsigned int *FHGAACEncoder::supportedSamplerates(void)
+{
+ static const unsigned int supportedRates[] = {192000, 96000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 6000, NULL};
+ return supportedRates;
+}
+
+const unsigned int *FHGAACEncoder::supportedBitdepths(void)
+{
+ static const unsigned int supportedBPS[] = {16, 24, NULL};
+ return supportedBPS;
+}
void FHGAACEncoder::setProfile(int profile)
{