implemented base for thumbnail display

This commit is contained in:
itsmattkc
2022-05-25 11:18:08 -07:00
parent 44b9888efb
commit 60f7f06de4
21 changed files with 503 additions and 328 deletions
+4 -2
View File
@@ -187,9 +187,9 @@ void ClipBlock::InvalidateCache(const TimeRange& range, const QString& from, int
if (Node *connected = GetConnectedOutput(from, element)) {
TimeRange max_range = InputTimeAdjustment(from, element, TimeRange(0, length()));
if (type == Track::kVideo) {
emit connected->video_frame_cache()->Request(range.Intersected(max_range), true);
emit connected->video_frame_cache()->Request(range.Intersected(max_range), PlaybackCache::kPreviewsOnly);
} else if (type == Track::kAudio) {
emit connected->audio_playback_cache()->Request(range.Intersected(max_range), true);
emit connected->audio_playback_cache()->Request(range.Intersected(max_range), PlaybackCache::kPreviewsOnly);
}
}
}
@@ -250,6 +250,7 @@ void ClipBlock::InputConnectedEvent(const QString &input, int element, Node *out
super::InputConnectedEvent(input, element, output);
if (input == kBufferIn) {
connect(output->video_frame_cache(), &FrameHashCache::ThumbnailsUpdated, this, &Block::PreviewChanged);
connect(output->audio_playback_cache(), &AudioPlaybackCache::WaveformUpdated, this, &Block::PreviewChanged);
}
}
@@ -259,6 +260,7 @@ void ClipBlock::InputDisconnectedEvent(const QString &input, int element, Node *
super::InputDisconnectedEvent(input, element, output);
if (input == kBufferIn) {
disconnect(output->video_frame_cache(), &FrameHashCache::ThumbnailsUpdated, this, &Block::PreviewChanged);
disconnect(output->audio_playback_cache(), &AudioPlaybackCache::WaveformUpdated, this, &Block::PreviewChanged);
}
}
+9
View File
@@ -119,6 +119,15 @@ public:
return block_links_;
}
const FrameHashCache *thumbnails()
{
if (Node *n = GetConnectedOutput(kBufferIn)) {
return n->video_frame_cache();
} else {
return nullptr;
}
}
const AudioVisualWaveform *waveform()
{
if (Node *n = GetConnectedOutput(kBufferIn)) {
-9
View File
@@ -389,10 +389,6 @@ void ViewerOutput::InputValueChangedEvent(const QString &input, int element)
}
if (frame_rate_changed) {
// FIXME: Will need to find a better way to update this soon
//if (video_frame_cache()->IsEnabled()) {
video_frame_cache()->SetTimebase(new_video_params.frame_rate_as_time_base());
//}
emit FrameRateChanged(new_video_params.frame_rate());
}
@@ -412,11 +408,6 @@ void ViewerOutput::InputValueChangedEvent(const QString &input, int element)
emit AudioParamsChanged();
// FIXME: Will need to find a better way to update this soon
//if (audio_playback_cache()->IsEnabled()) {
audio_playback_cache()->SetParameters(GetAudioParams());
//}
cached_audio_params_ = new_audio_params;
}
+7 -10
View File
@@ -443,17 +443,14 @@ void NodeTraverser::ResolveJobs(NodeValue &val, const TimeRange &range)
VideoParams render_params = GetCacheVideoParams();
VideoParams job_params = job.video_params();
// HACK/FIXME: Override old cached probe data that contains an invalid divider. Might be
// good in the future to version the probe data so we can automatically
// ignore older stuff.
job_params.set_divider(render_params.divider());
// See if we can make this divider larger (i.e. if the footage is smaller)
while (job_params.divider() > 1
&& VideoParams::GetScaledDimension(job_params.width(), job_params.divider()-1) < render_params.effective_width()
&& VideoParams::GetScaledDimension(job_params.height(), job_params.divider()-1) < render_params.effective_height()) {
job_params.set_divider(job_params.divider() - 1);
if (render_params.divider() > 1) {
// Use a divider appropriate for this target resolution
job_params.set_divider(VideoParams::GetDividerForTargetResolution(job_params.width(), job_params.height(), render_params.effective_width(), render_params.effective_height()));
} else {
// Render everything at full res
job_params.set_divider(1);
}
job.set_video_params(job_params);
if (footage_time.isNaN()) {