Fix compilation after previous changes to AudioFileModel in previous commit.

This commit is contained in:
LoRd_MuldeR 2013-10-12 22:55:41 +02:00
parent feccffdfd1
commit 0435637c75
50 changed files with 385 additions and 342 deletions

View File

@ -34,7 +34,7 @@
#define VER_LAMEXP_MINOR_LO 9
#define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 2
#define VER_LAMEXP_BUILD 1378
#define VER_LAMEXP_BUILD 1380
#define VER_LAMEXP_CONFG 1348
///////////////////////////////////////////////////////////////////////////////

View File

@ -315,7 +315,7 @@ void CueImportDialog::loadOtherButtonClicked(void)
void CueImportDialog::analyzedFile(const AudioFileModel &file)
{
qDebug("Received result: <%s> <%s/%s>", file.filePath().toLatin1().constData(), file.formatContainerType().toLatin1().constData(), file.formatAudioType().toLatin1().constData());
qDebug("Received result: <%s> <%s/%s>", file.filePath().toLatin1().constData(), file.techInfo().containerType().toLatin1().constData(), file.techInfo().audioType().toLatin1().constData());
m_fileInfo << file;
}

View File

@ -2705,36 +2705,40 @@ void MainWindow::makeFolderButtonClicked(void)
QDir basePath(m_fileSystemModel->fileInfo(ui->outputFolderView->currentIndex()).absoluteFilePath());
QString suggestedName = tr("New Folder");
if(!m_metaData->fileArtist().isEmpty() && !m_metaData->fileAlbum().isEmpty())
const AudioFileModel_MetaInfo &metaInfo = m_metaData->metaInfo();
if(!metaInfo.artist().isEmpty() && !metaInfo.album().isEmpty())
{
suggestedName = QString("%1 - %2").arg(m_metaData->fileArtist(), m_metaData->fileAlbum());
suggestedName = QString("%1 - %2").arg(metaInfo.artist(), metaInfo.album());
}
else if(!m_metaData->fileArtist().isEmpty())
else if(!metaInfo.artist().isEmpty())
{
suggestedName = m_metaData->fileArtist();
suggestedName = metaInfo.artist();
}
else if(!m_metaData->fileAlbum().isEmpty())
else if(!metaInfo.album().isEmpty())
{
suggestedName = m_metaData->fileAlbum();
suggestedName = metaInfo.album();
}
else
{
for(int i = 0; i < m_fileListModel->rowCount(); i++)
{
AudioFileModel audioFile = m_fileListModel->getFile(m_fileListModel->index(i, 0));
if(!audioFile.fileAlbum().isEmpty() || !audioFile.fileArtist().isEmpty())
const AudioFileModel &audioFile = m_fileListModel->getFile(m_fileListModel->index(i, 0));
const AudioFileModel_MetaInfo &fileMetaInfo = m_metaData->metaInfo();
if(!fileMetaInfo.album().isEmpty() || !fileMetaInfo.artist().isEmpty())
{
if(!audioFile.fileArtist().isEmpty() && !audioFile.fileAlbum().isEmpty())
if(!fileMetaInfo.artist().isEmpty() && !fileMetaInfo.album().isEmpty())
{
suggestedName = QString("%1 - %2").arg(audioFile.fileArtist(), audioFile.fileAlbum());
suggestedName = QString("%1 - %2").arg(fileMetaInfo.artist(), fileMetaInfo.album());
}
else if(!audioFile.fileArtist().isEmpty())
else if(!fileMetaInfo.artist().isEmpty())
{
suggestedName = audioFile.fileArtist();
suggestedName = fileMetaInfo.artist();
}
else if(!audioFile.fileAlbum().isEmpty())
else if(!fileMetaInfo.album().isEmpty())
{
suggestedName = audioFile.fileAlbum();
suggestedName = fileMetaInfo.album();
}
break;
}
@ -3187,7 +3191,7 @@ void MainWindow::editMetaButtonClicked(void)
if(index.row() == 4)
{
m_settings->metaInfoPosition(m_metaData->filePosition());
m_settings->metaInfoPosition(m_metaData->metaInfo().position());
}
}
}

View File

@ -109,10 +109,10 @@ int MetaInfoDialog::exec(AudioFileModel &audioFile, bool allowUp, bool allowDown
downButton->setEnabled(allowDown);
buttonArtwork->setChecked(false);
if(!audioFile.fileCover().isEmpty())
if(!audioFile.metaInfo().cover().isEmpty())
{
QImage artwork;
if(artwork.load(audioFile.fileCover()))
if(artwork.load(audioFile.metaInfo().cover()))
{
if((artwork.width() > 256) || (artwork.height() > 256))
{

View File

@ -585,7 +585,7 @@ void ProcessingDialog::startNextJob(void)
}
if((m_settings->samplingRate() > 0) && !nativeResampling)
{
if(SettingsModel::samplingRates[m_settings->samplingRate()] != currentFile.formatAudioSamplerate() || currentFile.formatAudioSamplerate() == 0)
if(SettingsModel::samplingRates[m_settings->samplingRate()] != currentFile.techInfo().audioSamplerate() || currentFile.techInfo().audioSamplerate() == 0)
{
thread->addFilter(new ResampleFilter(SettingsModel::samplingRates[m_settings->samplingRate()]));
}
@ -964,10 +964,10 @@ void ProcessingDialog::writePlayList(void)
int counter = 1;
//Generate playlist name
QString playListName = (m_metaInfo->fileAlbum().isEmpty() ? "Playlist" : m_metaInfo->fileAlbum());
if(!m_metaInfo->fileArtist().isEmpty())
QString playListName = (m_metaInfo->metaInfo().album().isEmpty() ? "Playlist" : m_metaInfo->metaInfo().album());
if(!m_metaInfo->metaInfo().artist().isEmpty())
{
playListName = QString("%1 - %2").arg(m_metaInfo->fileArtist(), playListName);
playListName = QString("%1 - %2").arg(m_metaInfo->metaInfo().artist(), playListName);
}
//Clean playlist name
@ -1031,22 +1031,22 @@ void ProcessingDialog::writePlayList(void)
}
}
AudioFileModel ProcessingDialog::updateMetaInfo(const AudioFileModel &audioFile)
AudioFileModel ProcessingDialog::updateMetaInfo(AudioFileModel &audioFile)
{
if(!m_settings->writeMetaTags())
{
return AudioFileModel(audioFile, false);
audioFile.metaInfo().reset();
return audioFile;
}
AudioFileModel result = audioFile;
result.updateMetaInfo(*m_metaInfo);
audioFile.metaInfo().update(m_metaInfo->metaInfo());
if(m_metaInfo->filePosition() == UINT_MAX)
if(audioFile.metaInfo().position() == UINT_MAX)
{
result.setFilePosition(m_currentFile);
audioFile.metaInfo().setPosition(m_currentFile);
}
return result;
return audioFile;
}
void ProcessingDialog::systemTrayActivated(QSystemTrayIcon::ActivationReason reason)

View File

@ -98,7 +98,7 @@ protected:
private:
Ui::ProcessingDialog *ui; //for Qt UIC
AudioFileModel updateMetaInfo(const AudioFileModel &audioFile);
AudioFileModel updateMetaInfo(AudioFileModel &audioFile);
void writePlayList(void);
bool shutdownComputer(void);
QString time2text(const double timeVal) const;

View File

@ -133,10 +133,8 @@ AACEncoder::~AACEncoder(void)
{
}
bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag)
bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo &metaInfo, const unsigned int duration, const QString &outputFile, volatile bool *abortFlag)
{
const unsigned int fileDuration = metaInfo.fileDuration();
QProcess process;
QStringList args;
const QString baseName = QFileInfo(outputFile).fileName();
@ -220,9 +218,9 @@ bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaInf
{
bool ok = false;
int progress = regExp_pass1.cap(1).toInt(&ok);
if(ok && (fileDuration > 0))
if(ok && (duration > 0))
{
int newProgress = qRound((static_cast<double>(progress) / static_cast<double>(fileDuration)) * 50.0);
int newProgress = qRound((static_cast<double>(progress) / static_cast<double>(duration)) * 50.0);
if(newProgress > prevProgress)
{
emit statusUpdated(newProgress);
@ -234,9 +232,9 @@ bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaInf
{
bool ok = false;
int progress = regExp_pass2.cap(1).toInt(&ok);
if(ok && (fileDuration > 0))
if(ok && (duration > 0))
{
int newProgress = qRound((static_cast<double>(progress) / static_cast<double>(fileDuration)) * 50.0) + 50;
int newProgress = qRound((static_cast<double>(progress) / static_cast<double>(duration)) * 50.0) + 50;
if(newProgress > prevProgress)
{
emit statusUpdated(newProgress);
@ -248,9 +246,9 @@ bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaInf
{
bool ok = false;
int progress = regExp.cap(1).toInt(&ok);
if(ok && (fileDuration > 0))
if(ok && (duration > 0))
{
int newProgress = qRound((static_cast<double>(progress) / static_cast<double>(fileDuration)) * 100.0);
int newProgress = qRound((static_cast<double>(progress) / static_cast<double>(duration)) * 100.0);
if(newProgress > prevProgress)
{
emit statusUpdated(newProgress);
@ -285,14 +283,14 @@ bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaInf
args.clear();
args << QDir::toNativeSeparators(outputFile);
if(!metaInfo.fileName().isEmpty()) args << QString("-meta:title=%1").arg(cleanTag(metaInfo.fileName()));
if(!metaInfo.fileArtist().isEmpty()) args << QString("-meta:artist=%1").arg(cleanTag(metaInfo.fileArtist()));
if(!metaInfo.fileAlbum().isEmpty()) args << QString("-meta:album=%1").arg(cleanTag(metaInfo.fileAlbum()));
if(!metaInfo.fileGenre().isEmpty()) args << QString("-meta:genre=%1").arg(cleanTag(metaInfo.fileGenre()));
if(!metaInfo.fileComment().isEmpty()) args << QString("-meta:comment=%1").arg(cleanTag(metaInfo.fileComment()));
if(metaInfo.fileYear()) args << QString("-meta:year=%1").arg(QString::number(metaInfo.fileYear()));
if(metaInfo.filePosition()) args << QString("-meta:track=%1").arg(QString::number(metaInfo.filePosition()));
if(!metaInfo.fileCover().isEmpty()) args << QString("-add-cover:%1:%2").arg("front", metaInfo.fileCover());
if(!metaInfo.title().isEmpty()) args << QString("-meta:title=%1").arg(cleanTag(metaInfo.title()));
if(!metaInfo.artist().isEmpty()) args << QString("-meta:artist=%1").arg(cleanTag(metaInfo.artist()));
if(!metaInfo.album().isEmpty()) args << QString("-meta:album=%1").arg(cleanTag(metaInfo.album()));
if(!metaInfo.genre().isEmpty()) args << QString("-meta:genre=%1").arg(cleanTag(metaInfo.genre()));
if(!metaInfo.comment().isEmpty()) args << QString("-meta:comment=%1").arg(cleanTag(metaInfo.comment()));
if(metaInfo.year()) args << QString("-meta:year=%1").arg(QString::number(metaInfo.year()));
if(metaInfo.position()) args << QString("-meta:track=%1").arg(QString::number(metaInfo.position()));
if(!metaInfo.cover().isEmpty()) args << QString("-add-cover:%1:%2").arg("front", metaInfo.cover());
if(!startProcess(process, m_binary_tag, args))
{

View File

@ -33,7 +33,7 @@ public:
AACEncoder(void);
~AACEncoder(void);
virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag);
virtual bool encode(const QString &sourceFile, const AudioFileModel_MetaInfo &metaInfo, const unsigned int duration, 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);
virtual const bool needsTimingInfo(void);

View File

@ -134,7 +134,7 @@ FHGAACEncoder::~FHGAACEncoder(void)
{
}
bool FHGAACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag)
bool FHGAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo &metaInfo, const unsigned int duration, const QString &outputFile, volatile bool *abortFlag)
{
QProcess process;
QStringList args;

View File

@ -33,7 +33,7 @@ public:
FHGAACEncoder(void);
~FHGAACEncoder(void);
virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag);
virtual bool encode(const QString &sourceFile, const AudioFileModel_MetaInfo &metaInfo, const unsigned int duration, 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);
virtual const unsigned int *supportedChannelCount(void);

View File

@ -135,7 +135,7 @@ QAACEncoder::~QAACEncoder(void)
{
}
bool QAACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag)
bool QAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo &metaInfo, const unsigned int duration, const QString &outputFile, volatile bool *abortFlag)
{
QProcess process;
QStringList args;
@ -175,14 +175,14 @@ bool QAACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaIn
if(!m_configCustomParams.isEmpty()) args << m_configCustomParams.split(" ", QString::SkipEmptyParts);
if(!metaInfo.fileName().isEmpty()) args << "--title" << cleanTag(metaInfo.fileName());
if(!metaInfo.fileArtist().isEmpty()) args << "--artist" << cleanTag(metaInfo.fileArtist());
if(!metaInfo.fileAlbum().isEmpty()) args << "--album" << cleanTag(metaInfo.fileAlbum());
if(!metaInfo.fileGenre().isEmpty()) args << "--genre" << cleanTag(metaInfo.fileGenre());
if(!metaInfo.fileComment().isEmpty()) args << "--comment" << cleanTag( metaInfo.fileComment());
if(metaInfo.fileYear()) args << "--date" << QString::number(metaInfo.fileYear());
if(metaInfo.filePosition()) args << "--track" << QString::number(metaInfo.filePosition());
if(!metaInfo.fileCover().isEmpty()) args << "--artwork" << metaInfo.fileCover();
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();
args << "-d" << ".";
args << "-o" << QDir::toNativeSeparators(outputFile);

View File

@ -33,7 +33,7 @@ public:
QAACEncoder(void);
~QAACEncoder(void);
virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag);
virtual bool encode(const QString &sourceFile, const AudioFileModel_MetaInfo &metaInfo, const unsigned int duration, 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);

View File

@ -132,7 +132,7 @@ AC3Encoder::~AC3Encoder(void)
{
}
bool AC3Encoder::encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag)
bool AC3Encoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo &metaInfo, const unsigned int duration, const QString &outputFile, volatile bool *abortFlag)
{
QProcess process;
QStringList args;

View File

@ -33,7 +33,7 @@ public:
AC3Encoder(void);
~AC3Encoder(void);
virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag);
virtual bool encode(const QString &sourceFile, const AudioFileModel_MetaInfo &metaInfo, const unsigned int duration, 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);
virtual const unsigned int *supportedChannelCount(void);

View File

@ -58,7 +58,7 @@ public:
virtual ~AbstractEncoder(void);
//Internal encoder API
virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag) = 0;
virtual bool encode(const QString &sourceFile, const AudioFileModel_MetaInfo &metaInfo, const unsigned int duration, 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;
virtual const unsigned int *supportedSamplerates(void);

View File

@ -129,7 +129,7 @@ DCAEncoder::~DCAEncoder(void)
{
}
bool DCAEncoder::encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag)
bool DCAEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo &metaInfo, const unsigned int duration, const QString &outputFile, volatile bool *abortFlag)
{
QProcess process;
QStringList args;

View File

@ -33,7 +33,7 @@ public:
DCAEncoder(void);
~DCAEncoder(void);
virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag);
virtual bool encode(const QString &sourceFile, const AudioFileModel_MetaInfo &metaInfo, const unsigned int duration, 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);
virtual const unsigned int *supportedChannelCount(void);

View File

@ -123,7 +123,7 @@ FLACEncoder::~FLACEncoder(void)
{
}
bool FLACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag)
bool FLACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo &metaInfo, const unsigned int duration, const QString &outputFile, volatile bool *abortFlag)
{
QProcess process;
QStringList args;
@ -131,14 +131,14 @@ bool FLACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaIn
args << QString("-%1").arg(QString::number(qBound(0, m_configBitrate, 8)));
args << "--channel-map=none";
if(!metaInfo.fileName().isEmpty()) args << "-T" << QString("title=%1").arg(cleanTag(metaInfo.fileName()));
if(!metaInfo.fileArtist().isEmpty()) args << "-T" << QString("artist=%1").arg(cleanTag(metaInfo.fileArtist()));
if(!metaInfo.fileAlbum().isEmpty()) args << "-T" << QString("album=%1").arg(cleanTag(metaInfo.fileAlbum()));
if(!metaInfo.fileGenre().isEmpty()) args << "-T" << QString("genre=%1").arg(cleanTag(metaInfo.fileGenre()));
if(!metaInfo.fileComment().isEmpty()) args << "-T" << QString("comment=%1").arg(cleanTag(metaInfo.fileComment()));
if(metaInfo.fileYear()) args << "-T" << QString("date=%1").arg(QString::number(metaInfo.fileYear()));
if(metaInfo.filePosition()) args << "-T" << QString("track=%1").arg(QString::number(metaInfo.filePosition()));
if(!metaInfo.fileCover().isEmpty()) args << QString("--picture=%1").arg(metaInfo.fileCover());
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.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());

View File

@ -33,7 +33,7 @@ public:
FLACEncoder(void);
~FLACEncoder(void);
virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag);
virtual bool encode(const QString &sourceFile, const AudioFileModel_MetaInfo &metaInfo, const unsigned int duration, 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);
virtual const unsigned int *supportedChannelCount(void);

View File

@ -134,7 +134,7 @@ MP3Encoder::~MP3Encoder(void)
{
}
bool MP3Encoder::encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag)
bool MP3Encoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo &metaInfo, const unsigned int duration, const QString &outputFile, volatile bool *abortFlag)
{
QProcess process;
QStringList args;
@ -194,22 +194,22 @@ bool MP3Encoder::encode(const QString &sourceFile, const AudioFileModel &metaInf
bool bUseUCS2 = false;
if(!metaInfo.fileName().isEmpty() && isUnicode(metaInfo.fileName())) bUseUCS2 = true;
if(!metaInfo.fileArtist().isEmpty() && isUnicode(metaInfo.fileArtist())) bUseUCS2 = true;
if(!metaInfo.fileAlbum().isEmpty() && isUnicode(metaInfo.fileAlbum())) bUseUCS2 = true;
if(!metaInfo.fileGenre().isEmpty() && isUnicode(metaInfo.fileGenre())) bUseUCS2 = true;
if(!metaInfo.fileComment().isEmpty() && isUnicode(metaInfo.fileComment())) bUseUCS2 = true;
if(!metaInfo.title().isEmpty() && isUnicode(metaInfo.title())) bUseUCS2 = true;
if(!metaInfo.artist().isEmpty() && isUnicode(metaInfo.artist())) bUseUCS2 = true;
if(!metaInfo.album().isEmpty() && isUnicode(metaInfo.album())) bUseUCS2 = true;
if(!metaInfo.genre().isEmpty() && isUnicode(metaInfo.genre())) bUseUCS2 = true;
if(!metaInfo.comment().isEmpty() && isUnicode(metaInfo.comment())) bUseUCS2 = true;
if(bUseUCS2) args << "--id3v2-ucs2"; //Must specify this BEFORE "--tt" and friends!
if(!metaInfo.fileName().isEmpty()) args << "--tt" << cleanTag(metaInfo.fileName());
if(!metaInfo.fileArtist().isEmpty()) args << "--ta" << cleanTag(metaInfo.fileArtist());
if(!metaInfo.fileAlbum().isEmpty()) args << "--tl" <<cleanTag( metaInfo.fileAlbum());
if(!metaInfo.fileGenre().isEmpty()) args << "--tg" << cleanTag(metaInfo.fileGenre());
if(!metaInfo.fileComment().isEmpty()) args << "--tc" << cleanTag(metaInfo.fileComment());
if(metaInfo.fileYear()) args << "--ty" << QString::number(metaInfo.fileYear());
if(metaInfo.filePosition()) args << "--tn" << QString::number(metaInfo.filePosition());
if(!metaInfo.fileCover().isEmpty()) args << "--ti" << QDir::toNativeSeparators(metaInfo.fileCover());
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(!m_configCustomParams.isEmpty()) args << m_configCustomParams.split(" ", QString::SkipEmptyParts);

View File

@ -33,7 +33,7 @@ public:
MP3Encoder(void);
~MP3Encoder(void);
virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag);
virtual bool encode(const QString &sourceFile, const AudioFileModel_MetaInfo &metaInfo, const unsigned int duration, 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);
virtual const unsigned int *supportedChannelCount(void);

View File

@ -122,10 +122,8 @@ OpusEncoder::~OpusEncoder(void)
{
}
bool OpusEncoder::encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag)
bool OpusEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo &metaInfo, const unsigned int duration, const QString &outputFile, volatile bool *abortFlag)
{
const unsigned int fileDuration = metaInfo.fileDuration();
QProcess process;
QStringList args;
@ -171,13 +169,13 @@ bool OpusEncoder::encode(const QString &sourceFile, const AudioFileModel &metaIn
args << QString("--bitrate") << QString::number(qBound(8, (m_configBitrate + 1) * 8, 256));
if(!metaInfo.fileName().isEmpty()) args << "--title" << cleanTag(metaInfo.fileName());
if(!metaInfo.fileArtist().isEmpty()) args << "--artist" << cleanTag(metaInfo.fileArtist());
if(!metaInfo.fileAlbum().isEmpty()) args << "--album" << cleanTag(metaInfo.fileAlbum());
if(!metaInfo.fileGenre().isEmpty()) args << "--genre" << cleanTag(metaInfo.fileGenre());
if(metaInfo.fileYear()) args << "--date" << QString::number(metaInfo.fileYear());
if(metaInfo.filePosition()) args << "--comment" << QString("tracknumber=%1").arg(QString::number(metaInfo.filePosition()));
if(!metaInfo.fileComment().isEmpty()) args << "--comment" << QString("comment=%1").arg(cleanTag(metaInfo.fileComment()));
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(!m_configCustomParams.isEmpty()) args << m_configCustomParams.split(" ", QString::SkipEmptyParts);

View File

@ -33,7 +33,7 @@ public:
OpusEncoder(void);
~OpusEncoder(void);
virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag);
virtual bool encode(const QString &sourceFile, const AudioFileModel_MetaInfo &metaInfo, const unsigned int duration, 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);
virtual const unsigned int *supportedChannelCount(void);

View File

@ -129,7 +129,7 @@ VorbisEncoder::~VorbisEncoder(void)
{
}
bool VorbisEncoder::encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag)
bool VorbisEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo &metaInfo, const unsigned int duration, const QString &outputFile, volatile bool *abortFlag)
{
QProcess process;
QStringList args;
@ -159,13 +159,13 @@ bool VorbisEncoder::encode(const QString &sourceFile, const AudioFileModel &meta
args << "--resample" << QString::number(m_configSamplingRate) << "--converter" << QString::number(0);
}
if(!metaInfo.fileName().isEmpty()) args << "-t" << cleanTag(metaInfo.fileName());
if(!metaInfo.fileArtist().isEmpty()) args << "-a" << cleanTag(metaInfo.fileArtist());
if(!metaInfo.fileAlbum().isEmpty()) args << "-l" << cleanTag(metaInfo.fileAlbum());
if(!metaInfo.fileGenre().isEmpty()) args << "-G" << cleanTag(metaInfo.fileGenre());
if(!metaInfo.fileComment().isEmpty()) args << "-c" << QString("comment=%1").arg(cleanTag(metaInfo.fileComment()));
if(metaInfo.fileYear()) args << "-d" << QString::number(metaInfo.fileYear());
if(metaInfo.filePosition()) args << "-N" << QString::number(metaInfo.filePosition());
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());
//args << "--tv" << QString().sprintf("Encoder=LameXP v%d.%02d.%04d [%s]", lamexp_version_major(), lamexp_version_minor(), lamexp_version_build(), lamexp_version_release());

View File

@ -33,7 +33,7 @@ public:
VorbisEncoder(void);
~VorbisEncoder(void);
virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag);
virtual bool encode(const QString &sourceFile, const AudioFileModel_MetaInfo &metaInfo, const unsigned int duration, 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);
virtual void setBitrateLimits(int minimumBitrate, int maximumBitrate);

View File

@ -120,7 +120,7 @@ WaveEncoder::~WaveEncoder(void)
{
}
bool WaveEncoder::encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag)
bool WaveEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo &metaInfo, const unsigned int duration, const QString &outputFile, volatile bool *abortFlag)
{
SHFILEOPSTRUCTW fileOperation;
memset(&fileOperation, 0, sizeof(SHFILEOPSTRUCTW));

View File

@ -33,7 +33,7 @@ public:
WaveEncoder(void);
~WaveEncoder(void);
virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag);
virtual bool encode(const QString &sourceFile, const AudioFileModel_MetaInfo &metaInfo, const unsigned int duration, 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);

View File

@ -23,7 +23,7 @@
#include "Tool_Abstract.h"
class AudioFileModel;
class AudioFileModel_TechInfo;
class AbstractFilter : public AbstractTool
{
@ -34,6 +34,6 @@ public:
~AbstractFilter(void);
//Internal decoder API
virtual bool apply(const QString &sourceFile, const QString &outputFile, AudioFileModel *formatInfo, volatile bool *abortFlag) = 0;
virtual bool apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *formatInfo, volatile bool *abortFlag) = 0;
};

View File

@ -43,9 +43,9 @@ DownmixFilter::~DownmixFilter(void)
{
}
bool DownmixFilter::apply(const QString &sourceFile, const QString &outputFile, AudioFileModel *formatInfo, volatile bool *abortFlag)
bool DownmixFilter::apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *formatInfo, volatile bool *abortFlag)
{
unsigned int channels = formatInfo->formatAudioChannels(); //detectChannels(sourceFile, abortFlag);
unsigned int channels = formatInfo->audioChannels(); //detectChannels(sourceFile, abortFlag);
emit messageLogged(QString().sprintf("--> Number of channels is: %d\n", channels));
if(channels == 2)
@ -156,6 +156,6 @@ bool DownmixFilter::apply(const QString &sourceFile, const QString &outputFile,
return false;
}
formatInfo->setFormatAudioChannels(2);
formatInfo->setAudioChannels(2);
return true;
}

View File

@ -31,7 +31,7 @@ public:
DownmixFilter(void);
~DownmixFilter(void);
virtual bool apply(const QString &sourceFile, const QString &outputFile, AudioFileModel *formatInfo, volatile bool *abortFlag);
virtual bool apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *formatInfo, volatile bool *abortFlag);
private:
const QString m_binary;

View File

@ -44,7 +44,7 @@ NormalizeFilter::~NormalizeFilter(void)
{
}
bool NormalizeFilter::apply(const QString &sourceFile, const QString &outputFile, AudioFileModel *formatInfo, volatile bool *abortFlag)
bool NormalizeFilter::apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *formatInfo, volatile bool *abortFlag)
{
QProcess process;
QStringList args;

View File

@ -29,7 +29,7 @@ public:
NormalizeFilter(int peakVolume = -50, int equalizationMode = 0);
~NormalizeFilter(void);
virtual bool apply(const QString &sourceFile, const QString &outputFile, AudioFileModel *formatInfo, volatile bool *abortFlag);
virtual bool apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *formatInfo, volatile bool *abortFlag);
private:
const QString m_binary;

View File

@ -55,12 +55,12 @@ ResampleFilter::~ResampleFilter(void)
{
}
bool ResampleFilter::apply(const QString &sourceFile, const QString &outputFile, AudioFileModel *formatInfo, volatile bool *abortFlag)
bool ResampleFilter::apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *formatInfo, volatile bool *abortFlag)
{
QProcess process;
QStringList args;
if((m_samplingRate == formatInfo->formatAudioSamplerate()) && (m_bitDepth == formatInfo->formatAudioBitdepth()))
if((m_samplingRate == formatInfo->audioSamplerate()) && (m_bitDepth == formatInfo->audioBitdepth()))
{
messageLogged("Skipping resample filter!");
qDebug("Resampling filter target samplerate/bitdepth is equals to the format of the input file, skipping!");
@ -153,8 +153,8 @@ bool ResampleFilter::apply(const QString &sourceFile, const QString &outputFile,
return false;
}
if(m_samplingRate) formatInfo->setFormatAudioSamplerate(m_samplingRate);
if(m_bitDepth) formatInfo->setFormatAudioBitdepth(m_bitDepth);
if(m_samplingRate) formatInfo->setAudioSamplerate(m_samplingRate);
if(m_bitDepth) formatInfo->setAudioBitdepth(m_bitDepth);
return true;
}

View File

@ -29,7 +29,7 @@ public:
ResampleFilter(int samplingRate = 0, int bitDepth = 0);
~ResampleFilter(void);
virtual bool apply(const QString &sourceFile, const QString &outputFile, AudioFileModel *formatInfo, volatile bool *abortFlag);
virtual bool apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *formatInfo, volatile bool *abortFlag);
private:
const QString m_binary;

View File

@ -45,7 +45,7 @@ ToneAdjustFilter::~ToneAdjustFilter(void)
{
}
bool ToneAdjustFilter::apply(const QString &sourceFile, const QString &outputFile, AudioFileModel *formatInfo, volatile bool *abortFlag)
bool ToneAdjustFilter::apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *formatInfo, volatile bool *abortFlag)
{
QProcess process;
QStringList args;

View File

@ -29,7 +29,7 @@ public:
ToneAdjustFilter(int bass = 0, int treble = 0);
~ToneAdjustFilter(void);
virtual bool apply(const QString &sourceFile, const QString &outputFile, AudioFileModel *formatInfo, volatile bool *abortFlag);
virtual bool apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *formatInfo, volatile bool *abortFlag);
private:
const QString m_binary;

View File

@ -39,6 +39,8 @@ public:
bool isOwner(void) const;
void setFilePath(const QString &newPath, bool isOwner = true);
void clear(void);
inline bool isEmpty(void) const { return (m_data != NULL); }
private:
const QString m_nullString;

View File

@ -51,7 +51,6 @@ AudioFileModel_MetaInfo::AudioFileModel_MetaInfo(const AudioFileModel_MetaInfo &
m_cover = model.m_cover;
m_year = model.m_year;
m_position = model.m_position;
m_duration = model.m_duration;
}
AudioFileModel_MetaInfo &AudioFileModel_MetaInfo::operator=(const AudioFileModel_MetaInfo &model)
@ -64,11 +63,22 @@ AudioFileModel_MetaInfo &AudioFileModel_MetaInfo::operator=(const AudioFileModel
m_cover = model.m_cover;
m_year = model.m_year;
m_position = model.m_position;
m_duration = model.m_duration;
return (*this);
}
void AudioFileModel_MetaInfo::update(const AudioFileModel_MetaInfo &model)
{
if(!model.m_titel.isEmpty()) m_titel = model.m_titel;
if(!model.m_artist.isEmpty()) m_artist = model.m_artist;
if(!model.m_album.isEmpty()) m_album = model.m_album;
if(!model.m_genre.isEmpty()) m_genre = model.m_genre;
if(!model.m_comment.isEmpty()) m_comment = model.m_comment;
if(!model.m_cover.isEmpty()) m_cover = model.m_cover;
if(model.m_year > 0) m_year = model.m_year;
if(model.m_position > 0) m_position = model.m_position;
}
AudioFileModel_MetaInfo::~AudioFileModel_MetaInfo(void)
{
/*nothing to do*/
@ -84,7 +94,6 @@ void AudioFileModel_MetaInfo::reset(void)
m_cover.clear();
m_year = 0;
m_position = 0;
m_duration = 0;
}
///////////////////////////////////////////////////////////////////////////////
@ -109,6 +118,7 @@ AudioFileModel_TechInfo::AudioFileModel_TechInfo(const AudioFileModel_TechInfo &
m_audioBitdepth = model.m_audioBitdepth;
m_audioBitrate = model.m_audioBitrate;
m_audioBitrateMode = model.m_audioBitrateMode;
m_duration = model.m_duration;
}
AudioFileModel_TechInfo &AudioFileModel_TechInfo::operator=(const AudioFileModel_TechInfo &model)
@ -124,6 +134,8 @@ AudioFileModel_TechInfo &AudioFileModel_TechInfo::operator=(const AudioFileModel
m_audioBitdepth = model.m_audioBitdepth;
m_audioBitrate = model.m_audioBitrate;
m_audioBitrateMode = model.m_audioBitrateMode;
m_duration = model.m_duration;
return (*this);
}
@ -146,6 +158,7 @@ void AudioFileModel_TechInfo::reset(void)
m_audioBitdepth = 0;
m_audioBitrate = 0;
m_audioBitrateMode = 0;
m_duration = 0;
}
////////////////////////////////////////////////////////////
@ -195,9 +208,9 @@ void AudioFileModel::reset(void)
const QString AudioFileModel::durationInfo(void) const
{
if(m_metaInfo.duration())
if(m_techInfo.duration())
{
QTime time = QTime().addSecs(m_metaInfo.duration());
QTime time = QTime().addSecs(m_techInfo.duration());
return time.toString("hh:mm:ss");
}
else

View File

@ -50,7 +50,6 @@ public:
inline const QString &cover(void) const { return m_cover.filePath(); }
inline unsigned int year(void) const { return m_year; }
inline unsigned int position(void) const { return m_position; }
inline unsigned int duration(void) const { return m_duration; }
//Setter
inline void setTitle(const QString &titel) { m_titel = titel.trimmed(); }
@ -58,14 +57,16 @@ public:
inline void setAlbum(const QString &album) { m_album = album.trimmed(); }
inline void setGenre(const QString &genre) { m_genre = genre.trimmed(); }
inline void setComment(const QString &comment) { m_comment = comment.trimmed(); }
inline const ArtworkModel &cover(const QString &path, const bool isOwner) { m_cover.setFilePath(path, isOwner); }
inline const ArtworkModel &setCover(const QString &path, const bool isOwner) { m_cover.setFilePath(path, isOwner); }
inline void setYear(const unsigned int year) { m_year = year; }
inline void setPosition(const unsigned int position) { m_position = position; }
inline void setDuration(const unsigned int duration) { m_duration = duration; }
//Reset
void reset(void);
//Update
void update(const AudioFileModel_MetaInfo &model);
private:
QString m_titel;
QString m_artist;
@ -75,7 +76,6 @@ private:
ArtworkModel m_cover;
unsigned int m_year;
unsigned int m_position;
unsigned int m_duration;
};
///////////////////////////////////////////////////////////////////////////////
@ -105,19 +105,21 @@ public:
inline unsigned int audioBitdepth(void) const { return m_audioBitdepth; }
inline unsigned int audioBitrate(void) const { return m_audioBitrate; }
inline unsigned int audioBitrateMode(void) const { return m_audioBitrateMode; }
inline unsigned int duration(void) const { return m_duration; }
//Setter
inline const QString &setContainerType(const QString &containerType) { m_containerType = containerType; }
inline const QString &setContainerProfile(const QString &containerProfile) { m_containerProfile = containerProfile; }
inline const QString &setAudioType(const QString &audioType) { m_audioType = audioType; }
inline const QString &setAudioProfile(const QString &audioProfile) { m_audioProfile = audioProfile; }
inline const QString &setAudioVersion(const QString &audioVersion) { m_audioVersion = audioVersion; }
inline const QString &setAudioEncodeLib(const QString &audioEncodeLib) { m_audioEncodeLib = audioEncodeLib; }
inline const QString &setContainerType(const QString &containerType) { m_containerType = containerType.trimmed(); }
inline const QString &setContainerProfile(const QString &containerProfile) { m_containerProfile = containerProfile.trimmed(); }
inline const QString &setAudioType(const QString &audioType) { m_audioType = audioType.trimmed(); }
inline const QString &setAudioProfile(const QString &audioProfile) { m_audioProfile = audioProfile.trimmed(); }
inline const QString &setAudioVersion(const QString &audioVersion) { m_audioVersion = audioVersion.trimmed(); }
inline const QString &setAudioEncodeLib(const QString &audioEncodeLib) { m_audioEncodeLib = audioEncodeLib.trimmed(); }
inline unsigned int setAudioSamplerate(const unsigned int audioSamplerate) { m_audioSamplerate = audioSamplerate; }
inline unsigned int setAudioChannels(const unsigned int audioChannels) { m_audioChannels = audioChannels; }
inline unsigned int setAudioBitdepth(const unsigned int audioBitdepth) { m_audioBitdepth = audioBitdepth; }
inline unsigned int setAudioBitrate(const unsigned int audioBitrate) { m_audioBitrate = audioBitrate; }
inline unsigned int setAudioBitrateMode(const unsigned int audioBitrateMode) { m_audioBitrateMode = audioBitrateMode; }
inline void setDuration(const unsigned int duration) { m_duration = duration; }
//Reset
void reset(void);
@ -134,6 +136,7 @@ private:
unsigned int m_audioBitdepth;
unsigned int m_audioBitrate;
unsigned int m_audioBitrateMode;
unsigned int m_duration;
};
///////////////////////////////////////////////////////////////////////////////
@ -157,7 +160,7 @@ public:
static const unsigned int BITDEPTH_IEEE_FLOAT32;
//Constructors & Destructor
AudioFileModel(const QString &path);
AudioFileModel(const QString &path = QString());
AudioFileModel(const AudioFileModel &model);
AudioFileModel &operator=(const AudioFileModel &model);
~AudioFileModel(void);

View File

@ -70,7 +70,7 @@ QVariant FileListModel::data(const QModelIndex &index, int role) const
switch(index.column())
{
case 0:
return m_fileStore.value(m_fileList.at(index.row())).fileName();
return m_fileStore.value(m_fileList.at(index.row())).metaInfo().title();
break;
case 1:
return QDir::toNativeSeparators(m_fileStore.value(m_fileList.at(index.row())).filePath());
@ -143,8 +143,10 @@ void FileListModel::addFile(const QString &filePath)
if(!m_fileStore.contains(key))
{
AudioFileModel audioFile(fileInfo.canonicalFilePath());
audioFile.metaInfo().setTitle(fileInfo.baseName());
if(flag) beginInsertRows(QModelIndex(), m_fileList.count(), m_fileList.count());
m_fileStore.insert(key, AudioFileModel(fileInfo.canonicalFilePath(), fileInfo.baseName()));
m_fileStore.insert(key, audioFile);
m_fileList.append(key);
if(flag) endInsertRows();
emit rowAppended();
@ -205,15 +207,15 @@ bool FileListModel::moveFile(const QModelIndex &index, int delta)
}
}
AudioFileModel FileListModel::getFile(const QModelIndex &index)
const AudioFileModel &FileListModel::getFile(const QModelIndex &index)
{
if(index.row() >= 0 && index.row() < m_fileList.count())
{
return m_fileStore.value(m_fileList.at(index.row()));
return m_fileStore[m_fileList.at(index.row())]; //return m_fileStore.value(m_fileList.at(index.row()));
}
else
{
return AudioFileModel();
return m_nullAudioFile;
}
}
@ -251,15 +253,16 @@ int FileListModel::exportToCsv(const QString &outFile)
for(int i = 0; i < nFiles; i++)
{
AudioFileModel current = m_fileStore.value(m_fileList.at(i));
const AudioFileModel &current = m_fileStore.value(m_fileList.at(i));
const AudioFileModel_MetaInfo &metaInfo = current.metaInfo();
if(current.filePosition() > 0) havePosition = true;
if(!current.fileName().isEmpty()) haveTitle = true;
if(!current.fileArtist().isEmpty()) haveArtist = true;
if(!current.fileAlbum().isEmpty()) haveAlbum = true;
if(!current.fileGenre().isEmpty()) haveGenre = true;
if(current.fileYear() > 0) haveYear = true;
if(!current.fileComment().isEmpty()) haveComment = true;
if(metaInfo.position() > 0) havePosition = true;
if(!metaInfo.title().isEmpty()) haveTitle = true;
if(!metaInfo.artist().isEmpty()) haveArtist = true;
if(!metaInfo.album().isEmpty()) haveAlbum = true;
if(!metaInfo.genre().isEmpty()) haveGenre = true;
if(metaInfo.year() > 0) haveYear = true;
if(!metaInfo.comment().isEmpty()) haveComment = true;
}
if(!(haveTitle || haveArtist || haveAlbum || haveGenre || haveYear || haveComment))
@ -295,15 +298,16 @@ int FileListModel::exportToCsv(const QString &outFile)
for(int i = 0; i < nFiles; i++)
{
QStringList line;
AudioFileModel current = m_fileStore.value(m_fileList.at(i));
const AudioFileModel &current = m_fileStore.value(m_fileList.at(i));
const AudioFileModel_MetaInfo &metaInfo = current.metaInfo();
if(havePosition) line << QString::number(current.filePosition());
if(haveTitle) line << current.fileName().trimmed();
if(haveArtist) line << current.fileArtist().trimmed();
if(haveAlbum) line << current.fileAlbum().trimmed();
if(haveGenre) line << current.fileGenre().trimmed();
if(haveYear) line << QString::number(current.fileYear());
if(haveComment) line << current.fileComment().trimmed();
if(havePosition) line << QString::number(metaInfo.position());
if(haveTitle) line << metaInfo.title().trimmed();
if(haveArtist) line << metaInfo.artist().trimmed();
if(haveAlbum) line << metaInfo.album().trimmed();
if(haveGenre) line << metaInfo.genre().trimmed();
if(haveYear) line << QString::number(metaInfo.year());
if(haveComment) line << metaInfo.comment().trimmed();
if(file.write(line.replaceInStrings(";", ",").join(";").append("\r\n").toUtf8()) < 1)
{
@ -455,38 +459,38 @@ int FileListModel::importFromCsv(QWidget *parent, const QString &inFile)
{
bool ok = false;
unsigned int temp = data.at(j).trimmed().toUInt(&ok);
if(ok) m_fileStore[key].setFilePosition(temp);
if(ok) m_fileStore[key].metaInfo().setPosition(temp);
}
else if(CHECK_HDR(header.at(j), "TITLE"))
{
QString temp = data.at(j).trimmed();
if(!temp.isEmpty()) m_fileStore[key].setFileName(temp);
if(!temp.isEmpty()) m_fileStore[key].metaInfo().setTitle(temp);
}
else if(CHECK_HDR(header.at(j), "ARTIST"))
{
QString temp = data.at(j).trimmed();
if(!temp.isEmpty()) m_fileStore[key].setFileArtist(temp);
if(!temp.isEmpty()) m_fileStore[key].metaInfo().setArtist(temp);
}
else if(CHECK_HDR(header.at(j), "ALBUM"))
{
QString temp = data.at(j).trimmed();
if(!temp.isEmpty()) m_fileStore[key].setFileAlbum(temp);
if(!temp.isEmpty()) m_fileStore[key].metaInfo().setAlbum(temp);
}
else if(CHECK_HDR(header.at(j), "GENRE"))
{
QString temp = data.at(j).trimmed();
if(!temp.isEmpty()) m_fileStore[key].setFileGenre(temp);
if(!temp.isEmpty()) m_fileStore[key].metaInfo().setGenre(temp);
}
else if(CHECK_HDR(header.at(j), "YEAR"))
{
bool ok = false;
unsigned int temp = data.at(j).trimmed().toUInt(&ok);
if(ok) m_fileStore[key].setFileYear(temp);
if(ok) m_fileStore[key].metaInfo().setYear(temp);
}
else if(CHECK_HDR(header.at(j), "COMMENT"))
{
QString temp = data.at(j).trimmed();
if(!temp.isEmpty()) m_fileStore[key].setFileComment(temp);
if(!temp.isEmpty()) m_fileStore[key].metaInfo().setComment(temp);
}
else
{

View File

@ -44,7 +44,7 @@ public:
bool removeFile(const QModelIndex &index);
void clearFiles(void);
bool moveFile(const QModelIndex &index, int delta);
AudioFileModel getFile(const QModelIndex &index);
const AudioFileModel &getFile(const QModelIndex &index);
bool setFile(const QModelIndex &index, const AudioFileModel &audioFile);
AudioFileModel &operator[] (const QModelIndex &index);
@ -72,6 +72,8 @@ public:
if(!flag) reset();
}
const AudioFileModel m_nullAudioFile;
public slots:
void addFile(const QString &filePath);
void addFile(const AudioFileModel &file);

View File

@ -81,37 +81,37 @@ QVariant MetaInfoModel::data(const QModelIndex &index, int role) const
return (!index.column()) ? tr("Full Path") : CHECK1(m_audioFile->filePath());
break;
case 1:
return (!index.column()) ? tr("Format") : CHECK1(m_audioFile->formatAudioBaseInfo());
return (!index.column()) ? tr("Format") : CHECK1(m_audioFile->audioBaseInfo());
break;
case 2:
return (!index.column()) ? tr("Container") : CHECK1(m_audioFile->formatContainerInfo());
return (!index.column()) ? tr("Container") : CHECK1(m_audioFile->containerInfo());
break;
case 3:
return (!index.column()) ? tr("Compression") : CHECK1(m_audioFile->formatAudioCompressInfo());
return (!index.column()) ? tr("Compression") : CHECK1(m_audioFile->audioCompressInfo());
break;
case 4:
return (!index.column()) ? tr("Duration") : CHECK1(m_audioFile->fileDurationInfo());
return (!index.column()) ? tr("Duration") : CHECK1(m_audioFile->durationInfo());
break;
case 5:
return (!index.column()) ? tr("Title") : CHECK1(m_audioFile->fileName());
return (!index.column()) ? tr("Title") : CHECK1(m_audioFile->metaInfo().title());
break;
case 6:
return (!index.column()) ? tr("Artist") : CHECK1(m_audioFile->fileArtist());
return (!index.column()) ? tr("Artist") : CHECK1(m_audioFile->metaInfo().artist());
break;
case 7:
return (!index.column()) ? tr("Album") : CHECK1(m_audioFile->fileAlbum());
return (!index.column()) ? tr("Album") : CHECK1(m_audioFile->metaInfo().album());
break;
case 8:
return (!index.column()) ? tr("Genre") : CHECK1(m_audioFile->fileGenre());
return (!index.column()) ? tr("Genre") : CHECK1(m_audioFile->metaInfo().genre());
break;
case 9:
return (!index.column()) ? tr("Year") : CHECK2(m_audioFile->fileYear());
return (!index.column()) ? tr("Year") : CHECK2(m_audioFile->metaInfo().year());
break;
case 10:
return (!index.column()) ? tr("Position") : ((m_audioFile->filePosition() == UINT_MAX) ? tr("Generate from list position") : CHECK2(m_audioFile->filePosition()));
return (!index.column()) ? tr("Position") : ((m_audioFile->metaInfo().position() == UINT_MAX) ? tr("Generate from list position") : CHECK2(m_audioFile->metaInfo().position()));
break;
case 11:
return (!index.column()) ? tr("Comment") : CHECK1(m_audioFile->fileComment());
return (!index.column()) ? tr("Comment") : CHECK1(m_audioFile->metaInfo().comment());
break;
default:
return QVariant();
@ -171,37 +171,37 @@ QVariant MetaInfoModel::data(const QModelIndex &index, int role) const
return CHECK3(m_audioFile->filePath());
break;
case 1:
return CHECK3(m_audioFile->formatAudioBaseInfo());
return CHECK3(m_audioFile->audioBaseInfo());
break;
case 2:
return CHECK3(m_audioFile->formatContainerInfo());
return CHECK3(m_audioFile->containerInfo());
break;
case 3:
return CHECK3(m_audioFile->formatAudioCompressInfo());
return CHECK3(m_audioFile->audioCompressInfo());
break;
case 4:
return CHECK4(m_audioFile->fileDurationInfo());
return CHECK4(m_audioFile->durationInfo());
break;
case 5:
return CHECK3(m_audioFile->fileName());
return CHECK3(m_audioFile->metaInfo().title());
break;
case 6:
return CHECK3(m_audioFile->fileArtist());
return CHECK3(m_audioFile->metaInfo().artist());
break;
case 7:
return CHECK3(m_audioFile->fileAlbum());
return CHECK3(m_audioFile->metaInfo().album());
break;
case 8:
return CHECK3(m_audioFile->fileGenre());
return CHECK3(m_audioFile->metaInfo().genre());
break;
case 9:
return CHECK4(m_audioFile->fileYear());
return CHECK4(m_audioFile->metaInfo().year());
break;
case 10:
return CHECK4(m_audioFile->filePosition());
return CHECK4(m_audioFile->metaInfo().position());
break;
case 11:
return CHECK3(m_audioFile->fileComment());
return CHECK3(m_audioFile->metaInfo().comment());
break;
default:
return QVariant();
@ -262,28 +262,28 @@ bool MetaInfoModel::setData (const QModelIndex &index, const QVariant &value, in
return false;
break;
case 4:
m_audioFile->setFileDuration(value.toUInt());
m_audioFile->techInfo().setDuration(value.toUInt());
break;
case 5:
m_audioFile->setFileName(value.toString());
m_audioFile->metaInfo().setTitle(value.toString());
break;
case 6:
m_audioFile->setFileArtist(value.toString());
m_audioFile->metaInfo().setArtist(value.toString());
break;
case 7:
m_audioFile->setFileAlbum(value.toString());
m_audioFile->metaInfo().setAlbum(value.toString());
break;
case 8:
m_audioFile->setFileGenre(value.toString());
m_audioFile->metaInfo().setGenre(value.toString());
break;
case 9:
m_audioFile->setFileYear(value.toUInt());
m_audioFile->metaInfo().setYear(value.toUInt());
break;
case 10:
m_audioFile->setFilePosition(value.toUInt());
m_audioFile->metaInfo().setPosition(value.toUInt());
break;
case 11:
m_audioFile->setFileComment(value.toString());
m_audioFile->metaInfo().setComment(value.toString());
break;
default:
return false;
@ -311,7 +311,7 @@ void MetaInfoModel::editItem(const QModelIndex &index, QWidget *parent)
case 5:
input.setWindowTitle(tr("Edit Title"));
input.setLabelText(EXPAND(tr("Please enter the title for this file:")));
input.setTextValue(m_audioFile->fileName());
input.setTextValue(m_audioFile->metaInfo().title());
if(input.exec() != 0)
{
temp = input.textValue().simplified();
@ -323,31 +323,31 @@ void MetaInfoModel::editItem(const QModelIndex &index, QWidget *parent)
if(index >= 0) temp = temp.mid(index + 3).trimmed();
}
beginResetModel();
m_audioFile->setFileName(temp.isEmpty() ? QString() : temp);
m_audioFile->metaInfo().setTitle(temp.isEmpty() ? QString() : temp);
endResetModel();
}
break;
case 6:
input.setWindowTitle(tr("Edit Artist"));
input.setLabelText(EXPAND(tr("Please enter the artist for this file:")));
input.setTextValue(m_audioFile->fileArtist());
input.setTextValue(m_audioFile->metaInfo().artist());
if(input.exec() != 0)
{
temp = input.textValue().simplified();
beginResetModel();
m_audioFile->setFileArtist(temp.isEmpty() ? QString() : temp);
m_audioFile->metaInfo().setArtist(temp.isEmpty() ? QString() : temp);
endResetModel();
}
break;
case 7:
input.setWindowTitle(tr("Edit Album"));
input.setLabelText(EXPAND(tr("Please enter the album for this file:")));
input.setTextValue(m_audioFile->fileAlbum());
input.setTextValue(m_audioFile->metaInfo().album());
if(input.exec() != 0)
{
temp = input.textValue().simplified();
beginResetModel();
m_audioFile->setFileAlbum(temp.isEmpty() ? QString() : temp);
m_audioFile->metaInfo().setAlbum(temp.isEmpty() ? QString() : temp);
endResetModel();
}
break;
@ -356,12 +356,12 @@ void MetaInfoModel::editItem(const QModelIndex &index, QWidget *parent)
input.setLabelText(EXPAND(tr("Please enter the genre for this file:")));
for(int i = 0; g_lamexp_generes[i]; i++) generes << g_lamexp_generes[i];
input.setComboBoxItems(generes);
input.setTextValue(m_audioFile->fileGenre());
input.setTextValue(m_audioFile->metaInfo().genre());
if(input.exec() != 0)
{
temp = input.textValue().simplified();
beginResetModel();
m_audioFile->setFileGenre((temp.isEmpty() || !temp.compare(generes.at(0), Qt::CaseInsensitive)) ? QString() : temp);
m_audioFile->metaInfo().setGenre((temp.isEmpty() || !temp.compare(generes.at(0), Qt::CaseInsensitive)) ? QString() : temp);
endResetModel();
}
break;
@ -369,13 +369,13 @@ void MetaInfoModel::editItem(const QModelIndex &index, QWidget *parent)
input.setWindowTitle(tr("Edit Year"));
input.setLabelText(EXPAND(tr("Please enter the year for this file:")));
input.setIntRange(0, 2100);
input.setIntValue((m_audioFile->fileYear() ? m_audioFile->fileYear() : 1900));
input.setIntValue((m_audioFile->metaInfo().year() ? m_audioFile->metaInfo().year() : 1900));
input.setIntStep(1);
if(input.exec() != 0)
{
val = input.intValue();
beginResetModel();
m_audioFile->setFileYear(val);
m_audioFile->metaInfo().setYear(val);
endResetModel();
}
break;
@ -385,13 +385,13 @@ void MetaInfoModel::editItem(const QModelIndex &index, QWidget *parent)
input.setWindowTitle(tr("Edit Position"));
input.setLabelText(EXPAND(tr("Please enter the position (track no.) for this file:")));
input.setIntRange(0, 99);
input.setIntValue((m_audioFile->filePosition() ? m_audioFile->filePosition() : 1));
input.setIntValue((m_audioFile->metaInfo().position() ? m_audioFile->metaInfo().position() : 1));
input.setIntStep(1);
if(input.exec() != 0)
{
val = input.intValue();
beginResetModel();
m_audioFile->setFilePosition(val);
m_audioFile->metaInfo().setPosition(val);
endResetModel();
}
}
@ -402,12 +402,12 @@ void MetaInfoModel::editItem(const QModelIndex &index, QWidget *parent)
input.setWindowTitle(tr("Edit Position"));
input.setLabelText(EXPAND(tr("Please enter the position (track no.) for this file:")));
input.setComboBoxItems(options);
input.setTextValue(options.value((m_audioFile->filePosition() == UINT_MAX) ? 1 : 0));
input.setTextValue(options.value((m_audioFile->metaInfo().position() == UINT_MAX) ? 1 : 0));
if(input.exec() != 0)
{
temp = input.textValue().simplified();
beginResetModel();
m_audioFile->setFilePosition((options.indexOf(temp) == 1) ? UINT_MAX : 0);
m_audioFile->metaInfo().setPosition((options.indexOf(temp) == 1) ? UINT_MAX : 0);
endResetModel();
}
}
@ -415,12 +415,12 @@ void MetaInfoModel::editItem(const QModelIndex &index, QWidget *parent)
case 11:
input.setWindowTitle(tr("Edit Comment"));
input.setLabelText(EXPAND(tr("Please enter the comment for this file:")));
input.setTextValue((m_audioFile->fileComment().isEmpty() ? tr("Encoded with LameXP") : m_audioFile->fileComment()));
input.setTextValue((m_audioFile->metaInfo().comment().isEmpty() ? tr("Encoded with LameXP") : m_audioFile->metaInfo().comment()));
if(input.exec() != 0)
{
temp = input.textValue().simplified();
beginResetModel();
m_audioFile->setFileComment(temp.isEmpty() ? QString() : temp);
m_audioFile->metaInfo().setComment(temp.isEmpty() ? QString() : temp);
endResetModel();
}
break;
@ -432,7 +432,7 @@ void MetaInfoModel::editItem(const QModelIndex &index, QWidget *parent)
void MetaInfoModel::editArtwork(const QString &imagePath)
{
m_audioFile->setFileCover(imagePath, false);
m_audioFile->metaInfo().setCover(imagePath, false);
}
void MetaInfoModel::clearData(bool clearMetaOnly)
@ -442,33 +442,39 @@ void MetaInfoModel::clearData(bool clearMetaOnly)
m_textUnknown = QString("(%1)").arg(tr("Unknown"));
m_textNotSpecified = QString("(%1)").arg(tr("Not Specified"));
m_audioFile->setFileArtist(QString());
m_audioFile->setFileAlbum(QString());
m_audioFile->setFileGenre(QString());
m_audioFile->setFileComment(tr("Encoded with LameXP"));
m_audioFile->setFileCover(QString(), false);
m_audioFile->setFileYear(0);
m_audioFile->setFilePosition(m_offset ? UINT_MAX : 0);
m_audioFile->metaInfo().reset();
m_audioFile->metaInfo().setComment(tr("Encoded with LameXP"));
m_audioFile->metaInfo().setPosition(m_offset ? UINT_MAX : 0);
//m_audioFile->setFileArtist(QString());
//m_audioFile->setFileAlbum(QString());
//m_audioFile->setFileGenre(QString());
//m_audioFile->setFileComment(tr("Encoded with LameXP"));
//m_audioFile->setFileCover(QString(), false);
//m_audioFile->setFileYear(0);
//m_audioFile->setFilePosition(m_offset ? UINT_MAX : 0);
if(!clearMetaOnly)
{
m_audioFile->setFilePath(QString());
m_audioFile->setFileName(QString());
m_audioFile->setFileDuration(0);
m_audioFile->setFormatContainerType(QString());
m_audioFile->setFormatContainerProfile(QString());
m_audioFile->setFormatAudioType(QString());
m_audioFile->setFormatAudioProfile(QString());
m_audioFile->setFormatAudioVersion(QString());
m_audioFile->setFormatAudioSamplerate(0);
m_audioFile->setFormatAudioChannels(0);
m_audioFile->setFormatAudioBitdepth(0);
m_audioFile->techInfo().reset();
//m_audioFile->setFilePath(QString());
//m_audioFile->setFileName(QString());
//m_audioFile->setFileDuration(0);
//m_audioFile->setFormatContainerType(QString());
//m_audioFile->setFormatContainerProfile(QString());
//m_audioFile->setFormatAudioType(QString());
//m_audioFile->setFormatAudioProfile(QString());
//m_audioFile->setFormatAudioVersion(QString());
//m_audioFile->setFormatAudioSamplerate(0);
//m_audioFile->setFormatAudioChannels(0);
//m_audioFile->setFormatAudioBitdepth(0);
}
else
{
QString temp = QFileInfo(m_audioFile->filePath()).baseName();
temp = temp.split("-", QString::SkipEmptyParts).last().trimmed();
m_audioFile->setFileName(temp);
m_audioFile->metaInfo().setTitle(temp);
}
endResetModel();
@ -479,9 +485,9 @@ Qt::ItemFlags MetaInfoModel::flags(const QModelIndex &index) const
return QAbstractTableModel::flags(index);
}
void MetaInfoModel::assignInfoFrom(AudioFileModel &file)
void MetaInfoModel::assignInfoFrom(const AudioFileModel &file)
{
beginResetModel();
m_audioFile->updateMetaInfo(file);
m_audioFile->metaInfo().update(file.metaInfo());
endResetModel();
}

View File

@ -43,7 +43,7 @@ public:
Qt::ItemFlags flags(const QModelIndex &index) const;
void editItem(const QModelIndex &index, QWidget *parent);
void editArtwork(const QString &imagePath);
void assignInfoFrom(AudioFileModel &file);
void assignInfoFrom(const AudioFileModel &file);
void clearData(bool clearMetaOnly = false);
private:

View File

@ -108,10 +108,10 @@ void CueSplitter::run()
//Decompress all input files
for(int i = 0; i < nInputFiles; i++)
{
AudioFileModel &inputFileInfo = m_inputFilesInfo[inputFileList.at(i)];
if(inputFileInfo.formatContainerType().compare("Wave", Qt::CaseInsensitive) || inputFileInfo.formatAudioType().compare("PCM", Qt::CaseInsensitive))
const AudioFileModel_TechInfo &inputFileInfo = m_inputFilesInfo[inputFileList.at(i)].techInfo();
if(inputFileInfo.containerType().compare("Wave", Qt::CaseInsensitive) || inputFileInfo.audioType().compare("PCM", Qt::CaseInsensitive))
{
AbstractDecoder *decoder = DecoderRegistry::lookup(inputFileInfo.formatContainerType(), inputFileInfo.formatContainerProfile(), inputFileInfo.formatAudioType(), inputFileInfo.formatAudioProfile(), inputFileInfo.formatAudioVersion());
AbstractDecoder *decoder = DecoderRegistry::lookup(inputFileInfo.containerType(), inputFileInfo.containerProfile(), inputFileInfo.audioType(), inputFileInfo.audioProfile(), inputFileInfo.audioVersion());
if(decoder)
{
m_activeFile = shortName(QFileInfo(inputFileList.at(i)).fileName());
@ -193,41 +193,42 @@ void CueSplitter::run()
}
//Setup meta info
AudioFileModel trackMetaInfo(QString().sprintf("cue://File%02d/Track%02d", i, j));
trackMetaInfo.setFileName(m_model->getTrackTitle(i, j));
trackMetaInfo.setFileArtist(m_model->getTrackPerformer(i, j));
trackMetaInfo.setFileGenre(m_model->getTrackGenre(i, j));
trackMetaInfo.setFileYear(m_model->getTrackYear(i, j));
trackMetaInfo.setFilePosition(trackNo);
AudioFileModel_MetaInfo trackMetaInfo; /*QString().sprintf("cue://File%02d/Track%02d", i, j)*/;
trackMetaInfo.setTitle(m_model->getTrackTitle(i, j));
trackMetaInfo.setArtist(m_model->getTrackPerformer(i, j));
trackMetaInfo.setGenre(m_model->getTrackGenre(i, j));
trackMetaInfo.setYear(m_model->getTrackYear(i, j));
trackMetaInfo.setPosition(trackNo);
//Apply album meta data on files
if(trackMetaInfo.fileName().trimmed().isEmpty())
if(trackMetaInfo.title().trimmed().isEmpty())
{
trackMetaInfo.setFileName(QString().sprintf("Track %02d", trackNo));
trackMetaInfo.setTitle(QString().sprintf("Track %02d", trackNo));
}
if(!albumTitle.isEmpty())
{
trackMetaInfo.setFileAlbum(albumTitle);
trackMetaInfo.setAlbum(albumTitle);
}
if(!albumPerformer.isEmpty() && trackMetaInfo.fileArtist().isEmpty())
if(!albumPerformer.isEmpty() && trackMetaInfo.artist().isEmpty())
{
trackMetaInfo.setFileArtist(albumPerformer);
trackMetaInfo.setArtist(albumPerformer);
}
if(!albumGenre.isEmpty() && trackMetaInfo.fileGenre().isEmpty())
if(!albumGenre.isEmpty() && trackMetaInfo.genre().isEmpty())
{
trackMetaInfo.setFileGenre(albumGenre);
trackMetaInfo.setGenre(albumGenre);
}
if((albumYear > 0) && (trackMetaInfo.fileYear() == 0))
if((albumYear > 0) && (trackMetaInfo.year() == 0))
{
trackMetaInfo.setFileYear(albumYear);
trackMetaInfo.setYear(albumYear);
}
if(_finite(trackLength))
{
trackMetaInfo.setFileDuration(static_cast<unsigned int>(abs(trackLength)));
//FIXME !!!
//trackMetaInfo.setDuration(static_cast<unsigned int>(abs(trackLength)));
}
//Generate output file name
QString trackTitle = trackMetaInfo.fileName().isEmpty() ? QString().sprintf("Track %02d", trackNo) : trackMetaInfo.fileName();
QString trackTitle = trackMetaInfo.title().isEmpty() ? QString().sprintf("Track %02d", trackNo) : trackMetaInfo.title();
QString outputFile = QString("%1/[%2] %3 - %4.wav").arg(m_outputDir, QString().sprintf("%02d", trackNo), lamexp_clean_filename(m_baseName), lamexp_clean_filename(trackTitle));
for(int n = 2; QFileInfo(outputFile).exists(); n++)
{
@ -236,7 +237,7 @@ void CueSplitter::run()
//Call split function
emit fileSelected(shortName(QFileInfo(outputFile).fileName()));
splitFile(outputFile, trackNo, trackFile, trackOffset, trackLength, trackMetaInfo, maxProgress);
splitFile(outputFile, trackNo, trackFile, trackOffset, trackLength, trackMetaInfo, maxProgress);
if(m_abortFlag)
{
@ -264,14 +265,14 @@ void CueSplitter::handleUpdate(int progress)
// Privtae Functions
////////////////////////////////////////////////////////////
void CueSplitter::splitFile(const QString &output, const int trackNo, const QString &file, const double offset, const double length, const AudioFileModel &metaInfo, int &maxProgress)
void CueSplitter::splitFile(const QString &output, const int trackNo, const QString &file, const double offset, const double length, const AudioFileModel_MetaInfo &metaInfo, int &maxProgress)
{
qDebug("[Track %02d]", trackNo);
qDebug("File: <%s>", file.toUtf8().constData());
qDebug("Offset: <%f> <%s>", offset, indexToString(offset).toLatin1().constData());
qDebug("Length: <%f> <%s>", length, indexToString(length).toLatin1().constData());
qDebug("Artist: <%s>", metaInfo.fileArtist().toUtf8().constData());
qDebug("Title: <%s>", metaInfo.fileName().toUtf8().constData());
qDebug("Artist: <%s>", metaInfo.artist().toUtf8().constData());
qDebug("Title: <%s>", metaInfo.title().toUtf8().constData());
if(!m_decompressedFiles.contains(file))
{
@ -286,10 +287,11 @@ void CueSplitter::splitFile(const QString &output, const int trackNo, const QStr
emit fileSelected(QString("%1 [%2%]").arg(baseName, QString::number(maxProgress)));
AudioFileModel outFileInfo(metaInfo);
AudioFileModel outFileInfo;
outFileInfo.setMetaInfo(metaInfo);
outFileInfo.setFilePath(output);
outFileInfo.setFormatContainerType("Wave");
outFileInfo.setFormatAudioType("PCM");
outFileInfo.techInfo().setContainerType("Wave");
outFileInfo.techInfo().setAudioType("PCM");
QStringList args;
args << "-S" << "-V3";
@ -364,19 +366,19 @@ void CueSplitter::splitFile(const QString &output, const int trackNo, const QStr
{
bool ok = false;
unsigned int channels = rxChannels.cap(1).toUInt(&ok);
if(ok) outFileInfo.setFormatAudioChannels(channels);
if(ok) outFileInfo.techInfo().setAudioChannels(channels);
}
else if(rxSamplerate.lastIndexIn(text) >= 0)
{
bool ok = false;
unsigned int samplerate = rxSamplerate.cap(1).toUInt(&ok);
if(ok) outFileInfo.setFormatAudioSamplerate(samplerate);
if(ok) outFileInfo.techInfo().setAudioSamplerate(samplerate);
}
else if(rxPrecision.lastIndexIn(text) >= 0)
{
bool ok = false;
unsigned int precision = rxPrecision.cap(1).toUInt(&ok);
if(ok) outFileInfo.setFormatAudioBitdepth(precision);
if(ok) outFileInfo.techInfo().setAudioBitdepth(precision);
}
else if(rxDuration.lastIndexIn(text) >= 0)
{
@ -392,7 +394,7 @@ void CueSplitter::splitFile(const QString &output, const int trackNo, const QStr
qDebug("Duration updated from SoX info!");
int duration = intputLen - static_cast<int>(floor(offset + 0.5));
if(duration < 0) qWarning("Track is out of bounds: Track offset exceeds input file duration!");
outFileInfo.setFileDuration(qMax(0, duration));
outFileInfo.techInfo().setDuration(qMax(0, duration));
}
else
{

View File

@ -26,6 +26,7 @@
#include <QMap>
class AudioFileModel;
class AudioFileModel_MetaInfo;
class CueSheetModel;
class QFile;
class QDir;
@ -62,7 +63,7 @@ public slots:
void abortProcess(void) { m_abortFlag = true; }
private:
void splitFile(const QString &output, const int trackNo, const QString &file, const double offset, const double length, const AudioFileModel &metaInfo, int &maxProgress);
void splitFile(const QString &output, const int trackNo, const QString &file, const double offset, const double length, const AudioFileModel_MetaInfo &metaInfo, int &maxProgress);
QString indexToString(const double index) const;
QString shortName(const QString &longName) const;

View File

@ -107,7 +107,7 @@ void AnalyzeTask::run_ex(void)
qWarning("Dummy CDDA file detected, skipping!");
break;
default:
if(file.fileName().isEmpty() || file.formatContainerType().isEmpty() || file.formatAudioType().isEmpty())
if(file.metaInfo().title().isEmpty() || file.techInfo().containerType().isEmpty() || file.techInfo().audioType().isEmpty())
{
fileType = fileTypeUnknown;
if(!QFileInfo(currentFile).suffix().compare("cue", Qt::CaseInsensitive))
@ -227,7 +227,7 @@ const AudioFileModel AnalyzeTask::analyzeFile(const QString &filePath, int *type
}
}
if(audioFile.fileName().isEmpty())
if(audioFile.metaInfo().title().isEmpty())
{
QString baseName = QFileInfo(filePath).fileName();
int index = baseName.lastIndexOf(".");
@ -245,7 +245,7 @@ const AudioFileModel AnalyzeTask::analyzeFile(const QString &filePath, int *type
baseName = baseName.mid(index + 3).trimmed();
}
audioFile.setFileName(baseName);
audioFile.metaInfo().setTitle(baseName);
}
process.waitForFinished();
@ -260,9 +260,9 @@ const AudioFileModel AnalyzeTask::analyzeFile(const QString &filePath, int *type
retrieveCover(audioFile, coverType, coverData);
}
if((audioFile.formatAudioType().compare("PCM", Qt::CaseInsensitive) == 0) && (audioFile.formatAudioProfile().compare("Float", Qt::CaseInsensitive) == 0))
if((audioFile.techInfo().audioType().compare("PCM", Qt::CaseInsensitive) == 0) && (audioFile.techInfo().audioProfile().compare("Float", Qt::CaseInsensitive) == 0))
{
if(audioFile.formatAudioBitdepth() == 32) audioFile.setFormatAudioBitdepth(AudioFileModel::BITDEPTH_IEEE_FLOAT32);
if(audioFile.techInfo().audioBitdepth() == 32) audioFile.techInfo().setAudioBitdepth(AudioFileModel::BITDEPTH_IEEE_FLOAT32);
}
return audioFile;
@ -311,8 +311,8 @@ void AnalyzeTask::updateInfo(AudioFileModel &audioFile, bool *skipNext, unsigned
if(IS_KEY("Aud_Source"))
{
*skipNext = true;
audioFile.setFormatContainerType(QString());
audioFile.setFormatAudioType(QString());
audioFile.techInfo().setContainerType(QString());
audioFile.techInfo().setAudioType(QString());
qWarning("Skipping info for playlist file!");
return;
}
@ -322,47 +322,47 @@ void AnalyzeTask::updateInfo(AudioFileModel &audioFile, bool *skipNext, unsigned
{
if(IS_KEY("Gen_Format"))
{
audioFile.setFormatContainerType(value);
audioFile.techInfo().setContainerType(value);
}
else if(IS_KEY("Gen_Format_Profile"))
{
audioFile.setFormatContainerProfile(value);
audioFile.techInfo().setContainerProfile(value);
}
else if(IS_KEY("Gen_Title") || IS_KEY("Gen_Track"))
{
audioFile.setFileName(value);
audioFile.metaInfo().setTitle(value);
}
else if(IS_KEY("Gen_Duration"))
{
unsigned int tmp = parseDuration(value);
if(tmp > 0) audioFile.setFileDuration(tmp);
if(tmp > 0) audioFile.techInfo().setDuration(tmp);
}
else if(IS_KEY("Gen_Artist") || IS_KEY("Gen_Performer"))
{
audioFile.setFileArtist(value);
audioFile.metaInfo().setArtist(value);
}
else if(IS_KEY("Gen_Album"))
{
audioFile.setFileAlbum(value);
audioFile.metaInfo().setAlbum(value);
}
else if(IS_KEY("Gen_Genre"))
{
audioFile.setFileGenre(value);
audioFile.metaInfo().setGenre(value);
}
else if(IS_KEY("Gen_Released_Date") || IS_KEY("Gen_Recorded_Date"))
{
unsigned int tmp = parseYear(value);
if(tmp > 0) audioFile.setFileYear(tmp);
if(tmp > 0) audioFile.metaInfo().setYear(tmp);
}
else if(IS_KEY("Gen_Comment"))
{
audioFile.setFileComment(value);
audioFile.metaInfo().setComment(value);
}
else if(IS_KEY("Gen_Track/Position"))
{
bool ok = false;
unsigned int tmp = value.toUInt(&ok);
if(ok) audioFile.setFilePosition(tmp);
if(ok) audioFile.metaInfo().setPosition(tmp);
}
else if(IS_KEY("Gen_Cover") || IS_KEY("Gen_Cover_Type"))
{
@ -396,53 +396,53 @@ void AnalyzeTask::updateInfo(AudioFileModel &audioFile, bool *skipNext, unsigned
if(IS_KEY("Aud_Format"))
{
audioFile.setFormatAudioType(value);
audioFile.techInfo().setAudioType(value);
}
else if(IS_KEY("Aud_Format_Profile"))
{
audioFile.setFormatAudioProfile(value);
audioFile.techInfo().setAudioProfile(value);
}
else if(IS_KEY("Aud_Format_Version"))
{
audioFile.setFormatAudioVersion(value);
audioFile.techInfo().setAudioVersion(value);
}
else if(IS_KEY("Aud_Channel(s)"))
{
bool ok = false;
unsigned int tmp = value.toUInt(&ok);
if(ok) audioFile.setFormatAudioChannels(tmp);
if(ok) audioFile.techInfo().setAudioChannels(tmp);
}
else if(IS_KEY("Aud_SamplingRate"))
{
bool ok = false;
unsigned int tmp = value.toUInt(&ok);
if(ok) audioFile.setFormatAudioSamplerate(tmp);
if(ok) audioFile.techInfo().setAudioSamplerate(tmp);
}
else if(IS_KEY("Aud_BitDepth"))
{
bool ok = false;
unsigned int tmp = value.toUInt(&ok);
if(ok) audioFile.setFormatAudioBitdepth(tmp);
if(ok) audioFile.techInfo().setAudioBitdepth(tmp);
}
else if(IS_KEY("Aud_Duration"))
{
unsigned int tmp = parseDuration(value);
if(tmp > 0) audioFile.setFileDuration(tmp);
if(tmp > 0) audioFile.techInfo().setDuration(tmp);
}
else if(IS_KEY("Aud_BitRate"))
{
bool ok = false;
unsigned int tmp = value.toUInt(&ok);
if(ok) audioFile.setFormatAudioBitrate(tmp/1000);
if(ok) audioFile.techInfo().setAudioBitrate(tmp/1000);
}
else if(IS_KEY("Aud_BitRate_Mode"))
{
if(!value.compare("CBR", Qt::CaseInsensitive)) audioFile.setFormatAudioBitrateMode(AudioFileModel::BitrateModeConstant);
if(!value.compare("VBR", Qt::CaseInsensitive)) audioFile.setFormatAudioBitrateMode(AudioFileModel::BitrateModeVariable);
if(!value.compare("CBR", Qt::CaseInsensitive)) audioFile.techInfo().setAudioBitrateMode(AudioFileModel::BitrateModeConstant);
if(!value.compare("VBR", Qt::CaseInsensitive)) audioFile.techInfo().setAudioBitrateMode(AudioFileModel::BitrateModeVariable);
}
else if(IS_KEY("Aud_Encoded_Library"))
{
audioFile.setFormatAudioEncodeLib(value);
audioFile.techInfo().setAudioEncodeLib(value);
}
else
{
@ -492,7 +492,7 @@ void AnalyzeTask::retrieveCover(AudioFileModel &audioFile, cover_t coverType, co
{
coverFile.write(coverData);
coverFile.close();
audioFile.setFileCover(coverFile.fileName(), true);
audioFile.metaInfo().setCover(coverFile.fileName(), true);
}
}
else
@ -558,34 +558,34 @@ bool AnalyzeTask::analyzeAvisynthFile(const QString &filePath, AudioFileModel &i
{
bool ok = false;
unsigned int duration = val.toUInt(&ok);
if(ok) info.setFileDuration(duration);
if(ok) info.techInfo().setDuration(duration);
}
if(key.compare("SamplesPerSec", Qt::CaseInsensitive) == 0)
{
bool ok = false;
unsigned int samplerate = val.toUInt(&ok);
if(ok) info.setFormatAudioSamplerate (samplerate);
if(ok) info.techInfo().setAudioSamplerate (samplerate);
}
if(key.compare("Channels", Qt::CaseInsensitive) == 0)
{
bool ok = false;
unsigned int channels = val.toUInt(&ok);
if(ok) info.setFormatAudioChannels(channels);
if(ok) info.techInfo().setAudioChannels(channels);
}
if(key.compare("BitsPerSample", Qt::CaseInsensitive) == 0)
{
bool ok = false;
unsigned int bitdepth = val.toUInt(&ok);
if(ok) info.setFormatAudioBitdepth(bitdepth);
}
if(ok) info.techInfo().setAudioBitdepth(bitdepth);
}
}
}
else
{
if(line.contains("[Audio Info]", Qt::CaseInsensitive))
{
info.setFormatAudioType("Avisynth");
info.setFormatContainerType("Avisynth");
info.techInfo().setAudioType("Avisynth");
info.techInfo().setContainerType("Avisynth");
bInfoHeaderFound = true;
}
}

View File

@ -46,7 +46,7 @@
#include <stdlib.h>
#define DIFF(X,Y) ((X > Y) ? (X-Y) : (Y-X))
#define IS_WAVE(X) ((X.formatContainerType().compare("Wave", Qt::CaseInsensitive) == 0) && (X.formatAudioType().compare("PCM", Qt::CaseInsensitive) == 0))
#define IS_WAVE(X) ((X.containerType().compare("Wave", Qt::CaseInsensitive) == 0) && (X.audioType().compare("PCM", Qt::CaseInsensitive) == 0))
#define STRDEF(STR,DEF) ((!STR.isEmpty()) ? STR : DEF)
////////////////////////////////////////////////////////////
@ -202,10 +202,11 @@ void ProcessThread::processFile()
//------------------
//Decode source file
//------------------
if(!m_filters.isEmpty() || !m_encoder->isFormatSupported(m_audioFile.formatContainerType(), m_audioFile.formatContainerProfile(), m_audioFile.formatAudioType(), m_audioFile.formatAudioProfile(), m_audioFile.formatAudioVersion()))
const AudioFileModel_TechInfo &formatInfo = m_audioFile.techInfo();
if(!m_filters.isEmpty() || !m_encoder->isFormatSupported(formatInfo.containerType(), formatInfo.containerProfile(), formatInfo.audioType(), formatInfo.audioProfile(), formatInfo.audioVersion()))
{
m_currentStep = DecodingStep;
AbstractDecoder *decoder = DecoderRegistry::lookup(m_audioFile.formatContainerType(), m_audioFile.formatContainerProfile(), m_audioFile.formatAudioType(), m_audioFile.formatAudioProfile(), m_audioFile.formatAudioVersion());
AbstractDecoder *decoder = DecoderRegistry::lookup(formatInfo.containerType(), formatInfo.containerProfile(), formatInfo.audioType(), formatInfo.audioProfile(), formatInfo.audioVersion());
if(decoder)
{
@ -220,8 +221,8 @@ void ProcessThread::processFile()
if(bSuccess)
{
sourceFile = tempFile;
m_audioFile.setFormatContainerType(QString::fromLatin1("Wave"));
m_audioFile.setFormatAudioType(QString::fromLatin1("PCM"));
m_audioFile.techInfo().setContainerType(QString::fromLatin1("Wave"));
m_audioFile.techInfo().setAudioType(QString::fromLatin1("PCM"));
if(QFileInfo(sourceFile).size() >= 4294967296i64)
{
@ -234,7 +235,7 @@ void ProcessThread::processFile()
else
{
if(QFileInfo(m_outFileName).exists() && (QFileInfo(m_outFileName).size() < 512)) QFile::remove(m_outFileName);
handleMessage(QString("%1\n%2\n\n%3\t%4\n%5\t%6").arg(tr("The format of this file is NOT supported:"), m_audioFile.filePath(), tr("Container Format:"), m_audioFile.formatContainerInfo(), tr("Audio Format:"), m_audioFile.formatAudioCompressInfo()));
handleMessage(QString("%1\n%2\n\n%3\t%4\n%5\t%6").arg(tr("The format of this file is NOT supported:"), m_audioFile.filePath(), tr("Container Format:"), m_audioFile.containerInfo(), tr("Audio Format:"), m_audioFile.audioCompressInfo()));
emit processStateChanged(m_jobId, tr("Unsupported!"), ProgressModel::JobFailed);
emit processStateFinished(m_jobId, m_outFileName, 0);
return;
@ -244,12 +245,12 @@ void ProcessThread::processFile()
//------------------------------------
//Update audio properties after decode
//------------------------------------
if(bSuccess && !m_aborted && IS_WAVE(m_audioFile))
if(bSuccess && !m_aborted && IS_WAVE(m_audioFile.techInfo()))
{
if(m_encoder->supportedSamplerates() || m_encoder->supportedBitdepths() || m_encoder->supportedChannelCount() || m_encoder->needsTimingInfo() || !m_filters.isEmpty())
{
m_currentStep = AnalyzeStep;
bSuccess = m_propDetect->detect(sourceFile, &m_audioFile, &m_aborted);
bSuccess = m_propDetect->detect(sourceFile, &m_audioFile.techInfo(), &m_aborted);
if(bSuccess)
{
@ -284,7 +285,7 @@ void ProcessThread::processFile()
connect(poFilter, SIGNAL(statusUpdated(int)), this, SLOT(handleUpdate(int)), Qt::DirectConnection);
connect(poFilter, SIGNAL(messageLogged(QString)), this, SLOT(handleMessage(QString)), Qt::DirectConnection);
if(poFilter->apply(sourceFile, tempFile, &m_audioFile, &m_aborted))
if(poFilter->apply(sourceFile, tempFile, &m_audioFile.techInfo(), &m_aborted))
{
sourceFile = tempFile;
}
@ -300,7 +301,7 @@ void ProcessThread::processFile()
if(bSuccess && !m_aborted)
{
m_currentStep = EncodingStep;
bSuccess = m_encoder->encode(sourceFile, m_audioFile, m_outFileName, &m_aborted);
bSuccess = m_encoder->encode(sourceFile, m_audioFile.metaInfo(), m_audioFile.techInfo().duration(), m_outFileName, &m_aborted);
}
//Clean-up
@ -426,15 +427,7 @@ int ProcessThread::generateOutFileName(QString &outFileName)
}
//Apply rename pattern
QString fileName = m_renamePattern;
fileName.replace("<BaseName>", STRDEF(baseName, tr("Unknown File Name")), Qt::CaseInsensitive);
fileName.replace("<TrackNo>", QString().sprintf("%02d", m_audioFile.filePosition()), Qt::CaseInsensitive);
fileName.replace("<Title>", STRDEF(m_audioFile.fileName(), tr("Unknown Title")) , Qt::CaseInsensitive);
fileName.replace("<Artist>", STRDEF(m_audioFile.fileArtist(), tr("Unknown Artist")), Qt::CaseInsensitive);
fileName.replace("<Album>", STRDEF(m_audioFile.fileAlbum(), tr("Unknown Album")), Qt::CaseInsensitive);
fileName.replace("<Year>", QString().sprintf("%04d", m_audioFile.fileYear()), Qt::CaseInsensitive);
fileName.replace("<Comment>", STRDEF(m_audioFile.fileComment(), tr("Unknown Comment")), Qt::CaseInsensitive);
fileName = lamexp_clean_filename(fileName).simplified();
QString fileName = applyRenamePattern(baseName, m_audioFile.metaInfo());
//Generate full output path
outFileName = QString("%1/%2.%3").arg(targetDir.canonicalPath(), fileName, m_encoder->extension());
@ -482,6 +475,22 @@ int ProcessThread::generateOutFileName(QString &outFileName)
return 1;
}
QString ProcessThread::applyRenamePattern(const QString &baseName, const AudioFileModel_MetaInfo &metaInfo)
{
QString fileName = m_renamePattern;
fileName.replace("<BaseName>", STRDEF(baseName, tr("Unknown File Name")), Qt::CaseInsensitive);
fileName.replace("<TrackNo>", QString().sprintf("%02d", metaInfo.position()), Qt::CaseInsensitive);
fileName.replace("<Title>", STRDEF(metaInfo.title(), tr("Unknown Title")) , Qt::CaseInsensitive);
fileName.replace("<Artist>", STRDEF(metaInfo.artist(), tr("Unknown Artist")), Qt::CaseInsensitive);
fileName.replace("<Album>", STRDEF(metaInfo.album(), tr("Unknown Album")), Qt::CaseInsensitive);
fileName.replace("<Year>", QString().sprintf("%04d", metaInfo.year()), Qt::CaseInsensitive);
fileName.replace("<Comment>", STRDEF(metaInfo.comment(), tr("Unknown Comment")), Qt::CaseInsensitive);
fileName = lamexp_clean_filename(fileName).simplified();
return fileName;
}
QString ProcessThread::generateTempFileName(void)
{
bool bOkay = false;
@ -520,7 +529,7 @@ void ProcessThread::insertDownsampleFilter(void)
int targetBitDepth = 0;
/* Adjust sample rate */
if(m_encoder->supportedSamplerates() && m_audioFile.formatAudioSamplerate())
if(m_encoder->supportedSamplerates() && m_audioFile.techInfo().audioSamplerate())
{
bool applyDownsampling = true;
@ -539,7 +548,7 @@ void ProcessThread::insertDownsampleFilter(void)
if(applyDownsampling)
{
const unsigned int *supportedRates = m_encoder->supportedSamplerates();
const unsigned int inputRate = m_audioFile.formatAudioSamplerate();
const unsigned int inputRate = m_audioFile.techInfo().audioSamplerate();
unsigned int currentDiff = UINT_MAX, minimumDiff = UINT_MAX, bestRate = UINT_MAX;
//Find the most suitable supported sampling rate
@ -562,9 +571,9 @@ void ProcessThread::insertDownsampleFilter(void)
}
/* Adjust bit depth (word size) */
if(m_encoder->supportedBitdepths() && m_audioFile.formatAudioBitdepth())
if(m_encoder->supportedBitdepths() && m_audioFile.techInfo().audioBitdepth())
{
const unsigned int inputBPS = m_audioFile.formatAudioBitdepth();
const unsigned int inputBPS = m_audioFile.techInfo().audioBitdepth();
const unsigned int *supportedBPS = m_encoder->supportedBitdepths();
bool bAdjustBitdepth = true;
@ -628,7 +637,7 @@ void ProcessThread::insertDownmixFilter(void)
{
bool requiresDownmix = true;
const unsigned int *supportedChannels = m_encoder->supportedChannelCount();
unsigned int channels = m_audioFile.formatAudioChannels();
unsigned int channels = m_audioFile.techInfo().audioChannels();
for(int i = 0; supportedChannels[i]; i++)
{

View File

@ -78,6 +78,7 @@ private:
void processFile();
int generateOutFileName(QString &outFileName);
QString applyRenamePattern(const QString &baseName, const AudioFileModel_MetaInfo &metaInfo);
QString generateTempFileName(void);
void insertDownmixFilter(void);
void insertDownsampleFilter(void);

View File

@ -40,7 +40,7 @@ WaveProperties::~WaveProperties(void)
{
}
bool WaveProperties::detect(const QString &sourceFile, AudioFileModel *info, volatile bool *abortFlag)
bool WaveProperties::detect(const QString &sourceFile, AudioFileModel_TechInfo *info, volatile bool *abortFlag)
{
QProcess process;
QStringList args;
@ -89,21 +89,21 @@ bool WaveProperties::detect(const QString &sourceFile, AudioFileModel *info, vol
{
bool ok = false;
unsigned int tmp = regExp_precision.cap(1).toUInt(&ok);
if(ok) info->setFormatAudioBitdepth(tmp);
if(ok) info->setAudioBitdepth(tmp);
emit statusUpdated(qMin(progress += 25, 100));
}
if(regExp_encoding.lastIndexIn(text) >= 0)
{
bool ok = false;
unsigned int tmp = regExp_encoding.cap(1).toUInt(&ok);
if(ok) info->setFormatAudioBitdepth((tmp == 32) ? AudioFileModel::BITDEPTH_IEEE_FLOAT32 : tmp);
if(ok) info->setAudioBitdepth((tmp == 32) ? AudioFileModel::BITDEPTH_IEEE_FLOAT32 : tmp);
emit statusUpdated(qMin(progress += 25, 100));
}
if(regExp_samplerate.lastIndexIn(text) >= 0)
{
bool ok = false;
unsigned int tmp = regExp_samplerate.cap(1).toUInt(&ok);
if(ok) info->setFormatAudioSamplerate(tmp);
if(ok) info->setAudioSamplerate(tmp);
emit statusUpdated(qMin(progress += 25, 100));
}
if(regExp_duration.lastIndexIn(text) >= 0)
@ -115,7 +115,7 @@ bool WaveProperties::detect(const QString &sourceFile, AudioFileModel *info, vol
unsigned int tmp4 = regExp_duration.cap(4).toUInt(&ok[3]);
if(ok[0] && ok[1] && ok[2] && ok[3])
{
info->setFileDuration((tmp1 * 3600) + (tmp2 * 60) + tmp3 + qRound(static_cast<double>(tmp4) / 100.0));
info->setDuration((tmp1 * 3600) + (tmp2 * 60) + tmp3 + qRound(static_cast<double>(tmp4) / 100.0));
}
emit statusUpdated(qMin(progress += 25, 100));
}
@ -123,7 +123,7 @@ bool WaveProperties::detect(const QString &sourceFile, AudioFileModel *info, vol
{
bool ok = false;
unsigned int tmp = regExp_channels.cap(1).toUInt(&ok);
if(ok) info->setFormatAudioChannels(tmp);
if(ok) info->setAudioChannels(tmp);
emit statusUpdated(qMin(progress += 25, 100));
}
if(!text.isEmpty())

View File

@ -22,7 +22,7 @@
#include "Tool_Abstract.h"
class AudioFileModel;
class AudioFileModel_TechInfo;
class WaveProperties : public AbstractTool
{
@ -32,7 +32,7 @@ public:
WaveProperties(void);
~WaveProperties(void);
bool detect(const QString &sourceFile, AudioFileModel *info, volatile bool *abortFlag);
bool detect(const QString &sourceFile, AudioFileModel_TechInfo *info, volatile bool *abortFlag);
private:
const QString m_binary;