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#import <MetalKit/MetalKit.h>
29
30QT_BEGIN_NAMESPACE
31
32class AVFVideoSinkInterface;
33
35{
37
38public:
39 explicit AVFVideoSink(QVideoSink *parent = nullptr);
41
42 // QPlatformVideoSink interface
43public:
44 void setRhi(QRhi *rhi) override;
45
46 void setNativeSize(QSize size);
47
49
50private:
51 AVFVideoSinkInterface *m_interface = nullptr;
52 QRhi *m_rhi = nullptr;
53};
54
56{
57public:
59
60 void setVideoSink(AVFVideoSink *sink);
61
62
63 virtual void reconfigure() = 0;
64 virtual void setRhi(QRhi *);
65 virtual void setLayer(CALayer *layer);
66 virtual void setOutputSettings();
67
68 QRhi *rhi() const { return m_rhi; }
69
70 void updateLayerBounds();
72 QSize nativeSize() const { return m_sink ? m_sink->nativeSize() : QSize(); }
73
75#if defined(Q_OS_MACOS)
77#elif defined(Q_OS_IOS)
79#endif
80private:
81 void freeTextureCaches();
82
83protected:
84
85 AVFVideoSink *m_sink = nullptr;
86 QRhi *m_rhi = nullptr;
87 CALayer *m_layer = nullptr;
89};
90
91
92QT_END_NAMESPACE
93
94#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.