///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End
-// Copyright (C) 2004-2014 LoRd_MuldeR <MuldeR2@GMX.de>
+// Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
#include "Thread_FileAnalyzer_Task.h"
+//Internal
#include "Global.h"
#include "LockedFile.h"
#include "Model_AudioFile.h"
+//MUtils
+#include <MUtils/Global.h>
+#include <MUtils/OSSupport.h>
+#include <MUtils/Exception.h>
+
+//Qt
#include <QDir>
#include <QFileInfo>
#include <QProcess>
#include <QWriteLocker>
#include <QThread>
+
+//CRT
#include <math.h>
#include <time.h>
#include <assert.h>
m_taskId(taskId),
m_inputFile(inputFile),
m_templateFile(templateFile),
- m_mediaInfoBin(lamexp_lookup_tool("mediainfo.exe")),
- m_avs2wavBin(lamexp_lookup_tool("avs2wav.exe")),
+ m_mediaInfoBin(lamexp_tools_lookup("mediainfo.exe")),
+ m_avs2wavBin(lamexp_tools_lookup("avs2wav.exe")),
m_abortFlag(abortFlag)
{
if(m_mediaInfoBin.isEmpty() || m_avs2wavBin.isEmpty())
}
catch(const std::exception &error)
{
- fflush(stdout); fflush(stderr);
- fprintf(stderr, "\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what());
- lamexp_fatal_exit(L"Unhandeled C++ exception error, application will exit!");
+ MUTILS_PRINT_ERROR("\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what());
+ MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!");
}
catch(...)
{
- fflush(stdout); fflush(stderr);
- fprintf(stderr, "\nGURU MEDITATION !!!\n\nUnknown exception error!\n");
- lamexp_fatal_exit(L"Unhandeled C++ exception error, application will exit!");
+ MUTILS_PRINT_ERROR("\nGURU MEDITATION !!!\n\nUnknown exception error!\n");
+ MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!");
}
}
{
int fileType = fileTypeNormal;
QString currentFile = QDir::fromNativeSeparators(m_inputFile);
- qDebug("Analyzing: %s", QUTF8(currentFile));
+ qDebug("Analyzing: %s", MUTILS_UTF8(currentFile));
AudioFileModel file = analyzeFile(currentFile, &fileType);
}
else
{
- qDebug("Rejected Avisynth file: %s", QUTF8(file.filePath()));
+ qDebug("Rejected Avisynth file: %s", MUTILS_UTF8(file.filePath()));
}
}
else
{
- qDebug("Rejected file of unknown type: %s", QUTF8(file.filePath()));
+ qDebug("Rejected file of unknown type: %s", MUTILS_UTF8(file.filePath()));
}
}
break;
params << QDir::toNativeSeparators(filePath);
QProcess process;
- lamexp_init_process(process, QFileInfo(m_mediaInfoBin).absolutePath());
+ MUtils::init_process(process, QFileInfo(m_mediaInfoBin).absolutePath());
process.start(m_mediaInfoBin, params);
QString line = QString::fromUtf8(process.readLine().constData()).simplified();
if(!line.isEmpty())
{
- //qDebug("Line:%s", QUTF8(line));
+ //qDebug("Line:%s", MUTILS_UTF8(line));
int index = line.indexOf('=');
if(index > 0)
void AnalyzeTask::updateInfo(AudioFileModel &audioFile, bool *skipNext, unsigned int *id_val, cover_t *coverType, QByteArray *coverData, const QString &key, const QString &value)
{
- //qWarning("'%s' -> '%s'", QUTF8(key), QUTF8(value));
+ //qWarning("'%s' -> '%s'", MUTILS_UTF8(key), MUTILS_UTF8(value));
/*New Stream*/
if(IS_KEY("Gen_ID") || IS_KEY("Aud_ID"))
}
else
{
- qWarning("Unknown key '%s' with value '%s' found!", QUTF8(key), QUTF8(value));
+ qWarning("Unknown key '%s' with value '%s' found!", MUTILS_UTF8(key), MUTILS_UTF8(value));
}
return;
}
}
else
{
- qWarning("Unknown key '%s' with value '%s' found!", QUTF8(key), QUTF8(value));
+ qWarning("Unknown key '%s' with value '%s' found!", MUTILS_UTF8(key), MUTILS_UTF8(value));
}
return;
}
/*Section not recognized*/
- qWarning("Unknown section: %s", QUTF8(key));
+ qWarning("Unknown section: %s", MUTILS_UTF8(key));
}
bool AnalyzeTask::checkFile_CDDA(QFile &file)
if(!(QImage::fromData(coverData, extension.toUpper().toLatin1().constData()).isNull()))
{
- QFile coverFile(QString("%1/%2.%3").arg(lamexp_temp_folder2(), lamexp_rand_str(), extension));
+ QFile coverFile(QString("%1/%2.%3").arg(MUtils::temp_folder(), MUtils::rand_str(), extension));
if(coverFile.open(QIODevice::WriteOnly))
{
coverFile.write(coverData);
bool AnalyzeTask::analyzeAvisynthFile(const QString &filePath, AudioFileModel &info)
{
QProcess process;
- lamexp_init_process(process, QFileInfo(m_avs2wavBin).absolutePath());
+ MUtils::init_process(process, QFileInfo(m_avs2wavBin).absolutePath());
process.start(m_avs2wavBin, QStringList() << QDir::toNativeSeparators(filePath) << "?");