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#include <gst/gst.h>
5
6#include "qgstreamermessage_p.h"
7
8QT_BEGIN_NAMESPACE
9
10/*!
11 \class QGstreamerMessage
12 \internal
13*/
14
15QGstreamerMessage::QGstreamerMessage(GstMessage* message):
16 m_message(message)
17{
18 gst_message_ref(msg: m_message);
19}
20
21QGstreamerMessage::QGstreamerMessage(QGstreamerMessage const& m):
22 m_message(m.m_message)
23{
24 gst_message_ref(msg: m_message);
25}
26
27QGstreamerMessage::QGstreamerMessage(const QGstStructure &structure)
28{
29 gst_structure_get(structure: structure.structure, first_fieldname: "message", GST_TYPE_MESSAGE, &m_message, nullptr);
30}
31
32QGstreamerMessage::~QGstreamerMessage()
33{
34 if (m_message != nullptr)
35 gst_message_unref(msg: m_message);
36}
37
38GstMessage* QGstreamerMessage::rawMessage() const
39{
40 return m_message;
41}
42
43QGstreamerMessage& QGstreamerMessage::operator=(QGstreamerMessage const& rhs)
44{
45 if (rhs.m_message != m_message) {
46 if (rhs.m_message != nullptr)
47 gst_message_ref(msg: rhs.m_message);
48
49 if (m_message != nullptr)
50 gst_message_unref(msg: m_message);
51
52 m_message = rhs.m_message;
53 }
54
55 return *this;
56}
57
58QT_END_NAMESPACE
59

source code of qtmultimedia/src/plugins/multimedia/gstreamer/common/qgstreamermessage.cpp