summaryrefslogtreecommitdiffstats
path: root/src/plugins/multimedia/qnx/camera/qqnxcameraframebuffer_p.h
blob: 222fd34eedb2f9689a4e8903bb2e8ab79d9da322 (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
// Copyright (C) 2022 The Qt Company
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQNXCAMERAFRAMEBUFFER_H
#define QQNXCAMERAFRAMEBUFFER_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 <private/qabstractvideobuffer_p.h>

#include <QtCore/qsize.h>

#include <camera/camera_api.h>

#include <memory>

QT_BEGIN_NAMESPACE

class QRhi;

class QQnxCameraFrameBuffer : public QAbstractVideoBuffer
{
public:
    explicit QQnxCameraFrameBuffer(const camera_buffer_t *buffer, QRhi *rhi = nullptr);

    QQnxCameraFrameBuffer(const QQnxCameraFrameBuffer&) = delete;
    QQnxCameraFrameBuffer& operator=(const QQnxCameraFrameBuffer&) = delete;

    MapData map(QVideoFrame::MapMode mode) override;
    void unmap() override;

    QVideoFrameFormat::PixelFormat pixelFormat() const;

    QSize size() const;

private:
    QRhi *m_rhi;

    QVideoFrameFormat::PixelFormat m_pixelFormat;

    std::unique_ptr<unsigned char[]> m_data;

    size_t m_dataSize;

    MapData m_mapData;

    QSize m_frameSize;
};

QT_END_NAMESPACE

#endif