Updated MediaInfo binaries with latest fix to properly handle tags with a "\n" when the "--inform" mode is used. Also improved internal handling of multiple streams.

This commit is contained in:
LoRd_MuldeR 2012-01-14 20:28:43 +01:00
parent 50ac87149e
commit 0fc8c5bae4
6 changed files with 173 additions and 113 deletions

Binary file not shown.

Binary file not shown.

View File

@ -29,8 +29,8 @@
#define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 4
#define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 15
#define VER_LAMEXP_BUILD 878
#define VER_LAMEXP_PATCH 16
#define VER_LAMEXP_BUILD 880
///////////////////////////////////////////////////////////////////////////////
// Tool versions (minimum expected versions!)

View File

@ -37,6 +37,8 @@
#include <math.h>
#define IS_KEY(KEY) (key.compare(KEY, Qt::CaseInsensitive) == 0)
#define IS_SEC(SEC) (key.startsWith((SEC "_"), Qt::CaseInsensitive))
#define FIRST_TOK(STR) (STR.split(" ", QString::SkipEmptyParts).first())
////////////////////////////////////////////////////////////
// Constructor
@ -81,6 +83,7 @@ FileAnalyzer::~FileAnalyzer(void)
const char *FileAnalyzer::g_tags_gen[] =
{
"ID",
"Format",
"Format_Profile",
"Format_Version",
@ -101,6 +104,7 @@ const char *FileAnalyzer::g_tags_gen[] =
const char *FileAnalyzer::g_tags_aud[] =
{
"ID",
"Format",
"Format_Profile",
"Format_Version",
@ -243,6 +247,8 @@ const AudioFileModel FileAnalyzer::analyzeFile(const QString &filePath, int *typ
}
readTest.close();
bool skipNext = false;
unsigned int id_val[2] = {UINT_MAX, UINT_MAX};
cover_t coverType = coverNone;
QByteArray coverData;
@ -298,9 +304,9 @@ const AudioFileModel FileAnalyzer::analyzeFile(const QString &filePath, int *typ
{
QString key = line.left(index).trimmed();
QString val = line.mid(index+1).trimmed();
if(!(key.isEmpty() || val.isEmpty()))
if(!key.isEmpty())
{
updateInfo(audioFile, &coverType, &coverData, key, val);
updateInfo(audioFile, &skipNext, id_val, &coverType, &coverData, key, val);
}
}
}
@ -343,10 +349,48 @@ const AudioFileModel FileAnalyzer::analyzeFile(const QString &filePath, int *typ
return audioFile;
}
void FileAnalyzer::updateInfo(AudioFileModel &audioFile, cover_t *coverType, QByteArray *coverData, const QString &key, const QString &value)
void FileAnalyzer::updateInfo(AudioFileModel &audioFile, bool *skipNext, unsigned int *id_val, cover_t *coverType, QByteArray *coverData, const QString &key, const QString &value)
{
//qWarning("'%s' -> '%s'", key.toUtf8().constData(), value.toUtf8().constData());
/*New Stream*/
if(IS_KEY("Gen_ID") || IS_KEY("Aud_ID"))
{
if(value.isEmpty())
{
*skipNext = false;
}
else
{
//We ignore all ID's, except for the lowest one!
bool ok = false;
unsigned int id = value.toUInt(&ok);
if(ok)
{
if(IS_KEY("Gen_ID")) { id_val[0] = qMin(id_val[0], id); *skipNext = (id > id_val[0]); }
if(IS_KEY("Aud_ID")) { id_val[1] = qMin(id_val[1], id); *skipNext = (id > id_val[1]); }
}
else
{
*skipNext = true;
}
}
if(*skipNext)
{
qWarning("Skipping info for non-primary stream!");
}
return;
}
/*Skip?*/
if((*skipNext) || value.isEmpty())
{
return;
}
/*General Section*/
if(IS_SEC("Gen"))
{
if(IS_KEY("Gen_Format"))
{
audioFile.setFormatContainerType(value);
@ -400,7 +444,7 @@ void FileAnalyzer::updateInfo(AudioFileModel &audioFile, cover_t *coverType, QBy
}
else if(IS_KEY("Gen_Cover_Mime"))
{
QString temp = value.split(" ", QString::SkipEmptyParts).first();
QString temp = FIRST_TOK(value);
if(!temp.compare("image/jpeg", Qt::CaseInsensitive)) *coverType = coverJpeg;
else if(!temp.compare("image/png", Qt::CaseInsensitive)) *coverType = coverPng;
else if(!temp.compare("image/gif", Qt::CaseInsensitive)) *coverType = coverGif;
@ -408,9 +452,20 @@ void FileAnalyzer::updateInfo(AudioFileModel &audioFile, cover_t *coverType, QBy
else if(IS_KEY("Gen_Cover_Data"))
{
if(!coverData->isEmpty()) coverData->clear();
coverData->append(QByteArray::fromBase64(value.toLatin1()));
coverData->append(QByteArray::fromBase64(FIRST_TOK(value).toLatin1()));
}
else if(IS_KEY("Aud_Format"))
else
{
qWarning("Unknown key '%s' with value '%s' found!", key.toUtf8().constData(), value.toUtf8().constData());
}
return;
}
/*Audio Section*/
if(IS_SEC("Aud"))
{
if(IS_KEY("Aud_Format"))
{
audioFile.setFormatAudioType(value);
}
@ -460,6 +515,11 @@ void FileAnalyzer::updateInfo(AudioFileModel &audioFile, cover_t *coverType, QBy
{
qWarning("Unknown key '%s' with value '%s' found!", key.toUtf8().constData(), value.toUtf8().constData());
}
return;
}
/*Section not recognized*/
qWarning("Unknown section: %s", key.toUtf8().constData());
}
bool FileAnalyzer::checkFile_CDDA(QFile &file)
@ -646,14 +706,14 @@ bool FileAnalyzer::createTemplate(void)
{
templateFile.write(QString("Gen_%1=%%1%\\n").arg(g_tags_gen[i]).toLatin1().constData());
}
templateFile.write("\r\n");
templateFile.write("\\n\r\n");
templateFile.write("Audio;");
for(size_t i = 0; g_tags_aud[i]; i++)
{
templateFile.write(QString("Aud_%1=%%1%\\n").arg(g_tags_aud[i]).toLatin1().constData());
}
templateFile.write("\r\n");
templateFile.write("\\n\r\n");
bool success = (templateFile.error() == QFile::NoError);
templateFile.close();

View File

@ -75,7 +75,7 @@ private:
};
const AudioFileModel analyzeFile(const QString &filePath, int *type);
void updateInfo(AudioFileModel &audioFile, cover_t *coverType, QByteArray *coverData, const QString &key, const QString &value);
void updateInfo(AudioFileModel &audioFile, bool *skipNext, unsigned int *id_val, cover_t *coverType, QByteArray *coverData, const QString &key, const QString &value);
unsigned int parseYear(const QString &str);
unsigned int parseDuration(const QString &str);
bool checkFile_CDDA(QFile &file);

View File

@ -65,8 +65,8 @@ g_lamexp_tools[] =
{"d5b35689208aaaf2809c3fb501e8e74af410378dc5f1921df30f2525e2ee084e5a9f9595", CPU_TYPE_ALL_GEN, "lame.i386.exe", 3992},
{"cfc59f7c299569355d8b4143a4f0524edf5b78dc61402c03be938dbabb5c2db5695feedd", CPU_TYPE_ALL_SSE, "lame.sse2.exe", 3992},
{"67933924d68ce319795989648f29e7bd1abaac4ec09c26cbb0ff0d15a67a9df17e257933", CPU_TYPE_ALL_ALL, "mac.exe", 406},
{"87ff2ec0db786740e8f3f567238369c907ac6d62a9548377179063ea8b98a78fc9b72254", CPU_TYPE_X86_ALL, "mediainfo.i386.exe", 752},
{"c0723723091996c4f6ba61322718d7953e258bcf89e70df6fe5b9392b18204f3334592bc", CPU_TYPE_X64_ALL, "mediainfo.x64.exe", 752},
{"c3163199c58c1a7d6269ae682a6f73817bae3ffac4a92d9c0de63cc4128386c8c15ad851", CPU_TYPE_X86_ALL, "mediainfo.i386.exe", 752},
{"1f905a78460ca33b0e9d03eb9cb96d7f9b0959b054d3eb2a6882653117a6ce92545e7748", CPU_TYPE_X64_ALL, "mediainfo.x64.exe", 752},
{"a93ec86187025e66fb78026af35555bd3b4e30fe1a40e8d66f600cfd918f07f431f0b2f2", CPU_TYPE_ALL_ALL, "mpcdec.exe", 435},
{"7fa1beb4161d603563089cadd601f68fb9f436f05d9477b6a604501b072f5a973dd45fbb", CPU_TYPE_ALL_ALL, "mpg123.exe", 1134},
{"0c781805dda931c529bd16069215f616a7a4c5e5c2dfb6b75fe85d52b20511830693e528", CPU_TYPE_ALL_ALL, "oggdec.exe", UINT_MAX},