Merge branch 'master' into pr/1875
This commit is contained in:
@@ -196,7 +196,7 @@ DiskCacheFolder::DiskCacheFolder(const QString &path, QObject *parent) :
|
||||
{
|
||||
SetPath(path);
|
||||
|
||||
save_timer_.setInterval(Config::Current()[QStringLiteral("DiskCacheSaveInterval")].toInt());
|
||||
save_timer_.setInterval(OLIVE_CONFIG("DiskCacheSaveInterval").toInt());
|
||||
connect(&save_timer_, &QTimer::timeout, this, &DiskCacheFolder::SaveDiskCacheIndex);
|
||||
save_timer_.start();
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ PreviewAutoCacher::PreviewAutoCacher() :
|
||||
SetPlayhead(0);
|
||||
|
||||
// Wait a certain amount of time before requeuing when we receive an invalidate signal
|
||||
delayed_requeue_timer_.setInterval(Config::Current()[QStringLiteral("AutoCacheDelay")].toInt());
|
||||
delayed_requeue_timer_.setInterval(OLIVE_CONFIG("AutoCacheDelay").toInt());
|
||||
delayed_requeue_timer_.setSingleShot(true);
|
||||
connect(&delayed_requeue_timer_, &QTimer::timeout, this, &PreviewAutoCacher::RequeueFrames);
|
||||
|
||||
@@ -502,8 +502,8 @@ void PreviewAutoCacher::StartCachingAudioRange(const TimeRange &range)
|
||||
|
||||
void PreviewAutoCacher::SetPlayhead(const rational &playhead)
|
||||
{
|
||||
cache_range_ = TimeRange(playhead - Config::Current()[QStringLiteral("DiskCacheBehind")].value<rational>(),
|
||||
playhead + Config::Current()[QStringLiteral("DiskCacheAhead")].value<rational>());
|
||||
cache_range_ = TimeRange(playhead - OLIVE_CONFIG("DiskCacheBehind").value<rational>(),
|
||||
playhead + OLIVE_CONFIG("DiskCacheAhead").value<rational>());
|
||||
|
||||
RequeueFrames();
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ FramePtr RenderProcessor::GenerateFrame(TexturePtr texture, const rational& time
|
||||
|
||||
job.SetColorProcessor(output_color_transform);
|
||||
job.SetInputTexture(texture);
|
||||
job.SetInputAlphaAssociation(Config::Current()[QStringLiteral("ReassocLinToNonLin")].toBool() ? kAlphaAssociated : kAlphaNone);
|
||||
job.SetInputAlphaAssociation(OLIVE_CONFIG("ReassocLinToNonLin").toBool() ? kAlphaAssociated : kAlphaNone);
|
||||
job.SetTransformMatrix(matrix);
|
||||
|
||||
render_ctx_->BlitColorManaged(job, blit_tex.get());
|
||||
@@ -523,10 +523,6 @@ void RenderProcessor::ProcessShader(TexturePtr destination, const Node *node, co
|
||||
}
|
||||
}
|
||||
|
||||
VideoParams tex_params = GetCacheVideoParams();
|
||||
|
||||
tex_params.set_channel_count(GetChannelCountFromJob(job));
|
||||
|
||||
// Run shader
|
||||
render_ctx_->BlitToTexture(shader, job, destination.get());
|
||||
}
|
||||
@@ -575,27 +571,7 @@ void RenderProcessor::ProcessFrameGeneration(TexturePtr destination, const Node
|
||||
|
||||
node->GenerateFrame(frame, job);
|
||||
|
||||
if (job.GetColorspace().isEmpty()) {
|
||||
// Just upload frame data straight to frame
|
||||
destination->Upload(frame->data(), frame->linesize_pixels());
|
||||
} else {
|
||||
// Convert to reference space
|
||||
|
||||
// Upload to middle texture
|
||||
TexturePtr mid = render_ctx_->CreateTexture(GetCacheVideoParams());
|
||||
mid->Upload(frame->data(), frame->linesize_pixels());
|
||||
|
||||
ColorManager* color_manager = Node::ValueToPtr<ColorManager>(ticket_->property("colormanager"));
|
||||
ColorProcessorPtr cp = ColorProcessor::Create(color_manager, job.GetColorspace(), color_manager->GetReferenceColorSpace());
|
||||
|
||||
ColorTransformJob ctj;
|
||||
|
||||
ctj.SetColorProcessor(cp);
|
||||
ctj.SetInputTexture(mid);
|
||||
ctj.SetInputAlphaAssociation(kAlphaAssociated);
|
||||
|
||||
render_ctx_->BlitColorManaged(ctj, destination.get());
|
||||
}
|
||||
destination->Upload(frame->data(), frame->linesize_pixels());
|
||||
}
|
||||
|
||||
bool RenderProcessor::CanCacheFrames()
|
||||
@@ -603,4 +579,18 @@ bool RenderProcessor::CanCacheFrames()
|
||||
return ticket_->property("type").value<RenderManager::TicketType>() == RenderManager::kTypeVideo;
|
||||
}
|
||||
|
||||
void RenderProcessor::ConvertToReferenceSpace(TexturePtr destination, TexturePtr source, const QString &input_cs)
|
||||
{
|
||||
ColorManager* color_manager = Node::ValueToPtr<ColorManager>(ticket_->property("colormanager"));
|
||||
ColorProcessorPtr cp = ColorProcessor::Create(color_manager, input_cs, color_manager->GetReferenceColorSpace());
|
||||
|
||||
ColorTransformJob ctj;
|
||||
|
||||
ctj.SetColorProcessor(cp);
|
||||
ctj.SetInputTexture(source);
|
||||
ctj.SetInputAlphaAssociation(kAlphaAssociated);
|
||||
|
||||
render_ctx_->BlitColorManaged(ctj, destination.get());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ protected:
|
||||
return SampleBuffer::CreateAllocated(params, sample_count);
|
||||
}
|
||||
|
||||
virtual void ConvertToReferenceSpace(TexturePtr destination, TexturePtr source, const QString &input_cs) override;
|
||||
|
||||
private:
|
||||
RenderProcessor(RenderTicketPtr ticket, Renderer* render_ctx, DecoderCache* decoder_cache, ShaderCache* shader_cache, QVariant default_shader);
|
||||
|
||||
|
||||
@@ -259,6 +259,8 @@ void VideoParams::set_defaults_for_footage()
|
||||
start_time_ = 0;
|
||||
duration_ = 0;
|
||||
premultiplied_alpha_ = false;
|
||||
x_ = 0;
|
||||
y_ = 0;
|
||||
}
|
||||
|
||||
void VideoParams::calculate_square_pixel_width()
|
||||
@@ -327,6 +329,8 @@ QByteArray VideoParams::toBytes() const
|
||||
hasher.addData(reinterpret_cast<const char*>(&interlacing_), sizeof(interlacing_));
|
||||
hasher.addData(reinterpret_cast<const char*>(÷r_), sizeof(divider_));
|
||||
hasher.addData(reinterpret_cast<const char*>(&enabled_), sizeof(enabled_));
|
||||
hasher.addData(reinterpret_cast<const char*>(&x_), sizeof(x_));
|
||||
hasher.addData(reinterpret_cast<const char*>(&y_), sizeof(y_));
|
||||
hasher.addData(reinterpret_cast<const char*>(&stream_index_), sizeof(stream_index_));
|
||||
hasher.addData(reinterpret_cast<const char*>(&video_type_), sizeof(video_type_));
|
||||
hasher.addData(reinterpret_cast<const char*>(&frame_rate_), sizeof(frame_rate_));
|
||||
@@ -370,6 +374,10 @@ void VideoParams::Load(QXmlStreamReader *reader)
|
||||
set_divider(reader->readElementText().toInt());
|
||||
} else if (reader->name() == QStringLiteral("enabled")) {
|
||||
set_enabled(reader->readElementText().toInt());
|
||||
} else if (reader->name() == QStringLiteral("x")) {
|
||||
set_x(reader->readElementText().toFloat());
|
||||
} else if (reader->name() == QStringLiteral("y")) {
|
||||
set_y(reader->readElementText().toFloat());
|
||||
} else if (reader->name() == QStringLiteral("streamindex")) {
|
||||
set_stream_index(reader->readElementText().toInt());
|
||||
} else if (reader->name() == QStringLiteral("videotype")) {
|
||||
@@ -402,6 +410,8 @@ void VideoParams::Save(QXmlStreamWriter *writer) const
|
||||
writer->writeTextElement(QStringLiteral("interlacing"), QString::number(interlacing_));
|
||||
writer->writeTextElement(QStringLiteral("divider"), QString::number(divider_));
|
||||
writer->writeTextElement(QStringLiteral("enabled"), QString::number(enabled_));
|
||||
writer->writeTextElement(QStringLiteral("x"), QString::number(x_));
|
||||
writer->writeTextElement(QStringLiteral("y"), QString::number(y_));
|
||||
writer->writeTextElement(QStringLiteral("streamindex"), QString::number(stream_index_));
|
||||
writer->writeTextElement(QStringLiteral("videotype"), QString::number(video_type_));
|
||||
writer->writeTextElement(QStringLiteral("framerate"), frame_rate_.toString());
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#ifndef VIDEOPARAMS_H
|
||||
#define VIDEOPARAMS_H
|
||||
|
||||
#include <QVector2D>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QXmlStreamWriter>
|
||||
|
||||
@@ -273,6 +274,12 @@ public:
|
||||
enabled_ = e;
|
||||
}
|
||||
|
||||
float x() const { return x_; }
|
||||
void set_x(float x) { x_ = x; }
|
||||
float y() const { return y_; }
|
||||
void set_y(float y) { y_ = y; }
|
||||
QVector2D offset() const { return QVector2D(x_, y_); }
|
||||
|
||||
int stream_index() const
|
||||
{
|
||||
return stream_index_;
|
||||
@@ -387,6 +394,8 @@ private:
|
||||
int64_t duration_;
|
||||
bool premultiplied_alpha_;
|
||||
QString colorspace_;
|
||||
float x_;
|
||||
float y_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user