This commit is contained in:
itsmattkc
2018-07-04 12:51:35 +01:00
parent d7a891fdd6
commit 00959ca50a
7 changed files with 181 additions and 167 deletions
+2 -2
View File
@@ -301,6 +301,8 @@ void open_clip_worker(Clip* clip) {
clip->frame = av_frame_alloc();
clip->finished_opening = true;
qDebug() << "[INFO] Clip opened on track" << clip->track;
}
@@ -360,8 +362,6 @@ void Cacher::run() {
open_clip_worker(clip);
clip->finished_opening = true;
while (caching) {
clip->can_cache.wait(&clip->lock);
if (!caching) {
+16 -10
View File
@@ -25,17 +25,23 @@ extern "C" {
bool texture_failed = false;
void open_clip(Clip* clip, bool multithreaded) {
clip->multithreaded = multithreaded;
if (multithreaded) {
// maybe keep cacher instance in memory while clip exists for performance?
clip->cacher = new Cacher(clip);
QObject::connect(clip->cacher, SIGNAL(finished()), clip->cacher, SLOT(deleteLater()));
if (multithreaded) {
if (clip->open_lock.tryLock()) {
clip->multithreaded = true;
clip->cacher->start(QThread::LowPriority);
} else {
open_clip_worker(clip);
clip->lock.unlock();
}
// maybe keep cacher instance in memory while clip exists for performance?
clip->cacher = new Cacher(clip);
QObject::connect(clip->cacher, SIGNAL(finished()), clip->cacher, SLOT(deleteLater()));
clip->cacher->start(QThread::LowPriority);
}
} else {
clip->multithreaded = false;
clip->finished_opening = false;
clip->open = true;
open_clip_worker(clip);
}
}
void close_clip(Clip* clip) {