change: change code style to Linux style except indent.

This commit is contained in:
Mike Solar
2025-08-03 03:09:40 +08:00
parent 65ab76edc8
commit 74f73ab3be
789 changed files with 77113 additions and 68888 deletions
+70 -64
View File
@@ -28,105 +28,111 @@
#include "common/qtutils.h"
#include "widget/slider/integerslider.h"
namespace olive {
namespace olive
{
AV1Section::AV1Section(QWidget *parent) :
AV1Section(AV1CRFSection::kDefaultAV1CRF, parent)
AV1Section::AV1Section(QWidget *parent)
: AV1Section(AV1CRFSection::kDefaultAV1CRF, parent)
{
}
AV1Section::AV1Section(int default_crf, QWidget *parent) :
CodecSection(parent)
AV1Section::AV1Section(int default_crf, QWidget *parent)
: CodecSection(parent)
{
QGridLayout* layout = new QGridLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
QGridLayout *layout = new QGridLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
int row = 0;
layout->addWidget(new QLabel(tr("Preset:")), row, 0);
int row = 0;
layout->addWidget(new QLabel(tr("Preset:")), row, 0);
preset_combobox_ = new QComboBox();
preset_combobox_->setToolTip(tr("This parameter governs the efficiency/encode-time trade-off.\n"
"Lower presets will result in an output with better quality for a given file size, but will take longer to encode.\n"
"Higher presets can result in a very fast encode, but will make some compromises on visual quality for a given crf value."));
preset_combobox_ = new QComboBox();
preset_combobox_->setToolTip(tr(
"This parameter governs the efficiency/encode-time trade-off.\n"
"Lower presets will result in an output with better quality for a given file size, but will take longer to encode.\n"
"Higher presets can result in a very fast encode, but will make some compromises on visual quality for a given crf value."));
for (int i = 0; i <= 13; i++)
preset_combobox_->addItem(QString::number(i));
for (int i = 0; i <= 13; i++)
preset_combobox_->addItem(QString::number(i));
preset_combobox_->setCurrentIndex(8);
preset_combobox_->setCurrentIndex(8);
layout->addWidget(preset_combobox_, row, 1);
layout->addWidget(preset_combobox_, row, 1);
row++;
row++;
layout->addWidget(new QLabel(tr("Compression Method:")), row, 0);
layout->addWidget(new QLabel(tr("Compression Method:")), row, 0);
QComboBox* compression_box = new QComboBox();
compression_box->setToolTip(tr("This parameter governs the quality/size trade-off.\n"
"Higher CRF values will result in a final output that takes less space, but begins to lose detail.\n"
"Lower CRF values retain more detail at the cost of larger file sizes.\n"
"The possible range of CRF in SVT-AV1 is 1-63."));
QComboBox *compression_box = new QComboBox();
compression_box->setToolTip(tr(
"This parameter governs the quality/size trade-off.\n"
"Higher CRF values will result in a final output that takes less space, but begins to lose detail.\n"
"Lower CRF values retain more detail at the cost of larger file sizes.\n"
"The possible range of CRF in SVT-AV1 is 1-63."));
// These items must correspond to the CompressionMethod enum
compression_box->addItem(tr("Constant Rate Factor"));
// These items must correspond to the CompressionMethod enum
compression_box->addItem(tr("Constant Rate Factor"));
layout->addWidget(compression_box, row, 1);
layout->addWidget(compression_box, row, 1);
row++;
row++;
compression_method_stack_ = new QStackedWidget();
layout->addWidget(compression_method_stack_, row, 0, 1, 2);
compression_method_stack_ = new QStackedWidget();
layout->addWidget(compression_method_stack_, row, 0, 1, 2);
crf_section_ = new AV1CRFSection(default_crf);
compression_method_stack_->addWidget(crf_section_);
crf_section_ = new AV1CRFSection(default_crf);
compression_method_stack_->addWidget(crf_section_);
connect(compression_box,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
compression_method_stack_,
&QStackedWidget::setCurrentIndex);
connect(
compression_box,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
compression_method_stack_, &QStackedWidget::setCurrentIndex);
}
void AV1Section::AddOpts(EncodingParams *params)
{
CompressionMethod method = static_cast<CompressionMethod>(
compression_method_stack_->currentIndex());
CompressionMethod method = static_cast<CompressionMethod>(compression_method_stack_->currentIndex());
if (method == kConstantRateFactor) {
// Set Quantizer value
params->set_video_option(QStringLiteral("qp"),
QString::number(crf_section_->GetValue()));
}
if (method == kConstantRateFactor) {
// Set Quantizer value
params->set_video_option(QStringLiteral("qp"), QString::number(crf_section_->GetValue()));
}
params->set_video_option(QStringLiteral("preset"), QString::number(preset_combobox_->currentIndex()));
params->set_video_option(QStringLiteral("preset"),
QString::number(preset_combobox_->currentIndex()));
}
AV1CRFSection::AV1CRFSection(int default_crf, QWidget *parent) :
QWidget(parent)
AV1CRFSection::AV1CRFSection(int default_crf, QWidget *parent)
: QWidget(parent)
{
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
QHBoxLayout *layout = new QHBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
crf_slider_ = new QSlider(Qt::Horizontal);
crf_slider_->setMinimum(kMinimumCRF);
crf_slider_->setMaximum(kMaximumCRF);
crf_slider_->setValue(default_crf);
layout->addWidget(crf_slider_);
crf_slider_ = new QSlider(Qt::Horizontal);
crf_slider_->setMinimum(kMinimumCRF);
crf_slider_->setMaximum(kMaximumCRF);
crf_slider_->setValue(default_crf);
layout->addWidget(crf_slider_);
IntegerSlider* crf_input = new IntegerSlider();
crf_input->setMaximumWidth(QtUtils::QFontMetricsWidth(crf_input->fontMetrics(), QStringLiteral("HHHH")));
crf_input->SetMinimum(kMinimumCRF);
crf_input->SetMaximum(kMaximumCRF);
crf_input->SetValue(default_crf);
crf_input->SetDefaultValue(default_crf);
layout->addWidget(crf_input);
IntegerSlider *crf_input = new IntegerSlider();
crf_input->setMaximumWidth(QtUtils::QFontMetricsWidth(
crf_input->fontMetrics(), QStringLiteral("HHHH")));
crf_input->SetMinimum(kMinimumCRF);
crf_input->SetMaximum(kMaximumCRF);
crf_input->SetValue(default_crf);
crf_input->SetDefaultValue(default_crf);
layout->addWidget(crf_input);
connect(crf_slider_, &QSlider::valueChanged, crf_input, &IntegerSlider::SetValue);
connect(crf_input, &IntegerSlider::ValueChanged, crf_slider_, &QSlider::setValue);
connect(crf_slider_, &QSlider::valueChanged, crf_input,
&IntegerSlider::SetValue);
connect(crf_input, &IntegerSlider::ValueChanged, crf_slider_,
&QSlider::setValue);
}
int AV1CRFSection::GetValue() const
{
return crf_slider_->value();
return crf_slider_->value();
}
}
+21 -23
View File
@@ -28,45 +28,43 @@
#include "codecsection.h"
#include "widget/slider/floatslider.h"
namespace olive {
class AV1CRFSection : public QWidget
namespace olive
{
Q_OBJECT
class AV1CRFSection : public QWidget {
Q_OBJECT
public:
AV1CRFSection(int default_crf, QWidget* parent = nullptr);
AV1CRFSection(int default_crf, QWidget *parent = nullptr);
int GetValue() const;
int GetValue() const;
static const int kDefaultAV1CRF = 30;
static const int kDefaultAV1CRF = 30;
private:
static const int kMinimumCRF = 0;
static const int kMaximumCRF = 63;
QSlider* crf_slider_;
static const int kMinimumCRF = 0;
static const int kMaximumCRF = 63;
QSlider *crf_slider_;
};
class AV1Section : public CodecSection
{
Q_OBJECT
class AV1Section : public CodecSection {
Q_OBJECT
public:
enum CompressionMethod {
kConstantRateFactor,
};
enum CompressionMethod {
kConstantRateFactor,
};
AV1Section(QWidget* parent = nullptr);
AV1Section(int default_crf, QWidget* parent);
AV1Section(QWidget *parent = nullptr);
AV1Section(int default_crf, QWidget *parent);
virtual void AddOpts(EncodingParams* params) override;
virtual void AddOpts(EncodingParams *params) override;
private:
QStackedWidget* compression_method_stack_;
QStackedWidget *compression_method_stack_;
AV1CRFSection* crf_section_;
AV1CRFSection *crf_section_;
QComboBox *preset_combobox_;
QComboBox *preset_combobox_;
};
}
+32 -28
View File
@@ -23,22 +23,23 @@
#include <QGridLayout>
#include <QLabel>
namespace olive {
CineformSection::CineformSection(QWidget *parent) :
CodecSection(parent)
namespace olive
{
QGridLayout *layout = new QGridLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
CineformSection::CineformSection(QWidget *parent)
: CodecSection(parent)
{
QGridLayout *layout = new QGridLayout(this);
int row = 0;
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(new QLabel(tr("Quality:")), row, 0);
int row = 0;
quality_combobox_ = new QComboBox();
layout->addWidget(new QLabel(tr("Quality:")), row, 0);
/* Correspond to the following indexes for FFmpeg
quality_combobox_ = new QComboBox();
/* Correspond to the following indexes for FFmpeg
*
* -quality <int> E..V....... set quality (from 0 to 12) (default film3+)
* film3+ 0 E..V.......
@@ -57,34 +58,37 @@ CineformSection::CineformSection(QWidget *parent) :
*
*/
quality_combobox_->addItem(tr("Film Scan 3+"));
quality_combobox_->addItem(tr("Film Scan 3"));
quality_combobox_->addItem(tr("Film Scan 2+"));
quality_combobox_->addItem(tr("Film Scan 2"));
quality_combobox_->addItem(tr("Film Scan 1.5"));
quality_combobox_->addItem(tr("Film Scan 1+"));
quality_combobox_->addItem(tr("Film Scan 1"));
quality_combobox_->addItem(tr("High+"));
quality_combobox_->addItem(tr("High"));
quality_combobox_->addItem(tr("Medium+"));
quality_combobox_->addItem(tr("Medium"));
quality_combobox_->addItem(tr("Low+"));
quality_combobox_->addItem(tr("Low"));
quality_combobox_->addItem(tr("Film Scan 3+"));
quality_combobox_->addItem(tr("Film Scan 3"));
quality_combobox_->addItem(tr("Film Scan 2+"));
quality_combobox_->addItem(tr("Film Scan 2"));
quality_combobox_->addItem(tr("Film Scan 1.5"));
quality_combobox_->addItem(tr("Film Scan 1+"));
quality_combobox_->addItem(tr("Film Scan 1"));
quality_combobox_->addItem(tr("High+"));
quality_combobox_->addItem(tr("High"));
quality_combobox_->addItem(tr("Medium+"));
quality_combobox_->addItem(tr("Medium"));
quality_combobox_->addItem(tr("Low+"));
quality_combobox_->addItem(tr("Low"));
// Default to "medium"
quality_combobox_->setCurrentIndex(10);
// Default to "medium"
quality_combobox_->setCurrentIndex(10);
layout->addWidget(quality_combobox_, row, 1);
layout->addWidget(quality_combobox_, row, 1);
}
void CineformSection::AddOpts(EncodingParams *params)
{
params->set_video_option(QStringLiteral("quality"), QString::number(quality_combobox_->currentIndex()));
params->set_video_option(
QStringLiteral("quality"),
QString::number(quality_combobox_->currentIndex()));
}
void CineformSection::SetOpts(const EncodingParams *p)
{
quality_combobox_->setCurrentIndex(p->video_option(QStringLiteral("quality")).toInt());
quality_combobox_->setCurrentIndex(
p->video_option(QStringLiteral("quality")).toInt());
}
}
+8 -9
View File
@@ -25,21 +25,20 @@
#include "codecsection.h"
namespace olive {
class CineformSection : public CodecSection
namespace olive
{
Q_OBJECT
class CineformSection : public CodecSection {
Q_OBJECT
public:
CineformSection(QWidget *parent = nullptr);
CineformSection(QWidget *parent = nullptr);
virtual void AddOpts(EncodingParams* params) override;
virtual void AddOpts(EncodingParams *params) override;
virtual void SetOpts(const EncodingParams *p) override;
virtual void SetOpts(const EncodingParams *p) override;
private:
QComboBox *quality_combobox_;
QComboBox *quality_combobox_;
};
}
+4 -3
View File
@@ -20,10 +20,11 @@
#include "codecsection.h"
namespace olive {
namespace olive
{
CodecSection::CodecSection(QWidget *parent) :
QWidget(parent)
CodecSection::CodecSection(QWidget *parent)
: QWidget(parent)
{
}
+13 -8
View File
@@ -25,18 +25,23 @@
#include "codec/encoder.h"
namespace olive {
class CodecSection : public QWidget
namespace olive
{
Q_OBJECT
class CodecSection : public QWidget {
Q_OBJECT
public:
CodecSection(QWidget* parent = nullptr);
CodecSection(QWidget *parent = nullptr);
virtual void AddOpts(EncodingParams* params){Q_UNUSED(params)}
virtual void SetOpts(const EncodingParams *p){Q_UNUSED(p)}
virtual void AddOpts(EncodingParams *params)
{
Q_UNUSED(params)
}
virtual void SetOpts(const EncodingParams *p)
{
Q_UNUSED(p)
}
};
}
+17 -14
View File
@@ -20,34 +20,37 @@
#include "codecstack.h"
namespace olive {
namespace olive
{
#define super QStackedWidget
CodecStack::CodecStack(QWidget *parent)
: super{parent}
: super{ parent }
{
connect(this, &CodecStack::currentChanged, this, &CodecStack::OnChange);
connect(this, &CodecStack::currentChanged, this, &CodecStack::OnChange);
}
void CodecStack::addWidget(QWidget *widget)
{
super::addWidget(widget);
super::addWidget(widget);
OnChange(currentIndex());
OnChange(currentIndex());
}
void CodecStack::OnChange(int index)
{
for (int i=0; i<count(); i++) {
if (i == index) {
widget(i)->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
} else {
widget(i)->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
}
widget(i)->adjustSize();
}
adjustSize();
for (int i = 0; i < count(); i++) {
if (i == index) {
widget(i)->setSizePolicy(QSizePolicy::Expanding,
QSizePolicy::Expanding);
} else {
widget(i)->setSizePolicy(QSizePolicy::Ignored,
QSizePolicy::Ignored);
}
widget(i)->adjustSize();
}
adjustSize();
}
}
+8 -9
View File
@@ -23,21 +23,20 @@
#include <QStackedWidget>
namespace olive {
class CodecStack : public QStackedWidget
namespace olive
{
Q_OBJECT
public:
explicit CodecStack(QWidget *parent = nullptr);
void addWidget(QWidget *widget);
class CodecStack : public QStackedWidget {
Q_OBJECT
public:
explicit CodecStack(QWidget *parent = nullptr);
void addWidget(QWidget *widget);
signals:
private slots:
void OnChange(int index);
void OnChange(int index);
};
}
+174 -164
View File
@@ -28,274 +28,284 @@
#include "common/qtutils.h"
#include "widget/slider/integerslider.h"
namespace olive {
namespace olive
{
H264Section::H264Section(QWidget *parent) :
H264Section(H264CRFSection::kDefaultH264CRF, parent)
H264Section::H264Section(QWidget *parent)
: H264Section(H264CRFSection::kDefaultH264CRF, parent)
{
}
H264Section::H264Section(int default_crf, QWidget *parent) :
CodecSection(parent)
H264Section::H264Section(int default_crf, QWidget *parent)
: CodecSection(parent)
{
QGridLayout* layout = new QGridLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
QGridLayout *layout = new QGridLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
int row = 0;
layout->addWidget(new QLabel(tr("Encode Speed:")), row, 0);
int row = 0;
layout->addWidget(new QLabel(tr("Encode Speed:")), row, 0);
preset_combobox_ = new QComboBox();
preset_combobox_->setToolTip(tr(
"This setting allows you to tweak the ratio of export speed to compression quality. \n\n"
"If using Constant Rate Factor, slower speeds will result in smaller file sizes for the same quality. \n\n"
"If using Target Bit Rate or Target File Size, slower speeds will result in higher quality for the same bitrate/filesize. \n\n"
"This setting is equivalent to the `preset` setting in libx264."));
preset_combobox_ = new QComboBox();
preset_combobox_->setToolTip(tr("This setting allows you to tweak the ratio of export speed to compression quality. \n\n"
"If using Constant Rate Factor, slower speeds will result in smaller file sizes for the same quality. \n\n"
"If using Target Bit Rate or Target File Size, slower speeds will result in higher quality for the same bitrate/filesize. \n\n"
"This setting is equivalent to the `preset` setting in libx264."));
preset_combobox_->addItem(tr("Ultra Fast"));
preset_combobox_->addItem(tr("Super Fast"));
preset_combobox_->addItem(tr("Very Fast"));
preset_combobox_->addItem(tr("Faster"));
preset_combobox_->addItem(tr("Fast"));
preset_combobox_->addItem(tr("Medium"));
preset_combobox_->addItem(tr("Slow"));
preset_combobox_->addItem(tr("Slower"));
preset_combobox_->addItem(tr("Very Slow"));
preset_combobox_->addItem(tr("Ultra Fast"));
preset_combobox_->addItem(tr("Super Fast"));
preset_combobox_->addItem(tr("Very Fast"));
preset_combobox_->addItem(tr("Faster"));
preset_combobox_->addItem(tr("Fast"));
preset_combobox_->addItem(tr("Medium"));
preset_combobox_->addItem(tr("Slow"));
preset_combobox_->addItem(tr("Slower"));
preset_combobox_->addItem(tr("Very Slow"));
//Default to "medium"
preset_combobox_->setCurrentIndex(5);
//Default to "medium"
preset_combobox_->setCurrentIndex(5);
layout->addWidget(preset_combobox_, row, 1);
layout->addWidget(preset_combobox_, row, 1);
row++;
row++;
layout->addWidget(new QLabel(tr("Compression Method:")), row, 0);
layout->addWidget(new QLabel(tr("Compression Method:")), row, 0);
QComboBox *compression_box = new QComboBox();
QComboBox* compression_box = new QComboBox();
// These items must correspond to the CompressionMethod enum
compression_box->addItem(tr("Constant Rate Factor"));
compression_box->addItem(tr("Target Bit Rate"));
compression_box->addItem(tr("Target File Size"));
// These items must correspond to the CompressionMethod enum
compression_box->addItem(tr("Constant Rate Factor"));
compression_box->addItem(tr("Target Bit Rate"));
compression_box->addItem(tr("Target File Size"));
layout->addWidget(compression_box, row, 1);
layout->addWidget(compression_box, row, 1);
row++;
row++;
compression_method_stack_ = new QStackedWidget();
layout->addWidget(compression_method_stack_, row, 0, 1, 2);
compression_method_stack_ = new QStackedWidget();
layout->addWidget(compression_method_stack_, row, 0, 1, 2);
crf_section_ = new H264CRFSection(default_crf);
compression_method_stack_->addWidget(crf_section_);
crf_section_ = new H264CRFSection(default_crf);
compression_method_stack_->addWidget(crf_section_);
bitrate_section_ = new H264BitRateSection();
compression_method_stack_->addWidget(bitrate_section_);
bitrate_section_ = new H264BitRateSection();
compression_method_stack_->addWidget(bitrate_section_);
filesize_section_ = new H264FileSizeSection();
compression_method_stack_->addWidget(filesize_section_);
filesize_section_ = new H264FileSizeSection();
compression_method_stack_->addWidget(filesize_section_);
connect(compression_box,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
compression_method_stack_,
&QStackedWidget::setCurrentIndex);
connect(
compression_box,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
compression_method_stack_, &QStackedWidget::setCurrentIndex);
}
void H264Section::AddOpts(EncodingParams *params)
{
// FIXME: Implement two-pass
// FIXME: Implement two-pass
CompressionMethod method = static_cast<CompressionMethod>(compression_method_stack_->currentIndex());
CompressionMethod method = static_cast<CompressionMethod>(
compression_method_stack_->currentIndex());
// This option is not used by the encoder (nor is anything with the ove_ prefix), it's to help us
// identify which option was chosen when params are restored
params->set_video_option(QStringLiteral("ove_compressionmethod"), QString::number(method));
// This option is not used by the encoder (nor is anything with the ove_ prefix), it's to help us
// identify which option was chosen when params are restored
params->set_video_option(QStringLiteral("ove_compressionmethod"),
QString::number(method));
if (method == kConstantRateFactor) {
if (method == kConstantRateFactor) {
// Simply set CRF value
params->set_video_option(QStringLiteral("crf"),
QString::number(crf_section_->GetValue()));
// Simply set CRF value
params->set_video_option(QStringLiteral("crf"), QString::number(crf_section_->GetValue()));
} else {
int64_t target_rate, max_rate, min_rate;
} else {
if (method == kTargetBitRate) {
// Use user-supplied values for the bit rate
target_rate = bitrate_section_->GetTargetBitRate();
min_rate = 0;
max_rate = bitrate_section_->GetMaximumBitRate();
} else {
// Calculate the bit rate from the file size divided by the sequence length in seconds (bits per second)
int64_t target_fs = filesize_section_->GetFileSize();
target_rate = qRound64(static_cast<double>(target_fs) /
params->GetExportLength().toDouble());
min_rate = target_rate;
max_rate = target_rate;
int64_t target_rate, max_rate, min_rate;
params->set_video_option(QStringLiteral("ove_targetfilesize"),
QString::number(target_fs));
}
if (method == kTargetBitRate) {
// Use user-supplied values for the bit rate
target_rate = bitrate_section_->GetTargetBitRate();
min_rate = 0;
max_rate = bitrate_section_->GetMaximumBitRate();
} else {
// Calculate the bit rate from the file size divided by the sequence length in seconds (bits per second)
int64_t target_fs = filesize_section_->GetFileSize();
target_rate = qRound64(static_cast<double>(target_fs) / params->GetExportLength().toDouble());
min_rate = target_rate;
max_rate = target_rate;
// Disable CRF encoding
params->set_video_option(QStringLiteral("crf"), QStringLiteral("-1"));
params->set_video_option(QStringLiteral("ove_targetfilesize"), QString::number(target_fs));
}
params->set_video_bit_rate(target_rate);
params->set_video_min_bit_rate(min_rate);
params->set_video_max_bit_rate(max_rate);
params->set_video_buffer_size(2000000);
}
// Disable CRF encoding
params->set_video_option(QStringLiteral("crf"), QStringLiteral("-1"));
params->set_video_bit_rate(target_rate);
params->set_video_min_bit_rate(min_rate);
params->set_video_max_bit_rate(max_rate);
params->set_video_buffer_size(2000000);
}
params->set_video_option(QStringLiteral("preset"), QString::number(preset_combobox_->currentIndex()));
params->set_video_option(QStringLiteral("preset"),
QString::number(preset_combobox_->currentIndex()));
}
void H264Section::SetOpts(const EncodingParams *p)
{
CompressionMethod method = static_cast<CompressionMethod>(p->video_option(QStringLiteral("ove_compressionmethod")).toInt());
CompressionMethod method = static_cast<CompressionMethod>(
p->video_option(QStringLiteral("ove_compressionmethod")).toInt());
compression_method_stack_->setCurrentIndex(method);
compression_method_stack_->setCurrentIndex(method);
if (method == kConstantRateFactor) {
crf_section_->SetValue(p->video_option(QStringLiteral("crf")).toInt());
} else {
int64_t target_rate = p->video_bit_rate();
int64_t max_rate = p->video_max_bit_rate();
if (method == kConstantRateFactor) {
crf_section_->SetValue(p->video_option(QStringLiteral("crf")).toInt());
} else {
int64_t target_rate = p->video_bit_rate();
int64_t max_rate = p->video_max_bit_rate();
if (method == kTargetBitRate) {
// Use user-supplied values for the bit rate
bitrate_section_->SetTargetBitRate(target_rate);
bitrate_section_->SetMaximumBitRate(max_rate);
} else {
// Calculate the bit rate from the file size divided by the sequence length in seconds (bits per second)
filesize_section_->SetFileSize(p->video_option(QStringLiteral("ove_targetfilesize")).toLongLong());
}
}
if (method == kTargetBitRate) {
// Use user-supplied values for the bit rate
bitrate_section_->SetTargetBitRate(target_rate);
bitrate_section_->SetMaximumBitRate(max_rate);
} else {
// Calculate the bit rate from the file size divided by the sequence length in seconds (bits per second)
filesize_section_->SetFileSize(
p->video_option(QStringLiteral("ove_targetfilesize"))
.toLongLong());
}
}
}
H264CRFSection::H264CRFSection(int default_crf, QWidget *parent) :
QWidget(parent)
H264CRFSection::H264CRFSection(int default_crf, QWidget *parent)
: QWidget(parent)
{
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
QHBoxLayout *layout = new QHBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
crf_slider_ = new QSlider(Qt::Horizontal);
crf_slider_->setMinimum(kMinimumCRF);
crf_slider_->setMaximum(kMaximumCRF);
crf_slider_->setValue(default_crf);
layout->addWidget(crf_slider_);
crf_slider_ = new QSlider(Qt::Horizontal);
crf_slider_->setMinimum(kMinimumCRF);
crf_slider_->setMaximum(kMaximumCRF);
crf_slider_->setValue(default_crf);
layout->addWidget(crf_slider_);
IntegerSlider* crf_input = new IntegerSlider();
crf_input->setMaximumWidth(QtUtils::QFontMetricsWidth(crf_input->fontMetrics(), QStringLiteral("HHHH")));
crf_input->SetMinimum(kMinimumCRF);
crf_input->SetMaximum(kMaximumCRF);
crf_input->SetValue(default_crf);
crf_input->SetDefaultValue(default_crf);
layout->addWidget(crf_input);
IntegerSlider *crf_input = new IntegerSlider();
crf_input->setMaximumWidth(QtUtils::QFontMetricsWidth(
crf_input->fontMetrics(), QStringLiteral("HHHH")));
crf_input->SetMinimum(kMinimumCRF);
crf_input->SetMaximum(kMaximumCRF);
crf_input->SetValue(default_crf);
crf_input->SetDefaultValue(default_crf);
layout->addWidget(crf_input);
connect(crf_slider_, &QSlider::valueChanged, crf_input, &IntegerSlider::SetValue);
connect(crf_input, &IntegerSlider::ValueChanged, crf_slider_, &QSlider::setValue);
connect(crf_slider_, &QSlider::valueChanged, crf_input,
&IntegerSlider::SetValue);
connect(crf_input, &IntegerSlider::ValueChanged, crf_slider_,
&QSlider::setValue);
}
int H264CRFSection::GetValue() const
{
return crf_slider_->value();
return crf_slider_->value();
}
void H264CRFSection::SetValue(int c)
{
crf_slider_->setValue(c);
crf_slider_->setValue(c);
}
H264BitRateSection::H264BitRateSection(QWidget *parent) :
QWidget(parent)
H264BitRateSection::H264BitRateSection(QWidget *parent)
: QWidget(parent)
{
QGridLayout* layout = new QGridLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
QGridLayout *layout = new QGridLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
int row = 0;
int row = 0;
layout->addWidget(new QLabel(tr("Target Bit Rate (Mbps):")), row, 0);
layout->addWidget(new QLabel(tr("Target Bit Rate (Mbps):")), row, 0);
target_rate_ = new FloatSlider();
target_rate_->SetMinimum(0);
layout->addWidget(target_rate_, row, 1);
target_rate_ = new FloatSlider();
target_rate_->SetMinimum(0);
layout->addWidget(target_rate_, row, 1);
row++;
row++;
layout->addWidget(new QLabel(tr("Maximum Bit Rate (Mbps):")), row, 0);
layout->addWidget(new QLabel(tr("Maximum Bit Rate (Mbps):")), row, 0);
max_rate_ = new FloatSlider();
max_rate_->SetMinimum(0);
layout->addWidget(max_rate_, row, 1);
max_rate_ = new FloatSlider();
max_rate_->SetMinimum(0);
layout->addWidget(max_rate_, row, 1);
row++;
row++;
layout->addWidget(new QLabel(tr("Two-Pass")), row, 0);
layout->addWidget(new QLabel(tr("Two-Pass")), row, 0);
QCheckBox* two_pass_box = new QCheckBox();
layout->addWidget(two_pass_box, row, 1);
QCheckBox *two_pass_box = new QCheckBox();
layout->addWidget(two_pass_box, row, 1);
// Bit rate defaults
target_rate_->SetValue(16.0);
max_rate_->SetValue(32.0);
// Bit rate defaults
target_rate_->SetValue(16.0);
max_rate_->SetValue(32.0);
}
int64_t H264BitRateSection::GetTargetBitRate() const
{
return qRound64(target_rate_->GetValue() * 1000000.0);
return qRound64(target_rate_->GetValue() * 1000000.0);
}
void H264BitRateSection::SetTargetBitRate(int64_t b)
{
target_rate_->SetValue(double(b) * 0.000001);
target_rate_->SetValue(double(b) * 0.000001);
}
int64_t H264BitRateSection::GetMaximumBitRate() const
{
return qRound64(max_rate_->GetValue() * 1000000.0);
return qRound64(max_rate_->GetValue() * 1000000.0);
}
void H264BitRateSection::SetMaximumBitRate(int64_t b)
{
max_rate_->SetValue(double(b) * 0.000001);
max_rate_->SetValue(double(b) * 0.000001);
}
H264FileSizeSection::H264FileSizeSection(QWidget *parent) :
QWidget(parent)
H264FileSizeSection::H264FileSizeSection(QWidget *parent)
: QWidget(parent)
{
QGridLayout* layout = new QGridLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
QGridLayout *layout = new QGridLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
int row = 0;
int row = 0;
layout->addWidget(new QLabel(tr("Target File Size (MB):")), row, 0);
layout->addWidget(new QLabel(tr("Target File Size (MB):")), row, 0);
file_size_ = new FloatSlider();
file_size_->SetMinimum(0);
layout->addWidget(file_size_, row, 1);
file_size_ = new FloatSlider();
file_size_->SetMinimum(0);
layout->addWidget(file_size_, row, 1);
row++;
row++;
layout->addWidget(new QLabel(tr("Two-Pass")), row, 0);
layout->addWidget(new QLabel(tr("Two-Pass")), row, 0);
QCheckBox* two_pass_box = new QCheckBox();
layout->addWidget(two_pass_box, row, 1);
QCheckBox *two_pass_box = new QCheckBox();
layout->addWidget(two_pass_box, row, 1);
// File size defaults
file_size_->SetValue(700.0);
// File size defaults
file_size_->SetValue(700.0);
}
int64_t H264FileSizeSection::GetFileSize() const
{
// Convert megabytes to BITS
return qRound64(file_size_->GetValue() * 1024.0 * 1024.0 * 8.0);
// Convert megabytes to BITS
return qRound64(file_size_->GetValue() * 1024.0 * 1024.0 * 8.0);
}
void H264FileSizeSection::SetFileSize(int64_t f)
{
// Convert bits back to megabytes
file_size_->SetValue(double(f) / 8.0 / 1024.0 / 1024.0);
// Convert bits back to megabytes
file_size_->SetValue(double(f) / 8.0 / 1024.0 / 1024.0);
}
H265Section::H265Section(QWidget *parent) :
H264Section(H264CRFSection::kDefaultH265CRF, parent)
H265Section::H265Section(QWidget *parent)
: H264Section(H264CRFSection::kDefaultH265CRF, parent)
{
}
+49 -56
View File
@@ -28,104 +28,97 @@
#include "codecsection.h"
#include "widget/slider/floatslider.h"
namespace olive {
class H264CRFSection : public QWidget
namespace olive
{
Q_OBJECT
class H264CRFSection : public QWidget {
Q_OBJECT
public:
H264CRFSection(int default_crf, QWidget* parent = nullptr);
H264CRFSection(int default_crf, QWidget *parent = nullptr);
int GetValue() const;
void SetValue(int c);
int GetValue() const;
void SetValue(int c);
static const int kDefaultH264CRF = 18;
static const int kDefaultH265CRF = 23;
static const int kDefaultH264CRF = 18;
static const int kDefaultH265CRF = 23;
private:
static const int kMinimumCRF = 0;
static const int kMaximumCRF = 51;
QSlider* crf_slider_;
static const int kMinimumCRF = 0;
static const int kMaximumCRF = 51;
QSlider *crf_slider_;
};
class H264BitRateSection : public QWidget
{
Q_OBJECT
class H264BitRateSection : public QWidget {
Q_OBJECT
public:
H264BitRateSection(QWidget* parent = nullptr);
H264BitRateSection(QWidget *parent = nullptr);
/**
/**
* @brief Get user-selected target bit rate (returns in BITS)
*/
int64_t GetTargetBitRate() const;
void SetTargetBitRate(int64_t b);
int64_t GetTargetBitRate() const;
void SetTargetBitRate(int64_t b);
/**
/**
* @brief Get user-selected maximum bit rate (returns in BITS)
*/
int64_t GetMaximumBitRate() const;
void SetMaximumBitRate(int64_t b);
int64_t GetMaximumBitRate() const;
void SetMaximumBitRate(int64_t b);
private:
FloatSlider* target_rate_;
FloatSlider* max_rate_;
FloatSlider *target_rate_;
FloatSlider *max_rate_;
};
class H264FileSizeSection : public QWidget
{
Q_OBJECT
class H264FileSizeSection : public QWidget {
Q_OBJECT
public:
H264FileSizeSection(QWidget* parent = nullptr);
H264FileSizeSection(QWidget *parent = nullptr);
/**
/**
* @brief Returns file size in BITS
*/
int64_t GetFileSize() const;
void SetFileSize(int64_t f);
int64_t GetFileSize() const;
void SetFileSize(int64_t f);
private:
FloatSlider* file_size_;
FloatSlider *file_size_;
};
class H264Section : public CodecSection
{
Q_OBJECT
class H264Section : public CodecSection {
Q_OBJECT
public:
enum CompressionMethod {
kConstantRateFactor,
kTargetBitRate,
kTargetFileSize
};
enum CompressionMethod {
kConstantRateFactor,
kTargetBitRate,
kTargetFileSize
};
H264Section(QWidget* parent = nullptr);
H264Section(int default_crf, QWidget* parent);
H264Section(QWidget *parent = nullptr);
H264Section(int default_crf, QWidget *parent);
virtual void AddOpts(EncodingParams* params) override;
virtual void AddOpts(EncodingParams *params) override;
virtual void SetOpts(const EncodingParams *p) override;
virtual void SetOpts(const EncodingParams *p) override;
private:
QStackedWidget* compression_method_stack_;
QStackedWidget *compression_method_stack_;
H264CRFSection* crf_section_;
H264CRFSection *crf_section_;
H264BitRateSection* bitrate_section_;
H264BitRateSection *bitrate_section_;
H264FileSizeSection* filesize_section_;
H264FileSizeSection *filesize_section_;
QComboBox *preset_combobox_;
QComboBox *preset_combobox_;
};
class H265Section : public H264Section
{
Q_OBJECT
class H265Section : public H264Section {
Q_OBJECT
public:
H265Section(QWidget* parent = nullptr);
H265Section(QWidget *parent = nullptr);
};
}
+23 -20
View File
@@ -23,37 +23,40 @@
#include <QGridLayout>
#include <QLabel>
namespace olive {
ImageSection::ImageSection(QWidget* parent) :
CodecSection(parent)
namespace olive
{
QGridLayout* layout = new QGridLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
int row = 0;
ImageSection::ImageSection(QWidget *parent)
: CodecSection(parent)
{
QGridLayout *layout = new QGridLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(new QLabel(tr("Image Sequence:")), row, 0);
int row = 0;
image_sequence_checkbox_ = new QCheckBox();
connect(image_sequence_checkbox_, &QCheckBox::toggled, this, &ImageSection::ImageSequenceCheckBoxToggled);
layout->addWidget(image_sequence_checkbox_, row, 1);
layout->addWidget(new QLabel(tr("Image Sequence:")), row, 0);
row++;
image_sequence_checkbox_ = new QCheckBox();
connect(image_sequence_checkbox_, &QCheckBox::toggled, this,
&ImageSection::ImageSequenceCheckBoxToggled);
layout->addWidget(image_sequence_checkbox_, row, 1);
layout->addWidget(new QLabel(tr("Frame to Export:")), row, 0);
row++;
frame_slider_ = new RationalSlider();
frame_slider_->SetMinimum(0);
frame_slider_->SetValue(0);
frame_slider_->SetDisplayType(RationalSlider::kTime);
connect(frame_slider_, &RationalSlider::ValueChanged, this, &ImageSection::TimeChanged);
layout->addWidget(frame_slider_, row, 1);
layout->addWidget(new QLabel(tr("Frame to Export:")), row, 0);
frame_slider_ = new RationalSlider();
frame_slider_->SetMinimum(0);
frame_slider_->SetValue(0);
frame_slider_->SetDisplayType(RationalSlider::kTime);
connect(frame_slider_, &RationalSlider::ValueChanged, this,
&ImageSection::TimeChanged);
layout->addWidget(frame_slider_, row, 1);
}
void ImageSection::ImageSequenceCheckBoxToggled(bool e)
{
frame_slider_->setEnabled(!e);
frame_slider_->setEnabled(!e);
}
}
+29 -30
View File
@@ -26,50 +26,49 @@
#include "codecsection.h"
#include "widget/slider/rationalslider.h"
namespace olive {
class ImageSection : public CodecSection
namespace olive
{
Q_OBJECT
class ImageSection : public CodecSection {
Q_OBJECT
public:
ImageSection(QWidget* parent = nullptr);
ImageSection(QWidget *parent = nullptr);
bool IsImageSequenceChecked() const
{
return image_sequence_checkbox_->isChecked();
}
bool IsImageSequenceChecked() const
{
return image_sequence_checkbox_->isChecked();
}
void SetImageSequenceChecked(bool e)
{
image_sequence_checkbox_->setChecked(e);
}
void SetImageSequenceChecked(bool e)
{
image_sequence_checkbox_->setChecked(e);
}
void SetTimebase(const rational& r)
{
frame_slider_->SetTimebase(r);
}
void SetTimebase(const rational &r)
{
frame_slider_->SetTimebase(r);
}
rational GetTime() const
{
return frame_slider_->GetValue();
}
rational GetTime() const
{
return frame_slider_->GetValue();
}
void SetTime(const rational &t)
{
frame_slider_->SetValue(t);
}
void SetTime(const rational &t)
{
frame_slider_->SetValue(t);
}
signals:
void TimeChanged(const rational &t);
void TimeChanged(const rational &t);
private:
QCheckBox* image_sequence_checkbox_;
QCheckBox *image_sequence_checkbox_;
RationalSlider* frame_slider_;
RationalSlider *frame_slider_;
private slots:
void ImageSequenceCheckBoxToggled(bool e);
void ImageSequenceCheckBoxToggled(bool e);
};
}
File diff suppressed because it is too large Load Diff
+60 -62
View File
@@ -37,107 +37,105 @@
#include "widget/nodeparamview/nodeparamviewwidgetbridge.h"
#include "widget/viewer/viewer.h"
namespace olive {
class ExportDialog : public QDialog
namespace olive
{
Q_OBJECT
class ExportDialog : public QDialog {
Q_OBJECT
public:
ExportDialog(ViewerOutput* viewer_node, bool stills_only_mode, QWidget* parent = nullptr);
ExportDialog(ViewerOutput* viewer_node, QWidget* parent = nullptr) :
ExportDialog(viewer_node, false, parent)
{}
ExportDialog(ViewerOutput *viewer_node, bool stills_only_mode,
QWidget *parent = nullptr);
ExportDialog(ViewerOutput *viewer_node, QWidget *parent = nullptr)
: ExportDialog(viewer_node, false, parent)
{
}
rational GetSelectedTimebase() const;
void SetSelectedTimebase(const rational &r);
rational GetSelectedTimebase() const;
void SetSelectedTimebase(const rational &r);
EncodingParams GenerateParams() const;
void SetParams(const EncodingParams &e);
EncodingParams GenerateParams() const;
void SetParams(const EncodingParams &e);
virtual bool eventFilter(QObject *o, QEvent *e) override;
virtual bool eventFilter(QObject *o, QEvent *e) override;
public slots:
virtual void done(int r) override;
virtual void done(int r) override;
signals:
void RequestImportFile(const QString &s);
void RequestImportFile(const QString &s);
private:
void AddPreferencesTab(QWidget *inner_widget, const QString &title);
void AddPreferencesTab(QWidget *inner_widget, const QString &title);
void LoadPresets();
void SetDefaultFilename();
void LoadPresets();
void SetDefaultFilename();
bool SequenceHasSubtitles() const;
bool SequenceHasSubtitles() const;
void SetDefaults();
void SetDefaults();
ViewerOutput* viewer_node_;
ViewerOutput *viewer_node_;
ExportFormat::Format previously_selected_format_;
ExportFormat::Format previously_selected_format_;
rational GetExportLength() const;
int64_t GetExportLengthInTimebaseUnits() const;
rational GetExportLength() const;
int64_t GetExportLengthInTimebaseUnits() const;
enum RangeSelection {
kRangeEntireSequence,
kRangeInToOut
};
enum RangeSelection { kRangeEntireSequence, kRangeInToOut };
enum AutoPreset {
kPresetDefault = -1,
kPresetLastUsed = -2,
};
enum AutoPreset {
kPresetDefault = -1,
kPresetLastUsed = -2,
};
QTabWidget* preferences_tabs_;
QTabWidget *preferences_tabs_;
QComboBox* preset_combobox_;
QComboBox* range_combobox_;
std::vector<EncodingParams> presets_;
QComboBox *preset_combobox_;
QComboBox *range_combobox_;
std::vector<EncodingParams> presets_;
QCheckBox* video_enabled_;
QCheckBox* audio_enabled_;
QCheckBox* subtitles_enabled_;
QCheckBox *video_enabled_;
QCheckBox *audio_enabled_;
QCheckBox *subtitles_enabled_;
ViewerWidget* preview_viewer_;
QLineEdit* filename_edit_;
ExportFormatComboBox* format_combobox_;
ViewerWidget *preview_viewer_;
QLineEdit *filename_edit_;
ExportFormatComboBox *format_combobox_;
ExportVideoTab* video_tab_;
ExportAudioTab* audio_tab_;
ExportSubtitlesTab* subtitle_tab_;
ExportVideoTab *video_tab_;
ExportAudioTab *audio_tab_;
ExportSubtitlesTab *subtitle_tab_;
double video_aspect_ratio_;
double video_aspect_ratio_;
ColorManager* color_manager_;
ColorManager *color_manager_;
QWidget* preferences_area_;
QCheckBox *export_bkg_box_;
QCheckBox *import_file_after_export_;
QWidget *preferences_area_;
QCheckBox *export_bkg_box_;
QCheckBox *import_file_after_export_;
bool stills_only_mode_;
bool stills_only_mode_;
bool loading_presets_;
bool loading_presets_;
private slots:
void BrowseFilename();
void BrowseFilename();
void FormatChanged(ExportFormat::Format current_format);
void FormatChanged(ExportFormat::Format current_format);
void ResolutionChanged();
void ResolutionChanged();
void UpdateViewerDimensions();
void UpdateViewerDimensions();
void StartExport();
void StartExport();
void ExportFinished();
void ExportFinished();
void ImageSequenceCheckBoxChanged(bool e);
void ImageSequenceCheckBoxChanged(bool e);
void SavePreset();
void PresetComboBoxChanged();
void SavePreset();
void PresetComboBoxChanged();
};
}
+48 -42
View File
@@ -5,65 +5,71 @@
#include <QGroupBox>
#include <QLabel>
namespace olive {
ExportAdvancedVideoDialog::ExportAdvancedVideoDialog(const QList<QString> &pix_fmts, QWidget *parent) :
QDialog(parent)
namespace olive
{
setWindowTitle(tr("Advanced"));
QVBoxLayout* layout = new QVBoxLayout(this);
ExportAdvancedVideoDialog::ExportAdvancedVideoDialog(
const QList<QString> &pix_fmts, QWidget *parent)
: QDialog(parent)
{
setWindowTitle(tr("Advanced"));
{
// Pixel Settings
QGroupBox* pixel_group = new QGroupBox();
layout->addWidget(pixel_group);
pixel_group->setTitle(tr("Pixel"));
QVBoxLayout *layout = new QVBoxLayout(this);
QGridLayout* pixel_layout = new QGridLayout(pixel_group);
{
// Pixel Settings
QGroupBox *pixel_group = new QGroupBox();
layout->addWidget(pixel_group);
pixel_group->setTitle(tr("Pixel"));
int row = 0;
QGridLayout *pixel_layout = new QGridLayout(pixel_group);
pixel_layout->addWidget(new QLabel(tr("Pixel Format:")), row, 0);
int row = 0;
pixel_format_combobox_ = new QComboBox();
pixel_format_combobox_->addItems(pix_fmts);
pixel_layout->addWidget(pixel_format_combobox_, row, 1);
pixel_layout->addWidget(new QLabel(tr("Pixel Format:")), row, 0);
row++;
pixel_format_combobox_ = new QComboBox();
pixel_format_combobox_->addItems(pix_fmts);
pixel_layout->addWidget(pixel_format_combobox_, row, 1);
pixel_layout->addWidget(new QLabel(tr("YUV Color Range:")), row, 0);
row++;
yuv_color_range_combobox_ = new QComboBox();
yuv_color_range_combobox_->addItems({tr("Limited (16-235)"), tr("Full (0-255)")});
pixel_layout->addWidget(yuv_color_range_combobox_, row, 1);
}
pixel_layout->addWidget(new QLabel(tr("YUV Color Range:")), row, 0);
{
// Performance Settings
QGroupBox* performance_group = new QGroupBox();
layout->addWidget(performance_group);
performance_group->setTitle(tr("Performance"));
yuv_color_range_combobox_ = new QComboBox();
yuv_color_range_combobox_->addItems(
{ tr("Limited (16-235)"), tr("Full (0-255)") });
pixel_layout->addWidget(yuv_color_range_combobox_, row, 1);
}
QGridLayout* performance_layout = new QGridLayout(performance_group);
{
// Performance Settings
QGroupBox *performance_group = new QGroupBox();
layout->addWidget(performance_group);
performance_group->setTitle(tr("Performance"));
int row = 0;
QGridLayout *performance_layout = new QGridLayout(performance_group);
performance_layout->addWidget(new QLabel(tr("Threads:")), row, 0);
int row = 0;
thread_slider_ = new IntegerSlider();
thread_slider_->SetMinimum(0);
thread_slider_->SetDefaultValue(0);
thread_slider_->InsertLabelSubstitution(0, tr("Auto"));
performance_layout->addWidget(thread_slider_, row, 1);
performance_layout->addWidget(new QLabel(tr("Threads:")), row, 0);
row++;
}
thread_slider_ = new IntegerSlider();
thread_slider_->SetMinimum(0);
thread_slider_->SetDefaultValue(0);
thread_slider_->InsertLabelSubstitution(0, tr("Auto"));
performance_layout->addWidget(thread_slider_, row, 1);
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
connect(buttons, &QDialogButtonBox::accepted, this, &ExportAdvancedVideoDialog::accept);
connect(buttons, &QDialogButtonBox::rejected, this, &ExportAdvancedVideoDialog::reject);
layout->addWidget(buttons);
row++;
}
QDialogButtonBox *buttons =
new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
connect(buttons, &QDialogButtonBox::accepted, this,
&ExportAdvancedVideoDialog::accept);
connect(buttons, &QDialogButtonBox::rejected, this,
&ExportAdvancedVideoDialog::reject);
layout->addWidget(buttons);
}
}
+34 -34
View File
@@ -7,52 +7,52 @@
#include "codec/encoder.h"
#include "widget/slider/integerslider.h"
namespace olive {
class ExportAdvancedVideoDialog : public QDialog
namespace olive
{
Q_OBJECT
class ExportAdvancedVideoDialog : public QDialog {
Q_OBJECT
public:
ExportAdvancedVideoDialog(const QList<QString>& pix_fmts,
QWidget* parent = nullptr);
ExportAdvancedVideoDialog(const QList<QString> &pix_fmts,
QWidget *parent = nullptr);
int threads() const
{
return static_cast<int>(thread_slider_->GetValue());
}
int threads() const
{
return static_cast<int>(thread_slider_->GetValue());
}
void set_threads(int t)
{
thread_slider_->SetValue(t);
}
void set_threads(int t)
{
thread_slider_->SetValue(t);
}
QString pix_fmt() const
{
return pixel_format_combobox_->currentText();
}
QString pix_fmt() const
{
return pixel_format_combobox_->currentText();
}
void set_pix_fmt(const QString& s)
{
pixel_format_combobox_->setCurrentText(s);
}
void set_pix_fmt(const QString &s)
{
pixel_format_combobox_->setCurrentText(s);
}
VideoParams::ColorRange yuv_range() const
{
return static_cast<VideoParams::ColorRange>(yuv_color_range_combobox_->currentIndex());
}
VideoParams::ColorRange yuv_range() const
{
return static_cast<VideoParams::ColorRange>(
yuv_color_range_combobox_->currentIndex());
}
void set_yuv_range(VideoParams::ColorRange i)
{
yuv_color_range_combobox_->setCurrentIndex(i);
}
void set_yuv_range(VideoParams::ColorRange i)
{
yuv_color_range_combobox_->setCurrentIndex(i);
}
private:
IntegerSlider* thread_slider_;
IntegerSlider *thread_slider_;
QComboBox* pixel_format_combobox_;
QComboBox* yuv_color_range_combobox_;
QComboBox *pixel_format_combobox_;
QComboBox *yuv_color_range_combobox_;
};
}
+61 -54
View File
@@ -25,96 +25,103 @@
#include "core.h"
namespace olive {
namespace olive
{
const int ExportAudioTab::kDefaultBitRate = 320;
ExportAudioTab::ExportAudioTab(QWidget* parent) :
QWidget(parent)
ExportAudioTab::ExportAudioTab(QWidget *parent)
: QWidget(parent)
{
QVBoxLayout* outer_layout = new QVBoxLayout(this);
QVBoxLayout *outer_layout = new QVBoxLayout(this);
QGridLayout* layout = new QGridLayout();
outer_layout->addLayout(layout);
QGridLayout *layout = new QGridLayout();
outer_layout->addLayout(layout);
int row = 0;
int row = 0;
layout->addWidget(new QLabel(tr("Codec:")), row, 0);
layout->addWidget(new QLabel(tr("Codec:")), row, 0);
codec_combobox_ = new QComboBox();
connect(codec_combobox_, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &ExportAudioTab::UpdateSampleFormats);
connect(codec_combobox_, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &ExportAudioTab::UpdateBitRateEnabled);
layout->addWidget(codec_combobox_, row, 1);
codec_combobox_ = new QComboBox();
connect(
codec_combobox_,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &ExportAudioTab::UpdateSampleFormats);
connect(
codec_combobox_,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &ExportAudioTab::UpdateBitRateEnabled);
layout->addWidget(codec_combobox_, row, 1);
row++;
row++;
layout->addWidget(new QLabel(tr("Sample Rate:")), row, 0);
layout->addWidget(new QLabel(tr("Sample Rate:")), row, 0);
sample_rate_combobox_ = new SampleRateComboBox();
layout->addWidget(sample_rate_combobox_, row, 1);
sample_rate_combobox_ = new SampleRateComboBox();
layout->addWidget(sample_rate_combobox_, row, 1);
row++;
row++;
layout->addWidget(new QLabel(tr("Channel Layout:")), row, 0);
layout->addWidget(new QLabel(tr("Channel Layout:")), row, 0);
channel_layout_combobox_ = new ChannelLayoutComboBox();
layout->addWidget(channel_layout_combobox_, row, 1);
channel_layout_combobox_ = new ChannelLayoutComboBox();
layout->addWidget(channel_layout_combobox_, row, 1);
row++;
row++;
layout->addWidget(new QLabel(tr("Format:")), row, 0);
layout->addWidget(new QLabel(tr("Format:")), row, 0);
sample_format_combobox_ = new SampleFormatComboBox();
layout->addWidget(sample_format_combobox_, row, 1);
sample_format_combobox_ = new SampleFormatComboBox();
layout->addWidget(sample_format_combobox_, row, 1);
row++;
row++;
layout->addWidget(new QLabel(tr("Bit Rate:")), row, 0);
layout->addWidget(new QLabel(tr("Bit Rate:")), row, 0);
bit_rate_slider_ = new IntegerSlider();
bit_rate_slider_->SetMinimum(32);
bit_rate_slider_->SetMaximum(320);
bit_rate_slider_->SetValue(kDefaultBitRate);
bit_rate_slider_->SetFormat(tr("%1 kbps"));
layout->addWidget(bit_rate_slider_, row, 1);
bit_rate_slider_ = new IntegerSlider();
bit_rate_slider_->SetMinimum(32);
bit_rate_slider_->SetMaximum(320);
bit_rate_slider_->SetValue(kDefaultBitRate);
bit_rate_slider_->SetFormat(tr("%1 kbps"));
layout->addWidget(bit_rate_slider_, row, 1);
outer_layout->addStretch();
outer_layout->addStretch();
}
int ExportAudioTab::SetFormat(ExportFormat::Format format)
{
QList<ExportCodec::Codec> acodecs = ExportFormat::GetAudioCodecs(format);
setEnabled(!acodecs.isEmpty());
codec_combobox_->blockSignals(true);
codec_combobox_->clear();
foreach (ExportCodec::Codec acodec, acodecs) {
codec_combobox_->addItem(ExportCodec::GetCodecName(acodec), acodec);
}
codec_combobox_->blockSignals(false);
fmt_ = format;
QList<ExportCodec::Codec> acodecs = ExportFormat::GetAudioCodecs(format);
setEnabled(!acodecs.isEmpty());
codec_combobox_->blockSignals(true);
codec_combobox_->clear();
foreach (ExportCodec::Codec acodec, acodecs) {
codec_combobox_->addItem(ExportCodec::GetCodecName(acodec), acodec);
}
codec_combobox_->blockSignals(false);
fmt_ = format;
UpdateSampleFormats();
UpdateBitRateEnabled();
UpdateSampleFormats();
UpdateBitRateEnabled();
return acodecs.size();
return acodecs.size();
}
void ExportAudioTab::UpdateSampleFormats()
{
auto fmts = ExportFormat::GetSampleFormatsForCodec(fmt_, GetCodec());
sample_format_combobox_->SetAvailableFormats(fmts);
auto fmts = ExportFormat::GetSampleFormatsForCodec(fmt_, GetCodec());
sample_format_combobox_->SetAvailableFormats(fmts);
}
void ExportAudioTab::UpdateBitRateEnabled()
{
bool uses_bitrate = !ExportCodec::IsCodecLossless(GetCodec());
bit_rate_slider_->setEnabled(uses_bitrate);
bool uses_bitrate = !ExportCodec::IsCodecLossless(GetCodec());
bit_rate_slider_->setEnabled(uses_bitrate);
if (!uses_bitrate) {
bit_rate_slider_->SetTristate();
} else {
bit_rate_slider_->SetValue(kDefaultBitRate );
}
if (!uses_bitrate) {
bit_rate_slider_->SetTristate();
} else {
bit_rate_slider_->SetValue(kDefaultBitRate);
}
}
}
+45 -45
View File
@@ -29,67 +29,67 @@
#include "widget/slider/integerslider.h"
#include "widget/standardcombos/standardcombos.h"
namespace olive {
class ExportAudioTab : public QWidget
namespace olive
{
Q_OBJECT
class ExportAudioTab : public QWidget {
Q_OBJECT
public:
ExportAudioTab(QWidget* parent = nullptr);
ExportAudioTab(QWidget *parent = nullptr);
ExportCodec::Codec GetCodec() const
{
return static_cast<ExportCodec::Codec>(codec_combobox_->currentData().toInt());
}
ExportCodec::Codec GetCodec() const
{
return static_cast<ExportCodec::Codec>(
codec_combobox_->currentData().toInt());
}
void SetCodec(ExportCodec::Codec c)
{
for (int i=0; i<codec_combobox_->count(); i++) {
if (codec_combobox_->itemData(i) == c) {
codec_combobox_->setCurrentIndex(i);
break;
}
}
}
void SetCodec(ExportCodec::Codec c)
{
for (int i = 0; i < codec_combobox_->count(); i++) {
if (codec_combobox_->itemData(i) == c) {
codec_combobox_->setCurrentIndex(i);
break;
}
}
}
SampleRateComboBox* sample_rate_combobox() const
{
return sample_rate_combobox_;
}
SampleRateComboBox *sample_rate_combobox() const
{
return sample_rate_combobox_;
}
SampleFormatComboBox* sample_format_combobox() const
{
return sample_format_combobox_;
}
SampleFormatComboBox *sample_format_combobox() const
{
return sample_format_combobox_;
}
ChannelLayoutComboBox* channel_layout_combobox() const
{
return channel_layout_combobox_;
}
ChannelLayoutComboBox *channel_layout_combobox() const
{
return channel_layout_combobox_;
}
IntegerSlider* bit_rate_slider() const
{
return bit_rate_slider_;
}
IntegerSlider *bit_rate_slider() const
{
return bit_rate_slider_;
}
public slots:
int SetFormat(ExportFormat::Format format);
int SetFormat(ExportFormat::Format format);
private:
ExportFormat::Format fmt_;
QComboBox* codec_combobox_;
SampleRateComboBox* sample_rate_combobox_;
ChannelLayoutComboBox* channel_layout_combobox_;
SampleFormatComboBox *sample_format_combobox_;
IntegerSlider* bit_rate_slider_;
ExportFormat::Format fmt_;
QComboBox *codec_combobox_;
SampleRateComboBox *sample_rate_combobox_;
ChannelLayoutComboBox *channel_layout_combobox_;
SampleFormatComboBox *sample_format_combobox_;
IntegerSlider *bit_rate_slider_;
static const int kDefaultBitRate;
static const int kDefaultBitRate;
private slots:
void UpdateSampleFormats();
void UpdateBitRateEnabled();
void UpdateSampleFormats();
void UpdateBitRateEnabled();
};
}
+80 -76
View File
@@ -25,115 +25,119 @@
#include "ui/icons/icons.h"
namespace olive {
ExportFormatComboBox::ExportFormatComboBox(Mode mode, QWidget *parent) :
QComboBox(parent)
namespace olive
{
custom_menu_ = new Menu(this);
// Populate combobox formats
switch (mode) {
case kShowAllFormats:
custom_menu_->addAction(CreateHeader(icon::Video, tr("Video")));
PopulateType(Track::kVideo);
custom_menu_->addSeparator();
ExportFormatComboBox::ExportFormatComboBox(Mode mode, QWidget *parent)
: QComboBox(parent)
{
custom_menu_ = new Menu(this);
custom_menu_->addAction(CreateHeader(icon::Audio, tr("Audio")));
PopulateType(Track::kAudio);
custom_menu_->addSeparator();
// Populate combobox formats
switch (mode) {
case kShowAllFormats:
custom_menu_->addAction(CreateHeader(icon::Video, tr("Video")));
PopulateType(Track::kVideo);
custom_menu_->addSeparator();
custom_menu_->addAction(CreateHeader(icon::Subtitles, tr("Subtitle")));
PopulateType(Track::kSubtitle);
break;
case kShowAudioOnly:
PopulateType(Track::kAudio);
break;
case kShowVideoOnly:
PopulateType(Track::kVideo);
break;
case kShowSubtitlesOnly:
PopulateType(Track::kSubtitle);
break;
}
custom_menu_->addAction(CreateHeader(icon::Audio, tr("Audio")));
PopulateType(Track::kAudio);
custom_menu_->addSeparator();
connect(custom_menu_, &Menu::triggered, this, &ExportFormatComboBox::HandleIndexChange);
custom_menu_->addAction(CreateHeader(icon::Subtitles, tr("Subtitle")));
PopulateType(Track::kSubtitle);
break;
case kShowAudioOnly:
PopulateType(Track::kAudio);
break;
case kShowVideoOnly:
PopulateType(Track::kVideo);
break;
case kShowSubtitlesOnly:
PopulateType(Track::kSubtitle);
break;
}
connect(custom_menu_, &Menu::triggered, this,
&ExportFormatComboBox::HandleIndexChange);
}
void ExportFormatComboBox::showPopup()
{
custom_menu_->setMinimumWidth(this->width());
custom_menu_->exec(mapToGlobal(QPoint(0, 0)));
custom_menu_->setMinimumWidth(this->width());
custom_menu_->exec(mapToGlobal(QPoint(0, 0)));
}
void ExportFormatComboBox::SetFormat(ExportFormat::Format fmt)
{
current_ = fmt;
clear();
addItem(ExportFormat::GetName(current_));
current_ = fmt;
clear();
addItem(ExportFormat::GetName(current_));
}
void ExportFormatComboBox::HandleIndexChange(QAction *a)
{
ExportFormat::Format f = static_cast<ExportFormat::Format>(a->data().toInt());
SetFormat(f);
emit FormatChanged(f);
ExportFormat::Format f =
static_cast<ExportFormat::Format>(a->data().toInt());
SetFormat(f);
emit FormatChanged(f);
}
void ExportFormatComboBox::PopulateType(Track::Type type)
{
for (int i=0; i<ExportFormat::kFormatCount; i++) {
ExportFormat::Format f = static_cast<ExportFormat::Format>(i);
for (int i = 0; i < ExportFormat::kFormatCount; i++) {
ExportFormat::Format f = static_cast<ExportFormat::Format>(i);
if (type == Track::kVideo
&& !ExportFormat::GetVideoCodecs(f).isEmpty()) {
// Do nothing
} else if (type == Track::kAudio
&& ExportFormat::GetVideoCodecs(f).isEmpty()
&& !ExportFormat::GetAudioCodecs(f).isEmpty()) {
// Do nothing
} else if (type == Track::kSubtitle
&& ExportFormat::GetVideoCodecs(f).isEmpty()
&& ExportFormat::GetAudioCodecs(f).isEmpty()
&& !ExportFormat::GetSubtitleCodecs(f).isEmpty()) {
// Do nothing
} else {
continue;
}
if (type == Track::kVideo &&
!ExportFormat::GetVideoCodecs(f).isEmpty()) {
// Do nothing
} else if (type == Track::kAudio &&
ExportFormat::GetVideoCodecs(f).isEmpty() &&
!ExportFormat::GetAudioCodecs(f).isEmpty()) {
// Do nothing
} else if (type == Track::kSubtitle &&
ExportFormat::GetVideoCodecs(f).isEmpty() &&
ExportFormat::GetAudioCodecs(f).isEmpty() &&
!ExportFormat::GetSubtitleCodecs(f).isEmpty()) {
// Do nothing
} else {
continue;
}
QString format_name = ExportFormat::GetName(f);
QString format_name = ExportFormat::GetName(f);
QAction *a = custom_menu_->addAction(format_name);
a->setData(i);
a->setIconVisibleInMenu(false);
}
QAction *a = custom_menu_->addAction(format_name);
a->setData(i);
a->setIconVisibleInMenu(false);
}
}
QWidgetAction *ExportFormatComboBox::CreateHeader(const QIcon &icon, const QString &title)
QWidgetAction *ExportFormatComboBox::CreateHeader(const QIcon &icon,
const QString &title)
{
QWidgetAction *a = new QWidgetAction(this);
QWidgetAction *a = new QWidgetAction(this);
QWidget *w = new QWidget();
QHBoxLayout *layout = new QHBoxLayout(w);
QWidget *w = new QWidget();
QHBoxLayout *layout = new QHBoxLayout(w);
QLabel *icon_lbl = new QLabel();
QLabel *icon_lbl = new QLabel();
QLabel *text_lbl = new QLabel(title);
text_lbl->setAlignment(Qt::AlignCenter);
QFont f = text_lbl->font();
f.setWeight(QFont::Bold);
text_lbl->setFont(f);
QLabel *text_lbl = new QLabel(title);
text_lbl->setAlignment(Qt::AlignCenter);
QFont f = text_lbl->font();
f.setWeight(QFont::Bold);
text_lbl->setFont(f);
icon_lbl->setPixmap(icon.pixmap(text_lbl->sizeHint()));
icon_lbl->setPixmap(icon.pixmap(text_lbl->sizeHint()));
layout->addStretch();
layout->addWidget(icon_lbl);
layout->addWidget(text_lbl);
layout->addStretch();
layout->addStretch();
layout->addWidget(icon_lbl);
layout->addWidget(text_lbl);
layout->addStretch();
a->setDefaultWidget(w);
a->setEnabled(false);
return a;
a->setDefaultWidget(w);
a->setEnabled(false);
return a;
}
}
+27 -27
View File
@@ -28,49 +28,49 @@
#include "node/output/track/track.h"
#include "widget/menu/menu.h"
namespace olive {
class ExportFormatComboBox : public QComboBox
namespace olive
{
Q_OBJECT
class ExportFormatComboBox : public QComboBox {
Q_OBJECT
public:
enum Mode {
kShowAllFormats,
kShowAudioOnly,
kShowVideoOnly,
kShowSubtitlesOnly
};
enum Mode {
kShowAllFormats,
kShowAudioOnly,
kShowVideoOnly,
kShowSubtitlesOnly
};
ExportFormatComboBox(Mode mode, QWidget *parent = nullptr);
ExportFormatComboBox(QWidget *parent = nullptr) :
ExportFormatComboBox(kShowAllFormats, parent)
{}
ExportFormatComboBox(Mode mode, QWidget *parent = nullptr);
ExportFormatComboBox(QWidget *parent = nullptr)
: ExportFormatComboBox(kShowAllFormats, parent)
{
}
ExportFormat::Format GetFormat() const
{
return current_;
}
ExportFormat::Format GetFormat() const
{
return current_;
}
void showPopup();
void showPopup();
signals:
void FormatChanged(ExportFormat::Format fmt);
void FormatChanged(ExportFormat::Format fmt);
public slots:
void SetFormat(ExportFormat::Format fmt);
void SetFormat(ExportFormat::Format fmt);
private slots:
void HandleIndexChange(QAction *a);
void HandleIndexChange(QAction *a);
private:
void PopulateType(Track::Type type);
void PopulateType(Track::Type type);
QWidgetAction *CreateHeader(const QIcon &icon, const QString &title);
QWidgetAction *CreateHeader(const QIcon &icon, const QString &title);
Menu *custom_menu_;
ExportFormat::Format current_;
Menu *custom_menu_;
ExportFormat::Format current_;
};
}
+62 -49
View File
@@ -25,73 +25,86 @@
#include <QMessageBox>
#include <QVBoxLayout>
namespace olive {
ExportSavePresetDialog::ExportSavePresetDialog(const EncodingParams &p, QWidget *parent) :
QDialog(parent),
params_(p)
namespace olive
{
auto layout = new QVBoxLayout(this);
name_edit_ = new QLineEdit();
ExportSavePresetDialog::ExportSavePresetDialog(const EncodingParams &p,
QWidget *parent)
: QDialog(parent)
, params_(p)
{
auto layout = new QVBoxLayout(this);
// Populate existing list
QStringList l = EncodingParams::GetListOfPresets();
if (!l.empty()) {
auto list_widget_ = new QListWidget();
for (const QString &f : l) {
list_widget_->addItem(f);
}
connect(list_widget_, &QListWidget::currentTextChanged, name_edit_, &QLineEdit::setText);
layout->addWidget(list_widget_);
}
name_edit_ = new QLineEdit();
auto name_layout = new QHBoxLayout();
layout->addLayout(name_layout);
// Populate existing list
QStringList l = EncodingParams::GetListOfPresets();
if (!l.empty()) {
auto list_widget_ = new QListWidget();
for (const QString &f : l) {
list_widget_->addItem(f);
}
connect(list_widget_, &QListWidget::currentTextChanged, name_edit_,
&QLineEdit::setText);
layout->addWidget(list_widget_);
}
name_layout->addWidget(new QLabel(tr("Name:")));
auto name_layout = new QHBoxLayout();
layout->addLayout(name_layout);
name_edit_->setFocus();
name_layout->addWidget(name_edit_);
name_layout->addWidget(new QLabel(tr("Name:")));
auto btns = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
connect(btns, &QDialogButtonBox::accepted, this, &ExportSavePresetDialog::accept);
connect(btns, &QDialogButtonBox::rejected, this, &ExportSavePresetDialog::reject);
layout->addWidget(btns);
name_edit_->setFocus();
name_layout->addWidget(name_edit_);
setWindowTitle(tr("Save Export Preset"));
auto btns =
new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
connect(btns, &QDialogButtonBox::accepted, this,
&ExportSavePresetDialog::accept);
connect(btns, &QDialogButtonBox::rejected, this,
&ExportSavePresetDialog::reject);
layout->addWidget(btns);
setWindowTitle(tr("Save Export Preset"));
}
void ExportSavePresetDialog::accept()
{
if (name_edit_->text().isEmpty()) {
QMessageBox::critical(this, tr("Invalid Name"), tr("You must enter a name to save an export preset."));
return;
}
if (name_edit_->text().isEmpty()) {
QMessageBox::critical(
this, tr("Invalid Name"),
tr("You must enter a name to save an export preset."));
return;
}
QDir d(EncodingParams::GetPresetPath());
if (!d.exists()) {
d.mkpath(QStringLiteral("."));
}
QDir d(EncodingParams::GetPresetPath());
if (!d.exists()) {
d.mkpath(QStringLiteral("."));
}
QFile f(d.filePath(name_edit_->text()));
if (f.exists()) {
if (QMessageBox::question(this, tr("Overwrite Preset"), tr("A preset with the name \"%1\" already exists. Do you wish to overwrite it?").arg(name_edit_->text()),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) {
return;
}
}
QFile f(d.filePath(name_edit_->text()));
if (f.exists()) {
if (QMessageBox::question(
this, tr("Overwrite Preset"),
tr("A preset with the name \"%1\" already exists. Do you wish to overwrite it?")
.arg(name_edit_->text()),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) {
return;
}
}
if (!f.open(QFile::WriteOnly)) {
QMessageBox::critical(this, tr("Write Error"), tr("Failed to open file \"%1\" for writing.").arg(f.fileName()));
return;
}
if (!f.open(QFile::WriteOnly)) {
QMessageBox::critical(
this, tr("Write Error"),
tr("Failed to open file \"%1\" for writing.").arg(f.fileName()));
return;
}
params_.Save(&f);
params_.Save(&f);
f.close();
f.close();
QDialog::accept();
QDialog::accept();
}
}
+13 -14
View File
@@ -27,27 +27,26 @@
#include "codec/encoder.h"
namespace olive {
class ExportSavePresetDialog : public QDialog
namespace olive
{
Q_OBJECT
public:
ExportSavePresetDialog(const EncodingParams &p, QWidget *parent = nullptr);
QString GetSelectedPresetName() const
{
return name_edit_->text();
}
class ExportSavePresetDialog : public QDialog {
Q_OBJECT
public:
ExportSavePresetDialog(const EncodingParams &p, QWidget *parent = nullptr);
QString GetSelectedPresetName() const
{
return name_edit_->text();
}
public slots:
virtual void accept() override;
virtual void accept() override;
private:
QLineEdit *name_edit_;
EncodingParams params_;
QLineEdit *name_edit_;
EncodingParams params_;
};
}
+47 -42
View File
@@ -2,69 +2,74 @@
#include <QGridLayout>
namespace olive {
ExportSubtitlesTab::ExportSubtitlesTab(QWidget *parent) :
QWidget(parent)
namespace olive
{
QVBoxLayout* outer_layout = new QVBoxLayout(this);
QGridLayout* layout = new QGridLayout();
outer_layout->addLayout(layout);
ExportSubtitlesTab::ExportSubtitlesTab(QWidget *parent)
: QWidget(parent)
{
QVBoxLayout *outer_layout = new QVBoxLayout(this);
int row = 0;
QGridLayout *layout = new QGridLayout();
outer_layout->addLayout(layout);
sidecar_checkbox_ = new QCheckBox(tr("Export to sidecar file"));
layout->addWidget(sidecar_checkbox_, row, 0, 1, 2);
int row = 0;
row++;
sidecar_checkbox_ = new QCheckBox(tr("Export to sidecar file"));
layout->addWidget(sidecar_checkbox_, row, 0, 1, 2);
sidecar_format_label_ = new QLabel(tr("Sidecar Format:"));
sidecar_format_label_->setVisible(false);
layout->addWidget(sidecar_format_label_, row, 0);
row++;
sidecar_format_combobox_ = new ExportFormatComboBox(ExportFormatComboBox::kShowSubtitlesOnly);
sidecar_format_combobox_->setVisible(true);
layout->addWidget(sidecar_format_combobox_, row, 1);
sidecar_format_label_ = new QLabel(tr("Sidecar Format:"));
sidecar_format_label_->setVisible(false);
layout->addWidget(sidecar_format_label_, row, 0);
row++;
sidecar_format_combobox_ =
new ExportFormatComboBox(ExportFormatComboBox::kShowSubtitlesOnly);
sidecar_format_combobox_->setVisible(true);
layout->addWidget(sidecar_format_combobox_, row, 1);
layout->addWidget(new QLabel(tr("Codec:")), row, 0);
row++;
codec_combobox_ = new QComboBox();
layout->addWidget(codec_combobox_, row, 1);
layout->addWidget(new QLabel(tr("Codec:")), row, 0);
outer_layout->addStretch();
codec_combobox_ = new QComboBox();
layout->addWidget(codec_combobox_, row, 1);
connect(sidecar_checkbox_, &QCheckBox::toggled, sidecar_format_label_, &QWidget::setVisible);
connect(sidecar_checkbox_, &QCheckBox::toggled, sidecar_format_combobox_, &QWidget::setVisible);
outer_layout->addStretch();
connect(sidecar_checkbox_, &QCheckBox::toggled, sidecar_format_label_,
&QWidget::setVisible);
connect(sidecar_checkbox_, &QCheckBox::toggled, sidecar_format_combobox_,
&QWidget::setVisible);
}
int ExportSubtitlesTab::SetFormat(ExportFormat::Format format)
{
auto vcodecs = ExportFormat::GetVideoCodecs(format);
auto acodecs = ExportFormat::GetAudioCodecs(format);
auto vcodecs = ExportFormat::GetVideoCodecs(format);
auto acodecs = ExportFormat::GetAudioCodecs(format);
auto scodecs = ExportFormat::GetSubtitleCodecs(format);
auto scodecs = ExportFormat::GetSubtitleCodecs(format);
if (!scodecs.empty() && vcodecs.empty() && acodecs.empty()) {
// If format supports ONLY scodecs, default this to off and disable it
sidecar_checkbox_->setChecked(false);
sidecar_checkbox_->setEnabled(false);
} else {
// If format does not support scodecs, default this to checked and disable it
sidecar_checkbox_->setChecked(scodecs.empty());
sidecar_checkbox_->setEnabled(!scodecs.empty());
}
if (!scodecs.empty() && vcodecs.empty() && acodecs.empty()) {
// If format supports ONLY scodecs, default this to off and disable it
sidecar_checkbox_->setChecked(false);
sidecar_checkbox_->setEnabled(false);
} else {
// If format does not support scodecs, default this to checked and disable it
sidecar_checkbox_->setChecked(scodecs.empty());
sidecar_checkbox_->setEnabled(!scodecs.empty());
}
scodecs = ExportFormat::GetSubtitleCodecs(sidecar_format_combobox_->GetFormat());
scodecs =
ExportFormat::GetSubtitleCodecs(sidecar_format_combobox_->GetFormat());
codec_combobox_->clear();
foreach (ExportCodec::Codec scodec, scodecs) {
codec_combobox_->addItem(ExportCodec::GetCodecName(scodec), scodec);
}
codec_combobox_->clear();
foreach (ExportCodec::Codec scodec, scodecs) {
codec_combobox_->addItem(ExportCodec::GetCodecName(scodec), scodec);
}
return scodecs.size();
return scodecs.size();
}
}
+35 -23
View File
@@ -29,40 +29,52 @@
#include "common/qtutils.h"
#include "dialog/export/exportformatcombobox.h"
namespace olive {
class ExportSubtitlesTab : public QWidget
namespace olive
{
Q_OBJECT
class ExportSubtitlesTab : public QWidget {
Q_OBJECT
public:
ExportSubtitlesTab(QWidget *parent = nullptr);
ExportSubtitlesTab(QWidget *parent = nullptr);
bool GetSidecarEnabled() const { return sidecar_checkbox_->isChecked(); }
void SetSidecarEnabled(bool e) { sidecar_checkbox_->setEnabled(e); }
bool GetSidecarEnabled() const
{
return sidecar_checkbox_->isChecked();
}
void SetSidecarEnabled(bool e)
{
sidecar_checkbox_->setEnabled(e);
}
ExportFormat::Format GetSidecarFormat() const { return sidecar_format_combobox_->GetFormat(); }
void SetSidecarFormat(ExportFormat::Format f) { sidecar_format_combobox_->SetFormat(f); }
ExportFormat::Format GetSidecarFormat() const
{
return sidecar_format_combobox_->GetFormat();
}
void SetSidecarFormat(ExportFormat::Format f)
{
sidecar_format_combobox_->SetFormat(f);
}
int SetFormat(ExportFormat::Format format);
int SetFormat(ExportFormat::Format format);
ExportCodec::Codec GetSubtitleCodec()
{
return static_cast<ExportCodec::Codec>(codec_combobox_->currentData().toInt());
}
ExportCodec::Codec GetSubtitleCodec()
{
return static_cast<ExportCodec::Codec>(
codec_combobox_->currentData().toInt());
}
void SetSubtitleCodec(ExportCodec::Codec c)
{
QtUtils::SetComboBoxData(codec_combobox_, c);
}
void SetSubtitleCodec(ExportCodec::Codec c)
{
QtUtils::SetComboBoxData(codec_combobox_, c);
}
private:
QCheckBox *sidecar_checkbox_;
QCheckBox *sidecar_checkbox_;
QLabel *sidecar_format_label_;
ExportFormatComboBox *sidecar_format_combobox_;
QComboBox *codec_combobox_;
QLabel *sidecar_format_label_;
ExportFormatComboBox *sidecar_format_combobox_;
QComboBox *codec_combobox_;
};
}
+170 -157
View File
@@ -30,259 +30,272 @@
#include "exportadvancedvideodialog.h"
#include "node/color/colormanager/colormanager.h"
namespace olive {
ExportVideoTab::ExportVideoTab(ColorManager* color_manager, QWidget *parent) :
QWidget(parent),
color_manager_(color_manager),
threads_(0),
color_range_(VideoParams::kColorRangeDefault)
namespace olive
{
QVBoxLayout* outer_layout = new QVBoxLayout(this);
outer_layout->addWidget(SetupResolutionSection());
ExportVideoTab::ExportVideoTab(ColorManager *color_manager, QWidget *parent)
: QWidget(parent)
, color_manager_(color_manager)
, threads_(0)
, color_range_(VideoParams::kColorRangeDefault)
{
QVBoxLayout *outer_layout = new QVBoxLayout(this);
outer_layout->addWidget(SetupCodecSection());
outer_layout->addWidget(SetupResolutionSection());
outer_layout->addWidget(SetupColorSection());
outer_layout->addWidget(SetupCodecSection());
outer_layout->addStretch();
outer_layout->addWidget(SetupColorSection());
outer_layout->addStretch();
}
int ExportVideoTab::SetFormat(ExportFormat::Format format)
{
format_ = format;
format_ = format;
QList<ExportCodec::Codec> vcodecs = ExportFormat::GetVideoCodecs(format);
setEnabled(!vcodecs.isEmpty());
codec_combobox()->clear();
foreach (ExportCodec::Codec vcodec, vcodecs) {
codec_combobox()->addItem(ExportCodec::GetCodecName(vcodec), vcodec);
}
return vcodecs.size();
QList<ExportCodec::Codec> vcodecs = ExportFormat::GetVideoCodecs(format);
setEnabled(!vcodecs.isEmpty());
codec_combobox()->clear();
foreach (ExportCodec::Codec vcodec, vcodecs) {
codec_combobox()->addItem(ExportCodec::GetCodecName(vcodec), vcodec);
}
return vcodecs.size();
}
bool ExportVideoTab::IsImageSequenceSet() const
{
ImageSection* img_section = dynamic_cast<ImageSection*>(codec_stack_->currentWidget());
ImageSection *img_section =
dynamic_cast<ImageSection *>(codec_stack_->currentWidget());
return (img_section && img_section->IsImageSequenceChecked());
return (img_section && img_section->IsImageSequenceChecked());
}
void ExportVideoTab::SetImageSequence(bool e) const
{
if (ImageSection* img_section = dynamic_cast<ImageSection*>(codec_stack_->currentWidget())) {
img_section->SetImageSequenceChecked(e);
}
if (ImageSection *img_section =
dynamic_cast<ImageSection *>(codec_stack_->currentWidget())) {
img_section->SetImageSequenceChecked(e);
}
}
QWidget* ExportVideoTab::SetupResolutionSection()
QWidget *ExportVideoTab::SetupResolutionSection()
{
int row = 0;
int row = 0;
QGroupBox* resolution_group = new QGroupBox();
resolution_group->setTitle(tr("General"));
QGroupBox *resolution_group = new QGroupBox();
resolution_group->setTitle(tr("General"));
QGridLayout* layout = new QGridLayout(resolution_group);
QGridLayout *layout = new QGridLayout(resolution_group);
layout->addWidget(new QLabel(tr("Width:")), row, 0);
layout->addWidget(new QLabel(tr("Width:")), row, 0);
width_slider_ = new IntegerSlider();
width_slider_->SetMinimum(1);
layout->addWidget(width_slider_, row, 1);
width_slider_ = new IntegerSlider();
width_slider_->SetMinimum(1);
layout->addWidget(width_slider_, row, 1);
row++;
row++;
layout->addWidget(new QLabel(tr("Height:")), row, 0);
layout->addWidget(new QLabel(tr("Height:")), row, 0);
height_slider_ = new IntegerSlider();
height_slider_->SetMinimum(1);
layout->addWidget(height_slider_, row, 1);
height_slider_ = new IntegerSlider();
height_slider_->SetMinimum(1);
layout->addWidget(height_slider_, row, 1);
row++;
row++;
layout->addWidget(new QLabel(tr("Maintain Aspect Ratio:")), row, 0);
layout->addWidget(new QLabel(tr("Maintain Aspect Ratio:")), row, 0);
maintain_aspect_checkbox_ = new QCheckBox();
maintain_aspect_checkbox_->setChecked(true);
layout->addWidget(maintain_aspect_checkbox_, row, 1);
maintain_aspect_checkbox_ = new QCheckBox();
maintain_aspect_checkbox_->setChecked(true);
layout->addWidget(maintain_aspect_checkbox_, row, 1);
row++;
row++;
layout->addWidget(new QLabel(tr("Scaling Method:")), row, 0);
layout->addWidget(new QLabel(tr("Scaling Method:")), row, 0);
scaling_method_combobox_ = new QComboBox();
scaling_method_combobox_->setEnabled(false);
scaling_method_combobox_->addItem(tr("Fit"), EncodingParams::kFit);
scaling_method_combobox_->addItem(tr("Stretch"), EncodingParams::kStretch);
scaling_method_combobox_->addItem(tr("Crop"), EncodingParams::kCrop);
layout->addWidget(scaling_method_combobox_, row, 1);
scaling_method_combobox_ = new QComboBox();
scaling_method_combobox_->setEnabled(false);
scaling_method_combobox_->addItem(tr("Fit"), EncodingParams::kFit);
scaling_method_combobox_->addItem(tr("Stretch"), EncodingParams::kStretch);
scaling_method_combobox_->addItem(tr("Crop"), EncodingParams::kCrop);
layout->addWidget(scaling_method_combobox_, row, 1);
// Automatically enable/disable the scaling method depending on maintain aspect ratio
connect(maintain_aspect_checkbox_, &QCheckBox::toggled, this, &ExportVideoTab::MaintainAspectRatioChanged);
// Automatically enable/disable the scaling method depending on maintain aspect ratio
connect(maintain_aspect_checkbox_, &QCheckBox::toggled, this,
&ExportVideoTab::MaintainAspectRatioChanged);
row++;
row++;
layout->addWidget(new QLabel(tr("Frame Rate:")), row, 0);
layout->addWidget(new QLabel(tr("Frame Rate:")), row, 0);
frame_rate_combobox_ = new FrameRateComboBox();
connect(frame_rate_combobox_, &FrameRateComboBox::FrameRateChanged, this, &ExportVideoTab::UpdateFrameRate);
layout->addWidget(frame_rate_combobox_, row, 1);
frame_rate_combobox_ = new FrameRateComboBox();
connect(frame_rate_combobox_, &FrameRateComboBox::FrameRateChanged, this,
&ExportVideoTab::UpdateFrameRate);
layout->addWidget(frame_rate_combobox_, row, 1);
row++;
row++;
layout->addWidget(new QLabel(tr("Pixel Aspect Ratio:")), row, 0);
layout->addWidget(new QLabel(tr("Pixel Aspect Ratio:")), row, 0);
pixel_aspect_combobox_ = new PixelAspectRatioComboBox();
layout->addWidget(pixel_aspect_combobox_, row, 1);
pixel_aspect_combobox_ = new PixelAspectRatioComboBox();
layout->addWidget(pixel_aspect_combobox_, row, 1);
row++;
row++;
layout->addWidget(new QLabel(tr("Interlacing:")), row, 0);
layout->addWidget(new QLabel(tr("Interlacing:")), row, 0);
interlaced_combobox_ = new InterlacedComboBox();
layout->addWidget(interlaced_combobox_, row, 1);
interlaced_combobox_ = new InterlacedComboBox();
layout->addWidget(interlaced_combobox_, row, 1);
row++;
row++;
layout->addWidget(new QLabel(tr("Quality:")), row, 0);
layout->addWidget(new QLabel(tr("Quality:")), row, 0);
pixel_format_field_ = new PixelFormatComboBox(false);
layout->addWidget(pixel_format_field_, row, 1);
pixel_format_field_ = new PixelFormatComboBox(false);
layout->addWidget(pixel_format_field_, row, 1);
return resolution_group;
return resolution_group;
}
QWidget* ExportVideoTab::SetupColorSection()
QWidget *ExportVideoTab::SetupColorSection()
{
color_space_chooser_ = new ColorSpaceChooser(color_manager_, true, false);
connect(color_space_chooser_, &ColorSpaceChooser::InputColorSpaceChanged, this, &ExportVideoTab::ColorSpaceChanged);
return color_space_chooser_;
color_space_chooser_ = new ColorSpaceChooser(color_manager_, true, false);
connect(color_space_chooser_, &ColorSpaceChooser::InputColorSpaceChanged,
this, &ExportVideoTab::ColorSpaceChanged);
return color_space_chooser_;
}
QWidget *ExportVideoTab::SetupCodecSection()
{
int row = 0;
int row = 0;
QGroupBox* codec_group = new QGroupBox();
codec_group->setTitle(tr("Codec"));
QGroupBox *codec_group = new QGroupBox();
codec_group->setTitle(tr("Codec"));
QGridLayout* codec_layout = new QGridLayout(codec_group);
QGridLayout *codec_layout = new QGridLayout(codec_group);
codec_layout->addWidget(new QLabel(tr("Codec:")), row, 0);
codec_layout->addWidget(new QLabel(tr("Codec:")), row, 0);
codec_combobox_ = new QComboBox();
codec_layout->addWidget(codec_combobox_, row, 1);
connect(codec_combobox_,
static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this,
&ExportVideoTab::VideoCodecChanged);
codec_combobox_ = new QComboBox();
codec_layout->addWidget(codec_combobox_, row, 1);
connect(
codec_combobox_,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &ExportVideoTab::VideoCodecChanged);
row++;
row++;
codec_stack_ = new CodecStack();
codec_layout->addWidget(codec_stack_, row, 0, 1, 2);
codec_stack_ = new CodecStack();
codec_layout->addWidget(codec_stack_, row, 0, 1, 2);
image_section_ = new ImageSection();
connect(image_section_, &ImageSection::TimeChanged, this, &ExportVideoTab::TimeChanged);
codec_stack_->addWidget(image_section_);
image_section_ = new ImageSection();
connect(image_section_, &ImageSection::TimeChanged, this,
&ExportVideoTab::TimeChanged);
codec_stack_->addWidget(image_section_);
h264_section_ = new H264Section();
codec_stack_->addWidget(h264_section_);
h264_section_ = new H264Section();
codec_stack_->addWidget(h264_section_);
h265_section_ = new H265Section();
codec_stack_->addWidget(h265_section_);
h265_section_ = new H265Section();
codec_stack_->addWidget(h265_section_);
av1_section_ = new AV1Section();
codec_stack_->addWidget(av1_section_);
av1_section_ = new AV1Section();
codec_stack_->addWidget(av1_section_);
cineform_section_ = new CineformSection();
codec_stack_->addWidget(cineform_section_);
cineform_section_ = new CineformSection();
codec_stack_->addWidget(cineform_section_);
row++;
row++;
QPushButton* advanced_btn = new QPushButton(tr("Advanced"));
connect(advanced_btn, &QPushButton::clicked, this, &ExportVideoTab::OpenAdvancedDialog);
codec_layout->addWidget(advanced_btn, row, 1);
QPushButton *advanced_btn = new QPushButton(tr("Advanced"));
connect(advanced_btn, &QPushButton::clicked, this,
&ExportVideoTab::OpenAdvancedDialog);
codec_layout->addWidget(advanced_btn, row, 1);
return codec_group;
return codec_group;
}
void ExportVideoTab::MaintainAspectRatioChanged(bool val)
{
scaling_method_combobox_->setEnabled(!val);
scaling_method_combobox_->setEnabled(!val);
}
void ExportVideoTab::OpenAdvancedDialog()
{
// Find export formats compatible with this encoder
QStringList pixel_formats = ExportFormat::GetPixelFormatsForCodec(format_, GetSelectedCodec());
// Find export formats compatible with this encoder
QStringList pixel_formats =
ExportFormat::GetPixelFormatsForCodec(format_, GetSelectedCodec());
ExportAdvancedVideoDialog d(pixel_formats, this);
ExportAdvancedVideoDialog d(pixel_formats, this);
d.set_threads(threads_);
d.set_pix_fmt(pix_fmt_);
d.set_yuv_range(color_range_);
d.set_threads(threads_);
d.set_pix_fmt(pix_fmt_);
d.set_yuv_range(color_range_);
if (d.exec() == QDialog::Accepted) {
threads_ = d.threads();
pix_fmt_ = d.pix_fmt();
color_range_ = d.yuv_range();
}
if (d.exec() == QDialog::Accepted) {
threads_ = d.threads();
pix_fmt_ = d.pix_fmt();
color_range_ = d.yuv_range();
}
}
void ExportVideoTab::UpdateFrameRate(rational r)
{
// Convert frame rate to timebase
r.flip();
// Convert frame rate to timebase
r.flip();
for (int i=0; i<codec_stack_->count(); i++) {
ImageSection* img = dynamic_cast<ImageSection*>(codec_stack_->widget(i));
if (img) {
img->SetTimebase(r);
}
}
for (int i = 0; i < codec_stack_->count(); i++) {
ImageSection *img =
dynamic_cast<ImageSection *>(codec_stack_->widget(i));
if (img) {
img->SetTimebase(r);
}
}
}
void ExportVideoTab::VideoCodecChanged()
{
ExportCodec::Codec codec = GetSelectedCodec();
ExportCodec::Codec codec = GetSelectedCodec();
switch (codec) {
case ExportCodec::kCodecH264:
case ExportCodec::kCodecH264rgb:
SetCodecSection(h264_section_);
break;
case ExportCodec::kCodecH265:
SetCodecSection(h265_section_);
break;
case ExportCodec::kCodecAV1:
SetCodecSection(av1_section_);
break;
case ExportCodec::kCodecCineform:
SetCodecSection(cineform_section_);
break;
default:
SetCodecSection(ExportCodec::IsCodecAStillImage(codec) ? image_section_ : nullptr);
}
switch (codec) {
case ExportCodec::kCodecH264:
case ExportCodec::kCodecH264rgb:
SetCodecSection(h264_section_);
break;
case ExportCodec::kCodecH265:
SetCodecSection(h265_section_);
break;
case ExportCodec::kCodecAV1:
SetCodecSection(av1_section_);
break;
case ExportCodec::kCodecCineform:
SetCodecSection(cineform_section_);
break;
default:
SetCodecSection(
ExportCodec::IsCodecAStillImage(codec) ? image_section_ : nullptr);
}
// Set default pixel format
QStringList pix_fmts = ExportFormat::GetPixelFormatsForCodec(format_, codec);
if (!pix_fmts.isEmpty()) {
pix_fmt_ = pix_fmts.first();
} else {
pix_fmt_.clear();
}
// Set default pixel format
QStringList pix_fmts =
ExportFormat::GetPixelFormatsForCodec(format_, codec);
if (!pix_fmts.isEmpty()) {
pix_fmt_ = pix_fmts.first();
} else {
pix_fmt_.clear();
}
}
void ExportVideoTab::SetTime(const rational &time)
{
for (int i=0; i<codec_stack_->count(); i++) {
ImageSection* img = dynamic_cast<ImageSection*>(codec_stack_->widget(i));
if (img) {
img->SetTime(time);
}
}
for (int i = 0; i < codec_stack_->count(); i++) {
ImageSection *img =
dynamic_cast<ImageSection *>(codec_stack_->widget(i));
if (img) {
img->SetTime(time);
}
}
}
}
+139 -127
View File
@@ -36,180 +36,192 @@
#include "widget/slider/integerslider.h"
#include "widget/standardcombos/standardcombos.h"
namespace olive {
class ExportVideoTab : public QWidget
namespace olive
{
Q_OBJECT
class ExportVideoTab : public QWidget {
Q_OBJECT
public:
ExportVideoTab(ColorManager* color_manager, QWidget* parent = nullptr);
ExportVideoTab(ColorManager *color_manager, QWidget *parent = nullptr);
int SetFormat(ExportFormat::Format format);
int SetFormat(ExportFormat::Format format);
bool IsImageSequenceSet() const;
void SetImageSequence(bool e) const;
bool IsImageSequenceSet() const;
void SetImageSequence(bool e) const;
rational GetStillImageTime() const
{
return image_section_->GetTime();
}
rational GetStillImageTime() const
{
return image_section_->GetTime();
}
ExportCodec::Codec GetSelectedCodec() const
{
return static_cast<ExportCodec::Codec>(codec_combobox()->currentData().toInt());
}
ExportCodec::Codec GetSelectedCodec() const
{
return static_cast<ExportCodec::Codec>(
codec_combobox()->currentData().toInt());
}
void SetSelectedCodec(ExportCodec::Codec c)
{
QtUtils::SetComboBoxData(codec_combobox(), c);
}
void SetSelectedCodec(ExportCodec::Codec c)
{
QtUtils::SetComboBoxData(codec_combobox(), c);
}
QComboBox* codec_combobox() const
{
return codec_combobox_;
}
QComboBox *codec_combobox() const
{
return codec_combobox_;
}
IntegerSlider* width_slider() const
{
return width_slider_;
}
IntegerSlider *width_slider() const
{
return width_slider_;
}
IntegerSlider* height_slider() const
{
return height_slider_;
}
IntegerSlider *height_slider() const
{
return height_slider_;
}
QCheckBox* maintain_aspect_checkbox() const
{
return maintain_aspect_checkbox_;
}
QCheckBox *maintain_aspect_checkbox() const
{
return maintain_aspect_checkbox_;
}
QComboBox* scaling_method_combobox() const
{
return scaling_method_combobox_;
}
QComboBox *scaling_method_combobox() const
{
return scaling_method_combobox_;
}
rational GetSelectedFrameRate() const
{
return frame_rate_combobox_->GetFrameRate();
}
rational GetSelectedFrameRate() const
{
return frame_rate_combobox_->GetFrameRate();
}
void SetSelectedFrameRate(const rational& fr)
{
frame_rate_combobox_->SetFrameRate(fr);
UpdateFrameRate(fr);
}
void SetSelectedFrameRate(const rational &fr)
{
frame_rate_combobox_->SetFrameRate(fr);
UpdateFrameRate(fr);
}
QString CurrentOCIOColorSpace()
{
return color_space_chooser_->input();
}
QString CurrentOCIOColorSpace()
{
return color_space_chooser_->input();
}
void SetOCIOColorSpace(const QString &s)
{
color_space_chooser_->set_input(s);
}
void SetOCIOColorSpace(const QString &s)
{
color_space_chooser_->set_input(s);
}
CodecSection* GetCodecSection() const
{
return static_cast<CodecSection*>(codec_stack_->currentWidget());
}
CodecSection *GetCodecSection() const
{
return static_cast<CodecSection *>(codec_stack_->currentWidget());
}
void SetCodecSection(CodecSection* section)
{
if (section) {
codec_stack_->setVisible(true);
codec_stack_->setCurrentWidget(section);
} else {
codec_stack_->setVisible(false);
}
}
void SetCodecSection(CodecSection *section)
{
if (section) {
codec_stack_->setVisible(true);
codec_stack_->setCurrentWidget(section);
} else {
codec_stack_->setVisible(false);
}
}
InterlacedComboBox* interlaced_combobox() const
{
return interlaced_combobox_;
}
InterlacedComboBox *interlaced_combobox() const
{
return interlaced_combobox_;
}
PixelAspectRatioComboBox* pixel_aspect_combobox() const
{
return pixel_aspect_combobox_;
}
PixelAspectRatioComboBox *pixel_aspect_combobox() const
{
return pixel_aspect_combobox_;
}
PixelFormatComboBox* pixel_format_field() const
{
return pixel_format_field_;
}
PixelFormatComboBox *pixel_format_field() const
{
return pixel_format_field_;
}
const int& threads() const
{
return threads_;
}
const int &threads() const
{
return threads_;
}
void SetThreads(int t)
{
threads_ = t;
}
void SetThreads(int t)
{
threads_ = t;
}
const QString& pix_fmt() const { return pix_fmt_; }
void SetPixFmt(const QString &s) { pix_fmt_ = s; }
const QString &pix_fmt() const
{
return pix_fmt_;
}
void SetPixFmt(const QString &s)
{
pix_fmt_ = s;
}
VideoParams::ColorRange color_range() const { return color_range_; }
void SetColorRange(VideoParams::ColorRange c) { color_range_ = c; }
VideoParams::ColorRange color_range() const
{
return color_range_;
}
void SetColorRange(VideoParams::ColorRange c)
{
color_range_ = c;
}
public slots:
void VideoCodecChanged();
void VideoCodecChanged();
void SetTime(const rational &time);
void SetTime(const rational &time);
signals:
void ColorSpaceChanged(const QString& colorspace);
void ColorSpaceChanged(const QString &colorspace);
void ImageSequenceCheckBoxChanged(bool e);
void ImageSequenceCheckBoxChanged(bool e);
void TimeChanged(const rational &time);
void TimeChanged(const rational &time);
private:
QWidget* SetupResolutionSection();
QWidget* SetupColorSection();
QWidget* SetupCodecSection();
QWidget *SetupResolutionSection();
QWidget *SetupColorSection();
QWidget *SetupCodecSection();
QComboBox* codec_combobox_;
FrameRateComboBox* frame_rate_combobox_;
QCheckBox* maintain_aspect_checkbox_;
QComboBox* scaling_method_combobox_;
QComboBox *codec_combobox_;
FrameRateComboBox *frame_rate_combobox_;
QCheckBox *maintain_aspect_checkbox_;
QComboBox *scaling_method_combobox_;
CodecStack* codec_stack_;
ImageSection* image_section_;
H264Section* h264_section_;
H264Section* h265_section_;
AV1Section* av1_section_;
CineformSection *cineform_section_;
CodecStack *codec_stack_;
ImageSection *image_section_;
H264Section *h264_section_;
H264Section *h265_section_;
AV1Section *av1_section_;
CineformSection *cineform_section_;
ColorSpaceChooser* color_space_chooser_;
ColorSpaceChooser *color_space_chooser_;
IntegerSlider* width_slider_;
IntegerSlider* height_slider_;
IntegerSlider *width_slider_;
IntegerSlider *height_slider_;
ColorManager* color_manager_;
ColorManager *color_manager_;
InterlacedComboBox* interlaced_combobox_;
PixelAspectRatioComboBox* pixel_aspect_combobox_;
PixelFormatComboBox* pixel_format_field_;
InterlacedComboBox *interlaced_combobox_;
PixelAspectRatioComboBox *pixel_aspect_combobox_;
PixelFormatComboBox *pixel_format_field_;
int threads_;
int threads_;
QString pix_fmt_;
VideoParams::ColorRange color_range_;
QString pix_fmt_;
VideoParams::ColorRange color_range_;
ExportFormat::Format format_;
ExportFormat::Format format_;
private slots:
void MaintainAspectRatioChanged(bool val);
void MaintainAspectRatioChanged(bool val);
void OpenAdvancedDialog();
void UpdateFrameRate(rational r);
void OpenAdvancedDialog();
void UpdateFrameRate(rational r);
};
}