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 ///////////////////////////////////////////////////////////////////////////////
34 OptionsModel(const SysinfoModel
*sysinfo
);
35 OptionsModel(const OptionsModel
&rhs
);
44 EncType_MIN
= EncType_X264
,
45 EncType_MAX
= EncType_NVEnc
,
53 EncArch_MIN
= EncArch_x86_32
,
54 EncArch_MAX
= EncArch_x86_64
63 EncVariant_MIN
= EncVariant_8Bit
,
64 EncVariant_MAX
= EncVariant_12Bit
74 RCMode_MIN
= RCMode_CRF
,
75 RCMode_MAX
= RCMode_ABR
,
78 static const char *const SETTING_UNSPECIFIED
;
79 static const char *const PROFILE_UNRESTRICTED
;
82 EncType
encType(void) const { return m_encoderType
; }
83 EncArch
encArch(void) const { return m_encoderArch
; }
84 EncVariant
encVariant(void) const { return m_encoderVariant
; }
85 RCMode
rcMode(void) const { return m_rcMode
; }
86 unsigned int bitrate(void) const { return m_bitrate
; }
87 double quantizer(void) const { return m_quantizer
; }
88 QString
preset(void) const { return m_preset
; }
89 QString
tune(void) const { return m_tune
; }
90 QString
profile(void) const { return m_profile
; }
91 QString
customEncParams(void) const { return m_custom_encoder
; }
92 QString
customAvs2YUV(void) const { return m_custom_avs2yuv
; }
95 void setEncType(EncType type
) { m_encoderType
= qBound(EncType_MIN
, type
, EncType_MAX
); }
96 void setEncArch(EncArch arch
) { m_encoderArch
= qBound(EncArch_MIN
, arch
, EncArch_MAX
); }
97 void setEncVariant(EncVariant variant
) { m_encoderVariant
= qBound(EncVariant_MIN
, variant
, EncVariant_MAX
); }
98 void setRCMode(RCMode mode
) { m_rcMode
= qBound(RCMode_CRF
, mode
, RCMode_ABR
); }
99 void setBitrate(unsigned int bitrate
) { m_bitrate
= qBound(10U, bitrate
, 800000U); }
100 void setQuantizer(double quantizer
) { m_quantizer
= qBound(0.0, quantizer
, 52.0); }
101 void setPreset(const QString
&preset
) { m_preset
= preset
.trimmed(); }
102 void setTune(const QString
&tune
) { m_tune
= tune
.trimmed(); }
103 void setProfile(const QString
&profile
) { m_profile
= profile
.trimmed(); }
104 void setCustomEncParams(const QString
&custom
) { m_custom_encoder
= custom
.trimmed(); }
105 void setCustomAvs2YUV(const QString
&custom
) { m_custom_avs2yuv
= custom
.trimmed(); }
108 bool equals(const OptionsModel
*model
);
111 static QString
rcMode2String(RCMode mode
);
112 static bool saveTemplate(const OptionsModel
*model
, const QString
&name
);
113 static bool loadTemplate(OptionsModel
*model
, const QString
&name
);
114 static QMap
<QString
, OptionsModel
*> loadAllTemplates(const SysinfoModel
*sysinfo
);
115 static bool templateExists(const QString
&name
);
116 static bool deleteTemplate(const QString
&name
);
117 static bool saveOptions(const OptionsModel
*model
, QSettings
&settingsFile
);
118 static bool loadOptions(OptionsModel
*model
, QSettings
&settingsFile
);
121 EncType m_encoderType
;
122 EncArch m_encoderArch
;
123 EncVariant m_encoderVariant
;
125 unsigned int m_bitrate
;
130 QString m_custom_encoder
;
131 QString m_custom_avs2yuv
;
134 static void fixTemplate(QSettings
&settingsFile
);