@@ -220,16 +220,6 @@ void Project::set_filename(const QString &s)
|
||||
emit NameChanged();
|
||||
}
|
||||
|
||||
ColorManager *Project::color_manager()
|
||||
{
|
||||
return color_manager_;
|
||||
}
|
||||
|
||||
bool Project::is_modified() const
|
||||
{
|
||||
return is_modified_;
|
||||
}
|
||||
|
||||
void Project::set_modified(bool e)
|
||||
{
|
||||
is_modified_ = e;
|
||||
|
||||
@@ -62,9 +62,10 @@ public:
|
||||
QString pretty_filename() const;
|
||||
void set_filename(const QString& s);
|
||||
|
||||
ColorManager* color_manager();
|
||||
ColorManager* color_manager() { return color_manager_; }
|
||||
ProjectSettingsNode* settings() { return settings_; }
|
||||
|
||||
bool is_modified() const;
|
||||
bool is_modified() const { return is_modified_; }
|
||||
void set_modified(bool e);
|
||||
|
||||
bool has_autorecovery_been_saved() const;
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -43,9 +43,9 @@ protected:
|
||||
virtual void AudioDownloaded(const TimeRange& range, SampleBufferPtr samples, qint64 job_time) override;
|
||||
|
||||
private:
|
||||
Footage* footage_;
|
||||
Project* project_;
|
||||
|
||||
int index_;
|
||||
Footage* footage_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -490,15 +490,19 @@ void ProjectExplorer::ContextMenuStartProxy(QAction *a)
|
||||
Sequence* sequence = Node::ValueToPtr<Sequence>(a->data());
|
||||
|
||||
// To get here, the `context_menu_items_` must be all kFootage
|
||||
foreach (Node* i, context_menu_items_) {
|
||||
Footage* f = static_cast<Footage*>(i);
|
||||
foreach (Node* item, context_menu_items_) {
|
||||
Footage* f = static_cast<Footage*>(item);
|
||||
|
||||
QVector<VideoParams> enabled_streams = f->GetEnabledVideoStreams();
|
||||
int sz = f->InputArraySize(Footage::kVideoParamsInput);
|
||||
|
||||
foreach (const VideoParams& stream, enabled_streams) {
|
||||
// Start a background task for proxying
|
||||
PreCacheTask* proxy_task = new PreCacheTask(f, stream.stream_index(), sequence);
|
||||
TaskManager::instance()->AddTask(proxy_task);
|
||||
for (int j=0; j<sz; j++) {
|
||||
VideoParams vp = f->GetVideoParams(j);
|
||||
|
||||
if (vp.enabled()) {
|
||||
// Start a background task for proxying
|
||||
PreCacheTask* proxy_task = new PreCacheTask(f, j, sequence);
|
||||
TaskManager::instance()->AddTask(proxy_task);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user