1 ///////////////////////////////////////////////////////////////////////////////
2 // Simple x264 Launcher
3 // Copyright (C) 2004-2012 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 ///////////////////////////////////////////////////////////////////////////////
22 #include "thread_encode.h"
25 #include "model_options.h"
30 EncodeThread::EncodeThread(const QString &sourceFileName, const QString &outputFileName, const OptionsModel *options)
32 m_jobId(QUuid::createUuid()),
33 m_sourceFileName(sourceFileName),
34 m_outputFileName(outputFileName),
35 m_options(new OptionsModel(*options))
40 EncodeThread::~EncodeThread(void)
42 X264_DELETE(m_options);
45 ///////////////////////////////////////////////////////////////////////////////
47 ///////////////////////////////////////////////////////////////////////////////
49 void EncodeThread::run(void)
57 emit messageLogged(m_jobId, QString("EXCEPTION ERROR: ").append(QString::fromLatin1(msg)));
61 emit messageLogged(m_jobId, QString("EXCEPTION ERROR !!!"));
65 void EncodeThread::encode(void)
69 //Print some basic info
70 log(tr("Job started at %1, %2.\n").arg(QDate::currentDate().toString(Qt::ISODate), QTime::currentTime().toString( Qt::ISODate)));
71 log(tr("Source file: %1").arg(m_sourceFileName));
72 log(tr("Output file: %1").arg(m_outputFileName));
73 log(tr("\n[Encoder Options]"));
74 log(tr("RC Mode: %1").arg(OptionsModel::rcMode2String(m_options->rcMode())));
75 log(tr("Preset: %1").arg(m_options->preset()));
76 log(tr("Tuning: %1").arg(m_options->tune()));
77 log(tr("Profile: %1").arg(m_options->profile()));
78 log(tr("Custom: %1").arg(m_options->custom().isEmpty() ? tr("(None)") : m_options->custom()));
79 log(tr("\n[Input Properties]"));
81 for(int i = 0; i <= 100; i += 5)
83 emit progressChanged(m_jobId, i);
84 emit statusChanged(m_jobId, (i % 2) ? JobStatus_Indexing : JobStatus_Running_Pass1);
85 emit messageLogged(m_jobId, QUuid::createUuid().toString());
87 for(int j = 0; j < 3; j++)
89 emit detailsChanged(m_jobId, QUuid::createUuid().toString());
96 emit statusChanged(m_jobId, JobStatus_Aborted);
103 for(int i = 0; i <= 100; i += 5)
105 emit progressChanged(m_jobId, i);
106 emit statusChanged(m_jobId, (i % 2) ? JobStatus_Indexing : JobStatus_Running_Pass2);
107 emit messageLogged(m_jobId, QUuid::createUuid().toString());
109 for(int j = 0; j < 3; j++)
111 emit detailsChanged(m_jobId, QUuid::createUuid().toString());
118 emit statusChanged(m_jobId, JobStatus_Aborted);
125 emit statusChanged(m_jobId, JobStatus_Completed);