libVLC captures video frames and renders them (QGraphicsView)

Author: Yiqu, Ersanli
Personal Wechat ID: iwaleon
Wechat Official Account: Efficient Programmer

After " libVLC Grabbing Video Frames and Rendering (QWidget) " introduces QWidget's rendering of video frames, it's time to introduce the second method - the QGraphicsView/QGraphicsScene/QGraphicsItem graphics view framework.

insert image description here

Basic steps: customize a QGraphicsItem, draw video frames through it, and then add it to QGraphicsScene. Using the interactivity of QGraphicsView, some additional functions (such as mouse wheel zooming, panning, etc.) can be realized, but it will have a certain impact on the real-time processing of the video.

Next, we render the video frame based on QGraphicsItem, and display some watermark text, pictures, including some interactive function buttons on the video.

Custom QGraphicsItem

In order to facilitate the rendering of video frames, we inherit from QGraphicsObject (or QGraphicsItem) and encapsulate a custom VideoItem class.

In this class, there is a main interface setPixmap(), through which you can directly set the picture ࿱

Guess you like

Origin blog.csdn.net/u011012932/article/details/131034996