vastly improved multithreaded loading and annchor point gizmo

This commit is contained in:
itsmattkc
2018-12-15 00:09:14 +11:00
parent 2fa7a638d5
commit 7a2a2af8ec
15 changed files with 292 additions and 153 deletions
+5 -5
View File
@@ -127,7 +127,7 @@ bool PreviewGenerator::retrieve_preview(const QString& hash) {
QString thumb_path = get_thumbnail_path(hash, ms);
QFile f(thumb_path);
if (f.exists() && ms->video_preview.load(thumb_path)) {
dout << "loaded thumb" << ms->file_index << "from" << thumb_path;
//dout << "loaded thumb" << ms->file_index << "from" << thumb_path;
ms->preview_done = true;
} else {
found = false;
@@ -139,7 +139,7 @@ bool PreviewGenerator::retrieve_preview(const QString& hash) {
QString waveform_path = get_waveform_path(hash, ms);
QFile f(waveform_path);
if (f.exists()) {
dout << "loaded wave" << ms->file_index << "from" << waveform_path;
//dout << "loaded wave" << ms->file_index << "from" << waveform_path;
f.open(QFile::ReadOnly);
QByteArray data = f.readAll();
ms->audio_preview.resize(data.size());
@@ -433,7 +433,7 @@ void PreviewGenerator::run() {
// see if we already have data for this
QFileInfo file_info(footage->url);
QString cache_file = footage->url.mid(footage->url.lastIndexOf('/')+1) + QString::number(file_info.size()) + QString::number(file_info.lastModified().toMSecsSinceEpoch());
dout << "using hash" << cache_file;
//dout << "using hash" << cache_file;
QString hash = QCryptographicHash::hash(cache_file.toLatin1(), QCryptographicHash::Md5).toHex();
if (retrieve_preview(hash)) {
@@ -445,7 +445,7 @@ void PreviewGenerator::run() {
for (int i=0;i<footage->video_tracks.size();i++) {
FootageStream* ms = footage->video_tracks.at(i);
ms->video_preview.save(get_thumbnail_path(hash, ms), "PNG");
dout << "saved" << ms->file_index << "thumbnail to" << get_thumbnail_path(hash, ms);
//dout << "saved" << ms->file_index << "thumbnail to" << get_thumbnail_path(hash, ms);
}
for (int i=0;i<footage->audio_tracks.size();i++) {
FootageStream* ms = footage->audio_tracks.at(i);
@@ -453,7 +453,7 @@ void PreviewGenerator::run() {
f.open(QFile::WriteOnly);
f.write(ms->audio_preview.constData(), ms->audio_preview.size());
f.close();
dout << "saved" << ms->file_index << "waveform to" << get_waveform_path(hash, ms);
//dout << "saved" << ms->file_index << "waveform to" << get_waveform_path(hash, ms);
}
sem.release();