Refactored the Settings::Instance()->MAX_WIDTH and Settings::Instance()->MAX_HEIGHT out of the Cilp class. GetFrame() now has an overload which specifies the width, height, and samples needed. Otherwise, it returns the Clip image based on the source reader (width, height, num samples).

This commit is contained in:
Jonathan Thomas
2020-08-26 17:05:50 -05:00
committed by FeRD (Frank Dana)
parent 000c9d6d4c
commit eb328f1190
3 changed files with 81 additions and 37 deletions

View File

@@ -441,7 +441,7 @@ std::shared_ptr<Frame> Timeline::GetOrCreateFrame(Clip* clip, int64_t number)
// Attempt to get a frame (but this could fail if a reader has just been closed)
#pragma omp critical (T_GetOtCreateFrame)
new_frame = std::shared_ptr<Frame>(clip->GetFrame(number));
new_frame = std::shared_ptr<Frame>(clip->GetFrame(number, info.width, info.height, samples_in_frame));
// Return real frame
return new_frame;
@@ -737,8 +737,10 @@ std::shared_ptr<Frame> Timeline::GetFrame(int64_t requested_frame)
// Get clip frame #
long clip_start_frame = (clip->Start() * info.fps.ToDouble()) + 1;
long clip_frame_number = frame_number - clip_start_position + clip_start_frame;
int samples_in_frame = Frame::GetSamplesPerFrame(frame_number, info.fps, info.sample_rate, info.channels);
// Cache clip object
clip->GetFrame(clip_frame_number);
clip->GetFrame(clip_frame_number, info.width, info.height, samples_in_frame);
}
}
}