X-Git-Url: https://git.sesse.net/?p=kdenlive;a=blobdiff_plain;f=src%2Fclipmanager.cpp;h=22fee7559ab503448312ff01a5e4bc725704a000;hp=584955a4f00f84c1cc33d5e43a098ae0f5a8a3c5;hb=a3eee7be24126f5a3458d488f44cd61c66135e17;hpb=6c62a4d8f799379bfb7a11d25521cf829248587c diff --git a/src/clipmanager.cpp b/src/clipmanager.cpp index 584955a4..22fee755 100644 --- a/src/clipmanager.cpp +++ b/src/clipmanager.cpp @@ -45,12 +45,14 @@ #include #include +#include #include -ClipManager::ClipManager(KdenliveDoc *doc) : +ClipManager::ClipManager(KdenliveDoc *doc, QGLWidget *glContext) : QObject(), + m_mainGLContext(glContext), m_audioThumbsQueue(), m_doc(doc), m_abortThumb(false), @@ -165,6 +167,10 @@ void ClipManager::stopThumbs(const QString &id) void ClipManager::slotGetThumbs() { + // We are in a new thread, so we need a new OpenGL context for the remainder of the function. + QGLWidget ctx(0, m_mainGLContext); + ctx.makeCurrent(); + QMap::const_iterator i; int max; int done = 0; @@ -251,6 +257,10 @@ void ClipManager::askForAudioThumb(const QString &id) void ClipManager::slotGetAudioThumbs() { + // We are in a new thread, so we need a new OpenGL context for the remainder of the function. + QGLWidget ctx(0, m_mainGLContext); + ctx.makeCurrent(); + Mlt::Profile prof((char*) KdenliveSettings::current_profile().toUtf8().constData()); mlt_audio_format audioFormat = mlt_audio_s16; while (!m_abortAudioThumb && !m_audioThumbsQueue.isEmpty()) {