diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-07-10 15:04:35 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-07-28 15:31:25 -0700 |
commit | fce42d4858d33e10b7a1c48d75838f1901b6b123 (patch) | |
tree | 3be7516c1e306e4fb8cce9cd1f3e357e3a5575df /core/imagedownloader.h | |
parent | 51066e5478d76824c5da53f37184e0e0d1f3e4af (diff) | |
download | subsurface-fce42d4858d33e10b7a1c48d75838f1901b6b123.tar.gz |
Dive media: Extract thumbnails from videos with ffmpeg
Extract thumbnails using ffmpeg.
Behavior is controlled by three new preferences fields:
- extract_video_thumbnails (bool): if true, thumbnails are calculated.
- extract_video_thumbnail_position (int 0..100): position in video
where thumbnail is fetched.
- ffmpeg_executable (string): path of ffmpeg executable.
If ffmpeg refuses to start, extract_video_thumbnails is set to false
to avoid unnecessary churn.
Video thumbnails are marked by an overlay.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/imagedownloader.h')
-rw-r--r-- | core/imagedownloader.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/core/imagedownloader.h b/core/imagedownloader.h index cab945e5f..e0d70f59f 100644 --- a/core/imagedownloader.h +++ b/core/imagedownloader.h @@ -46,6 +46,9 @@ public: public slots: void imageDownloaded(QString filename); void imageDownloadFailed(QString filename); + void frameExtracted(QString filename, QImage thumbnail, duration_t duration, duration_t offset); + void frameExtractionFailed(QString filename, duration_t duration); + void frameExtractionInvalid(QString filename, duration_t duration); signals: void thumbnailChanged(QString filename, QImage thumbnail, duration_t duration); private: @@ -56,22 +59,26 @@ private: }; Thumbnailer(); + Thumbnail fetchVideoThumbnail(const QString &filename, const QString &originalFilename, duration_t duration); + Thumbnail extractVideoThumbnail(const QString &picture_filename, duration_t duration); Thumbnail addPictureThumbnailToCache(const QString &picture_filename, const QImage &thumbnail); - Thumbnail addVideoThumbnailToCache(const QString &picture_filename, duration_t duration); + Thumbnail addVideoThumbnailToCache(const QString &picture_filename, duration_t duration, const QImage &thumbnail, duration_t position); Thumbnail 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 getVideoThumbnailFromStream(QDataStream &stream, const QString &filename); Thumbnail fetchImage(const QString &filename, const QString &originalFilename, bool tryDownload); Thumbnail getHashedImage(const QString &filename, bool tryDownload); + void markVideoThumbnail(QImage &img); mutable QMutex lock; QThreadPool pool; QImage failImage; // Shown when image-fetching fails QImage dummyImage; // Shown before thumbnail is fetched QImage videoImage; // Place holder for videos + QImage videoOverlayImage; // Overlay for video thumbnails QImage unknownImage; // Place holder for files where we couldn't determine the type QMap<QString,QFuture<void>> workingOn; |