1 ///////////////////////////////////////////////////////////////////////////////
2 // Simple x264 Launcher
3 // Copyright (C) 2004-2016 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 "tool_abstract.h"
25 #include "model_options.h"
28 template<class T
> class QList
;
29 template <class T1
, class T2
> struct QPair
;
32 class AbstractEncoderInfo
37 RC_TYPE_QUANTIZER
= 0,
38 RC_TYPE_RATE_KBPS
= 1,
50 typedef QPair
<QString
, RCType
> RCMode
;
51 typedef QPair
<QString
, ArchBit
> ArchId
;
53 virtual QString
getName(void) const = 0;
54 virtual QString
getFullName(const quint32
&encArch
, const quint32
&encVariant
) const;
55 virtual QList
<ArchId
> getArchitectures(void) const = 0;
56 virtual QStringList
getVariants(void) const = 0;
57 virtual QList
<RCMode
> getRCModes(void) const = 0;
58 virtual QStringList
getProfiles(const quint32
&variant
) const = 0;
59 virtual QStringList
getTunings(void) const = 0;
60 virtual QStringList
getPresets(void) const = 0;
61 virtual QStringList
supportedOutputFormats(void) const = 0;
62 virtual bool isInputTypeSupported(const int format
) const = 0;
63 virtual QString
getBinaryPath(const SysinfoModel
*sysinfo
, const quint32
&encArch
, const quint32
&encVariant
) const = 0;
64 virtual QStringList
getDependencies(const SysinfoModel
*sysinfo
, const quint32
&encArch
, const quint32
&encVariant
) const;
67 QString
archToString (const quint32
&index
) const;
68 ArchBit
archToType (const quint32
&index
) const;
69 QString
variantToString(const quint32
&index
) const;
70 QString
rcModeToString (const quint32
&index
) const;
71 RCType
rcModeToType (const quint32
&index
) const;
74 class AbstractEncoder
: public AbstractTool
77 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
);
78 virtual ~AbstractEncoder(void);
80 virtual bool runEncodingPass(AbstractSource
* pipedSource
, const QString outputFile
, const unsigned int &frames
, const int &pass
= 0, const QString
&passLogFile
= QString());
82 virtual const AbstractEncoderInfo
& getEncoderInfo(void) const = 0;
85 virtual void buildCommandLine(QStringList
&cmdLine
, const bool &usePipe
, const unsigned int &frames
, const QString
&indexFile
, const int &pass
, const QString
&passLogFile
) = 0;
87 virtual void runEncodingPass_init(QList
<QRegExp
*> &patterns
) = 0;
88 virtual void runEncodingPass_parseLine(const QString
&line
, QList
<QRegExp
*> &patterns
, const unsigned int &totalFrames
, const int &pass
, double &last_progress
, double &size_estimate
) = 0;
90 static double estimateSize(const QString
&fileName
, const double &progress
);
91 static QString
sizeToString(qint64 size
);
93 const QString
&m_sourceFile
;
94 const QString
&m_outputFile
;
95 const QString m_indexFile
;