various: implement sequence pixel aspect ratios and interlacing settings
Implements the following: - Sequences have pixel aspect ratios that work in tandem with footage PARs to render footage correctly. Viewer and export also acknowledge PARs - Sequences can have interlacing settings. This doesn't do anything yet, eventually the renderer will need to interlace/deinterlace/reinterlace appropriately in order to conform all the footage to the sequence. Export acknowledges interlacing, but this only affects metadata, not the image.
This commit is contained in:
@@ -177,9 +177,11 @@ ExportDialog::ExportDialog(ViewerOutput *viewer_node, QWidget *parent) :
|
||||
video_tab_->width_slider()->SetDefaultValue(viewer_node_->video_params().width());
|
||||
video_tab_->height_slider()->SetValue(viewer_node_->video_params().height());
|
||||
video_tab_->height_slider()->SetDefaultValue(viewer_node_->video_params().height());
|
||||
video_tab_->set_frame_rate(viewer_node_->video_params().time_base().flipped());
|
||||
audio_tab_->set_sample_rate(viewer_node_->audio_params().sample_rate());
|
||||
audio_tab_->set_channel_layout(viewer_node_->audio_params().channel_layout());
|
||||
video_tab_->frame_rate_combobox()->SetFrameRate(viewer_node_->video_params().time_base().flipped());
|
||||
video_tab_->pixel_aspect_combobox()->SetPixelAspectRatio(viewer_node_->video_params().pixel_aspect_ratio());
|
||||
video_tab_->interlaced_combobox()->SetInterlaceMode(viewer_node_->video_params().interlacing());
|
||||
audio_tab_->sample_rate_combobox()->SetSampleRate(viewer_node_->audio_params().sample_rate());
|
||||
audio_tab_->channel_layout_combobox()->SetChannelLayout(viewer_node_->audio_params().channel_layout());
|
||||
|
||||
video_aspect_ratio_ = static_cast<double>(viewer_node_->video_params().width()) / static_cast<double>(viewer_node_->video_params().height());
|
||||
|
||||
@@ -423,12 +425,14 @@ ExportParams ExportDialog::GenerateParams() const
|
||||
|
||||
VideoParams video_render_params(static_cast<int>(video_tab_->width_slider()->GetValue()),
|
||||
static_cast<int>(video_tab_->height_slider()->GetValue()),
|
||||
video_tab_->frame_rate().flipped(),
|
||||
video_tab_->frame_rate_combobox()->GetFrameRate().flipped(),
|
||||
PixelFormat::instance()->GetConfiguredFormatForMode(render_mode),
|
||||
video_tab_->pixel_aspect_combobox()->GetPixelAspectRatio(),
|
||||
video_tab_->interlaced_combobox()->GetInterlaceMode(),
|
||||
render_mode);
|
||||
|
||||
AudioParams audio_render_params(audio_tab_->sample_rate_combobox()->currentData().toInt(),
|
||||
audio_tab_->channel_layout_combobox()->currentData().toULongLong(),
|
||||
audio_tab_->channel_layout_combobox()->GetChannelLayout(),
|
||||
SampleFormat::kInternalFormat);
|
||||
|
||||
ExportParams params;
|
||||
@@ -462,8 +466,8 @@ ExportParams ExportDialog::GenerateParams() const
|
||||
|
||||
void ExportDialog::UpdateViewerDimensions()
|
||||
{
|
||||
preview_viewer_->SetOverrideSize(static_cast<int>(video_tab_->width_slider()->GetValue()),
|
||||
static_cast<int>(video_tab_->height_slider()->GetValue()));
|
||||
preview_viewer_->SetViewerResolution(static_cast<int>(video_tab_->width_slider()->GetValue()),
|
||||
static_cast<int>(video_tab_->height_slider()->GetValue()));
|
||||
|
||||
QMatrix4x4 transform =
|
||||
ExportParams::GenerateMatrix(static_cast<ExportParams::VideoScalingMethod>(video_tab_->scaling_method_combobox()->currentData().toInt()),
|
||||
|
||||
@@ -46,22 +46,14 @@ ExportAudioTab::ExportAudioTab(QWidget* parent) :
|
||||
|
||||
layout->addWidget(new QLabel(tr("Sample Rate:")), row, 0);
|
||||
|
||||
sample_rate_combobox_ = new QComboBox();
|
||||
sample_rates_ = Core::SupportedSampleRates();
|
||||
foreach (const int& sr, sample_rates_) {
|
||||
sample_rate_combobox_->addItem(Core::SampleRateToString(sr), sr);
|
||||
}
|
||||
sample_rate_combobox_ = new SampleRateComboBox();
|
||||
layout->addWidget(sample_rate_combobox_, row, 1);
|
||||
|
||||
row++;
|
||||
|
||||
layout->addWidget(new QLabel(tr("Channel Layout:")), row, 0);
|
||||
|
||||
channel_layout_combobox_ = new QComboBox();
|
||||
channel_layouts_ = Core::SupportedChannelLayouts();
|
||||
foreach (const uint64_t& ch_layout, channel_layouts_) {
|
||||
channel_layout_combobox_->addItem(Core::ChannelLayoutToString(ch_layout), QVariant::fromValue(ch_layout));
|
||||
}
|
||||
channel_layout_combobox_ = new ChannelLayoutComboBox();
|
||||
layout->addWidget(channel_layout_combobox_, row, 1);
|
||||
|
||||
row++;
|
||||
@@ -72,29 +64,4 @@ ExportAudioTab::ExportAudioTab(QWidget* parent) :
|
||||
outer_layout->addStretch();
|
||||
}
|
||||
|
||||
QComboBox *ExportAudioTab::codec_combobox() const
|
||||
{
|
||||
return codec_combobox_;
|
||||
}
|
||||
|
||||
QComboBox *ExportAudioTab::sample_rate_combobox() const
|
||||
{
|
||||
return sample_rate_combobox_;
|
||||
}
|
||||
|
||||
QComboBox *ExportAudioTab::channel_layout_combobox() const
|
||||
{
|
||||
return channel_layout_combobox_;
|
||||
}
|
||||
|
||||
void ExportAudioTab::set_sample_rate(int rate)
|
||||
{
|
||||
sample_rate_combobox_->setCurrentIndex(sample_rates_.indexOf(rate));
|
||||
}
|
||||
|
||||
void ExportAudioTab::set_channel_layout(uint64_t layout)
|
||||
{
|
||||
channel_layout_combobox_->setCurrentIndex(channel_layouts_.indexOf(layout));
|
||||
}
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <QWidget>
|
||||
|
||||
#include "common/define.h"
|
||||
#include "widget/standardcombos/standardcombos.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
@@ -33,20 +34,26 @@ class ExportAudioTab : public QWidget
|
||||
public:
|
||||
ExportAudioTab(QWidget* parent = nullptr);
|
||||
|
||||
QComboBox* codec_combobox() const;
|
||||
QComboBox* sample_rate_combobox() const;
|
||||
QComboBox* channel_layout_combobox() const;
|
||||
QComboBox* codec_combobox() const
|
||||
{
|
||||
return codec_combobox_;
|
||||
}
|
||||
|
||||
void set_sample_rate(int rate);
|
||||
void set_channel_layout(uint64_t layout);
|
||||
SampleRateComboBox* sample_rate_combobox() const
|
||||
{
|
||||
return sample_rate_combobox_;
|
||||
}
|
||||
|
||||
ChannelLayoutComboBox* channel_layout_combobox() const
|
||||
{
|
||||
return channel_layout_combobox_;
|
||||
}
|
||||
|
||||
private:
|
||||
QComboBox* codec_combobox_;
|
||||
QComboBox* sample_rate_combobox_;
|
||||
QComboBox* channel_layout_combobox_;
|
||||
SampleRateComboBox* sample_rate_combobox_;
|
||||
ChannelLayoutComboBox* channel_layout_combobox_;
|
||||
|
||||
QList<int> sample_rates_;
|
||||
QList<uint64_t> channel_layouts_;
|
||||
};
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
@@ -49,71 +49,6 @@ ExportVideoTab::ExportVideoTab(ColorManager* color_manager, QWidget *parent) :
|
||||
outer_layout->addStretch();
|
||||
}
|
||||
|
||||
ExportCodec::Codec ExportVideoTab::GetSelectedCodec() const
|
||||
{
|
||||
return static_cast<ExportCodec::Codec>(codec_combobox()->currentData().toInt());
|
||||
}
|
||||
|
||||
QComboBox *ExportVideoTab::codec_combobox() const
|
||||
{
|
||||
return codec_combobox_;
|
||||
}
|
||||
|
||||
IntegerSlider *ExportVideoTab::width_slider() const
|
||||
{
|
||||
return width_slider_;
|
||||
}
|
||||
|
||||
IntegerSlider *ExportVideoTab::height_slider() const
|
||||
{
|
||||
return height_slider_;
|
||||
}
|
||||
|
||||
QCheckBox *ExportVideoTab::maintain_aspect_checkbox() const
|
||||
{
|
||||
return maintain_aspect_checkbox_;
|
||||
}
|
||||
|
||||
QComboBox *ExportVideoTab::scaling_method_combobox() const
|
||||
{
|
||||
return scaling_method_combobox_;
|
||||
}
|
||||
|
||||
const rational &ExportVideoTab::frame_rate() const
|
||||
{
|
||||
return frame_rates_.at(frame_rate_combobox_->currentIndex());
|
||||
}
|
||||
|
||||
void ExportVideoTab::set_frame_rate(const rational &frame_rate)
|
||||
{
|
||||
frame_rate_combobox_->setCurrentIndex(frame_rates_.indexOf(frame_rate));
|
||||
}
|
||||
|
||||
QString ExportVideoTab::CurrentOCIOColorSpace()
|
||||
{
|
||||
return color_space_chooser_->input();
|
||||
}
|
||||
|
||||
CodecSection *ExportVideoTab::GetCodecSection() const
|
||||
{
|
||||
return static_cast<CodecSection*>(codec_stack_->currentWidget());
|
||||
}
|
||||
|
||||
void ExportVideoTab::SetCodecSection(CodecSection *section)
|
||||
{
|
||||
codec_stack_->setCurrentWidget(section);
|
||||
}
|
||||
|
||||
ImageSection *ExportVideoTab::image_section() const
|
||||
{
|
||||
return image_section_;
|
||||
}
|
||||
|
||||
H264Section *ExportVideoTab::h264_section() const
|
||||
{
|
||||
return h264_section_;
|
||||
}
|
||||
|
||||
QWidget* ExportVideoTab::SetupResolutionSection()
|
||||
{
|
||||
int row = 0;
|
||||
@@ -163,14 +98,23 @@ QWidget* ExportVideoTab::SetupResolutionSection()
|
||||
|
||||
layout->addWidget(new QLabel(tr("Frame Rate:")), row, 0);
|
||||
|
||||
frame_rate_combobox_ = new QComboBox();
|
||||
frame_rates_ = Core::SupportedFrameRates();
|
||||
foreach (const rational& fr, frame_rates_) {
|
||||
frame_rate_combobox_->addItem(Core::FrameRateToString(fr));
|
||||
}
|
||||
|
||||
frame_rate_combobox_ = new FrameRateComboBox();
|
||||
layout->addWidget(frame_rate_combobox_, row, 1);
|
||||
|
||||
row++;
|
||||
|
||||
layout->addWidget(new QLabel(tr("Pixel Aspect Ratio:")), row, 0);
|
||||
|
||||
pixel_aspect_combobox_ = new PixelAspectRatioComboBox();
|
||||
layout->addWidget(pixel_aspect_combobox_, row, 1);
|
||||
|
||||
row++;
|
||||
|
||||
layout->addWidget(new QLabel(tr("Interlacing:")), row, 0);
|
||||
|
||||
interlaced_combobox_ = new InterlacedComboBox();
|
||||
layout->addWidget(interlaced_combobox_, row, 1);
|
||||
|
||||
return resolution_group;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "render/colormanager.h"
|
||||
#include "widget/colorwheel/colorspacechooser.h"
|
||||
#include "widget/slider/integerslider.h"
|
||||
#include "widget/standardcombos/standardcombos.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
@@ -40,24 +41,75 @@ class ExportVideoTab : public QWidget
|
||||
public:
|
||||
ExportVideoTab(ColorManager* color_manager, QWidget* parent = nullptr);
|
||||
|
||||
ExportCodec::Codec GetSelectedCodec() const;
|
||||
ExportCodec::Codec GetSelectedCodec() const
|
||||
{
|
||||
return static_cast<ExportCodec::Codec>(codec_combobox()->currentData().toInt());
|
||||
}
|
||||
|
||||
QComboBox* codec_combobox() const;
|
||||
QComboBox* codec_combobox() const
|
||||
{
|
||||
return codec_combobox_;
|
||||
}
|
||||
|
||||
IntegerSlider* width_slider() const;
|
||||
IntegerSlider* height_slider() const;
|
||||
QCheckBox* maintain_aspect_checkbox() const;
|
||||
QComboBox* scaling_method_combobox() const;
|
||||
IntegerSlider* width_slider() const
|
||||
{
|
||||
return width_slider_;
|
||||
}
|
||||
|
||||
const rational& frame_rate() const;
|
||||
void set_frame_rate(const rational& frame_rate);
|
||||
IntegerSlider* height_slider() const
|
||||
{
|
||||
return height_slider_;
|
||||
}
|
||||
|
||||
QString CurrentOCIOColorSpace();
|
||||
QCheckBox* maintain_aspect_checkbox() const
|
||||
{
|
||||
return maintain_aspect_checkbox_;
|
||||
}
|
||||
|
||||
CodecSection* GetCodecSection() const;
|
||||
void SetCodecSection(CodecSection* section);
|
||||
ImageSection* image_section() const;
|
||||
H264Section* h264_section() const;
|
||||
QComboBox* scaling_method_combobox() const
|
||||
{
|
||||
return scaling_method_combobox_;
|
||||
}
|
||||
|
||||
FrameRateComboBox* frame_rate_combobox() const
|
||||
{
|
||||
return frame_rate_combobox_;
|
||||
}
|
||||
|
||||
QString CurrentOCIOColorSpace()
|
||||
{
|
||||
return color_space_chooser_->input();
|
||||
}
|
||||
|
||||
CodecSection* GetCodecSection() const
|
||||
{
|
||||
return static_cast<CodecSection*>(codec_stack_->currentWidget());
|
||||
}
|
||||
|
||||
void SetCodecSection(CodecSection* section)
|
||||
{
|
||||
codec_stack_->setCurrentWidget(section);
|
||||
}
|
||||
|
||||
ImageSection* image_section() const
|
||||
{
|
||||
return image_section_;
|
||||
}
|
||||
|
||||
H264Section* h264_section() const
|
||||
{
|
||||
return h264_section_;
|
||||
}
|
||||
|
||||
InterlacedComboBox* interlaced_combobox() const
|
||||
{
|
||||
return interlaced_combobox_;
|
||||
}
|
||||
|
||||
PixelAspectRatioComboBox* pixel_aspect_combobox() const
|
||||
{
|
||||
return pixel_aspect_combobox_;
|
||||
}
|
||||
|
||||
const int& threads() const
|
||||
{
|
||||
@@ -80,7 +132,7 @@ private:
|
||||
QWidget* SetupCodecSection();
|
||||
|
||||
QComboBox* codec_combobox_;
|
||||
QComboBox* frame_rate_combobox_;
|
||||
FrameRateComboBox* frame_rate_combobox_;
|
||||
QCheckBox* maintain_aspect_checkbox_;
|
||||
QComboBox* scaling_method_combobox_;
|
||||
|
||||
@@ -93,10 +145,11 @@ private:
|
||||
IntegerSlider* width_slider_;
|
||||
IntegerSlider* height_slider_;
|
||||
|
||||
QList<rational> frame_rates_;
|
||||
|
||||
ColorManager* color_manager_;
|
||||
|
||||
InterlacedComboBox* interlaced_combobox_;
|
||||
PixelAspectRatioComboBox* pixel_aspect_combobox_;
|
||||
|
||||
int threads_;
|
||||
|
||||
QString pix_fmt_;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <OpenColorIO/OpenColorIO.h>
|
||||
namespace OCIO = OCIO_NAMESPACE::v1;
|
||||
|
||||
#include "common/ratiodialog.h"
|
||||
#include "core.h"
|
||||
#include "project/item/footage/footage.h"
|
||||
#include "project/project.h"
|
||||
#include "undo/undostack.h"
|
||||
@@ -45,45 +45,16 @@ VideoStreamProperties::VideoStreamProperties(ImageStreamPtr stream) :
|
||||
|
||||
video_layout->addWidget(new QLabel(tr("Pixel Aspect:")), row, 0);
|
||||
|
||||
pixel_aspect_combo_ = new QComboBox();
|
||||
pixel_aspect_combo_ = new PixelAspectRatioComboBox();
|
||||
pixel_aspect_combo_->SetPixelAspectRatio(stream->pixel_aspect_ratio());
|
||||
video_layout->addWidget(pixel_aspect_combo_, row, 1);
|
||||
|
||||
AddPixelAspectRatio(tr("Square Pixels"), rational(1));
|
||||
AddPixelAspectRatio(tr("NTSC Standard"), rational(8, 9));
|
||||
AddPixelAspectRatio(tr("NTSC Widescreen"), rational(32, 27));
|
||||
AddPixelAspectRatio(tr("PAL Standard"), rational(16, 15));
|
||||
AddPixelAspectRatio(tr("PAL Widescreen"), rational(64, 45));
|
||||
AddPixelAspectRatio(tr("HD Anamorphic 1080"), rational(4, 3));
|
||||
|
||||
// Always add custom item last, much of the logic relies on this. Set this to the current AR so
|
||||
// that if none of the above are ==, it will eventually select this item
|
||||
AddPixelAspectRatio(QString(), rational());
|
||||
UpdateCustomItem(stream->pixel_aspect_ratio());
|
||||
|
||||
// Determine which index to select on startup
|
||||
for (int i=0; i<pixel_aspect_combo_->count(); i++) {
|
||||
if (pixel_aspect_combo_->itemData(i).value<rational>() == stream->pixel_aspect_ratio()) {
|
||||
pixel_aspect_combo_->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Pick up index signal to query for custom aspect ratio if requested
|
||||
connect(pixel_aspect_combo_, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &VideoStreamProperties::PixelAspectComboBoxChanged);
|
||||
|
||||
row++;
|
||||
|
||||
video_layout->addWidget(new QLabel(tr("Interlacing:")), row, 0);
|
||||
|
||||
video_interlace_combo_ = new QComboBox();
|
||||
|
||||
// These must match the Interlacing enum in ImageStream
|
||||
video_interlace_combo_->addItem(tr("None (Progressive)"));
|
||||
video_interlace_combo_->addItem(tr("Top-Field First"));
|
||||
video_interlace_combo_->addItem(tr("Bottom-Field First"));
|
||||
|
||||
video_interlace_combo_->setCurrentIndex(stream->interlacing());
|
||||
video_interlace_combo_ = new InterlacedComboBox();
|
||||
video_interlace_combo_->SetInterlaceMode(stream->interlacing());
|
||||
|
||||
video_layout->addWidget(video_interlace_combo_, row, 1);
|
||||
|
||||
@@ -153,14 +124,14 @@ void VideoStreamProperties::Accept(QUndoCommand *parent)
|
||||
|
||||
if (video_premultiply_alpha_->isChecked() != stream_->premultiplied_alpha()
|
||||
|| set_colorspace != stream_->colorspace(false)
|
||||
|| static_cast<ImageStream::Interlacing>(video_interlace_combo_->currentIndex()) != stream_->interlacing()
|
||||
|| pixel_aspect_combo_->currentData().value<rational>() != stream_->pixel_aspect_ratio()) {
|
||||
|| static_cast<VideoParams::Interlacing>(video_interlace_combo_->currentIndex()) != stream_->interlacing()
|
||||
|| pixel_aspect_combo_->GetPixelAspectRatio() != stream_->pixel_aspect_ratio()) {
|
||||
|
||||
new VideoStreamChangeCommand(stream_,
|
||||
video_premultiply_alpha_->isChecked(),
|
||||
set_colorspace,
|
||||
static_cast<ImageStream::Interlacing>(video_interlace_combo_->currentIndex()),
|
||||
pixel_aspect_combo_->currentData().value<rational>(),
|
||||
static_cast<VideoParams::Interlacing>(video_interlace_combo_->currentIndex()),
|
||||
pixel_aspect_combo_->GetPixelAspectRatio(),
|
||||
parent);
|
||||
}
|
||||
|
||||
@@ -199,46 +170,10 @@ bool VideoStreamProperties::IsImageSequence(ImageStream *stream)
|
||||
return (stream->type() == Stream::kVideo && static_cast<VideoStream*>(stream)->is_image_sequence());
|
||||
}
|
||||
|
||||
void VideoStreamProperties::AddPixelAspectRatio(const QString &name, const rational &ratio)
|
||||
{
|
||||
pixel_aspect_combo_->addItem(GetPixelAspectRatioItemText(name, ratio),
|
||||
QVariant::fromValue(ratio));
|
||||
}
|
||||
|
||||
QString VideoStreamProperties::GetPixelAspectRatioItemText(const QString &name, const rational &ratio)
|
||||
{
|
||||
return tr("%1 (%2)").arg(name, QString::number(ratio.toDouble(), 'f', 4));
|
||||
}
|
||||
|
||||
void VideoStreamProperties::UpdateCustomItem(const rational &ratio)
|
||||
{
|
||||
const int custom_index = pixel_aspect_combo_->count() - 1;
|
||||
|
||||
pixel_aspect_combo_->setItemText(custom_index,
|
||||
GetPixelAspectRatioItemText(tr("Custom"), ratio));
|
||||
pixel_aspect_combo_->setItemData(custom_index,
|
||||
QVariant::fromValue(ratio));
|
||||
}
|
||||
|
||||
void VideoStreamProperties::PixelAspectComboBoxChanged(int index)
|
||||
{
|
||||
// Detect if custom was selected, in which case query what the new AR should be
|
||||
if (index == pixel_aspect_combo_->count() - 1) {
|
||||
// Query for custom pixel aspect ratio
|
||||
bool ok;
|
||||
|
||||
double custom_ratio = GetFloatRatioFromUser(this, tr("Set Custom Pixel Aspect Ratio"), &ok);
|
||||
|
||||
if (ok) {
|
||||
UpdateCustomItem(rational::fromDouble(custom_ratio));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VideoStreamProperties::VideoStreamChangeCommand::VideoStreamChangeCommand(ImageStreamPtr stream,
|
||||
bool premultiplied,
|
||||
QString colorspace,
|
||||
ImageStream::Interlacing interlacing,
|
||||
VideoParams::Interlacing interlacing,
|
||||
const rational &pixel_ar,
|
||||
QUndoCommand *parent) :
|
||||
UndoCommand(parent),
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "streamproperties.h"
|
||||
#include "undo/undocommand.h"
|
||||
#include "widget/slider/integerslider.h"
|
||||
#include "widget/standardcombos/standardcombos.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
@@ -43,12 +44,6 @@ public:
|
||||
private:
|
||||
static bool IsImageSequence(ImageStream* stream);
|
||||
|
||||
void AddPixelAspectRatio(const QString& name, const rational& ratio);
|
||||
|
||||
static QString GetPixelAspectRatioItemText(const QString& name, const rational& ratio);
|
||||
|
||||
void UpdateCustomItem(const rational& ratio);
|
||||
|
||||
/**
|
||||
* @brief Attached video stream
|
||||
*/
|
||||
@@ -67,7 +62,7 @@ private:
|
||||
/**
|
||||
* @brief Setting for video interlacing
|
||||
*/
|
||||
QComboBox* video_interlace_combo_;
|
||||
InterlacedComboBox* video_interlace_combo_;
|
||||
|
||||
/**
|
||||
* @brief Sets the start index for image sequences
|
||||
@@ -82,14 +77,14 @@ private:
|
||||
/**
|
||||
* @brief Sets the pixel aspect ratio of the stream
|
||||
*/
|
||||
QComboBox* pixel_aspect_combo_;
|
||||
PixelAspectRatioComboBox* pixel_aspect_combo_;
|
||||
|
||||
class VideoStreamChangeCommand : public UndoCommand {
|
||||
public:
|
||||
VideoStreamChangeCommand(ImageStreamPtr stream,
|
||||
bool premultiplied,
|
||||
QString colorspace,
|
||||
ImageStream::Interlacing interlacing,
|
||||
VideoParams::Interlacing interlacing,
|
||||
const rational& pixel_ar,
|
||||
QUndoCommand* parent = nullptr);
|
||||
|
||||
@@ -104,12 +99,12 @@ private:
|
||||
|
||||
bool new_premultiplied_;
|
||||
QString new_colorspace_;
|
||||
ImageStream::Interlacing new_interlacing_;
|
||||
VideoParams::Interlacing new_interlacing_;
|
||||
rational new_pixel_ar_;
|
||||
|
||||
bool old_premultiplied_;
|
||||
QString old_colorspace_;
|
||||
ImageStream::Interlacing old_interlacing_;
|
||||
VideoParams::Interlacing old_interlacing_;
|
||||
rational old_pixel_ar_;
|
||||
|
||||
};
|
||||
@@ -138,9 +133,6 @@ private:
|
||||
|
||||
};
|
||||
|
||||
private slots:
|
||||
void PixelAspectComboBoxChanged(int index);
|
||||
|
||||
};
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
@@ -102,24 +102,17 @@ void SequenceDialog::accept()
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the rational at the combobox's index (which will be correct provided AddFrameRate() was used at all time)
|
||||
rational video_time_base = parameter_tab_->GetSelectedVideoFrameRate().flipped();
|
||||
|
||||
// Get the rational at the combobox's index (which will be correct provided AddFrameRate() was used at all time)
|
||||
int audio_sample_rate = parameter_tab_->GetSelectedAudioSampleRate();
|
||||
|
||||
// Get the audio channel layout value
|
||||
uint64_t channels = parameter_tab_->GetSelectedAudioChannelLayout();
|
||||
|
||||
// Generate video and audio parameter structs from data
|
||||
VideoParams video_params = VideoParams(parameter_tab_->GetSelectedVideoWidth(),
|
||||
parameter_tab_->GetSelectedVideoHeight(),
|
||||
video_time_base,
|
||||
parameter_tab_->GetSelectedVideoFrameRate().flipped(),
|
||||
parameter_tab_->GetSelectedPreviewFormat(),
|
||||
parameter_tab_->GetSelectedVideoPixelAspect(),
|
||||
parameter_tab_->GetSelectedVideoInterlacingMode(),
|
||||
parameter_tab_->GetSelectedPreviewResolution());
|
||||
|
||||
AudioParams audio_params = AudioParams(audio_sample_rate,
|
||||
channels,
|
||||
AudioParams audio_params = AudioParams(parameter_tab_->GetSelectedAudioSampleRate(),
|
||||
parameter_tab_->GetSelectedAudioChannelLayout(),
|
||||
SampleFormat::kInternalFormat);
|
||||
|
||||
if (make_undoable_) {
|
||||
|
||||
@@ -35,8 +35,16 @@ SequenceDialogParameterTab::SequenceDialogParameterTab(Sequence* sequence, QWidg
|
||||
video_layout->addWidget(video_height_field_, row, 1);
|
||||
row++;
|
||||
video_layout->addWidget(new QLabel(tr("Frame Rate:")), row, 0);
|
||||
video_frame_rate_field_ = new QComboBox();
|
||||
video_frame_rate_field_ = new FrameRateComboBox();
|
||||
video_layout->addWidget(video_frame_rate_field_, row, 1);
|
||||
row++;
|
||||
video_layout->addWidget(new QLabel(tr("Pixel Aspect Ratio:")), row, 0);
|
||||
video_pixel_aspect_field_ = new PixelAspectRatioComboBox();
|
||||
video_layout->addWidget(video_pixel_aspect_field_, row, 1);
|
||||
row++;
|
||||
video_layout->addWidget(new QLabel(tr("Interlacing:")));
|
||||
video_interlaced_field_ = new InterlacedComboBox();
|
||||
video_layout->addWidget(video_interlaced_field_, row, 1);
|
||||
layout->addWidget(video_group);
|
||||
|
||||
row = 0;
|
||||
@@ -46,11 +54,11 @@ SequenceDialogParameterTab::SequenceDialogParameterTab(Sequence* sequence, QWidg
|
||||
audio_group->setTitle(tr("Audio"));
|
||||
QGridLayout* audio_layout = new QGridLayout(audio_group);
|
||||
audio_layout->addWidget(new QLabel(tr("Sample Rate:")), row, 0);
|
||||
audio_sample_rate_field_ = new QComboBox();
|
||||
audio_sample_rate_field_ = new SampleRateComboBox();
|
||||
audio_layout->addWidget(audio_sample_rate_field_, row, 1);
|
||||
row++;
|
||||
audio_layout->addWidget(new QLabel(tr("Channels:")), row, 0);
|
||||
audio_channels_field_ = new QComboBox();
|
||||
audio_channels_field_ = new ChannelLayoutComboBox();
|
||||
audio_layout->addWidget(audio_channels_field_, row, 1);
|
||||
layout->addWidget(audio_group);
|
||||
|
||||
@@ -61,83 +69,29 @@ SequenceDialogParameterTab::SequenceDialogParameterTab(Sequence* sequence, QWidg
|
||||
preview_group->setTitle(tr("Preview"));
|
||||
QGridLayout* preview_layout = new QGridLayout(preview_group);
|
||||
preview_layout->addWidget(new QLabel(tr("Resolution:")), row, 0);
|
||||
preview_resolution_field_ = new QComboBox();
|
||||
preview_resolution_field_ = new VideoDividerComboBox();
|
||||
preview_layout->addWidget(preview_resolution_field_, row, 1);
|
||||
preview_resolution_label_ = new QLabel();
|
||||
preview_layout->addWidget(preview_resolution_label_, row, 2);
|
||||
row++;
|
||||
preview_layout->addWidget(new QLabel(tr("Format:")), row, 0);
|
||||
preview_format_field_ = new QComboBox();
|
||||
preview_format_field_ = new PixelFormatComboBox(true, true);
|
||||
preview_layout->addWidget(preview_format_field_, row, 1, 1, 2);
|
||||
layout->addWidget(preview_group);
|
||||
|
||||
// Set up available frame rates
|
||||
frame_rate_list_ = Core::SupportedFrameRates();
|
||||
foreach (const rational& fr, frame_rate_list_) {
|
||||
video_frame_rate_field_->addItem(Core::FrameRateToString(fr));
|
||||
}
|
||||
|
||||
// Set up available sample rates
|
||||
sample_rate_list_ = Core::SupportedSampleRates();
|
||||
foreach (const int& sr, sample_rate_list_) {
|
||||
audio_sample_rate_field_->addItem(Core::SampleRateToString(sr));
|
||||
}
|
||||
|
||||
// Set up available channel layouts
|
||||
channel_layout_list_ = Core::SupportedChannelLayouts();
|
||||
foreach (const uint64_t& ch_layout, channel_layout_list_) {
|
||||
audio_channels_field_->addItem(Core::ChannelLayoutToString(ch_layout), QVariant::fromValue(ch_layout));
|
||||
}
|
||||
|
||||
// Set up preview dividers
|
||||
divider_list_ = Core::SupportedDividers();
|
||||
foreach (int d, divider_list_) {
|
||||
QString name;
|
||||
|
||||
if (d == 1) {
|
||||
name = tr("Full");
|
||||
} else {
|
||||
name = tr("1/%1").arg(d);
|
||||
}
|
||||
|
||||
preview_resolution_field_->addItem(name);
|
||||
}
|
||||
connect(preview_resolution_field_, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &SequenceDialogParameterTab::UpdatePreviewResolutionLabel);
|
||||
|
||||
// Set up preview formats
|
||||
for (int i=0;i<PixelFormat::PIX_FMT_COUNT;i++) {
|
||||
PixelFormat::Format pix_fmt = static_cast<PixelFormat::Format>(i);
|
||||
|
||||
// We always render with an alpha channel internally
|
||||
if (PixelFormat::FormatHasAlphaChannel(pix_fmt)
|
||||
&& PixelFormat::FormatIsFloat(pix_fmt)) {
|
||||
preview_format_field_->addItem(PixelFormat::GetName(pix_fmt));
|
||||
|
||||
preview_format_list_.append(pix_fmt);
|
||||
}
|
||||
}
|
||||
|
||||
// Set values based on input sequence
|
||||
video_width_field_->SetValue(sequence->video_params().width());
|
||||
video_height_field_->SetValue(sequence->video_params().height());
|
||||
video_frame_rate_field_->SetFrameRate(sequence->video_params().time_base().flipped());
|
||||
video_pixel_aspect_field_->SetPixelAspectRatio(sequence->video_params().pixel_aspect_ratio());
|
||||
video_interlaced_field_->SetInterlaceMode(sequence->video_params().interlacing());
|
||||
preview_resolution_field_->SetDivider(sequence->video_params().divider());
|
||||
preview_format_field_->SetPixelFormat(sequence->video_params().format());
|
||||
audio_sample_rate_field_->SetSampleRate(sequence->audio_params().sample_rate());
|
||||
audio_channels_field_->SetChannelLayout(sequence->audio_params().channel_layout());
|
||||
|
||||
int frame_rate_index = frame_rate_list_.indexOf(sequence->video_params().time_base().flipped());
|
||||
video_frame_rate_field_->setCurrentIndex(frame_rate_index);
|
||||
|
||||
int sample_rate_index = sample_rate_list_.indexOf(sequence->audio_params().sample_rate());
|
||||
audio_sample_rate_field_->setCurrentIndex(sample_rate_index);
|
||||
|
||||
for (int i=0;i<audio_channels_field_->count();i++) {
|
||||
if (audio_channels_field_->itemData(i).toULongLong() == sequence->audio_params().channel_layout()) {
|
||||
audio_channels_field_->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
preview_resolution_field_->setCurrentIndex(divider_list_.indexOf(sequence->video_params().divider()));
|
||||
|
||||
preview_format_field_->setCurrentIndex(preview_format_list_.indexOf(sequence->video_params().format()));
|
||||
connect(preview_resolution_field_, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &SequenceDialogParameterTab::UpdatePreviewResolutionLabel);
|
||||
|
||||
layout->addStretch();
|
||||
|
||||
@@ -148,62 +102,31 @@ SequenceDialogParameterTab::SequenceDialogParameterTab(Sequence* sequence, QWidg
|
||||
UpdatePreviewResolutionLabel();
|
||||
}
|
||||
|
||||
int SequenceDialogParameterTab::GetSelectedVideoWidth() const
|
||||
{
|
||||
return video_width_field_->GetValue();
|
||||
}
|
||||
|
||||
int SequenceDialogParameterTab::GetSelectedVideoHeight() const
|
||||
{
|
||||
return video_height_field_->GetValue();
|
||||
}
|
||||
|
||||
const rational &SequenceDialogParameterTab::GetSelectedVideoFrameRate() const
|
||||
{
|
||||
return frame_rate_list_.at(video_frame_rate_field_->currentIndex());
|
||||
}
|
||||
|
||||
int SequenceDialogParameterTab::GetSelectedAudioSampleRate() const
|
||||
{
|
||||
return sample_rate_list_.at(audio_sample_rate_field_->currentIndex());
|
||||
}
|
||||
|
||||
uint64_t SequenceDialogParameterTab::GetSelectedAudioChannelLayout() const
|
||||
{
|
||||
return audio_channels_field_->currentData().toULongLong();
|
||||
}
|
||||
|
||||
int SequenceDialogParameterTab::GetSelectedPreviewResolution() const
|
||||
{
|
||||
return divider_list_.at(preview_resolution_field_->currentIndex());
|
||||
}
|
||||
|
||||
PixelFormat::Format SequenceDialogParameterTab::GetSelectedPreviewFormat() const
|
||||
{
|
||||
return preview_format_list_.at(preview_format_field_->currentIndex());
|
||||
}
|
||||
|
||||
void SequenceDialogParameterTab::PresetChanged(const SequencePreset &preset)
|
||||
{
|
||||
video_width_field_->SetValue(preset.width());
|
||||
video_height_field_->SetValue(preset.height());
|
||||
video_frame_rate_field_->setCurrentIndex(frame_rate_list_.indexOf(preset.frame_rate()));
|
||||
audio_sample_rate_field_->setCurrentIndex(sample_rate_list_.indexOf(preset.sample_rate()));
|
||||
audio_channels_field_->setCurrentIndex(channel_layout_list_.indexOf(preset.channel_layout()));
|
||||
preview_resolution_field_->setCurrentIndex(divider_list_.indexOf(preset.preview_divider()));
|
||||
preview_format_field_->setCurrentIndex(preview_format_list_.indexOf(preset.preview_format()));
|
||||
video_frame_rate_field_->SetFrameRate(preset.frame_rate());
|
||||
video_pixel_aspect_field_->SetPixelAspectRatio(preset.pixel_aspect());
|
||||
video_interlaced_field_->SetInterlaceMode(preset.interlacing());
|
||||
audio_sample_rate_field_->SetSampleRate(preset.sample_rate());
|
||||
audio_channels_field_->SetChannelLayout(preset.channel_layout());
|
||||
preview_resolution_field_->SetDivider(preset.preview_divider());
|
||||
preview_format_field_->SetPixelFormat(preset.preview_format());
|
||||
}
|
||||
|
||||
void SequenceDialogParameterTab::SavePresetClicked()
|
||||
{
|
||||
emit SaveParametersAsPreset({QString(),
|
||||
static_cast<int>(video_width_field_->GetValue()),
|
||||
static_cast<int>(video_height_field_->GetValue()),
|
||||
frame_rate_list_.at(video_frame_rate_field_->currentIndex()),
|
||||
sample_rate_list_.at(audio_sample_rate_field_->currentIndex()),
|
||||
channel_layout_list_.at(audio_channels_field_->currentIndex()),
|
||||
divider_list_.at(preview_resolution_field_->currentIndex()),
|
||||
preview_format_list_.at(preview_format_field_->currentIndex())});
|
||||
GetSelectedVideoWidth(),
|
||||
GetSelectedVideoHeight(),
|
||||
GetSelectedVideoFrameRate(),
|
||||
GetSelectedVideoPixelAspect(),
|
||||
GetSelectedVideoInterlacingMode(),
|
||||
GetSelectedAudioSampleRate(),
|
||||
GetSelectedAudioChannelLayout(),
|
||||
GetSelectedPreviewResolution(),
|
||||
GetSelectedPreviewFormat()});
|
||||
}
|
||||
|
||||
void SequenceDialogParameterTab::UpdatePreviewResolutionLabel()
|
||||
@@ -211,7 +134,9 @@ void SequenceDialogParameterTab::UpdatePreviewResolutionLabel()
|
||||
VideoParams test_param(video_width_field_->GetValue(),
|
||||
video_height_field_->GetValue(),
|
||||
PixelFormat::PIX_FMT_INVALID,
|
||||
divider_list_.at(preview_resolution_field_->currentIndex()));
|
||||
rational(1),
|
||||
VideoParams::kInterlaceNone,
|
||||
preview_resolution_field_->currentData().toInt());
|
||||
|
||||
preview_resolution_label_->setText(tr("(%1x%2)").arg(QString::number(test_param.effective_width()),
|
||||
QString::number(test_param.effective_height())));
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "project/item/sequence/sequence.h"
|
||||
#include "sequencepreset.h"
|
||||
#include "widget/slider/integerslider.h"
|
||||
#include "widget/standardcombos/standardcombos.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
@@ -17,19 +18,50 @@ class SequenceDialogParameterTab : public QWidget
|
||||
public:
|
||||
SequenceDialogParameterTab(Sequence* sequence, QWidget* parent = nullptr);
|
||||
|
||||
int GetSelectedVideoWidth() const;
|
||||
int GetSelectedVideoWidth() const
|
||||
{
|
||||
return video_width_field_->GetValue();
|
||||
}
|
||||
|
||||
int GetSelectedVideoHeight() const;
|
||||
int GetSelectedVideoHeight() const
|
||||
{
|
||||
return video_height_field_->GetValue();
|
||||
}
|
||||
|
||||
const rational& GetSelectedVideoFrameRate() const;
|
||||
rational GetSelectedVideoFrameRate() const
|
||||
{
|
||||
return video_frame_rate_field_->GetFrameRate();
|
||||
}
|
||||
|
||||
int GetSelectedAudioSampleRate() const;
|
||||
rational GetSelectedVideoPixelAspect() const
|
||||
{
|
||||
return video_pixel_aspect_field_->GetPixelAspectRatio();
|
||||
}
|
||||
|
||||
uint64_t GetSelectedAudioChannelLayout() const;
|
||||
VideoParams::Interlacing GetSelectedVideoInterlacingMode() const
|
||||
{
|
||||
return video_interlaced_field_->GetInterlaceMode();
|
||||
}
|
||||
|
||||
int GetSelectedPreviewResolution() const;
|
||||
int GetSelectedAudioSampleRate() const
|
||||
{
|
||||
return audio_sample_rate_field_->GetSampleRate();
|
||||
}
|
||||
|
||||
PixelFormat::Format GetSelectedPreviewFormat() const;
|
||||
uint64_t GetSelectedAudioChannelLayout() const
|
||||
{
|
||||
return audio_channels_field_->GetChannelLayout();
|
||||
}
|
||||
|
||||
int GetSelectedPreviewResolution() const
|
||||
{
|
||||
return preview_resolution_field_->GetDivider();
|
||||
}
|
||||
|
||||
PixelFormat::Format GetSelectedPreviewFormat() const
|
||||
{
|
||||
return preview_format_field_->GetPixelFormat();
|
||||
}
|
||||
|
||||
public slots:
|
||||
void PresetChanged(const SequencePreset& preset);
|
||||
@@ -42,27 +74,21 @@ private:
|
||||
|
||||
IntegerSlider* video_height_field_;
|
||||
|
||||
QComboBox* video_frame_rate_field_;
|
||||
FrameRateComboBox* video_frame_rate_field_;
|
||||
|
||||
QComboBox* audio_sample_rate_field_;
|
||||
PixelAspectRatioComboBox* video_pixel_aspect_field_;
|
||||
|
||||
QComboBox* audio_channels_field_;
|
||||
InterlacedComboBox* video_interlaced_field_;
|
||||
|
||||
QComboBox* preview_resolution_field_;
|
||||
SampleRateComboBox* audio_sample_rate_field_;
|
||||
|
||||
ChannelLayoutComboBox* audio_channels_field_;
|
||||
|
||||
VideoDividerComboBox* preview_resolution_field_;
|
||||
|
||||
QLabel* preview_resolution_label_;
|
||||
|
||||
QComboBox* preview_format_field_;
|
||||
|
||||
QList<rational> frame_rate_list_;
|
||||
|
||||
QList<int> sample_rate_list_;
|
||||
|
||||
QList<uint64_t> channel_layout_list_;
|
||||
|
||||
QList<int> divider_list_;
|
||||
|
||||
QList<PixelFormat::Format> preview_format_list_;
|
||||
PixelFormatComboBox* preview_format_field_;
|
||||
|
||||
private slots:
|
||||
void SavePresetClicked();
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
#include "common/filefunctions.h"
|
||||
#include "node/input.h"
|
||||
#include "render/videoparams.h"
|
||||
#include "ui/icons/icons.h"
|
||||
#include "widget/menu/menu.h"
|
||||
|
||||
@@ -40,6 +41,8 @@ const int kDataIsPreset = Qt::UserRole;
|
||||
const int kDataPresetIsCustomRole = Qt::UserRole + 1;
|
||||
const int kDataPresetDataRole = Qt::UserRole + 2;
|
||||
|
||||
const PixelFormat::Format kDefaultPreviewFormat = PixelFormat::PIX_FMT_RGBA16F;
|
||||
|
||||
SequenceDialogPresetTab::SequenceDialogPresetTab(QWidget* parent) :
|
||||
QWidget(parent),
|
||||
PresetManager<SequencePreset>(this, QStringLiteral("sequencepresets"))
|
||||
@@ -65,8 +68,12 @@ SequenceDialogPresetTab::SequenceDialogPresetTab(QWidget* parent) :
|
||||
preset_tree_->addTopLevelItem(CreateHDPresetFolder(tr("1080p"), 1920, 1080, 3));
|
||||
preset_tree_->addTopLevelItem(CreateHDPresetFolder(tr("720p"), 1280, 720, 2));
|
||||
|
||||
preset_tree_->addTopLevelItem(CreateSDPresetFolder(tr("NTSC"), 720, 480, rational(30000, 1001), 1));
|
||||
preset_tree_->addTopLevelItem(CreateSDPresetFolder(tr("PAL"), 720, 576, rational(25, 1), 1));
|
||||
preset_tree_->addTopLevelItem(CreateSDPresetFolder(tr("NTSC"), 720, 480, rational(30000, 1001),
|
||||
VideoParams::kPixelAspectNTSCStandard,
|
||||
VideoParams::kPixelAspectNTSCWidescreen, 1));
|
||||
preset_tree_->addTopLevelItem(CreateSDPresetFolder(tr("PAL"), 720, 576, rational(25, 1),
|
||||
VideoParams::kPixelAspectPALStandard,
|
||||
VideoParams::kPixelAspectPALWidescreen, 1));
|
||||
|
||||
// Load custom presets
|
||||
for (int i=0;i<GetNumberOfPresets();i++) {
|
||||
@@ -98,46 +105,56 @@ QTreeWidgetItem *SequenceDialogPresetTab::CreateHDPresetFolder(const QString &na
|
||||
width,
|
||||
height,
|
||||
rational(24000, 1001),
|
||||
VideoParams::kPixelAspectSquare,
|
||||
VideoParams::kInterlaceNone,
|
||||
48000,
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
divider,
|
||||
PixelFormat::PIX_FMT_RGBA16F));
|
||||
kDefaultPreviewFormat));
|
||||
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,
|
||||
PixelFormat::PIX_FMT_RGBA16F));
|
||||
kDefaultPreviewFormat));
|
||||
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,
|
||||
PixelFormat::PIX_FMT_RGBA16F));
|
||||
kDefaultPreviewFormat));
|
||||
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,
|
||||
PixelFormat::PIX_FMT_RGBA16F));
|
||||
kDefaultPreviewFormat));
|
||||
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,
|
||||
PixelFormat::PIX_FMT_RGBA16F));
|
||||
kDefaultPreviewFormat));
|
||||
return parent;
|
||||
}
|
||||
|
||||
QTreeWidgetItem *SequenceDialogPresetTab::CreateSDPresetFolder(const QString &name, int width, int height, const rational& frame_rate, int divider)
|
||||
QTreeWidgetItem *SequenceDialogPresetTab::CreateSDPresetFolder(const QString &name, int width, int height, const rational& frame_rate, const rational &standard_par, const rational &wide_par, int divider)
|
||||
{
|
||||
QTreeWidgetItem* parent = CreateFolder(name);
|
||||
preset_tree_->addTopLevelItem(parent);
|
||||
@@ -145,18 +162,22 @@ QTreeWidgetItem *SequenceDialogPresetTab::CreateSDPresetFolder(const QString &na
|
||||
width,
|
||||
height,
|
||||
frame_rate,
|
||||
standard_par,
|
||||
VideoParams::kInterlacedTopFirst,
|
||||
48000,
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
divider,
|
||||
PixelFormat::PIX_FMT_RGBA16F));
|
||||
kDefaultPreviewFormat));
|
||||
AddStandardItem(parent, SequencePreset::Create(tr("%1 Widescreen").arg(name),
|
||||
width,
|
||||
height,
|
||||
frame_rate,
|
||||
wide_par,
|
||||
VideoParams::kInterlacedTopFirst,
|
||||
48000,
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
divider,
|
||||
PixelFormat::PIX_FMT_RGBA16F));
|
||||
kDefaultPreviewFormat));
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ private:
|
||||
|
||||
QTreeWidgetItem *CreateHDPresetFolder(const QString& name, int width, int height, int divider);
|
||||
|
||||
QTreeWidgetItem *CreateSDPresetFolder(const QString& name, int width, int height, const rational &frame_rate, int divider);
|
||||
QTreeWidgetItem *CreateSDPresetFolder(const QString& name, int width, int height, const rational &frame_rate, const rational& standard_par, const rational& wide_par, int divider);
|
||||
|
||||
QTreeWidgetItem* GetSelectedItem();
|
||||
QTreeWidgetItem* GetSelectedCustomPreset();
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "common/xmlutils.h"
|
||||
#include "dialog/sequence/presetmanager.h"
|
||||
#include "render/pixelformat.h"
|
||||
#include "render/videoparams.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
@@ -38,6 +39,8 @@ public:
|
||||
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,
|
||||
@@ -45,6 +48,8 @@ public:
|
||||
width_(width),
|
||||
height_(height),
|
||||
frame_rate_(frame_rate),
|
||||
pixel_aspect_(pixel_aspect),
|
||||
interlacing_(interlacing),
|
||||
sample_rate_(sample_rate),
|
||||
channel_layout_(channel_layout),
|
||||
preview_divider_(preview_divider),
|
||||
@@ -57,13 +62,16 @@ public:
|
||||
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,
|
||||
PixelFormat::Format preview_format)
|
||||
{
|
||||
return std::make_shared<SequencePreset>(name, width, height, frame_rate, sample_rate,
|
||||
channel_layout, preview_divider, preview_format);
|
||||
return std::make_shared<SequencePreset>(name, width, height, frame_rate, pixel_aspect,
|
||||
interlacing, sample_rate, channel_layout,
|
||||
preview_divider, preview_format);
|
||||
}
|
||||
|
||||
virtual void Load(QXmlStreamReader* reader) override
|
||||
@@ -77,6 +85,10 @@ public:
|
||||
height_ = reader->readElementText().toInt();
|
||||
} else if (reader->name() == QStringLiteral("framerate")) {
|
||||
frame_rate_ = rational::fromString(reader->readElementText());
|
||||
} else if (reader->name() == QStringLiteral("pixelaspect")) {
|
||||
pixel_aspect_ = rational::fromString(reader->readElementText());
|
||||
} else if (reader->name() == QStringLiteral("interlacing")) {
|
||||
interlacing_ = static_cast<VideoParams::Interlacing>(reader->readElementText().toInt());
|
||||
} else if (reader->name() == QStringLiteral("samplerate")) {
|
||||
sample_rate_ = reader->readElementText().toInt();
|
||||
} else if (reader->name() == QStringLiteral("chlayout")) {
|
||||
@@ -97,6 +109,8 @@ public:
|
||||
writer->writeTextElement(QStringLiteral("width"), QString::number(width_));
|
||||
writer->writeTextElement(QStringLiteral("height"), QString::number(height_));
|
||||
writer->writeTextElement(QStringLiteral("framerate"), frame_rate_.toString());
|
||||
writer->writeTextElement(QStringLiteral("pixelaspect"), pixel_aspect_.toString());
|
||||
writer->writeTextElement(QStringLiteral("interlacing_"), QString::number(interlacing_));
|
||||
writer->writeTextElement(QStringLiteral("samplerate"), QString::number(sample_rate_));
|
||||
writer->writeTextElement(QStringLiteral("chlayout"), QString::number(channel_layout_));
|
||||
writer->writeTextElement(QStringLiteral("divider"), QString::number(preview_divider_));
|
||||
@@ -118,6 +132,16 @@ public:
|
||||
return frame_rate_;
|
||||
}
|
||||
|
||||
const rational& pixel_aspect() const
|
||||
{
|
||||
return pixel_aspect_;
|
||||
}
|
||||
|
||||
VideoParams::Interlacing interlacing() const
|
||||
{
|
||||
return interlacing_;
|
||||
}
|
||||
|
||||
int sample_rate() const
|
||||
{
|
||||
return sample_rate_;
|
||||
@@ -142,6 +166,8 @@ private:
|
||||
int width_;
|
||||
int height_;
|
||||
rational frame_rate_;
|
||||
rational pixel_aspect_;
|
||||
VideoParams::Interlacing interlacing_;
|
||||
int sample_rate_;
|
||||
uint64_t channel_layout_;
|
||||
int preview_divider_;
|
||||
|
||||
Reference in New Issue
Block a user