File indexing completed on 2024-05-05 04:22:01
0001 // SPDX-FileCopyrightText: 2012-2022 Jesper K. Pedersen <blackie@kde.org> 0002 // 0003 // SPDX-License-Identifier: GPL-2.0-or-later 0004 0005 #ifndef IMAGEMANAGER_VIDEOTHUMBNAILS_H 0006 #define IMAGEMANAGER_VIDEOTHUMBNAILS_H 0007 0008 #include <kpabase/FileName.h> 0009 0010 #include <QImage> 0011 #include <QObject> 0012 #include <QPointer> 0013 0014 namespace BackgroundJobs 0015 { 0016 class ExtractOneThumbnailJob; 0017 } 0018 0019 namespace ImageManager 0020 { 0021 0022 class VideoThumbnailsExtractor; 0023 class VideoLengthExtractor; 0024 0025 /** 0026 \brief Helper class for extracting videos for thumbnail cycling 0027 \see \ref videothumbnails 0028 */ 0029 class VideoThumbnails : public QObject 0030 { 0031 Q_OBJECT 0032 public: 0033 explicit VideoThumbnails(QObject *parent = nullptr); 0034 void setVideoFile(const DB::FileName &fileName); 0035 0036 public Q_SLOTS: 0037 void requestNext(); 0038 0039 Q_SIGNALS: 0040 void frameLoaded(const QImage &); 0041 0042 private Q_SLOTS: 0043 void gotFrame(); 0044 0045 private: 0046 bool loadFramesFromCache(const DB::FileName &fileName); 0047 void cancelPreviousJobs(); 0048 0049 DB::FileName m_videoFile; 0050 QVector<QImage> m_cache; 0051 bool m_pendingRequest; 0052 QVector<QPointer<BackgroundJobs::ExtractOneThumbnailJob>> m_activeRequests; 0053 int m_index; 0054 }; 0055 0056 } 0057 #endif // IMAGEMANAGER_VIDEOTHUMBNAILS_H 0058 // vi:expandtab:tabstop=4 shiftwidth=4: