Yes. The problem was with Qt internals conflicting with mpv library's way of multi threading. I have solved the problem by using a QT alternative to mpv_set_wakeup_callback. My solution is available at:
https://github.com/aario/qtible/blob/main/mediaplayer/mpveventloop.cpp
void MPVEventLoop::eventLoop()
{
qInfo() << "Started event loop";
while (1) {
if (mustShutdown)
break;
mpv_event *event = mpv_wait_event(mpv, 0.01);
switch (event->event_id) {
case MPV_EVENT_NONE:
break;
case MPV_EVENT_FILE_LOADED:
emit fileLoaded();
break;
case MPV_EVENT_END_FILE:
emit endFile();
break;
case MPV_EVENT_PROPERTY_CHANGE: {
mpv_event_property *property = (mpv_event_property *)event->data;
if (strcmp(property->name, "time-pos") == 0) {
if (property->format == MPV_FORMAT_DOUBLE) {
emit timePosChanged(*(double *)property->data);
}
}
break;
}
default: qDebug() << "Ignoring MPV event: " << event->event_id;
}
}
}
And then:
mpvEventLoop = new MPVEventLoop(mpv);
mpvEventLoop->moveToThread(&mpvEventLoopThread);
connect(&mpvEventLoopThread, &QThread::finished, mpvEventLoop, &QObject::deleteLater);
connect(this, &MediaPlayer::startMPVEventLoop, mpvEventLoop, &MPVEventLoop::eventLoop);
connect(mpvEventLoop, &MPVEventLoop::fileLoaded, this, &MediaPlayer::onMpvFileLoaded);
connect(mpvEventLoop, &MPVEventLoop::endFile, this, &MediaPlayer::onMpvEndFile);
connect(mpvEventLoop, &MPVEventLoop::timePosChanged, this, &MediaPlayer::onMpvTimePosChanged);
mpvEventLoopThread.start();
emit startMPVEventLoop();