| 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 |  | 
|---|
| 29 | QT_BEGIN_NAMESPACE | 
|---|
| 30 |  | 
|---|
| 31 | // Required for QDoc workaround | 
|---|
| 32 | class QString; | 
|---|
| 33 |  | 
|---|
| 34 | class Q_MULTIMEDIA_EXPORT QPlatformVideoSink : public QObject | 
|---|
| 35 | { | 
|---|
| 36 | Q_OBJECT | 
|---|
| 37 |  | 
|---|
| 38 | public: | 
|---|
| 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 | void setVideoFrame(const QVideoFrame &frame); | 
|---|
| 60 |  | 
|---|
| 61 | QVideoFrame currentVideoFrame() const; | 
|---|
| 62 |  | 
|---|
| 63 | void setSubtitleText(const QString &subtitleText); | 
|---|
| 64 |  | 
|---|
| 65 | QString subtitleText() const; | 
|---|
| 66 |  | 
|---|
| 67 | protected: | 
|---|
| 68 | explicit QPlatformVideoSink(QVideoSink *parent); | 
|---|
| 69 |  | 
|---|
| 70 | virtual void onVideoFrameChanged(const QVideoFrame &) { } | 
|---|
| 71 |  | 
|---|
| 72 | Q_SIGNALS: | 
|---|
| 73 | void rhiChanged(); | 
|---|
| 74 |  | 
|---|
| 75 | private: | 
|---|
| 76 | QVideoSink *const m_sink = nullptr; | 
|---|
| 77 | mutable QMutex m_mutex; // Protects all members below | 
|---|
| 78 | QSize m_nativeSize; | 
|---|
| 79 | QString m_subtitleText; | 
|---|
| 80 | QVideoFrame m_currentVideoFrame; | 
|---|
| 81 | }; | 
|---|
| 82 |  | 
|---|
| 83 | QT_END_NAMESPACE | 
|---|
| 84 |  | 
|---|
| 85 |  | 
|---|
| 86 | #endif | 
|---|
| 87 |  | 
|---|