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. Blocking QAbstractVideoSurface
Qt 6.11 is out! See what's new in the release blog

Blocking QAbstractVideoSurface

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 736 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.
  • O Offline
    O Offline
    ogh27
    wrote on last edited by
    #1

    Hi everybody!

    Qt contains great capabilities for video playback on android and is much nicer to handle than the Java Android SDK.

    I am trying to play a video using QMediaPlayer and setting the output to a class derived from QAbstractVideoSurface.
    By overriding the "present" method in QAbstractVideoSurface I can retrieve the frames, convert them to RGB and manipulate them as I want.
    Unfortunately, the "present" method seems to be called asynchronously and in a non-blocking way.
    Since my image manipulation routine takes some time, I lose a lot of frames. They simply get skipped. The MediaPlayer plays the video at normal speed and only calls the "present" method whenever the image manipulation routine is not busy.
    I don't need the video to play in real time or be drawn anywhere, I am (ab)using the QMediaPlayer to get to the frames, playing the frames smoothly is not an issue, I just want to have all the frames without missing any.

    Is there a way to make the "present" method blocking? Meaning that the MediaPlayer only plays a new frame if the "present" method has finished processing the previous frame.

    Thank you in advance!

    Best,

    ogh

    PS: Minimal example:

    @
    QMediaPlayer *player = new QMediaPlayer;
    // DrawVideoSurface is derived from QAbstractVideoSurface
    // and overrides the "present" method to perform image manipulation
    DrawVideoSurface *processor = new DrawVideoSurface();
    player->setVideoOutput(processor);
    player->setMedia(QUrl("file:///home/ogh/video.mp4"));
    player->play();
    @

    1 Reply Last reply
    1

    • Login

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