1 ///////////////////////////////////////////////////////////////////////////////
2 // Simple x264 Launcher
3 // Copyright (C) 2004-2018 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 Floory, Boston, MA 02110-1301 USA.
19 // http://www.gnu.org/licenses/gpl-2.0.txt
20 ///////////////////////////////////////////////////////////////////////////////
22 #include "encoder_factory.h"
26 #include "model_options.h"
27 #include "encoder_x264.h"
28 #include "encoder_x265.h"
29 #include "encoder_nvencc.h"
32 #include <MUtils/Exception.h>
34 AbstractEncoder *EncoderFactory::createEncoder(JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, JobStatus &jobStatus, volatile bool *abort, volatile bool *pause, QSemaphore *semaphorePause, const QString &sourceFile, const QString &outputFile)
36 AbstractEncoder *encoder = NULL;
38 switch(options->encType())
40 case OptionsModel::EncType_X264:
41 encoder = new X264Encoder(jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause, sourceFile, outputFile);
43 case OptionsModel::EncType_X265:
44 encoder = new X265Encoder(jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause, sourceFile, outputFile);
46 case OptionsModel::EncType_NVEnc:
47 encoder = new NVEncEncoder(jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause, sourceFile, outputFile);
50 MUTILS_THROW("Unknown encoder type encountered!");
56 const AbstractEncoderInfo& EncoderFactory::getEncoderInfo(const OptionsModel::EncType &encoderType)
60 case OptionsModel::EncType_X264:
61 return X264Encoder::encoderInfo();
62 case OptionsModel::EncType_X265:
63 return X265Encoder::encoderInfo();
64 case OptionsModel::EncType_NVEnc:
65 return NVEncEncoder::encoderInfo();
67 MUTILS_THROW("Unknown encoder type encountered!");
70 return *((AbstractEncoderInfo*)NULL);