Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qandroidvideoframebuffer_p.h
Go to the documentation of this file.
1
// Copyright (C) 2022 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
#
ifndef
QANDROIDVIDEOFRAMEBUFFER_P_H
5
#
define
QANDROIDVIDEOFRAMEBUFFER_P_H
6
7
//
8
// W A R N I N G
9
// -------------
10
//
11
// This file is not part of the Qt API. It exists purely as an
12
// implementation detail. This header file may change from version to
13
// version without notice, or even be removed.
14
//
15
// We mean it.
16
//
17
18
#
include
<
QAbstractVideoBuffer
>
19
#
include
<
QByteArray
>
20
#
include
<
QVideoFrameFormat
>
21
#
include
<
QJniObject
>
22
#
include
<
QtCore
/
qjnitypes
.
h
>
23
24
#
include
<
QtCore
/
qtconfigmacros
.
h
>
25
26
#
include
<
QtFFmpegMediaPluginImpl
/
private
/
qandroidvideojnitypes_p
.
h
>
27
28
QT_BEGIN_NAMESPACE
29
30
Q_DECLARE_JNI_CLASS
(Image,
"android/media/Image"
)
31
Q_DECLARE_JNI_CLASS(ImageFormat,
"android/graphics/ImageFormat"
)
32
Q_DECLARE_JNI_CLASS(ImagePlane,
"android/media/Image$Plane"
)
33
Q_DECLARE_JNI_CLASS(ByteBuffer,
"java/nio/ByteBuffer"
)
34
35
class
QAndroidVideoFrameBuffer :
public
QAbstractVideoBuffer
36
{
37
public
:
38
class
FrameReleaseDelegate {
39
public
:
40
virtual
~FrameReleaseDelegate() =
default
;
41
virtual
void
onFrameReleased() = 0;
42
};
43
enum
class
MemoryPolicy {
44
Copy,
// Make a copy of frame data
45
Reuse
// Reuse frame data
46
};
47
48
// Please note that MemoryPolicy::Reuse can be changed internally to MemoryPolicy::Copy
49
QAndroidVideoFrameBuffer(QJniObject frame,
50
std::shared_ptr<FrameReleaseDelegate> frameReleaseDelegate,
51
MemoryPolicy policy,
52
QtVideo::Rotation rotation = QtVideo::Rotation::None);
53
~QAndroidVideoFrameBuffer();
54
MapData map(QVideoFrame::MapMode) override {
return
m_mapData; }
55
QVideoFrameFormat format()
const
override {
return
m_videoFrameFormat; }
56
long
timestamp()
const
{
return
m_timestamp; }
57
bool
isParsed()
const
{
return
m_parsed; }
58
59
private
:
60
bool
useCopiedData()
const
;
61
bool
parse(
const
QJniObject &frame);
62
QVideoFrameFormat m_videoFrameFormat;
63
long
m_timestamp = 0;
64
MapData m_mapData;
65
// Currently we have maximum 3 planes here
66
// We keep this data in QByteArray for proper cleaning
67
static
constexpr
int
MAX_PLANES = 3;
68
QByteArray dataCleaner[MAX_PLANES];
69
jobject m_nativeFrame =
nullptr
;
70
std::shared_ptr<FrameReleaseDelegate> m_frameReleaseDelegate;
71
MemoryPolicy m_policy;
72
bool
m_parsed =
false
;
73
74
enum
AndroidImageFormat {
75
// Values taken from Android API ImageFormat, PixelFormat, or HardwareBuffer
76
// (that can be retuned by Image::getFormat() method)
77
// https://developer.android.com/reference/android/media/Image#getFormat()
78
RGBA_8888 = 1,
79
RAW_SENSOR = 32,
80
YUV_420_888 = 35,
81
RAW_PRIVATE = 36,
82
YUV_422_888 = 39,
83
YUV_444_888 = 40,
84
FLEX_RGB_888 = 41,
85
FLEX_RGBA_8888 = 42,
86
YCBCR_P010 = 54,
87
JPEG = 256,
88
HEIC = 1212500294
89
};
90
};
91
92
QT_END_NAMESPACE
93
94
#
endif
// QANDROIDVIDEOFRAMEBUFFER_P_H
Q_DECLARE_JNI_CLASS
Q_DECLARE_JNI_CLASS(MotionEvent, "android/view/MotionEvent")
qtmultimedia
src
plugins
multimedia
ffmpeg
android
qandroidvideoframebuffer_p.h
Generated on
for Qt by
1.18.0