File indexing completed on 2024-03-24 04:51:48
0001 /* 0002 SPDX-FileCopyrightText: 2010 Dirk Vanden Boer <dirk.vdb@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef KFFMPEG_THUMBNAILER_H 0008 #define KFFMPEG_THUMBNAILER_H 0009 0010 #include <KIO/ThumbnailCreator> 0011 #include <QCache> 0012 #include <QObject> 0013 0014 #include "ffmpegthumbnailer/videothumbnailer.h" 0015 #include "ffmpegthumbnailer/filmstripfilter.h" 0016 0017 class QCheckBox; 0018 class QLineEdit; 0019 class QSpinBox; 0020 0021 class FFMpegThumbnailer : public KIO::ThumbnailCreator 0022 { 0023 Q_OBJECT 0024 0025 private: 0026 typedef QCache<QString, QImage> ThumbCache; 0027 0028 public: 0029 explicit FFMpegThumbnailer(QObject *parent, const QVariantList &args); 0030 ~FFMpegThumbnailer() override; 0031 KIO::ThumbnailResult create(const KIO::ThumbnailRequest &request) override; 0032 0033 private: 0034 float updatedSequenceIndexWraparoundPoint(float offset); 0035 0036 // Assume that the video file has an embedded thumb, in which case it gets inserted before the 0037 // regular seek percentage-based thumbs. If we find out that the video doesn't have one, we can 0038 // correct that overestimation. 0039 KIO::ThumbnailResult pass(const QImage &img, float sequenceIndexWraparoundPoint = 1.0f) 0040 { 0041 auto res = KIO::ThumbnailResult::pass(img); 0042 res.setSequenceIndexWraparoundPoint(sequenceIndexWraparoundPoint); 0043 return res; 0044 } 0045 0046 private: 0047 ffmpegthumbnailer::VideoThumbnailer m_Thumbnailer; 0048 ffmpegthumbnailer::FilmStripFilter m_FilmStrip; 0049 ThumbCache m_thumbCache; 0050 }; 0051 0052 #endif