I want to make an app for videoconferencing with QT. I am new in this. I'd appreciate if anyone has an example of it.
Now, I am trying to display camera picture on screen using a subclass of qabstractvideosurface. Anyone has idea how to do it?
I want to make an app for videoconferencing with QT. I am new in this. I'd appreciate if anyone has an example of it.
Now, I am trying to display camera picture on screen using a subclass of qabstractvideosurface. Anyone has idea how to do it?
The
QAbstractVideoSurface
is an interface between the producer and consumer of the video frames. You only have two functions to implement to begin with:QVideoFrame
Lets say you want to use a classic
QWidget
for the display. In this case, you may choose to use aQImage
to draw on the widget.First Qt is guaranteed to paint a
QImage
which is RGB24 (or BGR24) on most platforms. SoNow to present the QVideoFrame, you map its data to a QImage, and paint the QImage to the widget. For simplicity I will use a
QLabel
, that I access directly (no signal no slot).This example is obviously not optimal.
QVideoFrame
might be stored in video memory, because we are drawing using a pixmap.You can write your own widget, and implement a paintEvent for better performance. Also, you have several design liberties on how
present()
behave. For instance :mylabel->repaint()
instead ofmylabel->update()