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