CuteLogger
Fast and simple logging solution for Qt based applications
audiolevelstask.h
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,
35  bool force = false);
36  static void closeAll();
37  bool operator==(AudioLevelsTask &b);
38 
39 protected:
40  void run();
41 
42 private:
43  Mlt::Producer *tempProducer();
44  QString cacheKey();
45 
46  QObject *m_object;
47  typedef QPair<Mlt::Producer *, QPersistentModelIndex> ProducerAndIndex;
48  QList<ProducerAndIndex> m_producers;
49  QScopedPointer<Mlt::Producer> m_tempProducer;
50  bool m_isCanceled;
51  bool m_isForce;
52  Mlt::Profile m_profile;
53 };
54 
55 #endif // AUDIOLEVELSTASK_H