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 
24 #include <MltProducer.h>
25 #include <MltProfile.h>
26 #include <QList>
27 #include <QPersistentModelIndex>
28 #include <QRunnable>
29 
30 class AudioLevelsTask : public QRunnable
31 {
32 public:
33  AudioLevelsTask(Mlt::Producer &producer, QObject *object, const QModelIndex &index);
34  virtual ~AudioLevelsTask();
35  static void start(Mlt::Producer &producer,
36  QObject *object,
37  const QModelIndex &index,
38  bool force = false);
39  static void closeAll();
40  bool operator==(AudioLevelsTask &b);
41 
42 protected:
43  void run();
44 
45 private:
46  Mlt::Producer *tempProducer();
47  QString cacheKey();
48 
49  QObject *m_object;
50  typedef QPair<Mlt::Producer *, QPersistentModelIndex> ProducerAndIndex;
51  QList<ProducerAndIndex> m_producers;
52  QScopedPointer<Mlt::Producer> m_tempProducer;
53  bool m_isCanceled;
54  bool m_isForce;
55  Mlt::Profile m_profile;
56 };
57 
58 #endif // AUDIOLEVELSTASK_H