OSDN Git Service

Updated OggEnc2 binaries to v2.88 using libvorbis v1.3.5 and aoTuV v6.03_2015 (2015...
[lamexp/LameXP.git] / src / Thread_FileAnalyzer_Task.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2015 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.
10 //
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.
15 //
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.
19 //
20 // http://www.gnu.org/licenses/gpl-2.0.txt
21 ///////////////////////////////////////////////////////////////////////////////
22
23 #pragma once
24
25 #include <QRunnable>
26 #include <QReadWriteLock>
27 #include <QWaitCondition>
28 #include <QStringList>
29 #include <QMutex>
30 #include <QSemaphore>
31 #include <QPair>
32
33 class AudioFileModel;
34 class QFile;
35 class QDir;
36 class QFileInfo;
37 class LockedFile;
38
39 ////////////////////////////////////////////////////////////
40 // Splash Thread
41 ////////////////////////////////////////////////////////////
42
43 class AnalyzeTask: public QObject, public QRunnable
44 {
45         Q_OBJECT
46
47 public:
48         AnalyzeTask(const int taskId, const QString &inputFile, const QString &templateFile, volatile bool *abortFlag);
49         ~AnalyzeTask(void);
50         
51         enum fileType_t
52         {
53                 fileTypeNormal   = 0,
54                 fileTypeCDDA     = 1,
55                 fileTypeDenied   = 2,
56                 fileTypeCueSheet = 3,
57                 fileTypeUnknown  = 4
58         };
59
60 signals:
61         void fileAnalyzed(const unsigned int taskId, const int fileType, const AudioFileModel &file);
62         void taskCompleted(const unsigned int taskId);
63
64 protected:
65         void run(void);
66         void run_ex(void);
67
68 private:
69         const AudioFileModel analyzeFile(const QString &filePath, int *type);
70         void updateInfo(AudioFileModel &audioFile, bool &skipNext, QPair<quint32, quint32> &id_val, quint32 &coverType, QByteArray &coverData, const QString &key, const QString &value);
71         unsigned int parseYear(const QString &str);
72         unsigned int parseDuration(const QString &str);
73         bool checkFile_CDDA(QFile &file);
74         void retrieveCover(AudioFileModel &audioFile, const quint32 coverType, const QByteArray &coverData);
75         bool analyzeAvisynthFile(const QString &filePath, AudioFileModel &info);
76
77         const unsigned int m_taskId;
78
79         const QString m_mediaInfoBin;
80         const QString m_avs2wavBin;
81         const QString m_templateFile;
82         const QString m_inputFile;
83         
84         volatile bool *m_abortFlag;
85 };