1 ///////////////////////////////////////////////////////////////////////////////
2 // Simple x264 Launcher
3 // Copyright (C) 2004-2020 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 "thread_abstract.h"
25 #include "model_status.h"
30 #include <QStringList>
34 class PreferencesModel;
38 class AbstractEncoder;
41 class EncodeThread : public AbstractThread
46 EncodeThread(const QString &sourceFileName, const QString &outputFileName, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const m_preferences);
49 QUuid getId(void) { return this->m_jobId; };
50 const QString &sourceFileName(void) const { return this->m_sourceFileName; }
51 const QString &outputFileName(void) const { return this->m_outputFileName; }
52 const OptionsModel *options(void) const { return m_options; }
62 m_semaphorePaused.release();
69 m_semaphorePaused.release();
74 const SysinfoModel *const m_sysinfo;
75 const PreferencesModel *const m_preferences;
79 const OptionsModel *m_options;
80 const QString m_sourceFileName;
81 const QString m_outputFileName;
84 volatile bool m_abort;
85 volatile bool m_pause;
88 QSemaphore m_semaphorePaused;
91 JobObject *m_jobObject;
93 //Internal status values
95 unsigned int m_progress;
98 //Encoder and Source objects
99 AbstractEncoder *m_encoder;
100 AbstractSource *m_pipedSource;
103 virtual void run(void);
106 virtual int threadMain(void);
109 static QString getPasslogFile(const QString &outputFile);
112 void statusChanged(const QUuid &jobId, const JobStatus &newStatus);
113 void progressChanged(const QUuid &jobId, const unsigned int &newProgress);
114 void messageLogged(const QUuid &jobId, qint64, const QString &text);
115 void detailsChanged(const QUuid &jobId, const QString &details);
118 void log(const QString &text);
119 void setStatus(const JobStatus &newStatus);
120 void setProgress(const unsigned int &newProgress);
121 void setDetails(const QString &text);
124 void start(Priority priority = InheritPriority);