~mbranton/libopenshot/alpha-channel-fix

« back to all changes in this revision

Viewing changes to src/FrameMapper.cpp

  • Committer: Jonathan Thomas
  • Date: 2016-09-14 09:11:12 UTC
  • Revision ID: jonathan@openshot.org-20160914091112-mcxg747f4zniwscx
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.

Show diffs side-by-side

added added

removed removed

Lines of Context:
342
342
                // Debug output
343
343
                ZmqLogger::Instance()->AppendDebugMethod("FrameMapper::GetOrCreateFrame (from reader)", "number", number, "samples_in_frame", samples_in_frame, "", -1, "", -1, "", -1, "", -1);
344
344
 
 
345
                // Set max image size (used for performance optimization)
 
346
                reader->SetMaxSize(max_width, max_height);
 
347
 
345
348
                // Attempt to get a frame (but this could fail if a reader has just been closed)
346
349
                new_frame = reader->GetFrame(number);
347
350
 
423
426
                                info.channel_layout == mapped_frame->ChannelsLayout() &&
424
427
                                info.fps.num == reader->info.fps.num &&
425
428
                                info.fps.den == reader->info.fps.den) {
 
429
                                        // Set frame # on mapped frame
 
430
                                        mapped_frame->SetFrameNumber(frame_number);
 
431
 
426
432
                                        // Add original frame to cache, and skip the rest (for performance reasons)
427
433
                                        final_cache.Add(mapped_frame);
428
434
                                        continue;