#define VER_LAMEXP_MAJOR 4
#define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 0
-#define VER_LAMEXP_BUILD 78
+#define VER_LAMEXP_BUILD 79
#define VER_LAMEXP_SUFFIX TechPreview
/*
if(m_userAborted)
{
- label_progress->setText("Process was aborted by the user!");
+ label_progress->setText(QString("Process was aborted by the user after %1 files!").arg(QString::number(m_succeededFiles)));
}
else
{
if(m_failedFiles)
{
- label_progress->setText(QString("Error: %1 of %2 files failed. See the log for details!").arg(QString::number(m_failedFiles), QString::number(m_failedFiles + m_succeededFiles)));
+ label_progress->setText(QString("Error: %1 of %2 files failed. Double-click failed items for detailed information!").arg(QString::number(m_failedFiles), QString::number(m_failedFiles + m_succeededFiles)));
}
else
{
button_closeDialog->setEnabled(true);
button_AbortProcess->setEnabled(false);
+ view_log->scrollToBottom();
m_progressIndicator->stop();
progressBar->setValue(100);
}
AbstractEncoder(void);
~AbstractEncoder(void);
+ //Internal encoder API
virtual bool encode(const AudioFileModel &sourceFile, const QString &outputFile, volatile bool *abortFlag) = 0;
+ virtual bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion) = 0;
virtual QString extension(void) = 0;
+ //Common setter methods
void setBitrate(int bitrate);
void setRCMode(int mode);
+ //Auxiliary functions
bool startProcess(QProcess &process, const QString &program, const QStringList &args);
static QString commandline2string(const QString &program, const QStringList &arguments);
{
return "mp3";
}
+
+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(formatType.compare("PCM", Qt::CaseInsensitive) == 0)
+ {
+ return true;
+ }
+ }
+ else if(containerType.compare("MPEG Audio", Qt::CaseInsensitive) == 0)
+ {
+ if(formatType.compare("MPEG Audio", Qt::CaseInsensitive) == 0)
+ {
+ if(formatProfile.compare("Layer 3", Qt::CaseInsensitive) == 0 || formatProfile.compare("Layer 2", Qt::CaseInsensitive) == 0)
+ {
+ if(formatVersion.compare("Version 1", Qt::CaseInsensitive) == 0 || formatVersion.compare("Version 2", Qt::CaseInsensitive) == 0)
+ {
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+}
~MP3Encoder(void);
virtual bool encode(const AudioFileModel &sourceFile, const QString &outputFile, volatile bool *abortFlag);
+ virtual bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion);
virtual QString extension(void);
private:
if(outFileName.isEmpty())
{
emit processStateChanged(m_jobId, "Not found!", ProgressModel::JobFailed);
+ emit processStateFinished(m_jobId, outFileName, false);
+ return;
+ }
+
+ if(!m_encoder->isFormatSupported(m_audioFile.formatContainerType(), m_audioFile.formatContainerProfile(), m_audioFile.formatAudioType(), m_audioFile.formatAudioProfile(), m_audioFile.formatAudioVersion()))
+ {
+ handleMessage(QString("The format of this file is NOT supported:\n%1\n\nContainer Format:\t%2\nAudio Format:\t%3").arg(m_audioFile.filePath(), m_audioFile.formatContainerInfo(), m_audioFile.formatAudioCompressInfo()));
+ emit processStateChanged(m_jobId, "Unsupported!", ProgressModel::JobFailed);
+ emit processStateFinished(m_jobId, outFileName, false);
return;
}
QFileInfo sourceFile(m_audioFile.filePath());
if(!sourceFile.exists() || !sourceFile.isFile())
{
+ handleMessage(QString("The source audio file could not be found:\n%1").arg(sourceFile.absoluteFilePath()));
+ return QString();
+ }
+
+ QFile readTest(sourceFile.canonicalFilePath());
+ if(!readTest.open(QIODevice::ReadOnly))
+ {
+ handleMessage(QString("The source audio file could not be opened for reading:\n%1").arg(readTest.fileName()));
return QString();
}
+ else
+ {
+ readTest.close();
+ }
QString baseName = sourceFile.completeBaseName();
QDir targetDir(m_outputDirectory.isEmpty() ? sourceFile.canonicalPath() : m_outputDirectory);
targetDir.mkpath(".");
if(!targetDir.exists())
{
+ handleMessage(QString("The target output directory doesn't exist and could NOT be created:\n%1").arg(targetDir.absolutePath()));
return QString();
}
}
+ QFile writeTest(QString("%1/%2").arg(targetDir.canonicalPath(), QUuid::createUuid().toString()));
+ if(!writeTest.open(QIODevice::ReadWrite))
+ {
+ handleMessage(QString("The target output directory is NOT writable:\n%1").arg(targetDir.absolutePath()));
+ return QString();
+ }
+ else
+ {
+ writeTest.close();
+ writeTest.remove();
+ }
+
QString outFileName = QString("%1/%2.%3").arg(targetDir.canonicalPath(), baseName, "mp3");
while(QFileInfo(outFileName).exists())
{