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

Method GetFrame

src/QtTextReader.cpp:164–190  ·  view source on GitHub ↗

Get an openshot::Frame object for a specific frame number of this reader.

Source from the content-addressed store, hash-verified

162
163// Get an openshot::Frame object for a specific frame number of this reader.
164std::shared_ptr<Frame> QtTextReader::GetFrame(int64_t requested_frame)
165{
166 // Create a scoped lock, allowing only a single thread to run the following code at one time
167 const std::lock_guard<std::recursive_mutex> lock(getFrameMutex);
168
169 auto sample_count = Frame::GetSamplesPerFrame(requested_frame, info.fps, info.sample_rate, info.channels);
170
171 if (image)
172 {
173 // Create or get frame object
174 auto image_frame = std::make_shared<Frame>(
175 requested_frame, image->size().width(), image->size().height(),
176 background_color, sample_count, info.channels);
177
178 // Add Image data to frame
179 image_frame->AddImage(image);
180
181 // return frame object
182 return image_frame;
183 } else {
184 // return empty frame
185 auto image_frame = std::make_shared<Frame>(1, 640, 480, background_color, sample_count, info.channels);
186
187 // return frame object
188 return image_frame;
189 }
190}
191
192// Generate JSON string of this object
193std::string QtTextReader::Json() const {

Callers

nothing calls this directly

Calls 1

AddImageMethod · 0.80

Tested by

no test coverage detected