From 755e23ea8ef02e4b54b10a84d150dd69575068b4 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 12 May 2021 10:54:38 +0200 Subject: 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 --- src/multimedia/qmediaformat.cpp | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'src/multimedia/qmediaformat.cpp') diff --git a/src/multimedia/qmediaformat.cpp b/src/multimedia/qmediaformat.cpp index 4c239e78f..ccf926026 100644 --- a/src/multimedia/qmediaformat.cpp +++ b/src/multimedia/qmediaformat.cpp @@ -67,6 +67,11 @@ const char *mimeTypeForFormat[QMediaFormat::LastFileFormat + 2] = } +class QMediaFormatPrivate : public QSharedData +{}; + +QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QMediaFormatPrivate); + /*! \enum QMediaFormat::FileFormat Describes the container format used in a multimedia file or stream. @@ -91,16 +96,39 @@ const char *mimeTypeForFormat[QMediaFormat::LastFileFormat + 2] = */ // these are non inline to make a possible future addition of a d pointer binary compatible + +/*! + Constucts a QMediaFormat object for \a format. +*/ QMediaFormat::QMediaFormat(FileFormat format) : fmt(format) { - Q_UNUSED(d); } +/*! + Destroys the QMediaFormat object. +*/ QMediaFormat::~QMediaFormat() = default; -QMediaFormat::QMediaFormat(const QMediaFormat &other) = default; -QMediaFormat &QMediaFormat::operator=(const QMediaFormat &other) = default; +/*! + Constructs a QMediaFormat object by copying from \a other. +*/ +QMediaFormat::QMediaFormat(const QMediaFormat &other) noexcept = default; + +/*! + Copies \a other into this QMediaFormat object. +*/ +QMediaFormat &QMediaFormat::operator=(const QMediaFormat &other) noexcept = default; + +/*! \fn QMediaFormat::QMediaFormat(QMediaFormat &&other) + + Constructs a QMediaFormat objects by moving from \a other. +*/ + +/*! \fn QMediaFormat &QMediaFormat::operator=(QMediaFormat &&other) + + Moves \a other into this QMediaFormat objects. +*/ /*! \fn void QMediaFormat::setMediaContainer(QMediaFormat::FileFormat container) -- cgit v1.2.3