diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-07-13 22:55:35 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-07-23 15:58:55 -0700 |
commit | c7428859840bfcf973a14f27c6376e39e915cb29 (patch) | |
tree | 4029d6eba843a9b5179234b992df3a7ec6a830f0 /core/imagedownloader.h | |
parent | 7dd49acf4b996255b9599d4fe3309d78f66a74cb (diff) | |
download | subsurface-c7428859840bfcf973a14f27c6376e39e915cb29.tar.gz |
Dive media: prepare for video-thumbnails
Video thumbnails are more complex than simple picture thumbnails.
We store a duration and might want to store multiple images.
Therefore, refactor the thumbnailing in imagedownloader.cpp. Move
the thumbnail-writing down in the call chain to where the thumbnails
are created, since we have more information there (i.e. whether we
could parse the file but not extract an image, etc.).
Split the write-to-cache function into three versions:
- pictures
- videos
- unknown
Define the video-thumbnail on-disk format as
- uint32 MEDIATYPE_VIDEO
- uint32 duration of video in seconds
- uint32 number of pictures
for each picture:
- uint32 offset in msec from begining of video
- QImage frame
Currently, we write 0 pictures. This will be filled in subsequent commits.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/imagedownloader.h')
-rw-r--r-- | core/imagedownloader.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/core/imagedownloader.h b/core/imagedownloader.h index f89f80678..dcdf08d20 100644 --- a/core/imagedownloader.h +++ b/core/imagedownloader.h @@ -52,13 +52,18 @@ private: struct Thumbnail { QImage img; mediatype_t type; + duration_t duration; }; Thumbnailer(); - static void addThumbnailToCache(const Thumbnail &thumbnail, const QString &picture_filename); + static void addPictureThumbnailToCache(const QString &picture_filename, const QImage &thumbnail); + static void addVideoThumbnailToCache(const QString &picture_filename, duration_t duration); + static void addUnknownThumbnailToCache(const QString &picture_filename); void recalculate(QString filename); void processItem(QString filename, bool tryDownload); Thumbnail getThumbnailFromCache(const QString &picture_filename); + Thumbnail getPictureThumbnailFromStream(QDataStream &stream); + Thumbnail getVideoThumbnailFromStream(QDataStream &stream); Thumbnail fetchImage(const QString &filename, const QString &originalFilename, bool tryDownload); Thumbnail getHashedImage(const QString &filename, bool tryDownload); |