digiKam
videothumbnailer.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2016-04-21
7  * Description : video thumbnails extraction based on ffmpeg
8  *
9  * Copyright (C) 2010 by Dirk Vanden Boer <dirk dot vdb at gmail dot com>
10  * Copyright (C) 2016-2018 by Maik Qualmann <metzpinguin at gmail dot com>
11  * Copyright (C) 2016-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_VIDEO_THUMBNAILER_H
26 #define DIGIKAM_VIDEO_THUMBNAILER_H
27 
28 // Qt includes
29 
30 #include <QString>
31 #include <QImage>
32 
33 // Local includes
34 
35 #include "digikam_export.h"
36 
37 namespace Digikam
38 {
39 
40 class VideoFrame;
41 class VideoThumbWriter;
42 class VideoDecoder;
43 class VideoStripFilter;
44 
45 class DIGIKAM_EXPORT VideoThumbnailer
46 {
47 public:
48 
50  VideoThumbnailer(int thumbnailSize,
51  bool workaroundIssues,
52  bool maintainAspectRatio,
53  bool smartFrameSelection);
55 
56 public:
57 
58  void generateThumbnail(const QString& videoFile, QImage& image);
59 
60  void setThumbnailSize(int size);
61  void setSeekPercentage(int percentage);
62  void setSeekTime(const QString& seekTime);
63  void setWorkAroundIssues(bool workAround);
64  void setMaintainAspectRatio(bool enabled);
65  void setSmartFrameSelection(bool enabled);
66  void addFilter(VideoStripFilter* const filter);
67  void removeFilter(VideoStripFilter* const filter);
68  void clearFilters();
69 
70 private:
71 
72  void generateThumbnail(const QString& videoFile, VideoThumbWriter& imageWriter, QImage& image);
73  void generateSmartThumbnail(VideoDecoder& movieDecoder, VideoFrame& videoFrame);
74 
75  void applyFilters(VideoFrame& frameData);
76  int timeToSeconds(const QString& time) const;
77 
78 private:
79 
80  // Disable
81  VideoThumbnailer(const VideoThumbnailer&) = delete;
82  VideoThumbnailer& operator=(const VideoThumbnailer&) = delete;
83 
84 private:
85 
86  class Private;
87  Private* const d;
88 };
89 
90 } // namespace Digikam
91 
92 #endif // DIGIKAM_VIDEO_THUMBNAILER_H
Definition: videodecoder.h:40
Definition: videothumbwriter.h:38
Definition: videostripfilter.h:38
Definition: videothumbwriter.h:56
Definition: videothumbnailer.h:46
Definition: datefolderview.cpp:43