diff options
author | Jøger Hansegård <joger.hansegard@qt.io> | 2023-11-24 11:56:59 +0100 |
---|---|---|
committer | Jøger Hansegård <joger.hansegard@qt.io> | 2023-12-01 15:00:49 +0100 |
commit | 037dcb2c2e685f261cbcf625b437520b092fc3f2 (patch) | |
tree | d13e9480638d742cfa4ed5bb3c774db18f290f53 /src/plugins/multimedia/ffmpeg/playbackengine/qffmpegmediadataholder_p.h | |
parent | 44c4ab5b4d13e71262a3832b2ae54afafec0ba29 (diff) |
Add support for thumbnail metadata in QMediaPlayer with FFmpeg backend
Video and audio files, can have an embedded thumbnail image. Video
players such as VLC and Windows Media Player can show this image in a
playlist or as a video background.
This patch adds support for reading thumbnails as metadata from the
QMediaPlayer if the file has an attached picture. If the file does not
contain any attached picture, the ThumbnailImage metadata item is empty/
QVariant(Invalid).
FFmpeg encodes the thumbnail image in its own video stream, separate
from the main video payload. This 'ATTACHED_PIC' video stream contains
just a single image that is encoded with the image encoding. Since this
stream can not be decoded through the regular FFmpeg video decoding, we
have to exclude it from QMediaPlayer's regular video streams. This way
we avoid decoding errors when loading video files with attached
thumbnails.
To test this change, the nokia-tune.mp3 media file now has an attached
icon, and a couple of video files with embedded thumbnails were added.
The duration of the nokia-tune.mp3 changed because it was downsampled
to reduce its size.
This change also fixes a code style issue in declaring the
ffmpegTagToMetaDataKey.
Fixes: QTBUG-116324
Pick-to: 6.6 6.5
Change-Id: I321c5166fdef104eb1d1d1c8a64b9f3dc26b4509
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mikko Hallamaa <mikko.hallamaa@qt.io>
Diffstat (limited to 'src/plugins/multimedia/ffmpeg/playbackengine/qffmpegmediadataholder_p.h')
-rw-r--r-- | src/plugins/multimedia/ffmpeg/playbackengine/qffmpegmediadataholder_p.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/plugins/multimedia/ffmpeg/playbackengine/qffmpegmediadataholder_p.h b/src/plugins/multimedia/ffmpeg/playbackengine/qffmpegmediadataholder_p.h index 6dee7f9eb..34d5cced2 100644 --- a/src/plugins/multimedia/ffmpeg/playbackengine/qffmpegmediadataholder_p.h +++ b/src/plugins/multimedia/ffmpeg/playbackengine/qffmpegmediadataholder_p.h @@ -97,6 +97,7 @@ private: StreamIndexes m_requestedStreams = { -1, -1, -1 }; qint64 m_duration = 0; QMediaMetaData m_metaData; + std::optional<QImage> m_cachedThumbnail; }; } // namespace QFFmpeg |