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 <QtMultimedia/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 setNativeSize(QSize size);
44
46
47private:
48 AVFVideoSinkInterface *m_interface = nullptr;
49};
50
52{
53public:
55
56 void setVideoSink(AVFVideoSink *sink);
57
58
59 virtual void reconfigure() = 0;
60 virtual void setRhi(QRhi *);
61 virtual void setLayer(CALayer *layer);
62 virtual void setOutputSettings();
63
64 QRhi *rhi() const { return m_rhi; }
65
66 void updateLayerBounds();
68 QSize nativeSize() const { return m_sink ? m_sink->nativeSize() : QSize(); }
69
71#if defined(Q_OS_MACOS)
73#elif defined(Q_OS_IOS)
75#endif
76private:
77 void freeTextureCaches();
78
79protected:
80
81 AVFVideoSink *m_sink = nullptr;
82 QRhi *m_rhi = nullptr;
83 CALayer *m_layer = nullptr;
85};
86
87
88QT_END_NAMESPACE
89
90#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
~AVFVideoSink() override
void setVideoSinkInterface(AVFVideoSinkInterface *interface)
void setNativeSize(QSize size)
Combined button and popup list for selecting options.