Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qsgvivantevideonode.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 Pelagicore AG
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include <GLES2/gl2.h>
5#include <GLES2/gl2ext.h>
6
10
11QMap<QVideoFrameFormat::PixelFormat, GLenum> QSGVivanteVideoNode::static_VideoFormat2GLFormatMap = QMap<QVideoFrameFormat::PixelFormat, GLenum>();
12
14 mFormat(format)
15{
17 mMaterial = new QSGVivanteVideoMaterial();
18 setMaterial(mMaterial);
19}
20
22{
23}
24
26{
27 mMaterial->setCurrentFrame(frame, flags);
29}
30
32{
33 if (static_VideoFormat2GLFormatMap.isEmpty()) {
34 static_VideoFormat2GLFormatMap.insert(QVideoFrameFormat::Format_YUV420P, GL_VIV_I420);
35 static_VideoFormat2GLFormatMap.insert(QVideoFrameFormat::Format_YV12, GL_VIV_YV12);
36 static_VideoFormat2GLFormatMap.insert(QVideoFrameFormat::Format_NV12, GL_VIV_NV12);
37 static_VideoFormat2GLFormatMap.insert(QVideoFrameFormat::Format_NV21, GL_VIV_NV21);
38 static_VideoFormat2GLFormatMap.insert(QVideoFrameFormat::Format_UYVY, GL_VIV_UYVY);
39 static_VideoFormat2GLFormatMap.insert(QVideoFrameFormat::Format_YUYV, GL_VIV_YUY2);
40 static_VideoFormat2GLFormatMap.insert(QVideoFrameFormat::Format_RGB32, GL_BGRA_EXT);
41 static_VideoFormat2GLFormatMap.insert(QVideoFrameFormat::Format_ARGB32, GL_BGRA_EXT);
42 static_VideoFormat2GLFormatMap.insert(QVideoFrameFormat::Format_BGR32, GL_RGBA);
43 static_VideoFormat2GLFormatMap.insert(QVideoFrameFormat::Format_BGRA32, GL_RGBA);
44 }
45
46 return static_VideoFormat2GLFormatMap;
47}
48
49
51{
52 switch (pixelformat) {
54 case QVideoFrameFormat::Format_YV12: return 1;
55 case QVideoFrameFormat::Format_NV12: return 1;
56 case QVideoFrameFormat::Format_NV21: return 1;
57 case QVideoFrameFormat::Format_UYVY: return 2;
58 case QVideoFrameFormat::Format_YUYV: return 2;
59 case QVideoFrameFormat::Format_RGB32: return 4;
60 case QVideoFrameFormat::Format_ARGB32: return 4;
61 case QVideoFrameFormat::Format_BGR32: return 4;
62 case QVideoFrameFormat::Format_BGRA32: return 4;
63 default: return 1;
64 }
65}
66
67
68
Definition qmap.h:186
iterator insert(const Key &key, const T &value)
Definition qmap.h:687
bool isEmpty() const
Definition qmap.h:268
void setMaterial(QSGMaterial *material)
Sets the material of this geometry node to material.
Definition qsgnode.cpp:925
@ DirtyMaterial
Definition qsgnode.h:75
@ OwnsMaterial
Definition qsgnode.h:58
void markDirty(DirtyState bits)
Notifies all connected renderers that the node has dirty bits.
Definition qsgnode.cpp:622
void setFlag(Flag, bool=true)
Sets the flag f on this node if enabled is true; otherwise clears the flag.
Definition qsgnode.cpp:584
void setCurrentFrame(const QVideoFrame &frame, QSGVideoNode::FrameFlags flags)
void setCurrentFrame(const QVideoFrame &frame, FrameFlags flags)
QSGVivanteVideoNode(const QVideoFrameFormat &format)
static int getBytesForPixelFormat(QVideoFrameFormat::PixelFormat pixelformat)
static const QMap< QVideoFrameFormat::PixelFormat, GLenum > & getVideoFormat2GLFormatMap()
The QVideoFrameFormat class specifies the stream format of a video presentation surface.
PixelFormat
Enumerates video data types.
The QVideoFrame class represents a frame of video data.
Definition qvideoframe.h:26
GLbitfield flags
GLint GLsizei GLsizei GLenum format
#define GL_BGRA_EXT
#define GL_RGBA
QFrame frame
[0]