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 QGSTREAMERMESSAGE_P_H |
5 | #define QGSTREAMERMESSAGE_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 <private/qtmultimediaglobal_p.h> |
19 | #include "qgst_p.h" |
20 | |
21 | QT_BEGIN_NAMESPACE |
22 | |
23 | // Required for QDoc workaround |
24 | class QString; |
25 | |
26 | template <> |
27 | struct QGstPointerImpl::QGstRefcountingAdaptor<GstMessage> |
28 | { |
29 | static void ref(GstMessage *arg) noexcept { gst_message_ref(msg: arg); } |
30 | static void unref(GstMessage *arg) noexcept { gst_message_unref(msg: arg); } |
31 | }; |
32 | |
33 | class QGstreamerMessage : public QGstPointerImpl::QGstObjectWrapper<GstMessage> |
34 | { |
35 | using BaseClass = QGstPointerImpl::QGstObjectWrapper<GstMessage>; |
36 | |
37 | public: |
38 | using BaseClass::BaseClass; |
39 | QGstreamerMessage(const QGstreamerMessage &) = default; |
40 | QGstreamerMessage(QGstreamerMessage &&) noexcept = default; |
41 | QGstreamerMessage &operator=(const QGstreamerMessage &) = default; |
42 | QGstreamerMessage &operator=(QGstreamerMessage &&) noexcept = default; |
43 | |
44 | GstMessageType type() const { return GST_MESSAGE_TYPE(get()); } |
45 | QGstObject source() const { return QGstObject(GST_MESSAGE_SRC(get()), QGstObject::NeedsRef); } |
46 | QGstStructureView structure() const { return QGstStructureView(gst_message_get_structure(message: get())); } |
47 | |
48 | GstMessage *message() const { return get(); } |
49 | }; |
50 | |
51 | QT_END_NAMESPACE |
52 | |
53 | Q_DECLARE_METATYPE(QGstreamerMessage); |
54 | |
55 | #endif |
56 |