QMediaMetaData Class

Provides meta-data for media files. 更多...

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

公共类型

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

公共函数

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 )

静态公共成员

QString metaDataKeyToString (QMediaMetaData::Key key )

Protected Variables

QHash<QMediaMetaData::Key, QVariant> data

静态保护成员

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

详细描述

注意: Not all identifiers are supported on all platforms.

公共属性
描述 类型
Title 媒体标题。 QString
Author 媒体作者。 QStringList
Comment 关于媒体的用户评论。 QString
Description 媒体描述。 QString
Genre 媒体流派。 QStringList
Date 媒体的日期。 QDateTime .
Language The language of media. QLocale::Language
Publisher 媒体出版商。 QString
Copyright 媒体的版权声明。 QString
Url A Url pointing to the origin of the media. QUrl
媒体属性
MediaType 媒体的类型 (音频、视频、等)。 QString
FileFormat The file format of the media. QMediaFormat::FileFormat
Duration 媒体的持续时间 (以毫秒为单位)。 qint64
音频属性
AudioBitRate 媒体音频流的比特率 (以位每秒为单位)。 int
AudioCodec 媒体音频流的编解码器。 QMediaFormat::AudioCodec
视频属性
VideoFrameRate 媒体视频流的帧速率。 qreal
VideoBitRate The bit rate of the media's video stream in bits per second. int
VideoCodec The codec of the media's video stream. QMediaFormat::VideoCodec
音乐属性
AlbumTitle 媒体所属的专辑标题。 QString
AlbumArtist 媒体所属专辑的亲代艺术家。 QString
ContributingArtist 媒体的贡献艺术家。 QStringList
TrackNumber 媒体轨道编号。 int
Composer 媒体的作曲家。 QStringList
LeadPerformer The lead performer in the media. QStringList
ThumbnailImage 嵌入缩略图图像。 QImage
CoverArtImage 嵌入的封面艺术图像。 QImage
图像和视频属性
Orientation The rotation angle of an image or video. int
Resolution 图像或视频的尺度。 QSize

成员类型文档编制

enum QMediaMetaData:: Key

The following meta data keys can be used:

常量 描述
QMediaMetaData::Title 0 Media title
QMediaMetaData::Author 1 Media author
QMediaMetaData::Comment 2 Comment
QMediaMetaData::Description 3 Brief desripttion
QMediaMetaData::Genre 4 Genre the media belongs to
QMediaMetaData::Date 5 Creation date
QMediaMetaData::Language 6 Media language
QMediaMetaData::Publisher 7 Media publisher info.
QMediaMetaData::Copyright 8 Media copyright info.
QMediaMetaData::Url 9 Publisher's website URL
QMediaMetaData::Duration 10 Media playback duration
QMediaMetaData::MediaType 11 Type of the media
QMediaMetaData::FileFormat 12 File format
QMediaMetaData::AudioBitRate 13
QMediaMetaData::AudioCodec 14
QMediaMetaData::VideoBitRate 15
QMediaMetaData::VideoCodec 16
QMediaMetaData::VideoFrameRate 17
QMediaMetaData::AlbumTitle 18 Album's title
QMediaMetaData::AlbumArtist 19 Artist's info.
QMediaMetaData::ContributingArtist 20
QMediaMetaData::TrackNumber 21
QMediaMetaData::Composer 22 Media composer's info.
QMediaMetaData::LeadPerformer 23
QMediaMetaData::ThumbnailImage 24 Media thumbnail image
QMediaMetaData::CoverArtImage 25 Media cover art
QMediaMetaData::Orientation 26
QMediaMetaData::Resolution 27

成员函数文档编制

[invokable] void QMediaMetaData:: clear ()

Removes all data from the meta data object.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

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

插入 value into a Key: k .

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

[invokable] bool QMediaMetaData:: isEmpty () const

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

注意: 此函数可以被援引,通过元对象系统和从 QML。见 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

返回 QList of QMediaMetaData::Keys.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 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.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

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

Removes meta data from a Key: k .

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

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

Returns the meta data for key key 作为 QString .

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

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

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

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

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

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

Returns data stored at the Key k .

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

成员变量文档编制

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

This variable holds the meta data.

注意: this is a protected member of its class.

相关非成员

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

Compares two meta data objects a and b ,并返回 false if they are identical or true 若它们不同。

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

Compares two meta data objects a and b ,并返回 true if they are identical or false 若它们不同。