Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to use QMediaPlayer not in the main thread?
maximmalofeev last edited by
I'm try to use QMediaPlayer with my own VideoSurface derived from QAbstractVideoSurface and want to execute QAbstractVideoSurface::present not in the main thread, cose it could take a lot of time. For this i try to do:
mediaPlayer = new QMediaPlayer; mediaPlaylist = new QMediaPlaylist(mediaPlayer); auto avi1 = QUrl::fromLocalFile(QDir::currentPath() + "/debug/1.avi"); mediaPlaylist->addMedia(QMediaContent(avi1)); mediaPlayer->setPlaylist(mediaPlaylist); videoSurface = new VideoSurface(mediaPlayer); mediaPlayer->setVideoOutput(videoSurface); mediaPlayer->moveToThread(&workerThread); workerThread.start();
but QAbstractVideoSurface::present of videoSurface object still processes in the main thread. What do I wrong? How to resolve this issue (of course if it's possible:) )?
Hi and welcome to devnet,
AFAIK, no that can't be done.
What take so long ?