[go: up one dir, main page]

QMediaMetaData Class

Provides meta-data for media files. More...

Header: #include <QMediaMetaData>
CMake: find_package(Qt6 REQUIRED COMPONENTS Multimedia)
target_link_libraries(mytarget PRIVATE Qt6::Multimedia)
qmake: QT += multimedia

Public Types

enum Key { Title, Author, Comment, Description, Genre, …, HasHdrContent }

Public Functions

void clear()
void insert(QMediaMetaData::Key k, const QVariant &value)
bool isEmpty() const
QList<QMediaMetaData::Key> keys() const
void remove(QMediaMetaData::Key k)
QString stringValue(QMediaMetaData::Key key) const
QVariant value(QMediaMetaData::Key key) const
QVariant &operator[](QMediaMetaData::Key k)

Static Public Members

QString metaDataKeyToString(QMediaMetaData::Key key)

Protected Variables

QHash<QMediaMetaData::Key, QVariant> data

Static Protected Members

QMetaType keyType(QMediaMetaData::Key key)
bool operator!=(const QMediaMetaData &a, const QMediaMetaData &b)
bool operator==(const QMediaMetaData &a, const QMediaMetaData &b)

Detailed Description

Note: Not all identifiers are supported on all platforms.

Common attributes
ValueDescriptionType
TitleThe title of the media.QString
AuthorThe authors of the media.QStringList
CommentA user comment about the media.QString
DescriptionA description of the media.QString
GenreThe genre of the media.QStringList
DateThe date of the media.QDateTime.
LanguageThe language of media.QLocale::Language
PublisherThe publisher of the media.QString
CopyrightThe media's copyright notice.QString
UrlA Url pointing to the origin of the media.QUrl
Media attributes
MediaTypeThe type of the media (audio, video, etc).QString
FileFormatThe file format of the media.QMediaFormat::FileFormat
DurationThe duration in milliseconds of the media.qint64
Audio attributes
AudioBitRateThe bit rate of the media's audio stream in bits per second.int
AudioCodecThe codec of the media's audio stream.QMediaFormat::AudioCodec
Video attributes
VideoFrameRateThe frame rate of the media's video stream.qreal
VideoBitRateThe bit rate of the media's video stream in bits per second.int
VideoCodecThe codec of the media's video stream.QMediaFormat::VideoCodec
HasHdrContentTrue if video is intended for HDR display (FFmpeg and Darwin media backends only).bool
Music attributes
AlbumTitleThe title of the album the media belongs to.QString
AlbumArtistThe principal artist of the album the media belongs to.QString
ContributingArtistThe artists contributing to the media.QStringList
TrackNumberThe track number of the media.int
ComposerThe composer of the media.QStringList
LeadPerformerThe lead performer in the media.QStringList
ThumbnailImageAn embedded thumbnail image if present in metadata.QImage
CoverArtImageAn embedded cover art image.QImage
Image and video attributes
OrientationThe rotation angle of an image or video.int
ResolutionThe dimensions of an image or video.QSize

Member Type Documentation

enum QMediaMetaData::Key

The following meta data keys can be used:

ConstantValueDescription
QMediaMetaData::Title0Media title
QMediaMetaData::Author1Media author
QMediaMetaData::Comment2Comment
QMediaMetaData::Description3Brief desripttion
QMediaMetaData::Genre4Genre the media belongs to
QMediaMetaData::Date5Creation date
QMediaMetaData::Language6Media language
QMediaMetaData::Publisher7Media publisher info.
QMediaMetaData::Copyright8Media copyright info.
QMediaMetaData::Url9Publisher's website URL
QMediaMetaData::Duration10Media playback duration
QMediaMetaData::MediaType11Type of the media
QMediaMetaData::FileFormat12File format
QMediaMetaData::AudioBitRate13 
QMediaMetaData::AudioCodec14 
QMediaMetaData::VideoBitRate15 
QMediaMetaData::VideoCodec16 
QMediaMetaData::VideoFrameRate17 
QMediaMetaData::AlbumTitle18Album's title
QMediaMetaData::AlbumArtist19Artist's info.
QMediaMetaData::ContributingArtist20 
QMediaMetaData::TrackNumber21 
QMediaMetaData::Composer22Media composer's info.
QMediaMetaData::LeadPerformer23 
QMediaMetaData::ThumbnailImage24Media thumbnail image (if embedded in metadata)
QMediaMetaData::CoverArtImage25Media cover art
QMediaMetaData::Orientation26 
QMediaMetaData::Resolution27 
QMediaMetaData::HasHdrContent (since Qt 6.8)28Video may have HDR content (read only, FFmpeg and Darwin media backends only)

Member Function Documentation

[invokable] void QMediaMetaData::clear()

Removes all data from the meta data object.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

[invokable] void QMediaMetaData::insert(QMediaMetaData::Key k, const QVariant &value)

Inserts a value into a Key: k.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

[invokable] bool QMediaMetaData::isEmpty() const

Returns true if the meta data contains no items: otherwise returns false.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

[static protected] QMetaType QMediaMetaData::keyType(QMediaMetaData::Key key)

Returns the meta type used to store data for Key key.

[invokable] QList<QMediaMetaData::Key> QMediaMetaData::keys() const

Returns a QList of QMediaMetaData::Keys.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

[static invokable] QString QMediaMetaData::metaDataKeyToString(QMediaMetaData::Key key)

returns a string representation of key that can be used when presenting meta data to users.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

[invokable] void QMediaMetaData::remove(QMediaMetaData::Key k)

Removes meta data from a Key: k.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

[invokable] QString QMediaMetaData::stringValue(QMediaMetaData::Key key) const

Returns the meta data for key key as a QString.

This is mainly meant to simplify presenting the meta data to a user.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

[invokable] QVariant QMediaMetaData::value(QMediaMetaData::Key key) const

Returns the meta data value for Key key, or a null QVariant if no meta data for the key is available.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

QVariant &QMediaMetaData::operator[](QMediaMetaData::Key k)

Returns data stored at the Key k.

QMediaMetaData rockBallad1;
rockBalad[QMediaMetaData::Genre]="Rock"

Member Variable Documentation

QHash<QMediaMetaData::Key, QVariant> QMediaMetaData::data

This variable holds the meta data.

Note: this is a protected member of its class.

Related Non-Members

bool operator!=(const QMediaMetaData &a, const QMediaMetaData &b)

Compares two meta data objects a and b, and returns false if they are identical or true if they differ.

bool operator==(const QMediaMetaData &a, const QMediaMetaData &b)

Compares two meta data objects a and b, and returns true if they are identical or false if they differ.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.