2012-01-29 19:14:46 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Simple x264 Launcher
|
|
|
|
// Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation; either version 2 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License along
|
|
|
|
// with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
//
|
|
|
|
// http://www.gnu.org/licenses/gpl-2.0.txt
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QString>
|
2012-01-31 22:30:21 +01:00
|
|
|
#include <QMap>
|
2012-01-29 19:14:46 +01:00
|
|
|
|
|
|
|
class OptionsModel
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
OptionsModel(void);
|
|
|
|
~OptionsModel(void);
|
|
|
|
|
|
|
|
enum RCMode
|
|
|
|
{
|
|
|
|
RCMode_CRF = 0,
|
|
|
|
RCMode_CQ = 1,
|
|
|
|
RCMode_2Pass = 2,
|
|
|
|
RCMode_ABR = 3,
|
|
|
|
};
|
|
|
|
|
|
|
|
//Getter
|
|
|
|
RCMode rcMode(void) const { return m_rcMode; }
|
|
|
|
unsigned int bitrate(void) const { return m_bitrate; }
|
2012-02-04 15:56:38 +01:00
|
|
|
double quantizer(void) const { return m_quantizer; }
|
2012-01-29 19:14:46 +01:00
|
|
|
QString preset(void) const { return m_preset; }
|
|
|
|
QString tune(void) const { return m_tune; }
|
|
|
|
QString profile(void) const { return m_profile; }
|
2012-02-12 15:58:28 +01:00
|
|
|
QString customX264(void) const { return m_custom_x264; }
|
|
|
|
QString customAvs2YUV(void) const { return m_custom_avs2yuv; }
|
2012-01-29 19:14:46 +01:00
|
|
|
|
|
|
|
//Setter
|
2012-01-30 17:50:19 +01:00
|
|
|
void setRCMode(RCMode mode) { m_rcMode = qBound(RCMode_CRF, mode, RCMode_ABR); }
|
2012-01-29 19:14:46 +01:00
|
|
|
void setBitrate(unsigned int bitrate) { m_bitrate = qBound(100U, bitrate, 250000U); }
|
2012-02-04 15:56:38 +01:00
|
|
|
void setQuantizer(double quantizer) { m_quantizer = qBound(0.0, quantizer, 52.0); }
|
2012-01-29 19:14:46 +01:00
|
|
|
void setPreset(const QString &preset) { m_preset = preset.trimmed(); }
|
|
|
|
void setTune(const QString &tune) { m_tune = tune.trimmed(); }
|
|
|
|
void setProfile(const QString &profile) { m_profile = profile.trimmed(); }
|
2012-02-12 15:58:28 +01:00
|
|
|
void setCustomX264(const QString &custom) { m_custom_x264 = custom.trimmed(); }
|
|
|
|
void setCustomAvs2YUV(const QString &custom) { m_custom_avs2yuv = custom.trimmed(); }
|
2012-01-29 19:14:46 +01:00
|
|
|
|
2012-01-31 03:03:17 +01:00
|
|
|
//Stuff
|
|
|
|
bool equals(OptionsModel *model);
|
|
|
|
|
2012-01-31 22:30:21 +01:00
|
|
|
//Static functions
|
2012-01-29 19:14:46 +01:00
|
|
|
static QString rcMode2String(RCMode mode);
|
2012-01-31 22:30:21 +01:00
|
|
|
static bool saveTemplate(OptionsModel *model, const QString &name);
|
2012-02-09 02:06:29 +01:00
|
|
|
static bool loadTemplate(OptionsModel *model, const QString &name);
|
2012-01-31 22:30:21 +01:00
|
|
|
static QMap<QString, OptionsModel*> loadAllTemplates(void);
|
|
|
|
static bool templateExists(const QString &name);
|
|
|
|
static bool deleteTemplate(const QString &name);
|
2012-01-29 19:14:46 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
RCMode m_rcMode;
|
|
|
|
unsigned int m_bitrate;
|
2012-02-04 15:56:38 +01:00
|
|
|
double m_quantizer;
|
2012-01-29 19:14:46 +01:00
|
|
|
QString m_preset;
|
|
|
|
QString m_tune;
|
|
|
|
QString m_profile;
|
2012-02-12 15:58:28 +01:00
|
|
|
QString m_custom_x264;
|
|
|
|
QString m_custom_avs2yuv;
|
2012-01-29 19:14:46 +01:00
|
|
|
};
|