1 /* 2 * Copyright (c) 2013-2018 Meltytech, LLC 3 * Author: Dan Dennedy <dan@dennedy.org> 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef AUDIOLEVELSTASK_H 20 #define AUDIOLEVELSTASK_H 21 22 #include "multitrackmodel.h" 23 #include <QRunnable> 24 #include <QPersistentModelIndex> 25 #include <QList> 26 #include <MltProducer.h> 27 #include <MltProfile.h> 28 29 class AudioLevelsTask : public QRunnable 30 { 31 public: 32 AudioLevelsTask(Mlt::Producer& producer, QObject* object, const QModelIndex& index); 33 virtual ~AudioLevelsTask(); 34 static void start(Mlt::Producer& producer, QObject* object, const QModelIndex& index, bool force = false); 35 static void closeAll(); 36 bool operator==(AudioLevelsTask& b); 37 38 protected: 39 void run(); 40 41 private: 42 Mlt::Producer* tempProducer(); 43 QString cacheKey(); 44 45 QObject* m_object; 46 typedef QPair<Mlt::Producer*, QPersistentModelIndex> ProducerAndIndex; 47 QList<ProducerAndIndex> m_producers; 48 QScopedPointer<Mlt::Producer> m_tempProducer; 49 bool m_isCanceled; 50 bool m_isForce; 51 Mlt::Profile m_profile; 52 }; 53 54 #endif // AUDIOLEVELSTASK_H 55