Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
avfvideobuffer_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 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 AVFVIDEOBUFFER_H
5#define AVFVIDEOBUFFER_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 <private/qhwvideobuffer_p.h>
19#include <private/qcore_mac_p.h>
20
21#include <QtCore/qobject.h>
22#include <QtCore/qmutex.h>
23#include <avfvideosink_p.h>
24
25#include <CoreVideo/CVImageBuffer.h>
26
27#import "Metal/Metal.h"
28#import "MetalKit/MetalKit.h"
29
31
32struct AVFMetalTexture;
34{
35public:
36 AVFVideoBuffer(AVFVideoSinkInterface *sink, QCFType<CVImageBufferRef> buffer);
38
39 MapData map(QVideoFrame::MapMode mode) override;
40 void unmap() override;
41
42 quint64 textureHandle(QRhi &, int plane) override;
43
44 QVideoFrameFormat videoFormat() const { return m_format; }
45
46private:
47 AVFVideoSinkInterface *sink = nullptr;
48
49 QCFType<CVMetalTextureCacheRef> metalCache;
50 QCFType<CVImageBufferRef> m_buffer;
51 QCFType<CVMetalTextureRef> cvMetalTexture[3];
52#if defined(Q_OS_MACOS)
54#elif defined(Q_OS_IOS)
56#endif
57
58 QVideoFrame::MapMode m_mode = QVideoFrame::NotMapped;
59 QVideoFrameFormat m_format;
60};
61
62QT_END_NAMESPACE
63
64#endif
static MTLPixelFormat rhiTextureFormatToMetalFormat(QRhiTexture::Format f)
MapData map(QVideoFrame::MapMode mode) override
Maps the planes of a video buffer to memory.
QVideoFrameFormat videoFormat() const
~AVFVideoBuffer() override
quint64 textureHandle(QRhi &, int plane) override
void unmap() override
Releases the memory mapped by the map() function.
AVFVideoBuffer(AVFVideoSinkInterface *sink, QCFType< CVImageBufferRef > buffer)