Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QMediaMetaData Class Reference

\inmodule QtMultimedia More...

#include <qmediametadata.h>

+ Inheritance diagram for QMediaMetaData:
+ Collaboration diagram for QMediaMetaData:

Public Types

enum  Key {
  Title , Author , Comment , Description ,
  Genre , Date , Language , Publisher ,
  Copyright , Url , Duration , MediaType ,
  FileFormat , AudioBitRate , AudioCodec , VideoBitRate ,
  VideoCodec , VideoFrameRate , AlbumTitle , AlbumArtist ,
  ContributingArtist , TrackNumber , Composer , LeadPerformer ,
  ThumbnailImage , CoverArtImage , Orientation , Resolution
}
 Provides meta-data for media files. More...
 

Public Member Functions

Q_INVOKABLE QVariant value (Key k) const
 \variable QMediaMetaData::NumMetaData
 
Q_INVOKABLE void insert (Key k, const QVariant &value)
 \qmlmethod void QtMultimedia::mediaMetaData::insert(Key k, variant value) Inserts a value into a Key: {k}.
 
Q_INVOKABLE void remove (Key k)
 \qmlmethod void QtMultimedia::mediaMetaData::remove(Key k) Removes meta data from a Key: {k}.
 
Q_INVOKABLE QList< Keykeys () const
 \qmlmethod list<Key> QtMultimedia::mediaMetaData::keys() Returns a list of MediaMetaData.Keys.
 
QVariantoperator[] (Key k)
 Returns data stored at the Key {k}.
 
Q_INVOKABLE void clear ()
 \qmlmethod void QtMultimedia::mediaMetaData::clear() Removes all data from the MediaMetaData object.
 
Q_INVOKABLE bool isEmpty () const
 \qmlmethod bool QtMultimedia::mediaMetaData::isEmpty() Returns true if the meta data contains no items: otherwise returns {false}.
 
Q_INVOKABLE QString stringValue (Key k) const
 \qmlmethod string QtMultimedia::mediaMetaData::stringValue(Key key) Returns the meta data for key key as a QString.
 

Static Public Member Functions

static Q_INVOKABLE QString metaDataKeyToString (Key k)
 \qmlmethod string QtMultimedia::mediaMetaData::metaDataKeyToString(Key key) returns a string representation of key that can be used when presenting meta data to users.
 

Static Public Attributes

static constexpr int NumMetaData = Resolution + 1
 

Static Protected Member Functions

static QMetaType keyType (Key key)
 Returns the meta type used to store data for Key key.
 

Protected Attributes

QHash< Key, QVariantdata
 

Friends

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.
 
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.
 

Detailed Description

\inmodule QtMultimedia

Provides meta-data for media files.

Note
Not all identifiers are supported on all platforms.

\table 60% \header

  • {3,1} Common attributes \header
  • Value
  • Description
  • Type \row
  • Title
  • The title of the media.
  • QString \row
  • Author
  • The authors of the media.
  • QStringList \row
  • Comment
  • A user comment about the media.
  • QString \row
  • Description
  • A description of the media.
  • QString \row
  • Genre
  • The genre of the media.
  • QStringList \row
  • Date
  • The date of the media.
  • QDateTime. \row
  • Language
  • The language of media.
  • QLocale::Language

\row

  • Publisher
  • The publisher of the media.
  • QString \row
  • Copyright
  • The media's copyright notice.
  • QString \row
  • Url
  • A Url pointing to the origin of the media.
  • QUrl

\header

  • {3,1} Media attributes \row
  • MediaType
  • The type of the media (audio, video, etc).
  • QString \row
  • FileFormat
  • The file format of the media.
  • QMediaFormat::FileFormat \row
  • Duration
  • The duration in millseconds of the media.
  • qint64

\header

  • {3,1} Audio attributes \row
  • AudioBitRate
  • The bit rate of the media's audio stream in bits per second.
  • int \row
  • AudioCodec
  • The codec of the media's audio stream.
  • QMediaFormat::AudioCodec

\header

  • {3,1} Video attributes \row
  • VideoFrameRate
  • The frame rate of the media's video stream.
  • qreal \row
  • VideoBitRate
  • The bit rate of the media's video stream in bits per second.
  • int \row
  • VideoCodec
  • The codec of the media's video stream.
  • QMediaFormat::VideoCodec

\header

  • {3,1} Music attributes \row
  • AlbumTitle
  • The title of the album the media belongs to.
  • QString \row
  • AlbumArtist
  • The principal artist of the album the media belongs to.
  • QString \row
  • ContributingArtist
  • The artists contributing to the media.
  • QStringList \row
  • TrackNumber
  • The track number of the media.
  • int \row
  • Composer
  • The composer of the media.
  • QStringList \row
  • LeadPerformer
  • The lead performer in the media.
  • QStringList

\row

  • ThumbnailImage
  • An embedded thumbnail image if present in metadata.
  • QImage \row
  • CoverArtImage
  • An embedded cover art image.
  • QImage

\header

  • {3,1} Image and video attributes \row
  • Orientation
  • The rotation angle of an image or video.
  • int \row
  • Resolution
  • The dimensions of an image or video.
  • QSize

\endtable

Definition at line 22 of file qmediametadata.h.

Member Enumeration Documentation

◆ Key

Provides meta-data for media files.

\qmlvaluetype mediaMetaData
\ingroup qmlvaluetypes
\inqmlmodule QtMultimedia
\since 6.2

! \instantiates QMediaMetaData

Meta-data is supplementary data describing media. See QMediaMetaData for available meta data attributes.

The following meta data keys can be used:

\value Title Media title \value Author Media author \value Comment Comment \value Description Brief desripttion \value Genre Genre the media belongs to \value Date Creation date \value Language Media language \value Publisher Media publisher info. \value Copyright Media copyright info. \value Url Publisher's website URL \value Duration Media playback duration \value MediaType Type of the media \value FileFormat File format \value AudioBitRate \value AudioCodec \value VideoBitRate \value VideoCodec \value VideoFrameRate \value AlbumTitle Album's title \value AlbumArtist Artist's info. \value ContributingArtist \value TrackNumber \value Composer Media composer's info. \value LeadPerformer \value ThumbnailImage Media thumbnail image (if embedded in metadata) \value CoverArtImage Media cover art \value Orientation \value Resolution

Enumerator
Title 
Author 
Comment 
Description 
Genre 
Date 
Language 
Publisher 
Copyright 
Url 
Duration 
MediaType 
FileFormat 
AudioBitRate 
AudioCodec 
VideoBitRate 
VideoCodec 
VideoFrameRate 
AlbumTitle 
AlbumArtist 
ContributingArtist 
TrackNumber 
Composer 
LeadPerformer 
ThumbnailImage 
CoverArtImage 
Orientation 
Resolution 

Definition at line 26 of file qmediametadata.h.

Member Function Documentation

◆ clear()

void QMediaMetaData::clear ( )
inline

\qmlmethod void QtMultimedia::mediaMetaData::clear() Removes all data from the MediaMetaData object.

Removes all data from the meta data object.

Definition at line 73 of file qmediametadata.h.

Referenced by QGstreamerMediaPlayer::setMedia(), and AVFMediaPlayer::setMedia().

+ Here is the caller graph for this function:

◆ insert()

void QMediaMetaData::insert ( QMediaMetaData::Key k,
const QVariant & value )
inline

\qmlmethod void QtMultimedia::mediaMetaData::insert(Key k, variant value) Inserts a value into a Key: {k}.

Inserts a value into a Key: {k}.

Definition at line 68 of file qmediametadata.h.

Referenced by QAndroidMetaData::QAndroidMetaData(), QT_BEGIN_NAMESPACE::addTagsFromExtendedComment(), QT_BEGIN_NAMESPACE::addTagToMetaData(), QAndroidMetaData::extractMetadata(), AVFMetaData::fromAsset(), AVFMetaData::fromAssetTrack(), fromAVMetadata(), MFMetaData::fromNative(), QGstreamerImageCapture::probeBuffer(), QGstreamerMediaPlayer::processBusMessage(), and Q_LOGGING_CATEGORY().

+ Here is the caller graph for this function:

◆ isEmpty()

bool QMediaMetaData::isEmpty ( ) const
inline

\qmlmethod bool QtMultimedia::mediaMetaData::isEmpty() Returns true if the meta data contains no items: otherwise returns {false}.

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

Definition at line 75 of file qmediametadata.h.

Referenced by QGstreamerMediaPlayer::setMedia(), and AVFMediaPlayer::setMedia().

+ Here is the caller graph for this function:

◆ keys()

QMediaMetaData::keys ( ) const
inline

\qmlmethod list<Key> QtMultimedia::mediaMetaData::keys() Returns a list of MediaMetaData.Keys.

Returns a QList of QMediaMetaData::Keys.

Definition at line 70 of file qmediametadata.h.

Referenced by QImageCapture::addMetaData(), QMediaRecorder::addMetaData(), QT_BEGIN_NAMESPACE::addTagToMetaData(), applyMetaDataToTagSetter(), QGstreamerMediaPlayer::processBusMessage(), QFFmpegMetaData::toAVMetaData(), AVFMetaData::toAVMetadataForFormat(), and MFMetaData::toNative().

+ Here is the caller graph for this function:

◆ keyType()

QMetaType QMediaMetaData::keyType ( Key key)
staticprotected

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

Definition at line 81 of file qmediametadata.cpp.

References AlbumArtist, AlbumTitle, AudioBitRate, AudioCodec, Author, Comment, Composer, ContributingArtist, Copyright, CoverArtImage, Date, Description, Duration, FileFormat, Genre, Language, LeadPerformer, MediaType, Orientation, Publisher, Resolution, ThumbnailImage, Title, TrackNumber, Url, VideoBitRate, VideoCodec, and VideoFrameRate.

Referenced by QFFmpegMetaData::addEntry(), and QFFmpegMetaData::value().

+ Here is the caller graph for this function:

◆ metaDataKeyToString()

QString QMediaMetaData::metaDataKeyToString ( QMediaMetaData::Key key)
static

\qmlmethod string QtMultimedia::mediaMetaData::metaDataKeyToString(Key key) returns a string representation of key that can be used when presenting meta data to users.

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

Definition at line 423 of file qmediametadata.cpp.

References AlbumArtist, AlbumTitle, AudioBitRate, AudioCodec, Author, Comment, Composer, ContributingArtist, Copyright, CoverArtImage, Date, Description, Duration, FileFormat, Genre, Language, LeadPerformer, MediaType, Orientation, Publisher, Resolution, ThumbnailImage, Title, TrackNumber, QCoreApplication::translate(), Url, VideoBitRate, VideoCodec, and VideoFrameRate.

+ Here is the call graph for this function:

◆ operator[]()

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

Returns data stored at the Key {k}.

QMediaMetaData rockBallad1;
rockBalad[QMediaMetaData::Genre]="Rock"
\inmodule QtMultimedia

Definition at line 72 of file qmediametadata.h.

◆ remove()

void QMediaMetaData::remove ( QMediaMetaData::Key k)
inline

\qmlmethod void QtMultimedia::mediaMetaData::remove(Key k) Removes meta data from a Key: {k}.

Removes meta data from a Key: {k}.

Definition at line 69 of file qmediametadata.h.

◆ stringValue()

QString QMediaMetaData::stringValue ( QMediaMetaData::Key key) const

\qmlmethod string QtMultimedia::mediaMetaData::stringValue(Key key) Returns the meta data for key key as a QString.

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

Returns the meta data for key key as a QString.

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

Definition at line 360 of file qmediametadata.cpp.

References AlbumArtist, AlbumTitle, AudioBitRate, AudioCodec, QMediaFormat::audioCodecName(), Author, Comment, Composer, ContributingArtist, Copyright, CoverArtImage, Date, Description, Duration, FileFormat, QMediaFormat::fileFormatName(), QTime::fromMSecsSinceStartOfDay(), Genre, Language, QLocale::languageToString(), LeadPerformer, MediaType, Orientation, Publisher, QStringLiteral, Resolution, ThumbnailImage, time, Title, TrackNumber, Url, QVariant::value(), VideoBitRate, VideoCodec, QMediaFormat::videoCodecName(), and VideoFrameRate.

Referenced by MFMetaData::toNative().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ value()

QVariant QMediaMetaData::value ( QMediaMetaData::Key key) const
inline

\variable QMediaMetaData::NumMetaData

\qmlmethod variant QtMultimedia::mediaMetaData::value(Key key)

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

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

Definition at line 67 of file qmediametadata.h.

References QVariant::value().

Referenced by QImageCapture::addMetaData(), QMediaRecorder::addMetaData(), applyMetaDataToTagSetter(), AVFMetaData::fromAssetTrack(), QGstreamerMediaPlayer::processBusMessage(), AVFMetaData::toAVMetadataForFormat(), MFMetaData::toNative(), and QFFmpegMetaData::value().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ operator!=

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

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

Definition at line 83 of file qmediametadata.h.

◆ operator==

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

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

Definition at line 81 of file qmediametadata.h.

Member Data Documentation

◆ data

QHash<Key, QVariant> QMediaMetaData::data
protected

Definition at line 88 of file qmediametadata.h.

◆ NumMetaData

constexpr int QMediaMetaData::NumMetaData = Resolution + 1
staticconstexpr

Definition at line 64 of file qmediametadata.h.


The documentation for this class was generated from the following files: