Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to use QMediaPlayer not in the main thread?
Forum Updated to NodeBB v4.3 + New Features

How to use QMediaPlayer not in the main thread?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 479 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • maximmalofeevM Offline
    maximmalofeevM Offline
    maximmalofeev
    wrote on last edited by
    #1

    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:) )?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      AFAIK, no that can't be done.

      What take so long ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved