Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qmediametadata.h
Go to the documentation of this file.
1// Copyright (C) 2016 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 QMEDIAMETADATA_H
5#define QMEDIAMETADATA_H
6
7#if 0
8#pragma qt_class(QMediaMetaData)
9#endif
10
11#include <QtCore/qvariant.h>
12#include <QtCore/qstring.h>
13#include <QtCore/qhash.h>
14#include <QtMultimedia/qtmultimediaglobal.h>
15
17
18class Q_MULTIMEDIA_EXPORT QMediaMetaData
19{
20 Q_GADGET
21public:
22 enum Key {
23 Title,
24 Author,
25 Comment,
26 Description,
27 Genre,
28 Date,
29
30 Language,
31 Publisher,
32 Copyright,
33 Url,
34
35 Duration,
36 MediaType,
37 FileFormat,
38
39 AudioBitRate,
40 AudioCodec,
41 VideoBitRate,
42 VideoCodec,
43 VideoFrameRate,
44
45 AlbumTitle,
46 AlbumArtist,
47 ContributingArtist,
48 TrackNumber,
49 Composer,
50 LeadPerformer,
51
52#if QT_DEPRECATED_SINCE(6, 12)
53 ThumbnailImage Q_DECL_ENUMERATOR_DEPRECATED_X("Use CoverArtImage instead"),
54#endif
55 CoverArtImage = LeadPerformer + 2,
56
57 Orientation,
58 Resolution,
59
60 HasHdrContent,
61 };
62 Q_ENUM(Key)
63
64 static constexpr int NumMetaData = HasHdrContent + 1;
65
66// QMetaType typeForKey(Key k);
67 Q_INVOKABLE QVariant value(Key k) const { return data.value(k); }
68 Q_INVOKABLE void insert(Key k, const QVariant &value) { data.insert(k, value); }
69 Q_INVOKABLE void remove(Key k) { data.remove(k); }
70 Q_INVOKABLE QList<Key> keys() const { return data.keys(); }
71
72 QVariant &operator[](Key k) { return data[k]; }
73 Q_INVOKABLE void clear() { data.clear(); }
74
75 Q_INVOKABLE bool isEmpty() const { return data.isEmpty(); }
76 Q_INVOKABLE QString stringValue(Key k) const;
77
78 Q_INVOKABLE static QString metaDataKeyToString(Key k);
79
80 QT_POST_CXX17_API_IN_EXPORTED_CLASS // don't export QHash's key-value-range
81 auto asKeyValueRange() const { return data.asKeyValueRange(); }
82
83protected:
84 Q_MULTIMEDIA_EXPORT friend QDebug operator<<(QDebug, const QMediaMetaData &);
85
86 friend bool operator==(const QMediaMetaData &a, const QMediaMetaData &b)
87 { return a.data == b.data; }
88 friend bool operator!=(const QMediaMetaData &a, const QMediaMetaData &b)
89 { return a.data != b.data; }
90
91 static QMetaType keyType(Key key);
92
93 QHash<Key, QVariant> data;
94};
95
96QT_END_NAMESPACE
97
98Q_DECLARE_METATYPE(QMediaMetaData)
99
100#endif // QMEDIAMETADATA_H
\inmodule QtMultimedia
\inmodule QtMultimedia
Combined button and popup list for selecting options.