viewer: use auto-cache as sequence parameter
This commit is contained in:
@@ -126,7 +126,8 @@ void SequenceDialog::accept()
|
||||
SequenceParamCommand* param_command = new SequenceParamCommand(sequence_,
|
||||
video_params,
|
||||
audio_params,
|
||||
name_field_->text());
|
||||
name_field_->text(),
|
||||
parameter_tab_->GetSelectedPreviewAutoCache());
|
||||
|
||||
Core::instance()->undo_stack()->push(param_command);
|
||||
|
||||
@@ -153,20 +154,23 @@ void SequenceDialog::SetAsDefaultClicked()
|
||||
Config::Current()[QStringLiteral("DefaultSequenceInterlacing")] = parameter_tab_->GetSelectedVideoInterlacingMode();
|
||||
Config::Current()[QStringLiteral("DefaultSequenceAudioFrequency")] = parameter_tab_->GetSelectedAudioSampleRate();
|
||||
Config::Current()[QStringLiteral("DefaultSequenceAudioLayout")] = QVariant::fromValue(parameter_tab_->GetSelectedAudioChannelLayout());
|
||||
Config::Current()[QStringLiteral("DefaultSequenceAutoCache")] = QVariant::fromValue(parameter_tab_->GetSelectedPreviewAutoCache());
|
||||
}
|
||||
}
|
||||
|
||||
SequenceDialog::SequenceParamCommand::SequenceParamCommand(Sequence* s,
|
||||
const VideoParams& video_params,
|
||||
const AudioParams &audio_params,
|
||||
const QString& name) :
|
||||
const QString& name, bool autocache) :
|
||||
sequence_(s),
|
||||
new_video_params_(video_params),
|
||||
new_audio_params_(audio_params),
|
||||
new_name_(name),
|
||||
new_autocache_(autocache),
|
||||
old_video_params_(s->GetVideoParams()),
|
||||
old_audio_params_(s->GetAudioParams()),
|
||||
old_name_(s->GetLabel())
|
||||
old_name_(s->GetLabel()),
|
||||
old_autocache_(s->GetAutoCacheEnabled())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -177,16 +181,26 @@ Project *SequenceDialog::SequenceParamCommand::GetRelevantProject() const
|
||||
|
||||
void SequenceDialog::SequenceParamCommand::redo()
|
||||
{
|
||||
sequence_->SetVideoParams(new_video_params_);
|
||||
sequence_->SetAudioParams(new_audio_params_);
|
||||
if (sequence_->GetVideoParams() != new_video_params_) {
|
||||
sequence_->SetVideoParams(new_video_params_);
|
||||
}
|
||||
if (sequence_->GetAudioParams() != new_audio_params_) {
|
||||
sequence_->SetAudioParams(new_audio_params_);
|
||||
}
|
||||
sequence_->SetLabel(new_name_);
|
||||
sequence_->SetAutoCacheEnabled(new_autocache_);
|
||||
}
|
||||
|
||||
void SequenceDialog::SequenceParamCommand::undo()
|
||||
{
|
||||
sequence_->SetVideoParams(old_video_params_);
|
||||
sequence_->SetAudioParams(old_audio_params_);
|
||||
if (sequence_->GetVideoParams() != old_video_params_) {
|
||||
sequence_->SetVideoParams(old_video_params_);
|
||||
}
|
||||
if (sequence_->GetAudioParams() != old_audio_params_) {
|
||||
sequence_->SetAudioParams(old_audio_params_);
|
||||
}
|
||||
sequence_->SetLabel(old_name_);
|
||||
sequence_->SetAutoCacheEnabled(old_autocache_);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -111,7 +111,8 @@ private:
|
||||
SequenceParamCommand(Sequence* s,
|
||||
const VideoParams& video_params,
|
||||
const AudioParams& audio_params,
|
||||
const QString& name);
|
||||
const QString& name,
|
||||
bool autocache);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
@@ -125,10 +126,12 @@ private:
|
||||
VideoParams new_video_params_;
|
||||
AudioParams new_audio_params_;
|
||||
QString new_name_;
|
||||
bool new_autocache_;
|
||||
|
||||
VideoParams old_video_params_;
|
||||
AudioParams old_audio_params_;
|
||||
QString old_name_;
|
||||
bool old_autocache_;
|
||||
};
|
||||
|
||||
private slots:
|
||||
|
||||
@@ -56,6 +56,10 @@ SequenceDialogParameterTab::SequenceDialogParameterTab(Sequence* sequence, QWidg
|
||||
preview_layout->addWidget(new QLabel(tr("Quality:")), row, 0);
|
||||
preview_format_field_ = new PixelFormatComboBox(false);
|
||||
preview_layout->addWidget(preview_format_field_, row, 1, 1, 2);
|
||||
row++;
|
||||
preview_layout->addWidget(new QLabel(tr("Auto-Cache:")), row, 0);
|
||||
preview_autocache_field_ = new QCheckBox();
|
||||
preview_layout->addWidget(preview_autocache_field_, row, 1);
|
||||
layout->addWidget(preview_group);
|
||||
|
||||
// Set values based on input sequence
|
||||
@@ -64,6 +68,7 @@ SequenceDialogParameterTab::SequenceDialogParameterTab(Sequence* sequence, QWidg
|
||||
video_section_->SetVideoParams(vp);
|
||||
preview_resolution_field_->SetDivider(vp.divider());
|
||||
preview_format_field_->SetPixelFormat(vp.format());
|
||||
preview_autocache_field_->setChecked(sequence->GetAutoCacheEnabled());
|
||||
audio_sample_rate_field_->SetSampleRate(ap.sample_rate());
|
||||
audio_channels_field_->SetChannelLayout(ap.channel_layout());
|
||||
|
||||
@@ -90,6 +95,7 @@ void SequenceDialogParameterTab::PresetChanged(const SequencePreset &preset)
|
||||
audio_channels_field_->SetChannelLayout(preset.channel_layout());
|
||||
preview_resolution_field_->SetDivider(preset.preview_divider());
|
||||
preview_format_field_->SetPixelFormat(preset.preview_format());
|
||||
preview_autocache_field_->setChecked(preset.preview_autocache());
|
||||
}
|
||||
|
||||
void SequenceDialogParameterTab::SavePresetClicked()
|
||||
@@ -103,7 +109,8 @@ void SequenceDialogParameterTab::SavePresetClicked()
|
||||
GetSelectedAudioSampleRate(),
|
||||
GetSelectedAudioChannelLayout(),
|
||||
GetSelectedPreviewResolution(),
|
||||
GetSelectedPreviewFormat()});
|
||||
GetSelectedPreviewFormat(),
|
||||
GetSelectedPreviewAutoCache()});
|
||||
}
|
||||
|
||||
void SequenceDialogParameterTab::UpdatePreviewResolutionLabel()
|
||||
|
||||
@@ -64,6 +64,11 @@ public:
|
||||
return preview_format_field_->GetPixelFormat();
|
||||
}
|
||||
|
||||
bool GetSelectedPreviewAutoCache() const
|
||||
{
|
||||
return preview_autocache_field_->isChecked();
|
||||
}
|
||||
|
||||
public slots:
|
||||
void PresetChanged(const SequencePreset& preset);
|
||||
|
||||
@@ -83,6 +88,8 @@ private:
|
||||
|
||||
PixelFormatComboBox* preview_format_field_;
|
||||
|
||||
QCheckBox *preview_autocache_field_;
|
||||
|
||||
private slots:
|
||||
void SavePresetClicked();
|
||||
|
||||
|
||||
@@ -105,86 +105,95 @@ QTreeWidgetItem* SequenceDialogPresetTab::CreateFolder(const QString &name)
|
||||
|
||||
QTreeWidgetItem *SequenceDialogPresetTab::CreateHDPresetFolder(const QString &name, int width, int height, int divider)
|
||||
{
|
||||
VideoParams::Format default_format = static_cast<VideoParams::Format>(Config::Current()["OfflinePixelFormat"].toInt());
|
||||
const VideoParams::Format default_format = static_cast<VideoParams::Format>(Config::Current()["OfflinePixelFormat"].toInt());
|
||||
const bool default_autocache = true;
|
||||
QTreeWidgetItem* parent = CreateFolder(name);
|
||||
AddStandardItem(parent, SequencePreset::Create(tr("%1 23.976 FPS").arg(name),
|
||||
width,
|
||||
height,
|
||||
rational(24000, 1001),
|
||||
VideoParams::kPixelAspectSquare,
|
||||
VideoParams::kInterlaceNone,
|
||||
48000,
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
divider,
|
||||
default_format));
|
||||
AddStandardItem(parent, SequencePreset::Create(tr("%1 25 FPS").arg(name),
|
||||
width,
|
||||
height,
|
||||
rational(25, 1),
|
||||
VideoParams::kPixelAspectSquare,
|
||||
VideoParams::kInterlaceNone,
|
||||
48000,
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
divider,
|
||||
default_format));
|
||||
AddStandardItem(parent, SequencePreset::Create(tr("%1 29.97 FPS").arg(name),
|
||||
width,
|
||||
height,
|
||||
rational(30000, 1001),
|
||||
VideoParams::kPixelAspectSquare,
|
||||
VideoParams::kInterlaceNone,
|
||||
48000,
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
divider,
|
||||
default_format));
|
||||
AddStandardItem(parent, SequencePreset::Create(tr("%1 50 FPS").arg(name),
|
||||
width,
|
||||
height,
|
||||
rational(50, 1),
|
||||
VideoParams::kPixelAspectSquare,
|
||||
VideoParams::kInterlaceNone,
|
||||
48000,
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
divider,
|
||||
default_format));
|
||||
AddStandardItem(parent, SequencePreset::Create(tr("%1 59.94 FPS").arg(name),
|
||||
width,
|
||||
height,
|
||||
rational(60000, 1001),
|
||||
VideoParams::kPixelAspectSquare,
|
||||
VideoParams::kInterlaceNone,
|
||||
48000,
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
divider,
|
||||
default_format));
|
||||
AddStandardItem(parent, new SequencePreset(tr("%1 23.976 FPS").arg(name),
|
||||
width,
|
||||
height,
|
||||
rational(24000, 1001),
|
||||
VideoParams::kPixelAspectSquare,
|
||||
VideoParams::kInterlaceNone,
|
||||
48000,
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
divider,
|
||||
default_format,
|
||||
default_autocache));
|
||||
AddStandardItem(parent, new SequencePreset(tr("%1 25 FPS").arg(name),
|
||||
width,
|
||||
height,
|
||||
rational(25, 1),
|
||||
VideoParams::kPixelAspectSquare,
|
||||
VideoParams::kInterlaceNone,
|
||||
48000,
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
divider,
|
||||
default_format,
|
||||
default_autocache));
|
||||
AddStandardItem(parent, new SequencePreset(tr("%1 29.97 FPS").arg(name),
|
||||
width,
|
||||
height,
|
||||
rational(30000, 1001),
|
||||
VideoParams::kPixelAspectSquare,
|
||||
VideoParams::kInterlaceNone,
|
||||
48000,
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
divider,
|
||||
default_format,
|
||||
default_autocache));
|
||||
AddStandardItem(parent, new SequencePreset(tr("%1 50 FPS").arg(name),
|
||||
width,
|
||||
height,
|
||||
rational(50, 1),
|
||||
VideoParams::kPixelAspectSquare,
|
||||
VideoParams::kInterlaceNone,
|
||||
48000,
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
divider,
|
||||
default_format,
|
||||
default_autocache));
|
||||
AddStandardItem(parent, new SequencePreset(tr("%1 59.94 FPS").arg(name),
|
||||
width,
|
||||
height,
|
||||
rational(60000, 1001),
|
||||
VideoParams::kPixelAspectSquare,
|
||||
VideoParams::kInterlaceNone,
|
||||
48000,
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
divider,
|
||||
default_format,
|
||||
default_autocache));
|
||||
return parent;
|
||||
}
|
||||
|
||||
QTreeWidgetItem *SequenceDialogPresetTab::CreateSDPresetFolder(const QString &name, int width, int height, const rational& frame_rate, const rational &standard_par, const rational &wide_par, int divider)
|
||||
{
|
||||
VideoParams::Format default_format = static_cast<VideoParams::Format>(Config::Current()["OfflinePixelFormat"].toInt());
|
||||
const VideoParams::Format default_format = static_cast<VideoParams::Format>(Config::Current()["OfflinePixelFormat"].toInt());
|
||||
const bool default_autocache = true;
|
||||
QTreeWidgetItem* parent = CreateFolder(name);
|
||||
preset_tree_->addTopLevelItem(parent);
|
||||
AddStandardItem(parent, SequencePreset::Create(tr("%1 Standard").arg(name),
|
||||
width,
|
||||
height,
|
||||
frame_rate,
|
||||
standard_par,
|
||||
VideoParams::kInterlacedBottomFirst,
|
||||
48000,
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
divider,
|
||||
default_format));
|
||||
AddStandardItem(parent, SequencePreset::Create(tr("%1 Widescreen").arg(name),
|
||||
width,
|
||||
height,
|
||||
frame_rate,
|
||||
wide_par,
|
||||
VideoParams::kInterlacedBottomFirst,
|
||||
48000,
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
divider,
|
||||
default_format));
|
||||
AddStandardItem(parent, new SequencePreset(tr("%1 Standard").arg(name),
|
||||
width,
|
||||
height,
|
||||
frame_rate,
|
||||
standard_par,
|
||||
VideoParams::kInterlacedBottomFirst,
|
||||
48000,
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
divider,
|
||||
default_format,
|
||||
default_autocache));
|
||||
AddStandardItem(parent, new SequencePreset(tr("%1 Widescreen").arg(name),
|
||||
width,
|
||||
height,
|
||||
frame_rate,
|
||||
wide_par,
|
||||
VideoParams::kInterlacedBottomFirst,
|
||||
48000,
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
divider,
|
||||
default_format,
|
||||
default_autocache));
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,8 @@ public:
|
||||
int sample_rate,
|
||||
uint64_t channel_layout,
|
||||
int preview_divider,
|
||||
VideoParams::Format preview_format) :
|
||||
VideoParams::Format preview_format,
|
||||
bool preview_autocache) :
|
||||
width_(width),
|
||||
height_(height),
|
||||
frame_rate_(frame_rate),
|
||||
@@ -52,27 +53,12 @@ public:
|
||||
sample_rate_(sample_rate),
|
||||
channel_layout_(channel_layout),
|
||||
preview_divider_(preview_divider),
|
||||
preview_format_(preview_format)
|
||||
preview_format_(preview_format),
|
||||
preview_autocache_(preview_autocache)
|
||||
{
|
||||
SetName(name);
|
||||
}
|
||||
|
||||
static Preset* Create(const QString& name,
|
||||
int width,
|
||||
int height,
|
||||
const rational& frame_rate,
|
||||
const rational& pixel_aspect,
|
||||
VideoParams::Interlacing interlacing,
|
||||
int sample_rate,
|
||||
uint64_t channel_layout,
|
||||
int preview_divider,
|
||||
VideoParams::Format preview_format)
|
||||
{
|
||||
return new SequencePreset(name, width, height, frame_rate, pixel_aspect,
|
||||
interlacing, sample_rate, channel_layout,
|
||||
preview_divider, preview_format);
|
||||
}
|
||||
|
||||
virtual void Load(QXmlStreamReader* reader) override
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
@@ -96,6 +82,8 @@ public:
|
||||
preview_divider_ = reader->readElementText().toInt();
|
||||
} else if (reader->name() == QStringLiteral("format")) {
|
||||
preview_format_ = static_cast<VideoParams::Format>(reader->readElementText().toInt());
|
||||
} else if (reader->name() == QStringLiteral("autocache")) {
|
||||
preview_autocache_ = reader->readElementText().toInt();
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
@@ -114,6 +102,7 @@ public:
|
||||
writer->writeTextElement(QStringLiteral("chlayout"), QString::number(channel_layout_));
|
||||
writer->writeTextElement(QStringLiteral("divider"), QString::number(preview_divider_));
|
||||
writer->writeTextElement(QStringLiteral("format"), QString::number(preview_format_));
|
||||
writer->writeTextElement(QStringLiteral("autocache"), QString::number(preview_autocache_));
|
||||
}
|
||||
|
||||
int width() const
|
||||
@@ -161,6 +150,11 @@ public:
|
||||
return preview_format_;
|
||||
}
|
||||
|
||||
bool preview_autocache() const
|
||||
{
|
||||
return preview_autocache_;
|
||||
}
|
||||
|
||||
private:
|
||||
int width_;
|
||||
int height_;
|
||||
@@ -171,6 +165,7 @@ private:
|
||||
uint64_t channel_layout_;
|
||||
int preview_divider_;
|
||||
VideoParams::Format preview_format_;
|
||||
bool preview_autocache_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user