| 1 | // Copyright (C) 2025 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 | #ifndef QPLAYBACKOPTIONS_H |
| 5 | #define QPLAYBACKOPTIONS_H |
| 6 | |
| 7 | #include <QtMultimedia/qtmultimediaexports.h> |
| 8 | #include <QtMultimedia/qtmultimediaglobal.h> |
| 9 | #include <QtCore/qcompare.h> |
| 10 | #include <QtCore/qobject.h> |
| 11 | #include <QtCore/qshareddata.h> |
| 12 | |
| 13 | #include <chrono> |
| 14 | |
| 15 | QT_BEGIN_NAMESPACE |
| 16 | |
| 17 | class QPlaybackOptionsPrivate; |
| 18 | QT_DECLARE_QESDP_SPECIALIZATION_DTOR(QPlaybackOptionsPrivate) |
| 19 | |
| 20 | class QPlaybackOptions |
| 21 | { |
| 22 | Q_GADGET_EXPORT(Q_MULTIMEDIA_EXPORT) |
| 23 | Q_PROPERTY(std::chrono::milliseconds networkTimeout READ networkTimeout WRITE setNetworkTimeout RESET |
| 24 | resetNetworkTimeout FINAL) |
| 25 | Q_PROPERTY(PlaybackIntent playbackIntent READ playbackIntent WRITE setPlaybackIntent RESET |
| 26 | resetPlaybackIntent) |
| 27 | Q_PROPERTY(qsizetype probeSize READ probeSize WRITE setProbeSize RESET resetProbeSize) |
| 28 | Q_CLASSINFO("RegisterEnumClassesUnscoped", "false") |
| 29 | public: |
| 30 | enum class PlaybackIntent { |
| 31 | Playback, |
| 32 | LowLatencyStreaming, |
| 33 | }; |
| 34 | Q_ENUM(PlaybackIntent) |
| 35 | |
| 36 | Q_MULTIMEDIA_EXPORT QPlaybackOptions(); |
| 37 | Q_MULTIMEDIA_EXPORT QPlaybackOptions(const QPlaybackOptions &); |
| 38 | Q_MULTIMEDIA_EXPORT QPlaybackOptions &operator=(const QPlaybackOptions &); |
| 39 | QPlaybackOptions(QPlaybackOptions &&) noexcept = default; |
| 40 | QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPlaybackOptions) |
| 41 | Q_MULTIMEDIA_EXPORT ~QPlaybackOptions(); |
| 42 | |
| 43 | void swap(QPlaybackOptions &other) noexcept { d.swap(other&: other.d); } |
| 44 | |
| 45 | Q_MULTIMEDIA_EXPORT std::chrono::milliseconds networkTimeout() const; |
| 46 | Q_MULTIMEDIA_EXPORT void setNetworkTimeout(std::chrono::milliseconds timeout); |
| 47 | Q_MULTIMEDIA_EXPORT void resetNetworkTimeout(); |
| 48 | |
| 49 | Q_MULTIMEDIA_EXPORT PlaybackIntent playbackIntent() const; |
| 50 | Q_MULTIMEDIA_EXPORT void setPlaybackIntent(PlaybackIntent intent); |
| 51 | Q_MULTIMEDIA_EXPORT void resetPlaybackIntent(); |
| 52 | |
| 53 | Q_MULTIMEDIA_EXPORT qsizetype probeSize() const; |
| 54 | Q_MULTIMEDIA_EXPORT void setProbeSize(qsizetype probeSizeBytes); |
| 55 | Q_MULTIMEDIA_EXPORT void resetProbeSize(); |
| 56 | |
| 57 | private: |
| 58 | friend Q_MULTIMEDIA_EXPORT bool comparesEqual(const QPlaybackOptions &lhs, |
| 59 | const QPlaybackOptions &rhs) noexcept; |
| 60 | friend Q_MULTIMEDIA_EXPORT Qt::strong_ordering compareThreeWay(const QPlaybackOptions &lhs, |
| 61 | const QPlaybackOptions &rhs) noexcept; |
| 62 | Q_DECLARE_STRONGLY_ORDERED(QPlaybackOptions) |
| 63 | |
| 64 | friend class QPlaybackOptionsPrivate; |
| 65 | QExplicitlySharedDataPointer<QPlaybackOptionsPrivate> d; |
| 66 | }; |
| 67 | |
| 68 | Q_DECLARE_SHARED(QPlaybackOptions) |
| 69 | |
| 70 | QT_END_NAMESPACE |
| 71 | |
| 72 | #endif |
| 73 |
