Updated FileAnalyzer_Task to extract cover artwork with latest MediaInfo version.
[LameXP.git] / src / Thread_FileAnalyzer.h
bloba44a511ad3df6eda528ffc7952089c5af9bd1f20
1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2018 LoRd_MuldeR <MuldeR2@GMX.de>
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 2 of the License, or
8 // (at your option) any later version, but always including the *additional*
9 // restrictions defined in the "License.txt" file.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this program; if not, write to the Free Software Foundation, Inc.,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 // http://www.gnu.org/licenses/gpl-2.0.txt
21 ///////////////////////////////////////////////////////////////////////////////
23 #pragma once
25 #include <MUtils/Global.h>
27 #include <QThread>
28 #include <QStringList>
29 #include <QHash>
30 #include <QSet>
32 class AudioFileModel;
33 class QFile;
34 class QDir;
35 class QFileInfo;
36 class LockedFile;
37 class QThreadPool;
38 class QElapsedTimer;
40 ////////////////////////////////////////////////////////////
41 // Splash Thread
42 ////////////////////////////////////////////////////////////
44 class FileAnalyzer: public QThread
46 Q_OBJECT
48 public:
49 FileAnalyzer(const QStringList &inputFiles);
50 ~FileAnalyzer(void);
51 void run();
52 bool getSuccess(void) { return (!isRunning()) && (!m_bAborted) && MUTILS_BOOLIFY(m_bSuccess); }
54 unsigned int filesAccepted(void);
55 unsigned int filesRejected(void);
56 unsigned int filesDenied(void);
57 unsigned int filesDummyCDDA(void);
58 unsigned int filesCueSheet(void);
60 signals:
61 void fileSelected(const QString &fileName);
62 void fileAnalyzed(const AudioFileModel &file);
63 void progressValChanged(unsigned int);
64 void progressMaxChanged(unsigned int);
66 public slots:
67 void abortProcess(void) { m_bAborted.ref(); exit(-1); }
69 private slots:
70 void initializeTasks(void);
71 void taskFileAnalyzed(const unsigned int taskId, const int fileType, const AudioFileModel &file);
72 void taskThreadFinish(const unsigned int);
74 private:
75 bool analyzeNextFile(void);
76 void handlePlaylistFiles(void);
78 QScopedPointer<QThreadPool> m_pool;
79 QScopedPointer<QElapsedTimer> m_timer;
81 unsigned int m_tasksCounterNext;
82 unsigned int m_tasksCounterDone;
83 unsigned int m_completedCounter;
85 unsigned int m_filesAccepted;
86 unsigned int m_filesRejected;
87 unsigned int m_filesDenied;
88 unsigned int m_filesDummyCDDA;
89 unsigned int m_filesCueSheet;
91 QStringList m_inputFiles;
93 QSet<unsigned int> m_completedTaskIds;
94 QSet<unsigned int> m_runningTaskIds;
95 QHash<unsigned int, AudioFileModel> m_completedFiles;
97 static const char *g_tags_gen[];
98 static const char *g_tags_aud[];
100 QAtomicInt m_bAborted;
101 QAtomicInt m_bSuccess;