example code for "Working with Low Level Video Frames" ?



  • on this page, it says "There are both C++ and QML examples available", but then doesn't link to them. Does anyone have example C++ (not QML) code for using MyVideoSurface and MyVideoProducer to draw over a movie while it is playing?


  • Moderators

    @davecotter said in example code for "Working with Low Level Video Frames" ?:

    MyVideoSurface and MyVideoProducer to draw over a movie while it is playing?

    what excatly do you want o draw? If it is just a watermark it's easier to place an overlay widget/item on the media player.



  • well yes, i'd like to draw animated text and / or graphics as an overlay. i think your idea is better since then we don't have to grab the video bits from the graphics card, draw on them, then push them back, right? i'd like the whole process to be hardware accelerated. i have no need to capture or alter the bits of the video.



  • still, is there sample code for that page, where it says "here is some sample code"?

    new tack: okay so here's my current code:

    			QMediaPlayer		*mediaPlayer = new QMediaPlayer(NULL, QMediaPlayer::VideoSurface);
    			QGraphicsVideoItem	*videoItem = new QGraphicsVideoItem();
    			QGraphicsView		*graphicsView = new QGraphicsView(new QGraphicsScene(this));
    			QSizeF				vidSize(340, 200);
    			
    		    videoItem->setSize(vidSize);
    		
    		    mediaPlayer->setVideoOutput(videoItem);
    			
    			graphicsView->scene()->addItem(videoItem);
    			
    			SuperString		filePath(movieFile.path(true));
    			QUrl			fileUrl(QUrl::fromLocalFile(filePath));
    
    			mediaPlayer->setMedia(fileUrl);
    			mediaPlayer->play();
    			
    			layout->addWidget(graphicsView, 0, columnI++);
    

    what widget do i use to overlay a draw surface on top of that, and keep everything hardware accelerated? is there sample code for that?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.