summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/multimedia/qmediaformat.cpp34
-rw-r--r--src/multimedia/qmediaformat.h13
2 files changed, 41 insertions, 6 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)
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