addressed #86 and #89

This commit is contained in:
itsmattkc
2018-06-30 03:02:19 +01:00
parent 384bb4eb5d
commit ae86a36902
11 changed files with 148 additions and 127 deletions
-39
View File
@@ -22,47 +22,8 @@ extern "C" {
#include <QDebug>
#include <QOpenGLPixelTransferOptions>
QList<Clip*> current_clips;
bool texture_failed = false;
QMutex cc_lock;
void handle_media(Sequence* sequence, long playhead, bool multithreaded) {
for (int i=0;i<sequence->clip_count();i++) {
Clip* c = sequence->get_clip(i);
// if clip starts within one second and/or hasn't finished yet
if (c != NULL) {
if (is_clip_active(c, playhead)) {
// if thread is already working, we don't want to touch this,
// but we also don't want to hang the UI thread
if (!c->open) {
if (c->open_lock.tryLock()) {
open_clip(c, multithreaded);
// add to current_clips, (insertion) sorted by track so composite them in order
cc_lock.lock();
bool found = false;
for (int j=0;j<current_clips.size();j++) {
if (current_clips[j]->track < c->track) {
current_clips.insert(current_clips.begin()+j, c);
found = true;
break;
}
}
if (!found) {
current_clips.push_back(c);
}
cc_lock.unlock();
}
}
} else if (c->open) {
close_clip(c);
}
}
}
}
void open_clip(Clip* clip, bool multithreaded) {
clip->multithreaded = multithreaded;
if (multithreaded) {