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
(*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(priority)
// self->clearFrameRenderer();
self->createThread(thread, function, data);
self->lockMonitor();
auto threadData = (mlt_event_data_thread*) Mlt::EventData(data).to_object();
if (threadData) {
auto renderThread = (RenderThread*) threadData->thread;
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)
if (thread) {
thread->quit();
thread->wait();
delete thread;
// self->clearFrameRenderer();
self->releaseMonitor();
Q_UNUSED(self)
auto threadData = (mlt_event_data_thread*) Mlt::EventData(data).to_object();
if (threadData) {
auto renderThread = (RenderThread*) threadData->thread;
if (renderThread) {
renderThread->quit();
renderThread->wait();
delete renderThread;
// TODO: useless ?
// self->releaseMonitor();
}
}
}
......@@ -1414,11 +1423,10 @@ void GLWidget::updateTexture(GLuint yName, GLuint uName, GLuint 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);
if (frame.get_int("rendered") != 0) {
auto *widget = static_cast<GLWidget *>(self);
auto frame = Mlt::EventData(data).to_frame();
if (frame.is_valid() && frame.get_int("rendered")) {
int timeout = (widget->consumer()->get_int("real_time") > 0) ? 0 : 1000;
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));
......
......@@ -234,7 +234,7 @@ private:
QPoint m_offset;
MonitorProxy *m_proxy;
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_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);
......
Markdown is supported
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