Added SetMaxSize for image optimizations in QImageReader and FFmpegReader, which lets the timeline pass down the max size to all clips and readers, so they can optionally optimize the size of images (especially useful for optimizing preview performance). Removed convoluted image scaling code in FFmpegReader, and replaced with simpler version. Also, fixed a few regressions from the new Caching code, primarily a crash when reaching the end of the last clip on the timeline.

This commit is contained in:
Jonathan Thomas
2016-09-14 04:11:12 -05:00
parent 6cc7fcfd99
commit 7f347eb1ca
12 changed files with 133 additions and 115 deletions

View File

@@ -342,6 +342,9 @@ tr1::shared_ptr<Frame> FrameMapper::GetOrCreateFrame(long int number)
// Debug output
ZmqLogger::Instance()->AppendDebugMethod("FrameMapper::GetOrCreateFrame (from reader)", "number", number, "samples_in_frame", samples_in_frame, "", -1, "", -1, "", -1, "", -1);
// Set max image size (used for performance optimization)
reader->SetMaxSize(max_width, max_height);
// Attempt to get a frame (but this could fail if a reader has just been closed)
new_frame = reader->GetFrame(number);
@@ -423,6 +426,9 @@ tr1::shared_ptr<Frame> FrameMapper::GetFrame(long int requested_frame) throw(Rea
info.channel_layout == mapped_frame->ChannelsLayout() &&
info.fps.num == reader->info.fps.num &&
info.fps.den == reader->info.fps.den) {
// Set frame # on mapped frame
mapped_frame->SetFrameNumber(frame_number);
// Add original frame to cache, and skip the rest (for performance reasons)
final_cache.Add(mapped_frame);
continue;