File indexing completed on 2024-05-05 16:28:10
0001 // SPDX-FileCopyrightText: 2012-2022 The KPhotoAlbum Development Team 0002 // 0003 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0004 0005 #ifndef IMAGEMANAGER_EXTRACTONEVIDEOFRAME_H 0006 #define IMAGEMANAGER_EXTRACTONEVIDEOFRAME_H 0007 0008 #include <kpabase/FileName.h> 0009 0010 #include <QObject> 0011 #include <QProcess> 0012 0013 class QImage; 0014 class QTemporaryDir; 0015 0016 namespace Utilities 0017 { 0018 class Process; 0019 } 0020 0021 namespace ImageManager 0022 { 0023 0024 /** 0025 \brief Extract a thumbnail given a filename and offset. 0026 \see \ref videothumbnails 0027 */ 0028 class ExtractOneVideoFrame : public QObject 0029 { 0030 Q_OBJECT 0031 public: 0032 static void extract(const DB::FileName &filename, double offset, QObject *receiver, const char *slot); 0033 0034 private Q_SLOTS: 0035 /** 0036 * @brief processFinished call the appropriate handler function based on exit status. 0037 * @param exitCode 0038 * @param status 0039 */ 0040 void processFinished(int exitCode, QProcess::ExitStatus status); 0041 0042 Q_SIGNALS: 0043 void result(const QImage &); 0044 0045 private: 0046 void frameFetched(); 0047 void handleError(QProcess::ProcessError); 0048 ExtractOneVideoFrame(const DB::FileName &filename, double offset, QObject *receiver, const char *slot); 0049 void markShortVideo(const DB::FileName &fileName); 0050 0051 QTemporaryDir *m_workingDirectory; 0052 Utilities::Process *m_process; 0053 DB::FileName m_fileName; 0054 static QString s_tokenForShortVideos; 0055 }; 0056 0057 } // namespace ImageManager 0058 0059 #endif // IMAGEMANAGER_EXTRACTONEVIDEOFRAME_H 0060 // vi:expandtab:tabstop=4 shiftwidth=4: