/src/ffmpegthumbs/ffmpegthumbnailer.h
Line | Count | Source |
1 | | /* |
2 | | SPDX-FileCopyrightText: 2010 Dirk Vanden Boer <dirk.vdb@gmail.com> |
3 | | |
4 | | SPDX-License-Identifier: GPL-2.0-or-later |
5 | | */ |
6 | | |
7 | | #ifndef KFFMPEG_THUMBNAILER_H |
8 | | #define KFFMPEG_THUMBNAILER_H |
9 | | |
10 | | #include <KIO/ThumbnailCreator> |
11 | | #include <QCache> |
12 | | #include <QObject> |
13 | | |
14 | | #include "ffmpegthumbnailer/videothumbnailer.h" |
15 | | #include "ffmpegthumbnailer/filmstripfilter.h" |
16 | | |
17 | | class QCheckBox; |
18 | | class QLineEdit; |
19 | | class QSpinBox; |
20 | | |
21 | | class FFMpegThumbnailer : public KIO::ThumbnailCreator |
22 | | { |
23 | 0 | Q_OBJECT |
24 | 0 |
|
25 | 0 | private: |
26 | 0 | typedef QCache<QString, QImage> ThumbCache; |
27 | 0 |
|
28 | 0 | public: |
29 | 0 | explicit FFMpegThumbnailer(QObject *parent, const QVariantList &args); |
30 | 0 | ~FFMpegThumbnailer() override; |
31 | 0 | KIO::ThumbnailResult create(const KIO::ThumbnailRequest &request) override; |
32 | 0 |
|
33 | 0 | private: |
34 | 0 | float updatedSequenceIndexWraparoundPoint(float offset); |
35 | 0 |
|
36 | 0 | // Assume that the video file has an embedded thumb, in which case it gets inserted before the |
37 | 0 | // regular seek percentage-based thumbs. If we find out that the video doesn't have one, we can |
38 | 0 | // correct that overestimation. |
39 | 0 | KIO::ThumbnailResult pass(const QImage &img, float sequenceIndexWraparoundPoint = 1.0f) |
40 | 0 | { |
41 | 0 | auto res = KIO::ThumbnailResult::pass(img); |
42 | 0 | res.setSequenceIndexWraparoundPoint(sequenceIndexWraparoundPoint); |
43 | 0 | return res; |
44 | 0 | } |
45 | | |
46 | | private: |
47 | | ffmpegthumbnailer::VideoThumbnailer m_Thumbnailer; |
48 | | ffmpegthumbnailer::FilmStripFilter m_FilmStrip; |
49 | | ThumbCache m_thumbCache; |
50 | | }; |
51 | | |
52 | | #endif |