Merge branch 'master' into multicam

This commit is contained in:
itsmattkc
2022-10-01 13:51:04 -07:00
16 changed files with 230 additions and 45 deletions
+2 -2
View File
@@ -232,7 +232,7 @@ void ClipBlock::RequestRangeFromConnected(const TimeRange &range)
{
TimeRange thumb_range = range.Intersected(max_range);
if (GetAdjustedThumbnailRange(&thumb_range)) {
emit connected->thumbnail_cache()->Request(thumb_range);
connected->thumbnail_cache()->Request(thumb_range);
}
}
@@ -296,7 +296,7 @@ void ClipBlock::RequestRangeForCache(PlaybackCache *cache, const TimeRange &max_
}
if (request) {
emit cache->Request(r);
cache->Request(r);
}
}
+27
View File
@@ -403,6 +403,33 @@ Block *Track::NearestBlockAfter(const rational &time) const
return nullptr;
}
bool Track::IsRangeFree(const TimeRange &range) const
{
Block *b = NearestBlockBeforeOrAt(range.in());
if (!b) {
// No block here, assume track is empty here
return true;
}
if (!dynamic_cast<GapBlock*>(b)) {
// There's a block at or around the start point that isn't a gap, range is not free
return false;
}
while ((b = b->next())) {
if (b->in() >= range.out()) {
// This block is after the range, no longer relevant
break;
} else if (!dynamic_cast<GapBlock*>(b)) {
// Found a block in this range, range is not free
return false;
}
}
// If we get here, we couldn't find anything in the way of this range
return true;
}
void Track::InvalidateCache(const TimeRange& range, const QString& from, int element, InvalidateCacheOptions options)
{
TimeRange limited;
+5
View File
@@ -316,6 +316,11 @@ public:
*/
Block* NearestBlockAfter(const rational& time) const;
/*
* @brief Returns whether a time range is empty or only has a gap
*/
bool IsRangeFree(const TimeRange &range) const;
const QVector<Block *> &Blocks() const
{
return blocks_;
+5 -5
View File
@@ -224,16 +224,16 @@ void ViewerOutput::InvalidateCache(const TimeRange& range, const QString& from,
if (Node *connected = GetConnectedOutput(from, element)) {
if (from == kTextureInput) {
//emit connected->thumbnail_cache()->Request(range.Intersected(max_range), PlaybackCache::kPreviewsOnly);
//connected->thumbnail_cache()->Request(range.Intersected(max_range), PlaybackCache::kPreviewsOnly);
if (autocache_input_video_) {
TimeRange max_range = InputTimeAdjustment(from, element, TimeRange(0, GetVideoLength()));
emit connected->video_frame_cache()->Request(range.Intersected(max_range));
connected->video_frame_cache()->Request(range.Intersected(max_range));
}
} else if (from == kSamplesInput) {
TimeRange max_range = InputTimeAdjustment(from, element, TimeRange(0, GetAudioLength()));
emit connected->waveform_cache()->Request(range.Intersected(max_range));
connected->waveform_cache()->Request(range.Intersected(max_range));
if (autocache_input_audio_) {
emit connected->audio_playback_cache()->Request(range.Intersected(max_range));
connected->audio_playback_cache()->Request(range.Intersected(max_range));
}
}
}
@@ -393,7 +393,7 @@ void ViewerOutput::ConnectedToPreviewEvent()
TimeRange max_range = InputTimeAdjustment(kSamplesInput, -1, TimeRange(0, GetAudioLength()));
TimeRangeList invalid = connected->waveform_cache()->GetInvalidatedRanges(max_range);
for (const TimeRange &r : invalid) {
emit connected->waveform_cache()->Request(r);
connected->waveform_cache()->Request(r);
}
}
}