MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / CreateFrame

Method CreateFrame

src/FFmpegReader.cpp:2685–2708  ·  view source on GitHub ↗

Create a new Frame (or return an existing one) and add it to the working queue.

Source from the content-addressed store, hash-verified

2683
2684// Create a new Frame (or return an existing one) and add it to the working queue.
2685std::shared_ptr<Frame> FFmpegReader::CreateFrame(int64_t requested_frame) {
2686 // Check working cache
2687 std::shared_ptr<Frame> output = working_cache.GetFrame(requested_frame);
2688
2689 if (!output) {
2690 // (re-)Check working cache
2691 output = working_cache.GetFrame(requested_frame);
2692 if(output) return output;
2693
2694 // Create a new frame on the working cache
2695 output = std::make_shared<Frame>(requested_frame, info.width, info.height, "#000000", Frame::GetSamplesPerFrame(requested_frame, info.fps, info.sample_rate, info.channels), info.channels);
2696 output->SetPixelRatio(info.pixel_ratio.num, info.pixel_ratio.den); // update pixel ratio
2697 output->ChannelsLayout(info.channel_layout); // update audio channel layout from the parent reader
2698 output->SampleRate(info.sample_rate); // update the frame's sample rate of the parent reader
2699
2700 working_cache.Add(output);
2701
2702 // Set the largest processed frame (if this is larger)
2703 if (requested_frame > largest_frame_processed)
2704 largest_frame_processed = requested_frame;
2705 }
2706 // Return frame
2707 return output;
2708}
2709
2710// Determine if frame is partial due to seek
2711bool FFmpegReader::IsPartialFrame(int64_t requested_frame) {

Callers 1

FFmpegReader.cppFile · 0.80

Calls 5

SetPixelRatioMethod · 0.80
GetFrameMethod · 0.45
ChannelsLayoutMethod · 0.45
SampleRateMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected