previewautocacher: better function structure
This commit is contained in:
@@ -132,10 +132,7 @@ void PreviewAutoCacher::VideoInvalidated(const TimeRange &range)
|
|||||||
|
|
||||||
// If auto-cache is enabled and a slider is not being dragged, queue up to hash these frames
|
// If auto-cache is enabled and a slider is not being dragged, queue up to hash these frames
|
||||||
if (viewer_node_->GetVideoAutoCacheEnabled() && !NodeInputDragger::IsInputBeingDragged()) {
|
if (viewer_node_->GetVideoAutoCacheEnabled() && !NodeInputDragger::IsInputBeingDragged()) {
|
||||||
invalidated_video_.insert(range);
|
StartCachingVideoRange(range);
|
||||||
video_job_tracker_.insert(range, graph_changed_time_);
|
|
||||||
|
|
||||||
TryRender();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,12 +144,7 @@ void PreviewAutoCacher::AudioInvalidated(const TimeRange &range)
|
|||||||
|
|
||||||
// If we're auto-caching audio or require realtime waveforms, we'll have to render this
|
// If we're auto-caching audio or require realtime waveforms, we'll have to render this
|
||||||
if (viewer_node_->GetAudioAutoCacheEnabled() || kRealTimeWaveformsEnabled) {
|
if (viewer_node_->GetAudioAutoCacheEnabled() || kRealTimeWaveformsEnabled) {
|
||||||
audio_job_tracker_.insert(range, graph_changed_time_);
|
StartCachingAudioRange(range);
|
||||||
|
|
||||||
// Start jobs to re-render the audio at this range, split into 2 second chunks
|
|
||||||
invalidated_audio_.insert(range);
|
|
||||||
|
|
||||||
TryRender();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -472,6 +464,24 @@ void PreviewAutoCacher::AudioInvalidatedList(const TimeRangeList &list)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PreviewAutoCacher::StartCachingRange(const TimeRange &range, TimeRangeList *range_list, RenderJobTracker *tracker)
|
||||||
|
{
|
||||||
|
range_list->insert(range);
|
||||||
|
tracker->insert(range, graph_changed_time_);
|
||||||
|
|
||||||
|
TryRender();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreviewAutoCacher::StartCachingVideoRange(const TimeRange &range)
|
||||||
|
{
|
||||||
|
StartCachingRange(range, &invalidated_video_, &video_job_tracker_);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreviewAutoCacher::StartCachingAudioRange(const TimeRange &range)
|
||||||
|
{
|
||||||
|
StartCachingRange(range, &invalidated_audio_, &audio_job_tracker_);
|
||||||
|
}
|
||||||
|
|
||||||
void PreviewAutoCacher::SetPlayhead(const rational &playhead)
|
void PreviewAutoCacher::SetPlayhead(const rational &playhead)
|
||||||
{
|
{
|
||||||
cache_range_ = TimeRange(playhead - Config::Current()[QStringLiteral("DiskCacheBehind")].value<rational>(),
|
cache_range_ = TimeRange(playhead - Config::Current()[QStringLiteral("DiskCacheBehind")].value<rational>(),
|
||||||
|
|||||||
@@ -125,6 +125,10 @@ private:
|
|||||||
void VideoInvalidatedList(const TimeRangeList &list);
|
void VideoInvalidatedList(const TimeRangeList &list);
|
||||||
void AudioInvalidatedList(const TimeRangeList &list);
|
void AudioInvalidatedList(const TimeRangeList &list);
|
||||||
|
|
||||||
|
void StartCachingRange(const TimeRange &range, TimeRangeList *range_list, RenderJobTracker *tracker);
|
||||||
|
void StartCachingVideoRange(const TimeRange &range);
|
||||||
|
void StartCachingAudioRange(const TimeRange &range);
|
||||||
|
|
||||||
struct HashData {
|
struct HashData {
|
||||||
rational time;
|
rational time;
|
||||||
QByteArray hash;
|
QByteArray hash;
|
||||||
|
|||||||
Reference in New Issue
Block a user