summaryrefslogtreecommitdiffstats
path: root/src/multimedia/qmediaformat.h
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2021-05-12 10:54:38 +0200
committerLars Knoll <lars.knoll@qt.io>2021-05-12 13:31:30 +0000
commit755e23ea8ef02e4b54b10a84d150dd69575068b4 (patch)
tree61f535ea9f4f871856380969fa1e5643f53d6794 /src/multimedia/qmediaformat.h
parent15aa7f7ea87c98642257bbea8833636621956e2e (diff)
Make QMediaFormat movable
The d-pointer is only a reserved placeholder, but make it a QExplicitlySharedDataPointer anyway. The default constructor just initializes to zero, so the overhead is marginal, but makes it safe to extend in the future if needed. Change-Id: Ib6269f59b59af05647c0f9295ce634d5c327339e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/multimedia/qmediaformat.h')
-rw-r--r--src/multimedia/qmediaformat.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/multimedia/qmediaformat.h b/src/multimedia/qmediaformat.h
index addd25a51..c8bfaf6c5 100644
--- a/src/multimedia/qmediaformat.h
+++ b/src/multimedia/qmediaformat.h
@@ -50,6 +50,8 @@ class QMediaFormat;
class QMediaEncoderSettings;
class QMediaFormatPrivate;
+QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QMediaFormatPrivate, Q_MULTIMEDIA_EXPORT)
+
class Q_MULTIMEDIA_EXPORT QMediaFormat
{
public:
@@ -110,8 +112,13 @@ public:
QMediaFormat(FileFormat format = UnspecifiedFormat);
~QMediaFormat();
- QMediaFormat(const QMediaFormat &other);
- QMediaFormat &operator=(const QMediaFormat &other);
+ QMediaFormat(const QMediaFormat &other) noexcept;
+ QMediaFormat &operator=(const QMediaFormat &other) noexcept;
+
+ QMediaFormat(QMediaFormat &&other) noexcept = default;
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QMediaFormat)
+ void swap(QMediaFormat &other) noexcept
+ { qSwap(d, other.d); }
FileFormat format() const { return fmt; }
void setFormat(FileFormat f) { fmt = f; }
@@ -147,7 +154,7 @@ protected:
FileFormat fmt;
AudioCodec audio = AudioCodec::Unspecified;
VideoCodec video = VideoCodec::Unspecified;
- QMediaFormatPrivate *d = nullptr;
+ QExplicitlySharedDataPointer<QMediaFormatPrivate> d;
};
QT_END_NAMESPACE