blob: 23a737f7d71d32211e9d62031e92e212443aafd8 (
plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QANDROIDCAMERAFRAME_H
#define QANDROIDCAMERAFRAME_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QVideoFrameFormat>
#include <QJniObject>
class QAndroidCameraFrame
{
public:
struct Plane
{
int pixelStride = 0;
int rowStride = 0;
int size = 0;
uint8_t *data;
};
QAndroidCameraFrame(QJniObject frame);
~QAndroidCameraFrame();
QVideoFrameFormat::PixelFormat format() const { return m_pixelFormat; }
int numberPlanes() const { return m_numberPlanes; }
Plane plane(int index) const
{
if (index < 0 || index > numberPlanes())
return {};
return m_planes[index];
}
QSize size() const { return m_size; }
long timestamp() const { return m_timestamp; }
bool isParsed() const { return m_parsed; }
private:
bool parse(const QJniObject &frame);
QVideoFrameFormat::PixelFormat m_pixelFormat;
QSize m_size = {};
long m_timestamp = 0;
int m_numberPlanes = 0;
Plane m_planes[3]; // 3 max number planes
jobject m_frame = nullptr;
bool m_parsed = false;
QImage m_image;
enum AndroidImageFormat {
RAW_SENSOR = 32,
YUV_420_888 = 35,
RAW_PRIVATE = 36,
YUV_422_888 = 39,
YUV_444_888 = 40,
FLEX_RGB_888 = 41,
FLEX_RGBA_8888 = 42,
YCBCR_P010 = 54,
JPEG = 256,
HEIC = 1212500294
};
};
#endif // QANDROIDCAMERAFRAME_H
|