cache: save states to disk
This commit is contained in:
@@ -311,4 +311,23 @@ void ClipBlock::Retranslate()
|
||||
SetInputName(kMaintainAudioPitchInput, tr("Maintain Audio Pitch"));
|
||||
}
|
||||
|
||||
void ClipBlock::ConnectedToPreviewEvent()
|
||||
{
|
||||
Track::Type type = GetTrackType();
|
||||
|
||||
if (type == Track::kVideo || type == Track::kAudio) {
|
||||
if (Node *connected = GetConnectedOutput(kBufferIn)) {
|
||||
TimeRange max_range = InputTimeAdjustment(kBufferIn, -1, TimeRange(0, length()));
|
||||
if (type == Track::kVideo) {
|
||||
TimeRangeList invalid = connected->thumbnail_cache()->GetInvalidatedRanges(max_range);
|
||||
for (const TimeRange &r : invalid) {
|
||||
emit connected->thumbnail_cache()->Request(r, PlaybackCache::kPreviewsOnly);
|
||||
}
|
||||
} else if (type == Track::kAudio) {
|
||||
//emit connected->audio_playback_cache()->Request(range.Intersected(max_range), PlaybackCache::kPreviewsOnly);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -158,6 +158,8 @@ public:
|
||||
return TimeRange(0, length());
|
||||
}
|
||||
|
||||
virtual void ConnectedToPreviewEvent() override;
|
||||
|
||||
static const QString kBufferIn;
|
||||
static const QString kMediaInInput;
|
||||
static const QString kSpeedInput;
|
||||
|
||||
@@ -991,6 +991,7 @@ public:
|
||||
void SetInputFlags(const QString &input, const InputFlags &f);
|
||||
|
||||
virtual void LoadFinishedEvent(){}
|
||||
virtual void ConnectedToPreviewEvent(){}
|
||||
|
||||
static void SetValueAtTime(const NodeInput &input, const rational &time, const QVariant &value, int track, MultiUndoCommand *command, bool insert_on_all_tracks_if_no_key);
|
||||
|
||||
|
||||
@@ -544,6 +544,18 @@ void ProjectSerializer220403::LoadNode(Node *node, XMLNodeData &xml_node_data, Q
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
} else if (reader->name() == QStringLiteral("caches")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (reader->name() == QStringLiteral("audio")) {
|
||||
node->audio_playback_cache()->SetUuid(reader->readElementText());
|
||||
} else if (reader->name() == QStringLiteral("video")) {
|
||||
node->video_frame_cache()->SetUuid(reader->readElementText());
|
||||
} else if (reader->name() == QStringLiteral("thumb")) {
|
||||
node->thumbnail_cache()->SetUuid(reader->readElementText());
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
@@ -599,6 +611,14 @@ void ProjectSerializer220403::SaveNode(Node *node, QXmlStreamWriter *writer) con
|
||||
}
|
||||
writer->writeEndElement();
|
||||
|
||||
writer->writeStartElement(QStringLiteral("caches"));
|
||||
|
||||
writer->writeTextElement(QStringLiteral("audio"), node->audio_playback_cache()->GetUuid().toString());
|
||||
writer->writeTextElement(QStringLiteral("video"), node->video_frame_cache()->GetUuid().toString());
|
||||
writer->writeTextElement(QStringLiteral("thumb"), node->thumbnail_cache()->GetUuid().toString());
|
||||
|
||||
writer->writeEndElement(); // caches
|
||||
|
||||
writer->writeStartElement(QStringLiteral("custom"));
|
||||
|
||||
SaveNodeCustom(writer, node);
|
||||
|
||||
Reference in New Issue
Block a user