-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvideosurface.cpp
46 lines (38 loc) · 1.15 KB
/
videosurface.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "videosurface.h"
VideoSurface::VideoSurface(QObject *parent) :
QAbstractVideoSurface(parent),
m_videoWidget(nullptr){;}
VideoSurface::~VideoSurface()
{
if(m_videoWidget)
m_videoWidget->deleteLater();
}
QList<QVideoFrame::PixelFormat> VideoSurface::supportedPixelFormats(QAbstractVideoBuffer::HandleType type) const
{
QList<QVideoFrame::PixelFormat> list;
if(type == QAbstractVideoBuffer::NoHandle){
list << QVideoFrame::Format_RGB32;
list << QVideoFrame::Format_ARGB32;
list << QVideoFrame::Format_ARGB32_Premultiplied;
list << QVideoFrame::Format_RGB555;
}
return list;
}
QVideoSurfaceFormat VideoSurface::nearestFormat(const QVideoSurfaceFormat &format) const
{
return format;
}
bool VideoSurface::isFormatSupported(const QVideoSurfaceFormat &format) const{
return true;
}
bool VideoSurface::present(const QVideoFrame &frame){
if(m_videoWidget)
m_videoWidget->setFrame(frame);
return true;
}
bool VideoSurface::start(const QVideoSurfaceFormat &format){
return QAbstractVideoSurface::start(format);
}
void VideoSurface::stop(){
QAbstractVideoSurface::stop();
}