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