QAbstractVideoSurface::present не вызывается

Вот код функции:

    VideoCapture capture;

    QMediaPlayer player;
    player.setMuted(true);
    player.setVideoOutput(&capture);

    QEventLoop loop;
    loop.connect(&player, &QMediaPlayer::mediaStatusChanged, [&](QMediaPlayer::MediaStatus){
        loop.quit();
    });

    player.setMedia(QUrl::fromLocalFile(filepath));

    loop.exec();

    if (player.mediaStatus() == QMediaPlayer::MediaStatus::InvalidMedia)
    {
        return QPixmap();
    }

    player.play();
    player.setPosition(player.duration() / 2);
    player.pause();

    return capture.getPixmap();

Вот код VideoCapture::present:

bool Collection::VideoCapture::present(const QVideoFrame& frame)
{
    if (supportedPixelFormats(frame.handleType()).contains((frame.pixelFormat())))
    {
        setError(IncorrectFormatError);
        return false;
    }
    else
    {
        QVideoFrame frametodraw(frame);

        if(!frametodraw.map(QAbstractVideoBuffer::ReadOnly))
        {
            setError(ResourceError);
            return false;
        }

        pixmap = QPixmap::fromImage(QImage(frametodraw.bits(), frametodraw.width(), frametodraw.height(), frametodraw.bytesPerLine(), QImage::Format::Format_RGB444));

        return true;
    }
}

Брекпоинт на present не вызывается вообще. Почему?


Ответы (0 шт):