[Interest] Cannot map videoforames for QAbstractVideoSurface::present

Jason H jhihn at gmx.com
Wed Jun 13 23:52:16 CEST 2018


> How can I get access to pixel data (for reading) when being presented a frame? I have the following:
> 
> class VideoSurface: public QAbstractVideoSurface {
> bool present(const QVideoFrame &frame) override {
>  // I can't map()  because frame is const and map() is not marked const
>  // and frame is not already mapped, so what can I do with it?
> }
> };


Having played with this further, I think something i wrong with Qt. I can't map() the frame even if I clone it (as found in various places on the web):
bool present(const QVideoFrame &frame) override {
QVideoFrame frame2(frame);
frame2.map(QAbstractVideoBuffer::ReadOnly); // this fails!
...

}

Even when I comment out all the frame logic except for a qDebug() and return true, there seems to be only one frame ever presented:

auto main(int, char **)::(anonymous class)::operator()(QMediaPlayer::MediaStatus) const QMediaPlayer::LoadingMedia
auto main(int, char **)::(anonymous class)::operator()(const QMediaPlayer::State &) const QMediaPlayer::PlayingState
auto main(int, char **)::(anonymous class)::operator()(QMediaPlayer::MediaStatus) const QMediaPlayer::BufferedMedia
virtual bool VideoSurface::start(const QVideoSurfaceFormat &)
virtual bool VideoSurface::present(const QVideoFrame &) 0 true (frameNumber, frame.iValid())
... 23 seconds later...
auto main(int, char **)::(anonymous class)::operator()(QMediaPlayer::MediaStatus) const QMediaPlayer::EndOfMedia
virtual void VideoSurface::stop()
auto main(int, char **)::(anonymous class)::operator()(const QMediaPlayer::State &) const QMediaPlayer::StoppedState

The video is an MP4 file from disk, 23 seconds long 71MB, I should have ~690 present() invocations.

Any help is appreciated!



More information about the Interest mailing list