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 QGSTREAMERVIDEOOVERLAY_P_H |
5 | #define QGSTREAMERVIDEOOVERLAY_P_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 <qgstpipeline_p.h> |
19 | #include <qgstreamerbufferprobe_p.h> |
20 | #include <qgst_p.h> |
21 | #include <QtGui/qwindowdefs.h> |
22 | |
23 | QT_BEGIN_NAMESPACE |
24 | class QGstreamerVideoSink; |
25 | |
26 | class Q_MULTIMEDIA_EXPORT QGstreamerVideoOverlay |
27 | : public QObject |
28 | , public QGstreamerSyncMessageFilter |
29 | , private QGstreamerBufferProbe |
30 | { |
31 | Q_OBJECT |
32 | public: |
33 | explicit QGstreamerVideoOverlay(QGstreamerVideoSink *parent = 0, const QByteArray &elementName = QByteArray()); |
34 | virtual ~QGstreamerVideoOverlay(); |
35 | |
36 | QGstElement videoSink() const; |
37 | void setVideoSink(QGstElement); |
38 | QSize nativeVideoSize() const; |
39 | |
40 | void setWindowHandle(WId id); |
41 | void setRenderRectangle(const QRect &rect); |
42 | |
43 | void setAspectRatioMode(Qt::AspectRatioMode mode); |
44 | void setFullScreen(bool fullscreen); |
45 | |
46 | bool processSyncMessage(const QGstreamerMessage &message) override; |
47 | |
48 | bool isNull() const { return m_videoSink.isNull(); } |
49 | |
50 | Q_SIGNALS: |
51 | void nativeVideoSizeChanged(); |
52 | void activeChanged(); |
53 | |
54 | private: |
55 | void probeCaps(GstCaps *caps) override; |
56 | void applyRenderRect(); |
57 | |
58 | QGstreamerVideoSink *m_gstreamerVideoSink = nullptr; |
59 | QGstElement m_videoSink; |
60 | QSize m_nativeVideoSize; |
61 | |
62 | bool m_hasForceAspectRatio = false; |
63 | bool m_hasFullscreen = false; |
64 | Qt::AspectRatioMode m_aspectRatioMode = Qt::KeepAspectRatio; |
65 | bool m_fullScreen = false; |
66 | |
67 | WId m_windowId = 0; |
68 | QRect renderRect; |
69 | }; |
70 | |
71 | QT_END_NAMESPACE |
72 | |
73 | #endif // QGSTREAMERVIDEOOVERLAY_P_H |
74 | |
75 | |