Commit b24148d5 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix MLT api change causing startup crash on movit (Movit still not usable)

CCBUG: #442880
parent 7b7d2719
...@@ -817,24 +817,33 @@ void GLWidget::createThread(RenderThread **thread, thread_function_t function, v ...@@ -817,24 +817,33 @@ void GLWidget::createThread(RenderThread **thread, thread_function_t function, v
(*thread)->start(); (*thread)->start();
} }
static void onThreadCreate(mlt_properties owner, GLWidget *self, RenderThread **thread, int *priority, thread_function_t function, void *data)
static void onThreadCreate(mlt_properties owner, GLWidget* self, mlt_event_data data)
{ {
Q_UNUSED(owner) Q_UNUSED(owner)
Q_UNUSED(priority) auto threadData = (mlt_event_data_thread*) Mlt::EventData(data).to_object();
// self->clearFrameRenderer(); if (threadData) {
self->createThread(thread, function, data); auto renderThread = (RenderThread*) threadData->thread;
self->lockMonitor(); self->createThread(&renderThread, threadData->function, threadData->data);
// TODO: useless ?
// self->lockMonitor();
}
} }
static void onThreadJoin(mlt_properties owner, GLWidget *self, RenderThread *thread) static void onThreadJoin(mlt_properties owner, GLWidget* self, mlt_event_data data)
{ {
Q_UNUSED(owner) Q_UNUSED(owner)
if (thread) { Q_UNUSED(self)
thread->quit(); auto threadData = (mlt_event_data_thread*) Mlt::EventData(data).to_object();
thread->wait(); if (threadData) {
delete thread; auto renderThread = (RenderThread*) threadData->thread;
// self->clearFrameRenderer(); if (renderThread) {
self->releaseMonitor(); renderThread->quit();
renderThread->wait();
delete renderThread;
// TODO: useless ?
// self->releaseMonitor();
}
} }
} }
...@@ -1414,11 +1423,10 @@ void GLWidget::updateTexture(GLuint yName, GLuint uName, GLuint vName) ...@@ -1414,11 +1423,10 @@ void GLWidget::updateTexture(GLuint yName, GLuint uName, GLuint vName)
m_texture[2] = vName; m_texture[2] = vName;
} }
void GLWidget::on_frame_show(mlt_consumer, void *self, mlt_frame frame_ptr) void GLWidget::on_frame_show(mlt_consumer, GLWidget* widget, mlt_event_data data)
{ {
Mlt::Frame frame(frame_ptr); auto frame = Mlt::EventData(data).to_frame();
if (frame.get_int("rendered") != 0) { if (frame.is_valid() && frame.get_int("rendered")) {
auto *widget = static_cast<GLWidget *>(self);
int timeout = (widget->consumer()->get_int("real_time") > 0) ? 0 : 1000; int timeout = (widget->consumer()->get_int("real_time") > 0) ? 0 : 1000;
if ((widget->m_frameRenderer != nullptr) && widget->m_frameRenderer->semaphore()->tryAcquire(1, timeout)) { if ((widget->m_frameRenderer != nullptr) && widget->m_frameRenderer->semaphore()->tryAcquire(1, timeout)) {
QMetaObject::invokeMethod(widget->m_frameRenderer, "showFrame", Qt::QueuedConnection, Q_ARG(Mlt::Frame, frame)); QMetaObject::invokeMethod(widget->m_frameRenderer, "showFrame", Qt::QueuedConnection, Q_ARG(Mlt::Frame, frame));
......
...@@ -234,7 +234,7 @@ private: ...@@ -234,7 +234,7 @@ private:
QPoint m_offset; QPoint m_offset;
MonitorProxy *m_proxy; MonitorProxy *m_proxy;
std::shared_ptr<Mlt::Producer> m_blackClip; std::shared_ptr<Mlt::Producer> m_blackClip;
static void on_frame_show(mlt_consumer, void *self, mlt_frame frame); static void on_frame_show(mlt_consumer, GLWidget* widget, mlt_event_data);
static void on_frame_render(mlt_consumer, GLWidget *widget, mlt_frame frame); static void on_frame_render(mlt_consumer, GLWidget *widget, mlt_frame frame);
static void on_gl_frame_show(mlt_consumer, void *self, mlt_frame frame_ptr); static void on_gl_frame_show(mlt_consumer, void *self, mlt_frame frame_ptr);
static void on_gl_nosync_frame_show(mlt_consumer, void *self, mlt_frame frame_ptr); static void on_gl_nosync_frame_show(mlt_consumer, void *self, mlt_frame frame_ptr);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment