Bump version + updated changelog.
[simple-x264-launcher.git] / src / encoder_factory.cpp
blobbee8b99c7631c11e6846bb1bd84b93ee0dd6b439
1 ///////////////////////////////////////////////////////////////////////////////
2 // Simple x264 Launcher
3 // Copyright (C) 2004-2018 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.
9 //
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"
24 //Internal
25 #include "global.h"
26 #include "model_options.h"
27 #include "encoder_x264.h"
28 #include "encoder_x265.h"
29 #include "encoder_nvencc.h"
31 //MUtils
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);
42 break;
43 case OptionsModel::EncType_X265:
44 encoder = new X265Encoder(jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause, sourceFile, outputFile);
45 break;
46 case OptionsModel::EncType_NVEnc:
47 encoder = new NVEncEncoder(jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause, sourceFile, outputFile);
48 break;
49 default:
50 MUTILS_THROW("Unknown encoder type encountered!");
53 return encoder;
56 const AbstractEncoderInfo& EncoderFactory::getEncoderInfo(const OptionsModel::EncType &encoderType)
58 switch(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();
66 default:
67 MUTILS_THROW("Unknown encoder type encountered!");
70 return *((AbstractEncoderInfo*)NULL);