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 ThumbnailImage,
53 CoverArtImage,
54
55 Orientation,
56 Resolution,
57
58 HasHdrContent,
59 };
60 Q_ENUM(Key)
61
62 static constexpr int NumMetaData = HasHdrContent + 1;
63
64// QMetaType typeForKey(Key k);
65 Q_INVOKABLE QVariant value(Key k) const { return data.value(k); }
66 Q_INVOKABLE void insert(Key k, const QVariant &value) { data.insert(k, value); }
67 Q_INVOKABLE void remove(Key k) { data.remove(k); }
68 Q_INVOKABLE QList<Key> keys() const { return data.keys(); }
69
70 QVariant &operator[](Key k) { return data[k]; }
71 Q_INVOKABLE void clear() { data.clear(); }
72
73 Q_INVOKABLE bool isEmpty() const { return data.isEmpty(); }
74 Q_INVOKABLE QString stringValue(Key k) const;
75
76 Q_INVOKABLE static QString metaDataKeyToString(Key k);
77
78 QT_POST_CXX17_API_IN_EXPORTED_CLASS // don't export QHash's key-value-range
79 auto asKeyValueRange() const { return data.asKeyValueRange(); }
80
81protected:
82 Q_MULTIMEDIA_EXPORT friend QDebug operator<<(QDebug, const QMediaMetaData &);
83
84 friend bool operator==(const QMediaMetaData &a, const QMediaMetaData &b)
85 { return a.data == b.data; }
86 friend bool operator!=(const QMediaMetaData &a, const QMediaMetaData &b)
87 { return a.data != b.data; }
88
89 static QMetaType keyType(Key key);
90
91 QHash<Key, QVariant> data;
92};
93
94QT_END_NAMESPACE
95
96Q_DECLARE_METATYPE(QMediaMetaData)
97
98#endif // QMEDIAMETADATA_H
\inmodule QtMultimedia
\inmodule QtMultimedia