File indexing completed on 2024-12-01 04:28:35

0001 /*
0002 SPDX-FileCopyrightText: 2021 Jean-Baptiste Mardelle <jb@kdenlive.org>
0003 This file is part of Kdenlive. See www.kdenlive.org.
0004 
0005 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006 */
0007 
0008 #pragma once
0009 
0010 #include "definitions.h"
0011 #include "abstracttask.h"
0012 #include <mlt++/MltProducer.h>
0013 #include <mlt++/MltProfile.h>
0014 
0015 #include <QRunnable>
0016 #include <QDomElement>
0017 #include <QObject>
0018 #include <QList>
0019 
0020 class ProjectClip;
0021 
0022 class CacheTask : public AbstractTask
0023 {
0024 public:
0025     CacheTask(const ObjectId &owner, int thumbsCount, int in, int out, QObject* object);
0026     ~CacheTask() override;
0027     static void start(const ObjectId &owner, int thumbsCount = 30, int in = 0, int out = 0, QObject* object = nullptr, bool force = false);
0028 
0029 protected:
0030     void run() override;
0031 
0032 private:
0033     int m_fullWidth;
0034     int m_thumbsCount;
0035     int m_in;
0036     int m_out;
0037     std::function<void()> m_readyCallBack;
0038     QString m_errorMessage;
0039     void generateThumbnail(std::shared_ptr<ProjectClip>binClip);
0040 };