summaryrefslogtreecommitdiffstats
path: root/examples/multimedia/player
diff options
context:
space:
mode:
authorJøger Hansegård <joger.hansegard@qt.io>2024-05-08 16:55:12 +0200
committerJøger Hansegård <joger.hansegard@qt.io>2024-05-14 09:15:15 +0200
commit2b2c3eec38576cf1fd3d571c1aaecf79ff301903 (patch)
tree2259853a10716506fd000c50e1dec7136026abcc /examples/multimedia/player
parent61ad94324811ef20849c97823cda00390f15d7a6 (diff)
Add HasHdrContent to QMediaMetaData::Key enumeration
The HasHdrContent metadata key can be used to determine if a video track potentially contains HDR video. QMediaMetaData::value(QMediaMetaData::HasHdrContent) will return true when the decoder reports that the video uses ColorTransfer_ST2084 or ColorTransfer_STD_B67. These are color transfers used with Dolby Vision videos, for example HDR video recorded with an iPhone. Note that even if HasHdrContent is true, the video may still not utilize the extended dynamic range. This simplified approach is chosen because it is fast, and does not require decoding video frames to determine the actual range being used. Qt Multimedia still does not support proper display of HDR content, but the new metadata key can be used to determine if the video is a SDR video that will be presented correctly. Supported on FFmpeg media backend only. Fixes: QTBUG-114427 Change-Id: I7361d8c61838a66a61d18a2b9e6c8d75a6bdbdb8 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Tim Blechmann <tim@klingt.org>
Diffstat (limited to 'examples/multimedia/player')
-rw-r--r--examples/multimedia/player/player.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/examples/multimedia/player/player.cpp b/examples/multimedia/player/player.cpp
index c674554e8..f5590b0e6 100644
--- a/examples/multimedia/player/player.cpp
+++ b/examples/multimedia/player/player.cpp
@@ -301,6 +301,20 @@ void Player::metaDataChanged()
m_metaDataFields[i]->setDisabled(false);
m_metaDataLabels[i]->setDisabled(false);
}
+
+ const QList<QMediaMetaData> tracks = m_player->videoTracks();
+ const int currentVideoTrack = m_player->activeVideoTrack();
+ if (currentVideoTrack >= 0 && currentVideoTrack < tracks.size()) {
+ const QMediaMetaData track = tracks.value(currentVideoTrack);
+ for (const QMediaMetaData::Key &key : track.keys()) {
+ if (QLineEdit *field = qobject_cast<QLineEdit *>(m_metaDataFields[key])) {
+ QString stringValue = track.stringValue(key);
+ field->setText(stringValue);
+ }
+ m_metaDataFields[key]->setDisabled(true);
+ m_metaDataLabels[key]->setDisabled(true);
+ }
+ }
#endif
}