fixed precache task

Fixes #1558
This commit is contained in:
itsmattkc
2021-04-11 18:57:21 +10:00
parent 6c30f8cf46
commit a87adbd801
5 changed files with 30 additions and 27 deletions
+14 -6
View File
@@ -27,23 +27,31 @@ namespace olive {
PreCacheTask::PreCacheTask(Footage *footage, int index, Sequence* sequence) :
RenderTask(new ViewerOutput(), sequence->GetVideoParams(), sequence->GetAudioParams())
{
// Create new project
project_ = new Project();
// Create viewer with same parameters as the sequence
viewer()->setParent(project_);
viewer()->SetVideoParams(sequence->GetVideoParams());
viewer()->SetAudioParams(sequence->GetAudioParams());
// Copy project config nodes
Node::CopyInputs(footage->project()->color_manager(), project_->color_manager(), false);
Node::CopyInputs(footage->project()->settings(), project_->settings(), false);
// Copy footage node so it can precache without any modifications from the user screwing it up
footage_ = static_cast<Footage*>(footage->copy());
index_ = index;
footage_->setParent(project_);
Node::CopyInputs(footage, footage_, false);
Node::ConnectEdge(NodeOutput(footage_, Track::Reference(Track::kVideo, index).ToString()), NodeInput(viewer(), ViewerOutput::kTextureInput));
Node::ConnectEdge(NodeOutput(footage_, Track::Reference(Track::kVideo, 0).ToString()), NodeInput(viewer(), ViewerOutput::kTextureInput));
SetTitle(tr("Pre-caching %1:%2").arg(footage_->filename()));
SetTitle(tr("Pre-caching %1:%2").arg(footage_->filename(), index));
}
PreCacheTask::~PreCacheTask()
{
// We created this viewer node ourselves, so now we should delete it
delete viewer();
// This should delete the footage we copied and the viewer we created
delete project_;
}
bool PreCacheTask::Run()