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