Bump version + updated changelog.
[simple-x264-launcher.git] / src / encoder_abstract.h
blobc3c1f2e70e664ed3df189c8ad009d85ed80d2592
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 Floor, Boston, MA 02110-1301 USA.
19 // http://www.gnu.org/licenses/gpl-2.0.txt
20 //////////////////////////////////////////////////////////////////////////////
22 #pragma once
24 #include "tool_abstract.h"
25 #include "model_options.h"
27 class QRegExp;
28 template<class T> class QList;
29 template <class T1, class T2> struct QPair;
30 class AbstractSource;
31 class ClipInfo;
33 class AbstractEncoderInfo
35 public:
36 typedef enum _RCType
38 RC_TYPE_QUANTIZER = 0,
39 RC_TYPE_RATE_KBPS = 1,
40 RC_TYPE_MULTIPASS = 2
42 RCType;
44 typedef enum _ArchBit
46 ARCH_TYPE_X86 = 0,
47 ARCH_TYPE_X64 = 1,
49 ArchBit;
51 typedef QPair<QString, RCType> RCMode;
52 typedef QPair<QString, ArchBit> ArchId;
54 virtual QString getName(void) const = 0;
55 virtual QString getFullName(const quint32 &encArch, const quint32 &encVariant) const;
56 virtual QList<ArchId> getArchitectures(void) const = 0;
57 virtual QStringList getVariants(void) const = 0;
58 virtual QList<RCMode> getRCModes(void) const = 0;
59 virtual QStringList getProfiles(const quint32 &variant) const = 0;
60 virtual QStringList getTunings(void) const = 0;
61 virtual QStringList getPresets(void) const = 0;
62 virtual QStringList supportedOutputFormats(void) const = 0;
63 virtual bool isInputTypeSupported(const int format) const = 0;
64 virtual QString getBinaryPath(const SysinfoModel *sysinfo, const quint32 &encArch, const quint32 &encVariant) const = 0;
65 virtual QStringList getDependencies(const SysinfoModel *sysinfo, const quint32 &encArch, const quint32 &encVariant) const;
66 virtual QString getHelpCommand(void) const = 0;
68 //Utilities
69 QString archToString (const quint32 &index) const;
70 ArchBit archToType (const quint32 &index) const;
71 QString variantToString(const quint32 &index) const;
72 QString rcModeToString (const quint32 &index) const;
73 RCType rcModeToType (const quint32 &index) const;
76 class AbstractEncoder : public AbstractTool
78 public:
79 AbstractEncoder(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);
80 virtual ~AbstractEncoder(void);
82 virtual bool runEncodingPass(AbstractSource* pipedSource, const QString outputFile, const ClipInfo &clipInfo, const int &pass = 0, const QString &passLogFile = QString());
84 virtual const AbstractEncoderInfo& getEncoderInfo(void) const = 0;
86 protected:
87 virtual void buildCommandLine(QStringList &cmdLine, const bool &usePipe, const ClipInfo &clipInfo, const QString &indexFile, const int &pass, const QString &passLogFile) = 0;
89 virtual void runEncodingPass_init(QList<QRegExp*> &patterns) = 0;
90 virtual void runEncodingPass_parseLine(const QString &line, const QList<QRegExp*> &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate) = 0;
92 static double estimateSize(const QString &fileName, const double &progress);
93 static QString sizeToString(qint64 size);
95 const QString &m_sourceFile;
96 const QString &m_outputFile;
97 const QString m_indexFile;