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
avfvideosink_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 AVFVIDEOWINDOWCONTROL_H
5#define AVFVIDEOWINDOWCONTROL_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/qplatformvideosink_p.h"
19
20#include <QtCore/private/qcore_mac_p.h>
21
25
26#include <CoreVideo/CVBase.h>
27#include <CoreVideo/CVImageBuffer.h>
28#include <CoreVideo/CVPixelBuffer.h>
29
30#import "Metal/Metal.h"
31#import "MetalKit/MetalKit.h"
32
33QT_BEGIN_NAMESPACE
34
35class AVFVideoSinkInterface;
36
38{
40
41public:
42 explicit AVFVideoSink(QVideoSink *parent = nullptr);
44
45 // QPlatformVideoSink interface
46public:
47 void setRhi(QRhi *rhi) override;
48
49 void setNativeSize(QSize size);
50
52
53private:
54 AVFVideoSinkInterface *m_interface = nullptr;
55 QRhi *m_rhi = nullptr;
56};
57
59{
60public:
62
63 void setVideoSink(AVFVideoSink *sink);
64
65
66 virtual void reconfigure() = 0;
67 virtual void setRhi(QRhi *);
68 virtual void setLayer(CALayer *layer);
69 virtual void setOutputSettings();
70
71 QRhi *rhi() const { return m_rhi; }
72
73 void updateLayerBounds();
75 QSize nativeSize() const { return m_sink ? m_sink->nativeSize() : QSize(); }
76
78#if defined(Q_OS_MACOS)
80#elif defined(Q_OS_IOS)
82#endif
83private:
84 void freeTextureCaches();
85
86protected:
87
88 AVFVideoSink *m_sink = nullptr;
89 QRhi *m_rhi = nullptr;
90 CALayer *m_layer = nullptr;
92};
93
94
95QT_END_NAMESPACE
96
97#endif // AVFVIDEOWINDOWCONTROL_H
static MTLPixelFormat rhiTextureFormatToMetalFormat(QRhiTexture::Format f)
Q_FORWARD_DECLARE_OBJC_CLASS(CALayer)
Q_FORWARD_DECLARE_OBJC_CLASS(AVPlayerLayer)
Q_FORWARD_DECLARE_OBJC_CLASS(AVCaptureVideoPreviewLayer)
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)
virtual void setLayer(CALayer *layer)
QCFType< CVMetalTextureCacheRef > cvMetalTextureCache
NSDictionary * m_outputSettings
virtual void setOutputSettings()
virtual void setRhi(QRhi *)
virtual void reconfigure()=0
AVFVideoSink * m_sink
void setVideoSink(AVFVideoSink *sink)
QSize nativeSize() const
void setRhi(QRhi *rhi) override
~AVFVideoSink() override
void setVideoSinkInterface(AVFVideoSinkInterface *interface)
void setNativeSize(QSize size)