improved render channel count system

This commit is contained in:
itsmattkc
2020-11-15 22:16:40 +11:00
parent ee5307336e
commit 0d0766e4fb
83 changed files with 1017 additions and 1132 deletions
+4 -1
View File
@@ -104,7 +104,9 @@ void VideoStream::LoadCustomParameters(QXmlStreamReader *reader)
} else if (reader->name() == QStringLiteral("type")) {
set_video_type(static_cast<VideoType>(reader->readElementText().toInt()));
} else if (reader->name() == QStringLiteral("format")) {
set_format(static_cast<PixelFormat::Format>(reader->readElementText().toInt()));
set_format(static_cast<VideoParams::Format>(reader->readElementText().toInt()));
} else if (reader->name() == QStringLiteral("channels")) {
set_channel_count(reader->readElementText().toInt());
} else if (reader->name() == QStringLiteral("pixelaspect")) {
set_pixel_aspect_ratio(rational::fromString(reader->readElementText()));
} else if (reader->name() == QStringLiteral("framerate")) {
@@ -126,6 +128,7 @@ void VideoStream::SaveCustomParameters(QXmlStreamWriter *writer) const
writer->writeTextElement(QStringLiteral("interlacing"), QString::number(interlacing_));
writer->writeTextElement(QStringLiteral("type"), QString::number(video_type_));
writer->writeTextElement(QStringLiteral("format"), QString::number(format_));
writer->writeTextElement(QStringLiteral("channels"), QString::number(channel_count_));
writer->writeTextElement(QStringLiteral("pixelaspect"), pixel_aspect_ratio_.toString());
writer->writeTextElement(QStringLiteral("framerate"), frame_rate_.toString());
writer->writeTextElement(QStringLiteral("starttime"), QString::number(start_time_));
+15 -4
View File
@@ -21,7 +21,6 @@
#ifndef VIDEOSTREAM_H
#define VIDEOSTREAM_H
#include "render/pixelformat.h"
#include "render/videoparams.h"
#include "stream.h"
@@ -74,16 +73,26 @@ public:
height_ = height;
}
const PixelFormat::Format& format() const
const VideoParams::Format& format() const
{
return format_;
}
void set_format(const PixelFormat::Format& format)
void set_format(const VideoParams::Format& format)
{
format_ = format;
}
int channel_count() const
{
return channel_count_;
}
void set_channel_count(int c)
{
channel_count_ = c;
}
bool premultiplied_alpha() const;
void set_premultiplied_alpha(bool e);
@@ -153,7 +162,9 @@ private:
VideoType video_type_;
PixelFormat::Format format_;
VideoParams::Format format_;
int channel_count_;
rational pixel_aspect_ratio_;
+12 -9
View File
@@ -70,7 +70,7 @@ void Sequence::Load(QXmlStreamReader *reader, XMLNodeData& xml_node_data, const
int video_width = 0, video_height = 0, preview_div = 1;
rational video_timebase, video_pixel_aspect;
VideoParams::Interlacing video_interlacing = VideoParams::kInterlaceNone;
PixelFormat::Format preview_format = PixelFormat::PIX_FMT_INVALID;
VideoParams::Format preview_format = VideoParams::kFormatInvalid;
while (XMLReadNextStartElement(reader)) {
if (cancelled && *cancelled) {
@@ -86,7 +86,7 @@ void Sequence::Load(QXmlStreamReader *reader, XMLNodeData& xml_node_data, const
} else if (reader->name() == QStringLiteral("divider")) {
preview_div = reader->readElementText().toInt();
} else if (reader->name() == QStringLiteral("format")) {
preview_format = static_cast<PixelFormat::Format>(reader->readElementText().toInt());
preview_format = static_cast<VideoParams::Format>(reader->readElementText().toInt());
} else if (reader->name() == QStringLiteral("pixelaspect")) {
video_pixel_aspect = rational::fromString(reader->readElementText());
} else if (reader->name() == QStringLiteral("interlacing")) {
@@ -97,11 +97,12 @@ void Sequence::Load(QXmlStreamReader *reader, XMLNodeData& xml_node_data, const
}
set_video_params(VideoParams(video_width, video_height, video_timebase, preview_format,
video_pixel_aspect, video_interlacing, preview_div));
VideoParams::kInternalChannelCount, video_pixel_aspect,
video_interlacing, preview_div));
} else if (reader->name() == QStringLiteral("audio")) {
int rate = 0;
uint64_t layout = 0;
SampleFormat::Format format = SampleFormat::SAMPLE_FMT_INVALID;
AudioParams::Format format = AudioParams::kFormatInvalid;
while (XMLReadNextStartElement(reader)) {
if (reader->name() == QStringLiteral("rate")) {
@@ -109,7 +110,7 @@ void Sequence::Load(QXmlStreamReader *reader, XMLNodeData& xml_node_data, const
} else if (reader->name() == QStringLiteral("layout")) {
layout = reader->readElementText().toULongLong();
} else if (reader->name() == QStringLiteral("format")) {
format = static_cast<SampleFormat::Format>(reader->readElementText().toInt());
format = static_cast<AudioParams::Format>(reader->readElementText().toInt());
} else {
reader->skipCurrentElement();
}
@@ -268,13 +269,14 @@ void Sequence::set_default_parameters()
set_video_params(VideoParams(width,
height,
Config::Current()["DefaultSequenceFrameRate"].value<rational>(),
static_cast<PixelFormat::Format>(Config::Current()["DefaultSequencePreviewFormat"].toInt()),
static_cast<VideoParams::Format>(Config::Current()["OfflinePixelFormat"].toInt()),
VideoParams::kInternalChannelCount,
Config::Current()["DefaultSequencePixelAspect"].value<rational>(),
Config::Current()["DefaultSequenceInterlacing"].value<VideoParams::Interlacing>(),
VideoParams::generate_auto_divider(width, height)));
set_audio_params(AudioParams(Config::Current()["DefaultSequenceAudioFrequency"].toInt(),
Config::Current()["DefaultSequenceAudioLayout"].toULongLong(),
SampleFormat::kInternalFormat));
AudioParams::kInternalFormat));
}
void Sequence::set_parameters_from_footage(const QList<Footage *> footage)
@@ -310,7 +312,8 @@ void Sequence::set_parameters_from_footage(const QList<Footage *> footage)
set_video_params(VideoParams(vs->width(),
vs->height(),
using_timebase,
static_cast<PixelFormat::Format>(Config::Current()["DefaultSequencePreviewFormat"].toInt()),
static_cast<VideoParams::Format>(Config::Current()["OfflinePixelFormat"].toInt()),
VideoParams::kInternalChannelCount,
vs->pixel_aspect_ratio(),
vs->interlacing(),
VideoParams::generate_auto_divider(vs->width(), vs->height())));
@@ -320,7 +323,7 @@ void Sequence::set_parameters_from_footage(const QList<Footage *> footage)
case Stream::kAudio:
if (!found_audio_params) {
AudioStream* as = static_cast<AudioStream*>(s.get());
set_audio_params(AudioParams(as->sample_rate(), as->channel_layout(), SampleFormat::kInternalFormat));
set_audio_params(AudioParams(as->sample_rate(), as->channel_layout(), AudioParams::kInternalFormat));
found_audio_params = true;
}
break;