1 ///////////////////////////////////////////////////////////////////////////////
2 // Simple x264 Launcher
3 // Copyright (C) 2004-2014 LoRd_MuldeR <MuldeR2@GMX.de>
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.
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.
15 // You should have received a copy of the GNU General Public License along
16 // with this program; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 // http://www.gnu.org/licenses/gpl-2.0.txt
20 ///////////////////////////////////////////////////////////////////////////////
24 #include "model_status.h"
29 #include <QStringList>
33 class PreferencesModel;
37 class AbstractEncoder;
40 class EncodeThread : public QThread
45 EncodeThread(const QString &sourceFileName, const QString &outputFileName, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const m_preferences);
48 QUuid getId(void) { return this->m_jobId; };
49 const QString &sourceFileName(void) { return this->m_sourceFileName; }
50 const QString &outputFileName(void) { return this->m_outputFileName; }
51 const OptionsModel *options(void) { return m_options; }
61 m_semaphorePaused.release();
68 m_semaphorePaused.release();
73 const SysinfoModel *const m_sysinfo;
74 const PreferencesModel *const m_preferences;
78 const OptionsModel *m_options;
79 const QString m_sourceFileName;
80 const QString m_outputFileName;
83 volatile bool m_abort;
84 volatile bool m_pause;
87 QSemaphore m_semaphorePaused;
90 JobObject *m_jobObject;
92 //Internal status values
94 unsigned int m_progress;
97 //Encoder and Source objects
98 AbstractEncoder *m_encoder;
99 AbstractSource *m_pipedSource;
102 virtual void run(void);
103 virtual void checkedRun(void);
105 //Main encoding functions
109 static int getInputType(const QString &fileExt);
110 static QString getPasslogFile(const QString &outputFile);
113 void statusChanged(const QUuid &jobId, const JobStatus &newStatus);
114 void progressChanged(const QUuid &jobId, const unsigned int &newProgress);
115 void messageLogged(const QUuid &jobId, const QString &text);
116 void detailsChanged(const QUuid &jobId, const QString &details);
119 void log(const QString &text);
120 void setStatus(const JobStatus &newStatus);
121 void setProgress(const unsigned int &newProgress);
122 void setDetails(const QString &text);
125 void start(Priority priority = InheritPriority);