110
110
throw ReaderClosed("The Image is closed. Call Open() before calling this method.", path);
112
// Create or get frame object
113
tr1::shared_ptr<Frame> image_frame(new Frame(requested_frame, info.width, info.height, "#000000", Frame::GetSamplesPerFrame(requested_frame, info.fps, info.sample_rate, info.channels), info.channels));
115
// Add Image data to frame
116
image_frame->AddImage(image);
118
// return frame object
112
// Determine if we need to scale the image (for performance reasons)
113
// The timeline passes its size to the clips, which pass their size to the readers, and eventually here
114
// A max_width/max_height = 0 means do not scale (probably because we are scaling the image larger than 100%)
115
if (max_width != 0 && max_height != 0 && max_width < info.width && max_height < info.height)
117
// Scale image smaller (or use a previous scaled image)
119
// Create a scoped lock, allowing only a single thread to run the following code at one time
120
const GenericScopedLock<CriticalSection> lock(getFrameCriticalSection);
122
// We need to resize the original image to a smaller image (for performance reasons)
123
// Only do this once, to prevent tons of unneeded scaling operations
124
cached_image = tr1::shared_ptr<QImage>(new QImage(image->scaled(max_width, max_height, Qt::KeepAspectRatio, Qt::SmoothTransformation)));
125
cached_image = tr1::shared_ptr<QImage>(new QImage(cached_image->convertToFormat(QImage::Format_RGBA8888)));
128
// Create or get frame object
129
tr1::shared_ptr<Frame> image_frame(new Frame(requested_frame, cached_image->width(), cached_image->height(), "#000000", Frame::GetSamplesPerFrame(requested_frame, info.fps, info.sample_rate, info.channels), info.channels));
131
// Add Image data to frame
132
image_frame->AddImage(cached_image);
134
// return frame object
138
// Use original image (higher quality but slower)
139
// Create or get frame object
140
tr1::shared_ptr<Frame> image_frame(new Frame(requested_frame, info.width, info.height, "#000000", Frame::GetSamplesPerFrame(requested_frame, info.fps, info.sample_rate, info.channels), info.channels));
142
// Add Image data to frame
143
image_frame->AddImage(image);
145
// return frame object
122
150
// Generate JSON string of this object