Commit b3a97400 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

MLT7 dropped luma files, they are now generated on the fly, so adjust to this...

MLT7 dropped luma files, they are now generated on the fly, so adjust to this new behavior (still have to find a way to generate thumbnails)
parent f6ae3b0d
......@@ -385,6 +385,14 @@ bool DocumentChecker::hasErrorInClips()
}
if (!QFile::exists(filePath)) {
QString lumaName = filePath.section(QLatin1Char('/'), -1);
// MLT 7 now generates lumas on the fly for files named luma01.pgm to luma22.pgm, so don't detect these as missing
if (lumaName.length() == 10 && lumaName.startsWith(QLatin1String("luma")) && lumaName.endsWith(QLatin1String(".pgm"))) {
bool ok;
int lumaNumber = lumaName.mid(4, 2).toInt(&ok);
if (ok && lumaNumber > 0 && lumaNumber < 23) {
continue;
}
}
// check if this was an old format luma, not in correct folder
QString fixedLuma = filePath.section(QLatin1Char('/'), 0, -2);
lumaName.prepend(hdProfile ? QStringLiteral("/HD/") : QStringLiteral("/PAL/"));
......
......@@ -228,6 +228,8 @@ void MltConnection::refreshLumas()
#endif
customLumas.append(QString(mlt_environment("MLT_DATA")) + QStringLiteral("/lumas"));
customLumas.removeDuplicates();
QStringList hdLumas;
QStringList sdLumas;
QStringList allImagefiles;
for (const QString &folder : qAsConst(customLumas)) {
QDir topDir(folder);
......@@ -236,11 +238,6 @@ void MltConnection::refreshLumas()
for (const QString &f : qAsConst(folders)) {
QStringList imagefiles;
QDir dir(topDir.absoluteFilePath(f));
if (f == QLatin1String("HD")) {
format = QStringLiteral("16_9");
} else {
format = f;
}
QStringList filesnames;
QDirIterator it(dir.absolutePath(), fileFilters, QDir::Files, QDirIterator::Subdirectories);
while (it.hasNext()) {
......@@ -252,10 +249,21 @@ void MltConnection::refreshLumas()
for (const QString &fname : qAsConst(filesnames)) {
imagefiles.append(dir.absoluteFilePath(fname));
}
MainWindow::m_lumaFiles.insert(format, imagefiles);
if (f == QLatin1String("HD")) {
hdLumas << imagefiles;
} else {
sdLumas << imagefiles;
}
allImagefiles << imagefiles;
}
}
// Insert MLT builtin lumas (created on the fly)
for (int i = 1; i < 23; i++) {
QString imageName = QStringLiteral("luma%1.pgm").arg(i, 2, 10, QLatin1Char('0'));
hdLumas << imageName;
}
MainWindow::m_lumaFiles.insert(QStringLiteral("16_9"), hdLumas);
MainWindow::m_lumaFiles.insert(QStringLiteral("PAL"), sdLumas);
allImagefiles.removeDuplicates();
QtConcurrent::run(pCore.get(), &Core::buildLumaThumbs, allImagefiles);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment