summaryrefslogtreecommitdiffstats
path: root/src/multimedia/video/qvideoframe_p.h
blob: cb8b7b74710090f24033ba024bd793528d5cb27e (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
// Copyright (C) 2024 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 QVIDEOFRAME_P_H
#define QVIDEOFRAME_P_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 "qvideoframe.h"
#include "qabstractvideobuffer_p.h"

#include <qmutex.h>

QT_BEGIN_NAMESPACE

class QVideoFramePrivate : public QSharedData
{
public:
    QVideoFramePrivate() = default;
    QVideoFramePrivate(const QVideoFrameFormat &format) : format(format) { }
    QVideoFramePrivate(QVideoFrameFormat format, std::unique_ptr<QAbstractVideoBuffer> buffer)
        : format{ std::move(format) }, buffer{ std::move(buffer) }
    {
    }

    static QVideoFramePrivate *handle(QVideoFrame &frame) { return frame.d.get(); };

    QVideoFrame adoptThisByVideoFrame()
    {
        QVideoFrame frame;
        frame.d = QExplicitlySharedDataPointer(this, QAdoptSharedDataTag{});
        return frame;
    }

    qint64 startTime = -1;
    qint64 endTime = -1;
    QAbstractVideoBuffer::MapData mapData;
    QVideoFrameFormat format;
    std::unique_ptr<QAbstractVideoBuffer> buffer;
    int mappedCount = 0;
    QMutex mapMutex;
    QString subtitleText;
    QImage image;
    QMutex imageMutex;

private:
    Q_DISABLE_COPY(QVideoFramePrivate)
};

QT_END_NAMESPACE

#endif // QVIDEOFRAMEPRIVATE_P_H