diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-05-12 10:54:38 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2021-05-12 13:31:30 +0000 |
commit | 755e23ea8ef02e4b54b10a84d150dd69575068b4 (patch) | |
tree | 61f535ea9f4f871856380969fa1e5643f53d6794 /src/multimedia/qmediaformat.cpp | |
parent | 15aa7f7ea87c98642257bbea8833636621956e2e (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.cpp')
-rw-r--r-- | src/multimedia/qmediaformat.cpp | 34 |
1 files changed, 31 insertions, 3 deletions
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) |