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
22#include <CoreVideo/CVBase.h>
23#include <CoreVideo/CVImageBuffer.h>
24#include <CoreVideo/CVPixelBuffer.h>
25
26#import <AVFoundation/AVFoundation.h>
27#import <Metal/Metal.h>
28
29QT_BEGIN_NAMESPACE
30
31class AVFVideoSinkInterface;
32
34{
36
37public:
38 explicit AVFVideoSink(QVideoSink *parent = nullptr);
40
41 // QPlatformVideoSink interface
42public:
43 void setRhi(QRhi *rhi) override;
44
45 void setNativeSize(QSize size);
46
48
49private:
50 AVFVideoSinkInterface *m_interface = nullptr;
51 QRhi *m_rhi = nullptr;
52};
53
55{
56public:
58
59 void setVideoSink(AVFVideoSink *sink);
60
61
62 virtual void reconfigure() = 0;
63 virtual void setRhi(QRhi *);
64 virtual void setLayer(CALayer *layer);
65 virtual void setOutputSettings();
66
67 QRhi *rhi() const { return m_rhi; }
68
69 void updateLayerBounds();
71 QSize nativeSize() const { return m_sink ? m_sink->nativeSize() : QSize(); }
72
74#if defined(Q_OS_MACOS)
76#elif defined(Q_OS_IOS)
78#endif
79private:
80 void freeTextureCaches();
81
82protected:
83
84 AVFVideoSink *m_sink = nullptr;
85 QRhi *m_rhi = nullptr;
86 CALayer *m_layer = nullptr;
88};
89
90
91QT_END_NAMESPACE
92
93#endif // AVFVIDEOWINDOWCONTROL_H
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)
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)
Combined button and popup list for selecting options.