Much improved Avisynth input. Now actually detect Avisynth scripts and read meta-info.
This commit is contained in:
parent
0d254e20c4
commit
eece27de06
@ -110,6 +110,7 @@ Currently the following input formats are supported by LameXP:<br><ul>
|
|||||||
<li>Advanced Audio Coding (AAC), using FAAD decoder [built-in]
|
<li>Advanced Audio Coding (AAC), using FAAD decoder [built-in]
|
||||||
<li>Apple Lossless (ALAC)
|
<li>Apple Lossless (ALAC)
|
||||||
<li>Apple/SGI AIFF
|
<li>Apple/SGI AIFF
|
||||||
|
<li>Avisynth, audio only [requires Avisynth 2.5.x to be installed]
|
||||||
<li>Digital Theater System, using Valib decoder [built-in]
|
<li>Digital Theater System, using Valib decoder [built-in]
|
||||||
<li>Free Lossless Audio Codec (FLAC)
|
<li>Free Lossless Audio Codec (FLAC)
|
||||||
<li>Microsoft ADPCM
|
<li>Microsoft ADPCM
|
||||||
|
Binary file not shown.
@ -30,7 +30,7 @@
|
|||||||
#define VER_LAMEXP_MINOR_LO 2
|
#define VER_LAMEXP_MINOR_LO 2
|
||||||
#define VER_LAMEXP_TYPE Beta
|
#define VER_LAMEXP_TYPE Beta
|
||||||
#define VER_LAMEXP_PATCH 3
|
#define VER_LAMEXP_PATCH 3
|
||||||
#define VER_LAMEXP_BUILD 541
|
#define VER_LAMEXP_BUILD 544
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Tools versions
|
// Tools versions
|
||||||
|
@ -84,7 +84,7 @@ LockedFile::LockedFile(const QString &resourcePath, const QString &outPath, cons
|
|||||||
LAMEXP_CLOSE(m_fileHandle);
|
LAMEXP_CLOSE(m_fileHandle);
|
||||||
QFile::remove(QFileInfo(outFile).canonicalFilePath());
|
QFile::remove(QFileInfo(outFile).canonicalFilePath());
|
||||||
char error_msg[512];
|
char error_msg[512];
|
||||||
strcpy_s(error_msg, 512, QString("File '%1' is corruputed, take care!").arg(QFileInfo(outFile).fileName()).toLatin1().constData());
|
strcpy_s(error_msg, 512, QString("File '%1' is corruputed, take care!").arg(QFileInfo(resourcePath).absoluteFilePath().replace(QRegExp("^:/"), QString())).toLatin1().constData());
|
||||||
throw error_msg;
|
throw error_msg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ FileAnalyzer::FileAnalyzer(const QStringList &inputFiles)
|
|||||||
:
|
:
|
||||||
m_inputFiles(inputFiles),
|
m_inputFiles(inputFiles),
|
||||||
m_mediaInfoBin(lamexp_lookup_tool("mediainfo.exe")),
|
m_mediaInfoBin(lamexp_lookup_tool("mediainfo.exe")),
|
||||||
|
m_avs2wavBin(lamexp_lookup_tool("avs2wav.exe")),
|
||||||
m_abortFlag(false)
|
m_abortFlag(false)
|
||||||
{
|
{
|
||||||
m_bSuccess = false;
|
m_bSuccess = false;
|
||||||
@ -122,10 +123,11 @@ void FileAnalyzer::run()
|
|||||||
else if(!QFileInfo(currentFile).suffix().compare("avs", Qt::CaseInsensitive))
|
else if(!QFileInfo(currentFile).suffix().compare("avs", Qt::CaseInsensitive))
|
||||||
{
|
{
|
||||||
qWarning("Added an potential Avisynth script file!");
|
qWarning("Added an potential Avisynth script file!");
|
||||||
file.setFormatAudioType("Avisynth");
|
if(analyzeAvisynthFile(currentFile, file))
|
||||||
file.setFormatContainerType("Avisynth");
|
{
|
||||||
m_filesAccepted++;
|
m_filesAccepted++;
|
||||||
emit fileAnalyzed(file);
|
emit fileAnalyzed(file);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -250,6 +252,13 @@ const AudioFileModel FileAnalyzer::analyzeFile(const QString &filePath, int *typ
|
|||||||
audioFile.setFileName(baseName);
|
audioFile.setFileName(baseName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
process.waitForFinished();
|
||||||
|
if(process.state() != QProcess::NotRunning)
|
||||||
|
{
|
||||||
|
process.kill();
|
||||||
|
process.waitForFinished(-1);
|
||||||
|
}
|
||||||
|
|
||||||
if(m_currentCover != coverNone)
|
if(m_currentCover != coverNone)
|
||||||
{
|
{
|
||||||
retrieveCover(audioFile, filePath);
|
retrieveCover(audioFile, filePath);
|
||||||
@ -541,8 +550,118 @@ void FileAnalyzer::retrieveCover(AudioFileModel &audioFile, const QString &fileP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
process.waitForFinished();
|
||||||
|
if(process.state() != QProcess::NotRunning)
|
||||||
|
{
|
||||||
|
process.kill();
|
||||||
|
process.waitForFinished(-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FileAnalyzer::analyzeAvisynthFile(const QString &filePath, AudioFileModel &info)
|
||||||
|
{
|
||||||
|
bool bAudioInfoReceived = false;
|
||||||
|
|
||||||
|
QProcess process;
|
||||||
|
process.setProcessChannelMode(QProcess::MergedChannels);
|
||||||
|
process.setReadChannel(QProcess::StandardOutput);
|
||||||
|
process.start(m_avs2wavBin, QStringList() << QDir::toNativeSeparators(filePath) << "?");
|
||||||
|
|
||||||
|
if(!process.waitForStarted())
|
||||||
|
{
|
||||||
|
qWarning("AVS2WAV process failed to create!");
|
||||||
|
qWarning("Error message: \"%s\"\n", process.errorString().toLatin1().constData());
|
||||||
|
process.kill();
|
||||||
|
process.waitForFinished(-1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
while(process.state() != QProcess::NotRunning)
|
||||||
|
{
|
||||||
|
if(m_abortFlag)
|
||||||
|
{
|
||||||
|
process.kill();
|
||||||
|
qWarning("Process was aborted on user request!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!process.waitForReadyRead())
|
||||||
|
{
|
||||||
|
if(process.state() == QProcess::Running)
|
||||||
|
{
|
||||||
|
qWarning("AVS2WAV time out. Killing process and skipping file!");
|
||||||
|
process.kill();
|
||||||
|
process.waitForFinished(-1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray data;
|
||||||
|
|
||||||
|
while(process.canReadLine())
|
||||||
|
{
|
||||||
|
QString line = QString::fromUtf8(process.readLine().constData()).simplified();
|
||||||
|
if(!line.isEmpty())
|
||||||
|
{
|
||||||
|
int index = line.indexOf(':');
|
||||||
|
if(index > 0)
|
||||||
|
{
|
||||||
|
QString key = line.left(index).trimmed();
|
||||||
|
QString val = line.mid(index+1).trimmed();
|
||||||
|
|
||||||
|
if(!key.isEmpty() && !val.isEmpty())
|
||||||
|
{
|
||||||
|
if(key.compare("TotalSeconds", Qt::CaseInsensitive) == 0)
|
||||||
|
{
|
||||||
|
bool ok = false;
|
||||||
|
unsigned int duration = val.toUInt(&ok);
|
||||||
|
if(ok) info.setFileDuration(duration);
|
||||||
|
}
|
||||||
|
if(key.compare("SamplesPerSec", Qt::CaseInsensitive) == 0)
|
||||||
|
{
|
||||||
|
bool ok = false;
|
||||||
|
unsigned int samplerate = val.toUInt(&ok);
|
||||||
|
if(ok) info.setFormatAudioSamplerate (samplerate);
|
||||||
|
}
|
||||||
|
if(key.compare("Channels", Qt::CaseInsensitive) == 0)
|
||||||
|
{
|
||||||
|
bool ok = false;
|
||||||
|
unsigned int channels = val.toUInt(&ok);
|
||||||
|
if(ok) info.setFormatAudioChannels(channels);
|
||||||
|
}
|
||||||
|
if(key.compare("BitsPerSample", Qt::CaseInsensitive) == 0)
|
||||||
|
{
|
||||||
|
bool ok = false;
|
||||||
|
unsigned int bitdepth = val.toUInt(&ok);
|
||||||
|
if(ok) info.setFormatAudioBitdepth(bitdepth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(line.contains("[Audio Info]", Qt::CaseInsensitive))
|
||||||
|
{
|
||||||
|
info.setFormatAudioType("Avisynth");
|
||||||
|
info.setFormatContainerType("Avisynth");
|
||||||
|
bAudioInfoReceived = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process.waitForFinished();
|
||||||
|
if(process.state() != QProcess::NotRunning)
|
||||||
|
{
|
||||||
|
process.kill();
|
||||||
|
process.waitForFinished(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return bAudioInfoReceived;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Public Functions
|
// Public Functions
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
@ -84,9 +84,12 @@ private:
|
|||||||
unsigned int parseDuration(const QString &str);
|
unsigned int parseDuration(const QString &str);
|
||||||
bool checkFile_CDDA(QFile &file);
|
bool checkFile_CDDA(QFile &file);
|
||||||
void retrieveCover(AudioFileModel &audioFile, const QString &filePath);
|
void retrieveCover(AudioFileModel &audioFile, const QString &filePath);
|
||||||
|
bool analyzeAvisynthFile(const QString &filePath, AudioFileModel &info);
|
||||||
|
|
||||||
|
const QString m_mediaInfoBin;
|
||||||
|
const QString m_avs2wavBin;
|
||||||
|
|
||||||
QStringList m_inputFiles;
|
QStringList m_inputFiles;
|
||||||
const QString m_mediaInfoBin;
|
|
||||||
section_t m_currentSection;
|
section_t m_currentSection;
|
||||||
cover_t m_currentCover;
|
cover_t m_currentCover;
|
||||||
unsigned int m_filesAccepted;
|
unsigned int m_filesAccepted;
|
||||||
@ -95,7 +98,6 @@ private:
|
|||||||
unsigned int m_filesDummyCDDA;
|
unsigned int m_filesDummyCDDA;
|
||||||
unsigned int m_filesCueSheet;
|
unsigned int m_filesCueSheet;
|
||||||
|
|
||||||
|
|
||||||
volatile bool m_abortFlag;
|
volatile bool m_abortFlag;
|
||||||
|
|
||||||
bool m_bAborted;
|
bool m_bAborted;
|
||||||
|
@ -56,7 +56,7 @@ g_lamexp_tools[] =
|
|||||||
{"22253052acba92a0088bbf0aa82a8c505c07b854", CPU_TYPE_SSE, "aften.sse2.exe", 8},
|
{"22253052acba92a0088bbf0aa82a8c505c07b854", CPU_TYPE_SSE, "aften.sse2.exe", 8},
|
||||||
{"2996a48b01b65a2c1806482654beeea7ffcf1f80", CPU_TYPE_X64, "aften.x64.exe", 8},
|
{"2996a48b01b65a2c1806482654beeea7ffcf1f80", CPU_TYPE_X64, "aften.x64.exe", 8},
|
||||||
{"3b41f85dde8d4a5a0f4cd5f461099d0db24610ba", CPU_TYPE_ALL, "alac.exe", 20},
|
{"3b41f85dde8d4a5a0f4cd5f461099d0db24610ba", CPU_TYPE_ALL, "alac.exe", 20},
|
||||||
{"b865f725c1d3930a2034597c267971d29674a36b", CPU_TYPE_ALL, "avs2wav.exe", 12},
|
{"566dc304a9af848e980c169f690846a72a860687", CPU_TYPE_ALL, "avs2wav.exe", 12},
|
||||||
{"fb74ac8b73ad8cba2c3b4e6e61f23401d630dc22", CPU_TYPE_ALL, "elevator.exe", UINT_MAX},
|
{"fb74ac8b73ad8cba2c3b4e6e61f23401d630dc22", CPU_TYPE_ALL, "elevator.exe", UINT_MAX},
|
||||||
{"80e372d8b20be24102c18284286fcdf5fa14bd86", CPU_TYPE_ALL, "faad.exe", 27},
|
{"80e372d8b20be24102c18284286fcdf5fa14bd86", CPU_TYPE_ALL, "faad.exe", 27},
|
||||||
{"d33cd86f04bd4067e244d2804466583c7b90a4e2", CPU_TYPE_ALL, "flac.exe", 121},
|
{"d33cd86f04bd4067e244d2804466583c7b90a4e2", CPU_TYPE_ALL, "flac.exe", 121},
|
||||||
|
Loading…
Reference in New Issue
Block a user