added second frame cache for thumbnails

This commit is contained in:
itsmattkc
2022-05-27 19:16:08 -07:00
parent 3d8c0114fb
commit e9404ba869
10 changed files with 64 additions and 67 deletions
-41
View File
@@ -340,47 +340,6 @@ bool FrameHashCache::SaveCacheFrame(const QString &filename, const FramePtr fram
QImage img(reinterpret_cast<const uchar*>(frame->data()), frame->width(), frame->height(), frame->linesize_bytes(), fmt);
return img.save(filename, "jpg");
/*
qDebug() << "hello?" << filename;
// Integer types are stored in JPG
QString tmp = filename;
tmp.append(QStringLiteral(".jpg"));
std::string tmp_std = tmp.toStdString();
auto out = OIIO::ImageOutput::create(tmp_std);
if (!out) {
qDebug() << "fail create";
return false;
}
auto fmt = OIIOUtils::GetOIIOBaseTypeFromFormat(frame->format());
qDebug() << "writing" << fmt;
if (!out->open(tmp_std, OIIO::ImageSpec(frame->width(), frame->height(), frame->channel_count(), fmt))) {
qDebug() << "fail open";
return false;
}
bool ret = out->write_image(fmt, frame->data(), OIIO::AutoStride, frame->linesize_bytes());
out->close();
if (ret) {
QFile f(filename);
if (f.exists()) {
f.remove();
}
ret = QFile::rename(tmp, filename);
if (!ret) {
qDebug() << "fail rename from" << tmp << "to" << filename;
}
} else {
qDebug() << "fail write";
}
return ret;
*/
}
}