1// Copyright (C) 2021 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 QPLATFORMVIDEOSINK_H
5#define QPLATFORMVIDEOSINK_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/qtmultimediaglobal.h>
19#include <QtCore/qobject.h>
20#include <QtCore/qrect.h>
21#include <QtCore/qsize.h>
22#include <QtCore/qmutex.h>
23#include <QtGui/qwindowdefs.h>
24#include <qvideosink.h>
25#include <qvideoframe.h>
26#include <qdebug.h>
27#include <private/qglobal_p.h>
28
29QT_BEGIN_NAMESPACE
30
31// Required for QDoc workaround
32class QString;
33
34class Q_MULTIMEDIA_EXPORT QPlatformVideoSink : public QObject
35{
36 Q_OBJECT
37
38public:
39 ~QPlatformVideoSink() override;
40
41 virtual void setRhi(QRhi * /*rhi*/) {}
42
43 virtual void setWinId(WId) {}
44 virtual void setDisplayRect(const QRect &) {};
45 virtual void setFullScreen(bool) {}
46 virtual void setAspectRatioMode(Qt::AspectRatioMode) {}
47
48 QSize nativeSize() const;
49
50 virtual void setBrightness(float /*brightness*/) {}
51 virtual void setContrast(float /*contrast*/) {}
52 virtual void setHue(float /*hue*/) {}
53 virtual void setSaturation(float /*saturation*/) {}
54
55 QVideoSink *videoSink() { return m_sink; }
56
57 void setNativeSize(QSize s);
58
59 virtual void setVideoFrame(const QVideoFrame &frame);
60
61 QVideoFrame currentVideoFrame() const;
62
63 void setSubtitleText(const QString &subtitleText);
64
65 QString subtitleText() const;
66
67protected:
68 explicit QPlatformVideoSink(QVideoSink *parent);
69
70Q_SIGNALS:
71 void rhiChanged(QRhi *rhi);
72
73private:
74 QVideoSink *m_sink = nullptr;
75 mutable QMutex m_mutex;
76 QSize m_nativeSize;
77 QString m_subtitleText;
78 QVideoFrame m_currentVideoFrame;
79};
80
81QT_END_NAMESPACE
82
83
84#endif
85

source code of qtmultimedia/src/multimedia/platform/qplatformvideosink_p.h