File indexing completed on 2024-04-21 04:51:38

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 ClipLoadTask : public AbstractTask
0023 {
0024     Q_OBJECT
0025 public:
0026     ClipLoadTask(const ObjectId &owner, const QDomElement &xml, bool thumbOnly, int in, int out, QObject* object);
0027     ~ClipLoadTask() override;
0028     static void start(const ObjectId &owner, const QDomElement &xml, bool thumbOnly, int in, int out, QObject* object, bool force = false, const std::function<void()> &readyCallBack = []() {});
0029     static ClipType::ProducerType getTypeForService(const QString &id, const QString &path);
0030     std::shared_ptr<Mlt::Producer> loadResource(QString resource, const QString &type);
0031     std::shared_ptr<Mlt::Producer> loadPlaylist(QString &resource);
0032     void processProducerProperties(const std::shared_ptr<Mlt::Producer> &prod, const QDomElement &xml);
0033     void processSlideShow(std::shared_ptr<Mlt::Producer> producer);
0034 
0035 protected:
0036     void run() override;
0037 
0038 private:
0039     //QString cacheKey();
0040     QDomElement m_xml;
0041     int m_in;
0042     int m_out;
0043     bool m_thumbOnly;
0044     QString m_errorMessage;
0045     void generateThumbnail(std::shared_ptr<ProjectClip>binClip, std::shared_ptr<Mlt::Producer> producer);
0046     void abort();
0047 
0048 Q_SIGNALS:
0049     void taskDone();
0050 };