Explicitly pass "--discard-comments" to OggEnc2 + some code refactoring.

This commit is contained in:
LoRd_MuldeR 2016-04-16 13:26:21 +02:00
parent b6b0413e86
commit 898eb216eb
17 changed files with 219 additions and 212 deletions

View File

@ -86,6 +86,7 @@
<ul>
<li>Upgraded build environment to Microsoft Visual Studio 2015 with Update-2</li>
<li>Fixed the location of temporary intermediate files for SoX-based audio effects</li>
<li>Fixed embedding of meta tags with OggEnc2 when reading directly from OGG/FLAC input file</li>
<li>Enabled the &quot;built-in&quot; resampler for QAAC encoder</li>
<li>The &quot;Algorithm Quality&quot; slider now also affects the QAAC encoder</li>
<li>Added &quot;AVX&quot; (Advanced Vector Extensions) to CPU feature detection code</li>

View File

@ -6,6 +6,7 @@
* Upgraded build environment to Microsoft Visual Studio 2015 with Update-2
* Fixed the location of temporary intermediate files for SoX-based audio effects
* Fixed embedding of meta tags with OggEnc2 when reading directly from OGG/FLAC input file
* Enabled the "built-in" resampler for QAAC encoder
* The "Algorithm Quality" slider now also affects the QAAC encoder
* Added "AVX" (Advanced Vector Extensions) to CPU feature detection code

View File

@ -34,8 +34,8 @@
#define VER_LAMEXP_MINOR_HI 1
#define VER_LAMEXP_MINOR_LO 4
#define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 8
#define VER_LAMEXP_BUILD 1878
#define VER_LAMEXP_PATCH 9
#define VER_LAMEXP_BUILD 1880
#define VER_LAMEXP_CONFG 1818
///////////////////////////////////////////////////////////////////////////////

View File

@ -128,11 +128,10 @@ static const g_aacEncoderInfo;
AACEncoder::AACEncoder(void)
:
m_binary_enc(lamexp_tools_lookup("neroAacEnc.exe")),
m_binary_tag(lamexp_tools_lookup("neroAacTag.exe")),
m_binary_sox(lamexp_tools_lookup("sox.exe"))
m_binary_enc(lamexp_tools_lookup(L1S("neroAacEnc.exe"))),
m_binary_tag(lamexp_tools_lookup(L1S("neroAacTag.exe")))
{
if(m_binary_enc.isEmpty() || m_binary_tag.isEmpty() || m_binary_sox.isEmpty())
if(m_binary_enc.isEmpty() || m_binary_tag.isEmpty())
{
MUTILS_THROW("Error initializing AAC encoder. Tool 'neroAacEnc.exe' is not registred!");
}
@ -154,13 +153,13 @@ bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
switch(m_configRCMode)
{
case SettingsModel::VBRMode:
args << "-q" << QString().sprintf("%.2f", double(qBound(0, m_configBitrate * 5, 100)) / 100.0);
args << L1S("-q") << QString().sprintf("%.2f", double(qBound(0, m_configBitrate * 5, 100)) / 100.0);
break;
case SettingsModel::ABRMode:
args << "-br" << QString::number(qBound(8, index2bitrate(m_configBitrate), 400) * 1000);
args << L1S("-br") << QString::number(qBound(8, index2bitrate(m_configBitrate), 400) * 1000);
break;
case SettingsModel::CBRMode:
args << "-cbr" << QString::number(qBound(8, index2bitrate(m_configBitrate), 400) * 1000);
args << L1S("-cbr") << QString::number(qBound(8, index2bitrate(m_configBitrate), 400) * 1000);
break;
default:
MUTILS_THROW("Bad rate-control mode!");
@ -169,26 +168,26 @@ bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
if(m_configEnable2Pass && (m_configRCMode == SettingsModel::ABRMode))
{
args << "-2pass";
args << L1S("-2pass");
}
switch(m_configProfile)
{
case 1:
args << "-lc"; //Forces use of LC AAC profile
args << L1S("-lc"); //Forces use of LC AAC profile
break;
case 2:
args << "-he"; //Forces use of HE AAC profile
args << L1S("-he"); //Forces use of HE AAC profile
break;
case 3:
args << "-hev2"; //Forces use of HEv2 AAC profile
args << L1S("-hev2"); //Forces use of HEv2 AAC profile
break;
}
if(!m_configCustomParams.isEmpty()) args << m_configCustomParams.split(" ", QString::SkipEmptyParts);
args << "-if" << QDir::toNativeSeparators(sourceFile);
args << "-of" << QDir::toNativeSeparators(outputFile);
args << L1S("-if") << QDir::toNativeSeparators(sourceFile);
args << L1S("-of") << QDir::toNativeSeparators(outputFile);
if(!startProcess(process, m_binary_enc, args))
{
@ -200,9 +199,9 @@ bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
int prevProgress = -1;
QRegExp regExp("Processed\\s+(\\d+)\\s+seconds");
QRegExp regExp_pass1("First\\s+pass:\\s+processed\\s+(\\d+)\\s+seconds");
QRegExp regExp_pass2("Second\\s+pass:\\s+processed\\s+(\\d+)\\s+seconds");
QRegExp regExp(L1S("Processed\\s+(\\d+)\\s+seconds"));
QRegExp regExp_pass1(L1S("First\\s+pass:\\s+processed\\s+(\\d+)\\s+seconds"));
QRegExp regExp_pass2(L1S("Second\\s+pass:\\s+processed\\s+(\\d+)\\s+seconds"));
while(process.state() != QProcess::NotRunning)
{
@ -210,7 +209,7 @@ bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
{
process.kill();
bAborted = true;
emit messageLogged("\nABORTED BY USER !!!");
emit messageLogged(L1S("\nABORTED BY USER !!!"));
break;
}
process.waitForReadyRead(m_processTimeoutInterval);
@ -218,7 +217,7 @@ bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
{
process.kill();
qWarning("NeroAacEnc process timed out <-- killing!");
emit messageLogged("\nPROCESS TIMEOUT !!!");
emit messageLogged(L1S("\nPROCESS TIMEOUT !!!"));
bTimeout = true;
break;
}
@ -295,7 +294,7 @@ bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
return true;
}
emit messageLogged("\n-------------------------------\n");
emit messageLogged(L1S("\n-------------------------------\n"));
args.clear();
args << QDir::toNativeSeparators(outputFile);
@ -322,7 +321,7 @@ bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
{
process.kill();
bAborted = true;
emit messageLogged("\nABORTED BY USER !!!");
emit messageLogged(L1S("\nABORTED BY USER !!!"));
break;
}
process.waitForReadyRead(m_processTimeoutInterval);
@ -330,7 +329,7 @@ bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
{
process.kill();
qWarning("NeroAacTag process timed out <-- killing!");
emit messageLogged("\nPROCESS TIMEOUT !!!");
emit messageLogged(L1S("\nPROCESS TIMEOUT !!!"));
bTimeout = true;
break;
}
@ -364,9 +363,9 @@ bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
bool AACEncoder::isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion)
{
if(containerType.compare("Wave", Qt::CaseInsensitive) == 0)
if(containerType.compare(L1S("Wave"), Qt::CaseInsensitive) == 0)
{
if(formatType.compare("PCM", Qt::CaseInsensitive) == 0)
if(formatType.compare(L1S("PCM"), Qt::CaseInsensitive) == 0)
{
return true;
}

View File

@ -49,7 +49,7 @@ public:
private:
const QString m_binary_enc;
const QString m_binary_tag;
const QString m_binary_sox;
//const QString m_binary_sox;
int m_configProfile;
bool m_configEnable2Pass;
};

View File

@ -134,7 +134,7 @@ static const g_fdkAacEncoderInfo;
FDKAACEncoder::FDKAACEncoder(void)
:
m_binary(lamexp_tools_lookup("fdkaac.exe"))
m_binary(lamexp_tools_lookup(L1S("fdkaac.exe")))
{
if(m_binary.isEmpty())
{
@ -154,29 +154,29 @@ bool FDKAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaI
QStringList args;
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert("PATH", QDir::toNativeSeparators(QString("%1;%1/QTfiles;%2").arg(QDir(QCoreApplication::applicationDirPath()).canonicalPath(), MUtils::temp_folder())));
env.insert(L1S("PATH"), QDir::toNativeSeparators(QString("%1;%1/QTfiles;%2").arg(QDir(QCoreApplication::applicationDirPath()).canonicalPath(), MUtils::temp_folder())));
process.setProcessEnvironment(env);
switch(m_configProfile)
{
case 1:
args << "-p" << "2";
args << L1S("-p") << QString::number(2);
break;
case 2:
args << "-p" << "5";
args << L1S("-p") << QString::number(5);
break;
case 3:
args << "-p" << "29";
args << L1S("-p") << QString::number(29);
break;
}
switch(m_configRCMode)
{
case SettingsModel::CBRMode:
args << "-b" << QString::number(qBound(8, index2bitrate(m_configBitrate), 576));
args << L1S("-b") << QString::number(qBound(8, index2bitrate(m_configBitrate), 576));
break;
case SettingsModel::VBRMode:
args << "-m" << QString::number(qBound(1, m_configBitrate + 1 , 5));
args << L1S("-m") << QString::number(qBound(1, m_configBitrate + 1 , 5));
break;
default:
MUTILS_THROW("Bad rate-control mode!");
@ -185,15 +185,15 @@ bool FDKAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaI
if(!m_configCustomParams.isEmpty()) args << m_configCustomParams.split(" ", QString::SkipEmptyParts);
if(!metaInfo.title().isEmpty()) args << "--title" << cleanTag(metaInfo.title());
if(!metaInfo.artist().isEmpty()) args << "--artist" << cleanTag(metaInfo.artist());
if(!metaInfo.album().isEmpty()) args << "--album" << cleanTag(metaInfo.album());
if(!metaInfo.genre().isEmpty()) args << "--genre" << cleanTag(metaInfo.genre());
if(!metaInfo.comment().isEmpty()) args << "--comment" << cleanTag( metaInfo.comment());
if(metaInfo.year()) args << "--date" << QString::number(metaInfo.year());
if(metaInfo.position()) args << "--track" << QString::number(metaInfo.position());
if(!metaInfo.title().isEmpty()) args << L1S("--title") << cleanTag(metaInfo.title());
if(!metaInfo.artist().isEmpty()) args << L1S("--artist") << cleanTag(metaInfo.artist());
if(!metaInfo.album().isEmpty()) args << L1S("--album") << cleanTag(metaInfo.album());
if(!metaInfo.genre().isEmpty()) args << L1S("--genre") << cleanTag(metaInfo.genre());
if(!metaInfo.comment().isEmpty()) args << L1S("--comment") << cleanTag( metaInfo.comment());
if(metaInfo.year()) args << L1S("--date") << QString::number(metaInfo.year());
if(metaInfo.position()) args << L1S("--track") << QString::number(metaInfo.position());
args << "-o" << QDir::toNativeSeparators(outputFile);
args << L1S("-o") << QDir::toNativeSeparators(outputFile);
args << QDir::toNativeSeparators(sourceFile);
if(!startProcess(process, m_binary, args, QFileInfo(outputFile).canonicalPath()))
@ -205,7 +205,7 @@ bool FDKAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaI
bool bAborted = false;
int prevProgress = -1;
QRegExp regExp("\\[(\\d+)%\\]\\s+(\\d+):(\\d+)");
QRegExp regExp(L1S("\\[(\\d+)%\\]\\s+(\\d+):(\\d+)"));
while(process.state() != QProcess::NotRunning)
{
@ -213,7 +213,7 @@ bool FDKAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaI
{
process.kill();
bAborted = true;
emit messageLogged("\nABORTED BY USER !!!");
emit messageLogged(L1S("\nABORTED BY USER !!!"));
break;
}
process.waitForReadyRead(m_processTimeoutInterval);
@ -221,7 +221,7 @@ bool FDKAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaI
{
process.kill();
qWarning("FDKAAC process timed out <-- killing!");
emit messageLogged("\nPROCESS TIMEOUT !!!");
emit messageLogged(L1S("\nPROCESS TIMEOUT !!!"));
bTimeout = true;
break;
}
@ -266,9 +266,9 @@ bool FDKAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaI
bool FDKAACEncoder::isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion)
{
if(containerType.compare("Wave", Qt::CaseInsensitive) == 0)
if(containerType.compare(L1S("Wave"), Qt::CaseInsensitive) == 0)
{
if(formatType.compare("PCM", Qt::CaseInsensitive) == 0)
if(formatType.compare(L1S("PCM"), Qt::CaseInsensitive) == 0)
{
return true;
}

View File

@ -131,8 +131,8 @@ static const g_fhgAacEncoderInfo;
FHGAACEncoder::FHGAACEncoder(void)
:
m_binary_enc(lamexp_tools_lookup("fhgaacenc.exe")),
m_binary_dll(lamexp_tools_lookup("enc_fhgaac.dll"))
m_binary_enc(lamexp_tools_lookup(L1S("fhgaacenc.exe"))),
m_binary_dll(lamexp_tools_lookup(L1S("enc_fhgaac.dll")))
{
if(m_binary_enc.isEmpty() || m_binary_dll.isEmpty())
{
@ -158,15 +158,15 @@ bool FHGAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaI
switch(m_configProfile)
{
case 1:
args << "--profile" << "lc"; //Forces use of LC AAC profile
args << L1S("--profile") << L1S("lc"); //Forces use of LC AAC profile
break;
case 2:
maxBitrate = 128;
args << "--profile" << "he"; //Forces use of HE AAC profile
args << L1S("--profile") << L1S("he"); //Forces use of HE AAC profile
break;
case 3:
maxBitrate = 56;
args << "--profile" << "hev2"; //Forces use of HEv2 AAC profile
args << L1S("--profile") << L1S("hev2"); //Forces use of HEv2 AAC profile
break;
}
}
@ -174,10 +174,10 @@ bool FHGAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaI
switch(m_configRCMode)
{
case SettingsModel::CBRMode:
args << "--cbr" << QString::number(qBound(8, index2bitrate(m_configBitrate), maxBitrate));
args << L1S("--cbr") << QString::number(qBound(8, index2bitrate(m_configBitrate), maxBitrate));
break;
case SettingsModel::VBRMode:
args << "--vbr" << QString::number(qBound(1, m_configBitrate + 1, 6));
args << L1S("--vbr") << QString::number(qBound(1, m_configBitrate + 1, 6));
break;
default:
MUTILS_THROW("Bad rate-control mode!");
@ -200,7 +200,7 @@ bool FHGAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaI
bool bAborted = false;
int prevProgress = -1;
QRegExp regExp("Progress:\\s*(\\d+)%");
QRegExp regExp(L1S("Progress:\\s*(\\d+)%"));
while(process.state() != QProcess::NotRunning)
{
@ -208,7 +208,7 @@ bool FHGAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaI
{
process.kill();
bAborted = true;
emit messageLogged("\nABORTED BY USER !!!");
emit messageLogged(L1S("\nABORTED BY USER !!!"));
break;
}
process.waitForReadyRead(m_processTimeoutInterval);
@ -216,7 +216,7 @@ bool FHGAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaI
{
process.kill();
qWarning("FhgAacEnc process timed out <-- killing!");
emit messageLogged("\nPROCESS TIMEOUT !!!");
emit messageLogged(L1S("\nPROCESS TIMEOUT !!!"));
bTimeout = true;
break;
}
@ -261,9 +261,9 @@ bool FHGAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaI
bool FHGAACEncoder::isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion)
{
if(containerType.compare("Wave", Qt::CaseInsensitive) == 0)
if(containerType.compare(L1S("Wave"), Qt::CaseInsensitive) == 0)
{
if(formatType.compare("PCM", Qt::CaseInsensitive) == 0)
if(formatType.compare(L1S("PCM"), Qt::CaseInsensitive) == 0)
{
return true;
}

View File

@ -141,8 +141,8 @@ static const g_qaacEncoderInfo;
QAACEncoder::QAACEncoder(void)
:
m_binary_qaac32(lamexp_tools_lookup("qaac.exe")),
m_binary_qaac64(lamexp_tools_lookup("qaac64.exe"))
m_binary_qaac32(lamexp_tools_lookup(L1S("qaac.exe"))),
m_binary_qaac64(lamexp_tools_lookup(L1S("qaac64.exe")))
{
if(m_binary_qaac32.isEmpty() && m_binary_qaac64.isEmpty())
{
@ -165,7 +165,7 @@ bool QAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInf
QStringList args;
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert("PATH", QDir::toNativeSeparators(QString("%1;%1/QTfiles;%2").arg(QDir(QCoreApplication::applicationDirPath()).canonicalPath(), MUtils::temp_folder())));
env.insert(L1S("PATH"), QDir::toNativeSeparators(QString("%1;%1/QTfiles;%2").arg(QDir(QCoreApplication::applicationDirPath()).canonicalPath(), MUtils::temp_folder())));
process.setProcessEnvironment(env);
if(m_configRCMode != SettingsModel::VBRMode)
@ -174,7 +174,7 @@ bool QAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInf
{
case 2:
case 3:
args << "--he"; //Forces use of HE AAC profile (there is no explicit HEv2 switch for QAAC)
args << L1S("--he"); //Forces use of HE AAC profile (there is no explicit HEv2 switch for QAAC)
break;
}
}
@ -182,39 +182,39 @@ bool QAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInf
switch(m_configRCMode)
{
case SettingsModel::CBRMode:
args << "--cbr" << QString::number(qBound(8, index2bitrate(m_configBitrate), 576));
args << L1S("--cbr") << QString::number(qBound(8, index2bitrate(m_configBitrate), 576));
break;
case SettingsModel::ABRMode:
args << "--cvbr" << QString::number(qBound(8, index2bitrate(m_configBitrate), 576));
args << L1S("--cvbr") << QString::number(qBound(8, index2bitrate(m_configBitrate), 576));
break;
case SettingsModel::VBRMode:
args << "--tvbr" << QString::number(g_qaacVBRQualityLUT[qBound(0, m_configBitrate , 14)]);
args << L1S("--tvbr") << QString::number(g_qaacVBRQualityLUT[qBound(0, m_configBitrate , 14)]);
break;
default:
MUTILS_THROW("Bad rate-control mode!");
break;
}
args << "--quality" << QString::number(qBound(0, m_algorithmQuality, 2));
args << L1S("--quality") << QString::number(qBound(0, m_algorithmQuality, 2));
if (m_configSamplingRate > 0)
{
args << QString("--native-resampler=bats,%0").arg(QString::number(RESAMPLING_QUALITY));
args << "--rate" << QString::number(m_configSamplingRate);
args << L1S("--rate") << QString::number(m_configSamplingRate);
}
if(!m_configCustomParams.isEmpty()) args << m_configCustomParams.split(" ", QString::SkipEmptyParts);
if(!metaInfo.title().isEmpty()) args << "--title" << cleanTag(metaInfo.title());
if(!metaInfo.artist().isEmpty()) args << "--artist" << cleanTag(metaInfo.artist());
if(!metaInfo.album().isEmpty()) args << "--album" << cleanTag(metaInfo.album());
if(!metaInfo.genre().isEmpty()) args << "--genre" << cleanTag(metaInfo.genre());
if(!metaInfo.comment().isEmpty()) args << "--comment" << cleanTag( metaInfo.comment());
if(metaInfo.year()) args << "--date" << QString::number(metaInfo.year());
if(metaInfo.position()) args << "--track" << QString::number(metaInfo.position());
if(!metaInfo.cover().isEmpty()) args << "--artwork" << metaInfo.cover();
if(!metaInfo.title().isEmpty()) args << L1S("--title") << cleanTag(metaInfo.title());
if(!metaInfo.artist().isEmpty()) args << L1S("--artist") << cleanTag(metaInfo.artist());
if(!metaInfo.album().isEmpty()) args << L1S("--album") << cleanTag(metaInfo.album());
if(!metaInfo.genre().isEmpty()) args << L1S("--genre") << cleanTag(metaInfo.genre());
if(!metaInfo.comment().isEmpty()) args << L1S("--comment") << cleanTag( metaInfo.comment());
if(metaInfo.year()) args << L1S("--date") << QString::number(metaInfo.year());
if(metaInfo.position()) args << L1S("--track") << QString::number(metaInfo.position());
if(!metaInfo.cover().isEmpty()) args << L1S("--artwork") << metaInfo.cover();
args << "-d" << ".";
args << "-o" << QDir::toNativeSeparators(outputFile);
args << L1S("-d") << L1S(".");
args << L1S("-o") << QDir::toNativeSeparators(outputFile);
args << QDir::toNativeSeparators(sourceFile);
if(!startProcess(process, qaac_bin, args, QFileInfo(outputFile).canonicalPath()))
@ -226,7 +226,7 @@ bool QAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInf
bool bAborted = false;
int prevProgress = -1;
QRegExp regExp("\\[(\\d+)\\.(\\d)%\\]");
QRegExp regExp(L1S("\\[(\\d+)\\.(\\d)%\\]"));
while(process.state() != QProcess::NotRunning)
{
@ -234,7 +234,7 @@ bool QAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInf
{
process.kill();
bAborted = true;
emit messageLogged("\nABORTED BY USER !!!");
emit messageLogged(L1S("\nABORTED BY USER !!!"));
break;
}
process.waitForReadyRead(m_processTimeoutInterval);
@ -242,7 +242,7 @@ bool QAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInf
{
process.kill();
qWarning("QAAC process timed out <-- killing!");
emit messageLogged("\nPROCESS TIMEOUT !!!");
emit messageLogged(L1S("\nPROCESS TIMEOUT !!!"));
bTimeout = true;
break;
}
@ -287,9 +287,9 @@ bool QAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInf
bool QAACEncoder::isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion)
{
if(containerType.compare("Wave", Qt::CaseInsensitive) == 0)
if(containerType.compare(L1S("Wave"), Qt::CaseInsensitive) == 0)
{
if(formatType.compare("PCM", Qt::CaseInsensitive) == 0)
if(formatType.compare(L1S("PCM"), Qt::CaseInsensitive) == 0)
{
return true;
}

View File

@ -127,7 +127,7 @@ static const g_aftenEncoderInfo;
AC3Encoder::AC3Encoder(void)
:
m_binary(lamexp_tools_lookup("aften.exe"))
m_binary(lamexp_tools_lookup(L1S("aften.exe")))
{
if(m_binary.isEmpty())
{
@ -152,10 +152,10 @@ bool AC3Encoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
switch(m_configRCMode)
{
case SettingsModel::VBRMode:
args << "-q" << QString::number(qBound(0, m_configBitrate * 16, 1023));
args << L1S("-q") << QString::number(qBound(0, m_configBitrate * 16, 1023));
break;
case SettingsModel::CBRMode:
args << "-b" << QString::number(g_ac3BitratesLUT[qBound(0, m_configBitrate, 18)]);
args << L1S("-b") << QString::number(g_ac3BitratesLUT[qBound(0, m_configBitrate, 18)]);
break;
default:
MUTILS_THROW("Bad rate-control mode!");
@ -164,19 +164,19 @@ bool AC3Encoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
if(m_configAudioCodingMode >= 1)
{
args << "-acmod" << QString::number(m_configAudioCodingMode - 1);
args << L1S("-acmod") << QString::number(m_configAudioCodingMode - 1);
}
if(m_configDynamicRangeCompression != 5)
{
args << "-dynrng" << QString::number(m_configDynamicRangeCompression);
args << L1S("-dynrng") << QString::number(m_configDynamicRangeCompression);
}
if(m_configExponentSearchSize != 8)
{
args << "-exps" << QString::number(m_configExponentSearchSize);
args << L1S("-exps") << QString::number(m_configExponentSearchSize);
}
if(m_configFastBitAllocation)
{
args << "-fba" << QString::number(1);
args << L1S("-fba") << QString::number(1);
}
if(!m_configCustomParams.isEmpty()) args << m_configCustomParams.split(" ", QString::SkipEmptyParts);
@ -193,7 +193,7 @@ bool AC3Encoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
bool bAborted = false;
int prevProgress = -1;
QRegExp regExp("progress:(\\s+)(\\d+)%(\\s+)\\|");
QRegExp regExp(L1S("progress:(\\s+)(\\d+)%(\\s+)\\|"));
while(process.state() != QProcess::NotRunning)
{
@ -201,7 +201,7 @@ bool AC3Encoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
{
process.kill();
bAborted = true;
emit messageLogged("\nABORTED BY USER !!!");
emit messageLogged(L1S("\nABORTED BY USER !!!"));
break;
}
process.waitForReadyRead(m_processTimeoutInterval);
@ -209,7 +209,7 @@ bool AC3Encoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
{
process.kill();
qWarning("Aften process timed out <-- killing!");
emit messageLogged("\nPROCESS TIMEOUT !!!");
emit messageLogged(L1S("\nPROCESS TIMEOUT !!!"));
bTimeout = true;
break;
}
@ -286,9 +286,9 @@ const unsigned int *AC3Encoder::supportedSamplerates(void)
bool AC3Encoder::isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion)
{
if(containerType.compare("Wave", Qt::CaseInsensitive) == 0)
if(containerType.compare(L1S("Wave"), Qt::CaseInsensitive) == 0)
{
if(formatType.compare("PCM", Qt::CaseInsensitive) == 0)
if(formatType.compare(L1S("PCM"), Qt::CaseInsensitive) == 0)
{
return true;
}

View File

@ -129,7 +129,7 @@ static const g_dcaEncoderInfo;
DCAEncoder::DCAEncoder(void)
:
m_binary(lamexp_tools_lookup("dcaenc.exe"))
m_binary(lamexp_tools_lookup(L1S("dcaenc.exe")))
{
if(m_binary.isEmpty())
{
@ -146,9 +146,9 @@ bool DCAEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
QProcess process;
QStringList args;
args << "-i" << QDir::toNativeSeparators(sourceFile);
args << "-o" << QDir::toNativeSeparators(outputFile);
args << "-b" << QString::number(qBound(32, index2bitrate(m_configBitrate), 4096));
args << L1S("-i") << QDir::toNativeSeparators(sourceFile);
args << L1S("-o") << QDir::toNativeSeparators(outputFile);
args << L1S("-b") << QString::number(qBound(32, index2bitrate(m_configBitrate), 4096));
if(!startProcess(process, m_binary, args))
{
@ -159,7 +159,7 @@ bool DCAEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
bool bAborted = false;
int prevProgress = -1;
QRegExp regExp("\\[(\\d+)\\.(\\d+)%\\]");
QRegExp regExp(L1S("\\[(\\d+)\\.(\\d+)%\\]"));
while(process.state() != QProcess::NotRunning)
{
@ -167,7 +167,7 @@ bool DCAEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
{
process.kill();
bAborted = true;
emit messageLogged("\nABORTED BY USER !!!");
emit messageLogged(L1S("\nABORTED BY USER !!!"));
break;
}
process.waitForReadyRead(m_processTimeoutInterval);
@ -175,7 +175,7 @@ bool DCAEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
{
process.kill();
qWarning("DCAENC process timed out <-- killing!");
emit messageLogged("\nPROCESS TIMEOUT !!!");
emit messageLogged(L1S("\nPROCESS TIMEOUT !!!"));
bTimeout = true;
break;
}
@ -220,9 +220,9 @@ bool DCAEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
bool DCAEncoder::isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion)
{
if(containerType.compare("Wave", Qt::CaseInsensitive) == 0)
if(containerType.compare(L1S("Wave"), Qt::CaseInsensitive) == 0)
{
if(formatType.compare("PCM", Qt::CaseInsensitive) == 0)
if(formatType.compare(L1S("PCM"), Qt::CaseInsensitive) == 0)
{
return true;
}

View File

@ -123,7 +123,7 @@ static const g_flacEncoderInfo;
FLACEncoder::FLACEncoder(void)
:
m_binary(lamexp_tools_lookup("flac.exe"))
m_binary(lamexp_tools_lookup(L1S("flac.exe")))
{
if(m_binary.isEmpty())
{
@ -141,22 +141,22 @@ bool FLACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInf
QStringList args;
args << QString("-%1").arg(QString::number(qBound(0, m_configBitrate, 8)));
args << "--channel-map=none";
args << L1S("--channel-map=none");
if(!metaInfo.title().isEmpty()) args << "-T" << QString("title=%1").arg(cleanTag(metaInfo.title()));
if(!metaInfo.artist().isEmpty()) args << "-T" << QString("artist=%1").arg(cleanTag(metaInfo.artist()));
if(!metaInfo.album().isEmpty()) args << "-T" << QString("album=%1").arg(cleanTag(metaInfo.album()));
if(!metaInfo.genre().isEmpty()) args << "-T" << QString("genre=%1").arg(cleanTag(metaInfo.genre()));
if(!metaInfo.comment().isEmpty()) args << "-T" << QString("comment=%1").arg(cleanTag(metaInfo.comment()));
if(metaInfo.year()) args << "-T" << QString("date=%1").arg(QString::number(metaInfo.year()));
if(metaInfo.position()) args << "-T" << QString("track=%1").arg(QString::number(metaInfo.position()));
if(!metaInfo.title().isEmpty()) args << L1S("-T") << QString("title=%1").arg(cleanTag(metaInfo.title()));
if(!metaInfo.artist().isEmpty()) args << L1S("-T") << QString("artist=%1").arg(cleanTag(metaInfo.artist()));
if(!metaInfo.album().isEmpty()) args << L1S("-T") << QString("album=%1").arg(cleanTag(metaInfo.album()));
if(!metaInfo.genre().isEmpty()) args << L1S("-T") << QString("genre=%1").arg(cleanTag(metaInfo.genre()));
if(!metaInfo.comment().isEmpty()) args << L1S("-T") << QString("comment=%1").arg(cleanTag(metaInfo.comment()));
if(metaInfo.year()) args << L1S("-T") << QString("date=%1").arg(QString::number(metaInfo.year()));
if(metaInfo.position()) args << L1S("-T") << QString("track=%1").arg(QString::number(metaInfo.position()));
if(!metaInfo.cover().isEmpty()) args << QString("--picture=%1").arg(metaInfo.cover());
//args << "--tv" << QString().sprintf("Encoder=LameXP v%d.%02d.%04d [%s]", lamexp_version_major(), lamexp_version_minor(), lamexp_version_build(), lamexp_version_release());
if(!m_configCustomParams.isEmpty()) args << m_configCustomParams.split(" ", QString::SkipEmptyParts);
args << "-f" << "-o" << QDir::toNativeSeparators(outputFile);
args << L1S("-f") << L1S("-o") << QDir::toNativeSeparators(outputFile);
args << QDir::toNativeSeparators(sourceFile);
if(!startProcess(process, m_binary, args))
@ -168,7 +168,7 @@ bool FLACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInf
bool bAborted = false;
int prevProgress = -1;
QRegExp regExp("\\b(\\d+)% complete");
QRegExp regExp(L1S("\\b(\\d+)% complete"));
while(process.state() != QProcess::NotRunning)
{
@ -176,7 +176,7 @@ bool FLACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInf
{
process.kill();
bAborted = true;
emit messageLogged("\nABORTED BY USER !!!");
emit messageLogged(L1S("\nABORTED BY USER !!!"));
break;
}
process.waitForReadyRead(m_processTimeoutInterval);
@ -184,7 +184,7 @@ bool FLACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInf
{
process.kill();
qWarning("FLAC process timed out <-- killing!");
emit messageLogged("\nPROCESS TIMEOUT !!!");
emit messageLogged(L1S("\nPROCESS TIMEOUT !!!"));
bTimeout = true;
break;
}
@ -229,9 +229,9 @@ bool FLACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInf
bool FLACEncoder::isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion)
{
if(containerType.compare("Wave", Qt::CaseInsensitive) == 0)
if(containerType.compare(L1S("Wave"), Qt::CaseInsensitive) == 0)
{
if(formatType.compare("PCM", Qt::CaseInsensitive) == 0)
if(formatType.compare(L1S("PCM"), Qt::CaseInsensitive) == 0)
{
return true;
}

View File

@ -123,8 +123,8 @@ static const g_macEncoderInfo;
MACEncoder::MACEncoder(void)
:
m_binary_enc(lamexp_tools_lookup("mac.exe")),
m_binary_tag(lamexp_tools_lookup("tag.exe"))
m_binary_enc(lamexp_tools_lookup(L1S("mac.exe"))),
m_binary_tag(lamexp_tools_lookup(L1S("tag.exe")))
{
if(m_binary_enc.isEmpty() || m_binary_tag.isEmpty())
{
@ -165,7 +165,7 @@ bool MACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
bool bAborted = false;
int prevProgress = -1;
QRegExp regExp("Progress: (\\d+).(\\d+)%");
QRegExp regExp(L1S("Progress: (\\d+).(\\d+)%"));
while(process.state() != QProcess::NotRunning)
{
@ -173,7 +173,7 @@ bool MACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
{
process.kill();
bAborted = true;
emit messageLogged("\nABORTED BY USER !!!");
emit messageLogged(L1S("\nABORTED BY USER !!!"));
break;
}
process.waitForReadyRead(m_processTimeoutInterval);
@ -181,7 +181,7 @@ bool MACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
{
process.kill();
qWarning("MAC process timed out <-- killing!");
emit messageLogged("\nPROCESS TIMEOUT !!!");
emit messageLogged(L1S("\nPROCESS TIMEOUT !!!"));
bTimeout = true;
break;
}
@ -226,10 +226,10 @@ bool MACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
return true;
}
emit messageLogged("\n-------------------------------\n");
emit messageLogged(L1S("\n-------------------------------\n"));
args.clear();
args << "APE2" << QDir::toNativeSeparators(outputFile);
args << L1S("APE2") << QDir::toNativeSeparators(outputFile);
if(!metaInfo.title().isEmpty()) args << QString("Title=%1").arg(cleanTag(metaInfo.title()));
if(!metaInfo.artist().isEmpty()) args << QString("Artist=%1").arg(cleanTag(metaInfo.artist()));
@ -254,7 +254,7 @@ bool MACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
{
process.kill();
bAborted = true;
emit messageLogged("\nABORTED BY USER !!!");
emit messageLogged(L1S("\nABORTED BY USER !!!"));
break;
}
process.waitForReadyRead(m_processTimeoutInterval);
@ -262,7 +262,7 @@ bool MACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
{
process.kill();
qWarning("Tag process timed out <-- killing!");
emit messageLogged("\nPROCESS TIMEOUT !!!");
emit messageLogged(L1S("\nPROCESS TIMEOUT !!!"));
bTimeout = true;
break;
}
@ -296,9 +296,9 @@ bool MACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
bool MACEncoder::isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion)
{
if(containerType.compare("Wave", Qt::CaseInsensitive) == 0)
if(containerType.compare(L1S("Wave"), Qt::CaseInsensitive) == 0)
{
if(formatType.compare("PCM", Qt::CaseInsensitive) == 0)
if(formatType.compare(L1S("PCM"), Qt::CaseInsensitive) == 0)
{
return true;
}

View File

@ -128,7 +128,7 @@ static const g_mp3EncoderInfo;
MP3Encoder::MP3Encoder(void)
:
m_binary(lamexp_tools_lookup("lame.exe"))
m_binary(lamexp_tools_lookup(L1S("lame.exe")))
{
if(m_binary.isEmpty())
{
@ -151,20 +151,20 @@ bool MP3Encoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
QProcess process;
QStringList args;
args << "--nohist";
args << "-q" << QString::number(g_lameAgorithmQualityLUT[m_algorithmQuality]);
args << L1S("--nohist");
args << L1S("-q") << QString::number(g_lameAgorithmQualityLUT[m_algorithmQuality]);
switch(m_configRCMode)
{
case SettingsModel::VBRMode:
args << "-V" << QString::number(g_lameVBRQualityLUT[qBound(0, m_configBitrate, 9)]);
args << L1S("-V") << QString::number(g_lameVBRQualityLUT[qBound(0, m_configBitrate, 9)]);
break;
case SettingsModel::ABRMode:
args << "--abr" << QString::number(g_mp3BitrateLUT[qBound(0, m_configBitrate, 13)]);
args << L1S("--abr") << QString::number(g_mp3BitrateLUT[qBound(0, m_configBitrate, 13)]);
break;
case SettingsModel::CBRMode:
args << "--cbr";
args << "-b" << QString::number(g_mp3BitrateLUT[qBound(0, m_configBitrate, 13)]);
args << L1S("--cbr");
args << L1S("-b") << QString::number(g_mp3BitrateLUT[qBound(0, m_configBitrate, 13)]);
break;
default:
MUTILS_THROW("Bad rate-control mode!");
@ -175,32 +175,32 @@ bool MP3Encoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
{
if(m_configRCMode != SettingsModel::CBRMode)
{
args << "-b" << QString::number(clipBitrate(m_configBitrateMinimum));
args << "-B" << QString::number(clipBitrate(m_configBitrateMaximum));
args << L1S("-b") << QString::number(clipBitrate(m_configBitrateMinimum));
args << L1S("-B") << QString::number(clipBitrate(m_configBitrateMaximum));
}
}
if(m_configSamplingRate > 0)
{
args << "--resample" << QString::number(m_configSamplingRate);
args << L1S("--resample") << QString::number(m_configSamplingRate);
}
switch(m_configChannelMode)
{
case 1:
args << "-m" << "j";
args << L1S("-m") << L1S("j");
break;
case 2:
args << "-m" << "f";
args << L1S("-m") << L1S("f");
break;
case 3:
args << "-m" << "s";
args << L1S("-m") << L1S("s");
break;
case 4:
args << "-m" << "d";
args << L1S("-m") << L1S("d");
break;
case 5:
args << "-m" << "m";
args << L1S("-m") << L1S("m");
break;
}
@ -212,16 +212,16 @@ bool MP3Encoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
if(isUnicode(metaInfo.genre())) bUseUCS2 = true;
if(isUnicode(metaInfo.comment())) bUseUCS2 = true;
if(bUseUCS2) args << "--id3v2-ucs2"; //Must specify this BEFORE "--tt" and friends!
if (bUseUCS2) args << L1S("--id3v2-ucs2"); //Must specify this BEFORE "--tt" and friends!
if(!metaInfo.title().isEmpty()) args << "--tt" << cleanTag(metaInfo.title());
if(!metaInfo.artist().isEmpty()) args << "--ta" << cleanTag(metaInfo.artist());
if(!metaInfo.album().isEmpty()) args << "--tl" << cleanTag( metaInfo.album());
if(!metaInfo.genre().isEmpty()) args << "--tg" << cleanTag(metaInfo.genre());
if(!metaInfo.comment().isEmpty()) args << "--tc" << cleanTag(metaInfo.comment());
if(metaInfo.year()) args << "--ty" << QString::number(metaInfo.year());
if(metaInfo.position()) args << "--tn" << QString::number(metaInfo.position());
if(!metaInfo.cover().isEmpty()) args << "--ti" << QDir::toNativeSeparators(metaInfo.cover());
if(!metaInfo.title().isEmpty()) args << L1S("--tt") << cleanTag(metaInfo.title());
if(!metaInfo.artist().isEmpty()) args << L1S("--ta") << cleanTag(metaInfo.artist());
if(!metaInfo.album().isEmpty()) args << L1S("--tl") << cleanTag( metaInfo.album());
if(!metaInfo.genre().isEmpty()) args << L1S("--tg") << cleanTag(metaInfo.genre());
if(!metaInfo.comment().isEmpty()) args << L1S("--tc") << cleanTag(metaInfo.comment());
if(metaInfo.year()) args << L1S("--ty") << QString::number(metaInfo.year());
if(metaInfo.position()) args << L1S("--tn") << QString::number(metaInfo.position());
if(!metaInfo.cover().isEmpty()) args << L1S("--ti") << QDir::toNativeSeparators(metaInfo.cover());
if(!m_configCustomParams.isEmpty()) args << m_configCustomParams.split(" ", QString::SkipEmptyParts);
@ -237,7 +237,7 @@ bool MP3Encoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
bool bAborted = false;
int prevProgress = -1;
QRegExp regExp("\\(.*(\\d+)%\\)\\|");
QRegExp regExp(L1S("\\(.*(\\d+)%\\)\\|"));
while(process.state() != QProcess::NotRunning)
{
@ -245,7 +245,7 @@ bool MP3Encoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
{
process.kill();
bAborted = true;
emit messageLogged("\nABORTED BY USER !!!");
emit messageLogged(L1S("\nABORTED BY USER !!!"));
break;
}
process.waitForReadyRead(m_processTimeoutInterval);
@ -253,7 +253,7 @@ bool MP3Encoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
{
process.kill();
qWarning("LAME process timed out <-- killing!");
emit messageLogged("\nPROCESS TIMEOUT !!!");
emit messageLogged(L1S("\nPROCESS TIMEOUT !!!"));
bTimeout = true;
break;
}
@ -298,20 +298,20 @@ bool MP3Encoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
bool MP3Encoder::isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion)
{
if(containerType.compare("Wave", Qt::CaseInsensitive) == 0)
if(containerType.compare(L1S("Wave"), Qt::CaseInsensitive) == 0)
{
if(formatType.compare("PCM", Qt::CaseInsensitive) == 0)
if(formatType.compare(L1S("PCM"), Qt::CaseInsensitive) == 0)
{
return true;
}
}
else if(containerType.compare("MPEG Audio", Qt::CaseInsensitive) == 0)
else if(containerType.compare(L1S("MPEG Audio"), Qt::CaseInsensitive) == 0)
{
if(formatType.compare("MPEG Audio", Qt::CaseInsensitive) == 0)
if(formatType.compare(L1S("MPEG Audio"), Qt::CaseInsensitive) == 0)
{
if(formatProfile.compare("Layer 3", Qt::CaseInsensitive) == 0 || formatProfile.compare("Layer 2", Qt::CaseInsensitive) == 0)
if(formatProfile.compare(L1S("Layer 3"), Qt::CaseInsensitive) == 0 || formatProfile.compare(L1S("Layer 2"), Qt::CaseInsensitive) == 0)
{
if(formatVersion.compare("Version 1", Qt::CaseInsensitive) == 0 || formatVersion.compare("Version 2", Qt::CaseInsensitive) == 0)
if(formatVersion.compare(L1S("Version 1"), Qt::CaseInsensitive) == 0 || formatVersion.compare(L1S("Version 2"), Qt::CaseInsensitive) == 0)
{
return true;
}

View File

@ -124,7 +124,7 @@ static const g_opusEncoderInfo;
OpusEncoder::OpusEncoder(void)
:
m_binary(lamexp_tools_lookup("opusenc.exe"))
m_binary(lamexp_tools_lookup(L1S("opusenc.exe")))
{
if(m_binary.isEmpty())
{
@ -148,13 +148,13 @@ bool OpusEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInf
switch(m_configRCMode)
{
case SettingsModel::VBRMode:
args << "--vbr";
args << L1S("--vbr");
break;
case SettingsModel::ABRMode:
args << "--cvbr";
args << L1S("--cvbr");
break;
case SettingsModel::CBRMode:
args << "--hard-cbr";
args << L1S("--hard-cbr");
break;
default:
MUTILS_THROW("Bad rate-control mode!");
@ -166,35 +166,35 @@ bool OpusEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInf
switch(m_configFrameSize)
{
case 0:
args << "--framesize" << "2.5";
args << L1S("--framesize") << L1S("2.5");
break;
case 1:
args << "--framesize" << "5";
args << L1S("--framesize") << L1S("5");
break;
case 2:
args << "--framesize" << "10";
args << L1S("--framesize") << L1S("10");
break;
case 3:
args << "--framesize" << "20";
args << L1S("--framesize") << L1S("20");
break;
case 4:
args << "--framesize" << "40";
args << L1S("--framesize") << L1S("40");
break;
case 5:
args << "--framesize" << "60";
args << L1S("--framesize") << L1S("60");
break;
}
args << QString("--bitrate") << QString::number(qBound(8, (m_configBitrate + 1) * 8, 256));
args << L1S("--bitrate") << QString::number(qBound(8, (m_configBitrate + 1) * 8, 256));
if(!metaInfo.title().isEmpty()) args << "--title" << cleanTag(metaInfo.title());
if(!metaInfo.artist().isEmpty()) args << "--artist" << cleanTag(metaInfo.artist());
if(!metaInfo.album().isEmpty()) args << "--album" << cleanTag(metaInfo.album());
if(!metaInfo.genre().isEmpty()) args << "--genre" << cleanTag(metaInfo.genre());
if(metaInfo.year()) args << "--date" << QString::number(metaInfo.year());
if(metaInfo.position()) args << "--comment" << QString("tracknumber=%1").arg(QString::number(metaInfo.position()));
if(!metaInfo.comment().isEmpty()) args << "--comment" << QString("comment=%1").arg(cleanTag(metaInfo.comment()));
if(!metaInfo.cover().isEmpty()) args << "--picture" << makeCoverParam(metaInfo.cover());
if(!metaInfo.title().isEmpty()) args << L1S("--title") << cleanTag(metaInfo.title());
if(!metaInfo.artist().isEmpty()) args << L1S("--artist") << cleanTag(metaInfo.artist());
if(!metaInfo.album().isEmpty()) args << L1S("--album") << cleanTag(metaInfo.album());
if(!metaInfo.genre().isEmpty()) args << L1S("--genre") << cleanTag(metaInfo.genre());
if(metaInfo.year()) args << L1S("--date") << QString::number(metaInfo.year());
if(metaInfo.position()) args << L1S("--comment") << QString("tracknumber=%1").arg(QString::number(metaInfo.position()));
if(!metaInfo.comment().isEmpty()) args << L1S("--comment") << QString("comment=%1").arg(cleanTag(metaInfo.comment()));
if(!metaInfo.cover().isEmpty()) args << L1S("--picture") << makeCoverParam(metaInfo.cover());
if(!m_configCustomParams.isEmpty()) args << m_configCustomParams.split(" ", QString::SkipEmptyParts);
@ -210,7 +210,7 @@ bool OpusEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInf
bool bAborted = false;
int prevProgress = -1;
QRegExp regExp("\\((\\d+)%\\)");
QRegExp regExp(L1S("\\((\\d+)%\\)"));
while(process.state() != QProcess::NotRunning)
{
@ -218,7 +218,7 @@ bool OpusEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInf
{
process.kill();
bAborted = true;
emit messageLogged("\nABORTED BY USER !!!");
emit messageLogged(L1S("\nABORTED BY USER !!!"));
break;
}
process.waitForReadyRead(m_processTimeoutInterval);
@ -226,7 +226,7 @@ bool OpusEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInf
{
process.kill();
qWarning("Opus process timed out <-- killing!");
emit messageLogged("\nPROCESS TIMEOUT !!!");
emit messageLogged(L1S("\nPROCESS TIMEOUT !!!"));
bTimeout = true;
break;
}
@ -309,9 +309,9 @@ void OpusEncoder::setFrameSize(int frameSize)
bool OpusEncoder::isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion)
{
if(containerType.compare("Wave", Qt::CaseInsensitive) == 0)
if(containerType.compare(L1S("Wave"), Qt::CaseInsensitive) == 0)
{
if(formatType.compare("PCM", Qt::CaseInsensitive) == 0)
if(formatType.compare(L1S("PCM"), Qt::CaseInsensitive) == 0)
{
return true;
}

View File

@ -125,7 +125,7 @@ static const g_vorbisEncoderInfo;
VorbisEncoder::VorbisEncoder(void)
:
m_binary(lamexp_tools_lookup("oggenc2.exe"))
m_binary(lamexp_tools_lookup(L1S("oggenc2.exe")))
{
if(m_binary.isEmpty())
{
@ -150,10 +150,10 @@ bool VorbisEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaI
switch(m_configRCMode)
{
case SettingsModel::VBRMode:
args << "-q" << QString::number(qBound(-2, m_configBitrate - 2, 10));
args << L1S("-q") << QString::number(qBound(-2, m_configBitrate - 2, 10));
break;
case SettingsModel::ABRMode:
args << "-b" << QString::number(qBound(32, (m_configBitrate + 4) * 8, 500));
args << L1S("-b") << QString::number(qBound(32, (m_configBitrate + 4) * 8, 500));
break;
default:
MUTILS_THROW("Bad rate-control mode!");
@ -162,28 +162,33 @@ bool VorbisEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaI
if((m_configBitrateMaximum > 0) && (m_configBitrateMinimum > 0) && (m_configBitrateMinimum <= m_configBitrateMaximum))
{
args << "--min-bitrate" << QString::number(qBound(32, m_configBitrateMinimum, 500));
args << "--max-bitrate" << QString::number(qBound(32, m_configBitrateMaximum, 500));
args << L1S("--min-bitrate") << QString::number(qBound(32, m_configBitrateMinimum, 500));
args << L1S("--max-bitrate") << QString::number(qBound(32, m_configBitrateMaximum, 500));
}
if(m_configSamplingRate > 0)
{
args << "--resample" << QString::number(m_configSamplingRate) << "--converter" << QString::number(0);
args << L1S("--resample") << QString::number(m_configSamplingRate) << L1S("--converter") << QString::number(0);
}
if(!metaInfo.title().isEmpty()) args << "-t" << cleanTag(metaInfo.title());
if(!metaInfo.artist().isEmpty()) args << "-a" << cleanTag(metaInfo.artist());
if(!metaInfo.album().isEmpty()) args << "-l" << cleanTag(metaInfo.album());
if(!metaInfo.genre().isEmpty()) args << "-G" << cleanTag(metaInfo.genre());
if(!metaInfo.comment().isEmpty()) args << "-c" << QString("comment=%1").arg(cleanTag(metaInfo.comment()));
if(metaInfo.year()) args << "-d" << QString::number(metaInfo.year());
if(metaInfo.position()) args << "-N" << QString::number(metaInfo.position());
if (!metaInfo.empty(false))
{
args << L1S("--discard-comments");
}
if(!metaInfo.title().isEmpty()) args << L1S("-t") << cleanTag(metaInfo.title());
if(!metaInfo.artist().isEmpty()) args << L1S("-a") << cleanTag(metaInfo.artist());
if(!metaInfo.album().isEmpty()) args << L1S("-l") << cleanTag(metaInfo.album());
if(!metaInfo.genre().isEmpty()) args << L1S("-G") << cleanTag(metaInfo.genre());
if(!metaInfo.comment().isEmpty()) args << L1S("-c") << QString("comment=%1").arg(cleanTag(metaInfo.comment()));
if(metaInfo.year()) args << L1S("-d") << QString::number(metaInfo.year());
if(metaInfo.position()) args << L1S("-N") << QString::number(metaInfo.position());
//args << "--tv" << QString().sprintf("Encoder=LameXP v%d.%02d.%04d [%s]", lamexp_version_major(), lamexp_version_minor(), lamexp_version_build(), lamexp_version_release());
if(!m_configCustomParams.isEmpty()) args << m_configCustomParams.split(" ", QString::SkipEmptyParts);
args << "-o" << QDir::toNativeSeparators(outputFile);
args << L1S("-o") << QDir::toNativeSeparators(outputFile);
args << QDir::toNativeSeparators(sourceFile);
if(!startProcess(process, m_binary, args))
@ -195,7 +200,7 @@ bool VorbisEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaI
bool bAborted = false;
int prevProgress = -1;
QRegExp regExp("\\[.*(\\d+)[.,](\\d+)%\\]");
QRegExp regExp(L1S("\\[.*(\\d+)[.,](\\d+)%\\]"));
while(process.state() != QProcess::NotRunning)
{
@ -203,7 +208,7 @@ bool VorbisEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaI
{
process.kill();
bAborted = true;
emit messageLogged("\nABORTED BY USER !!!");
emit messageLogged(L1S("\nABORTED BY USER !!!"));
break;
}
process.waitForReadyRead(m_processTimeoutInterval);
@ -211,7 +216,7 @@ bool VorbisEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaI
{
process.kill();
qWarning("OggEnc process timed out <-- killing!");
emit messageLogged("\nPROCESS TIMEOUT !!!");
emit messageLogged(L1S("\nPROCESS TIMEOUT !!!"));
bTimeout = true;
break;
}
@ -256,16 +261,16 @@ bool VorbisEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaI
bool VorbisEncoder::isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion)
{
if(containerType.compare("Wave", Qt::CaseInsensitive) == 0)
if(containerType.compare(L1S("Wave"), Qt::CaseInsensitive) == 0)
{
if(formatType.compare("PCM", Qt::CaseInsensitive) == 0)
if(formatType.compare(L1S("PCM"), Qt::CaseInsensitive) == 0)
{
return true;
}
}
else if(containerType.compare("FLAC", Qt::CaseInsensitive) == 0)
else if(containerType.compare(L1S("FLAC"), Qt::CaseInsensitive) == 0)
{
if(formatType.compare("FLAC", Qt::CaseInsensitive) == 0)
if(formatType.compare(L1S("FLAC"), Qt::CaseInsensitive) == 0)
{
return true;
}

View File

@ -146,11 +146,11 @@ bool WaveEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInf
if (success)
{
emit messageLogged(QLatin1String("File copied successfully."));
emit messageLogged(L1S("File copied successfully."));
}
else
{
emit messageLogged((*abortFlag) ? QLatin1String("Operation cancelled by user!") : QLatin1String("Error: Failed to copy file!"));
emit messageLogged((*abortFlag) ? L1S("Operation cancelled by user!") : L1S("Error: Failed to copy file!"));
}
return success;
@ -174,9 +174,9 @@ void WaveEncoder::updateProgress(const double &progress)
bool WaveEncoder::isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion)
{
if(containerType.compare("Wave", Qt::CaseInsensitive) == 0)
if(containerType.compare(L1S("Wave"), Qt::CaseInsensitive) == 0)
{
if(formatType.compare("PCM", Qt::CaseInsensitive) == 0)
if(formatType.compare(L1S("PCM"), Qt::CaseInsensitive) == 0)
{
return true;
}

View File

@ -83,4 +83,5 @@ const QString lamexp_version2string(const QString &pattern, unsigned int version
// HELPER MACROS
///////////////////////////////////////////////////////////////////////////////
#define L1S(STR) (QLatin1String((STR)))
#define NOBR(STR) (QString("<nobr>%1</nobr>").arg((STR)).replace("-", "&minus;"))