You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Removed Cache::Exists method, which created all sorts of havoc when being called in quick succession (basically a frame might exist a split second before calling Cache::GetFrame, but then be missing when GetFrame is called).
Next Syntax: frame = Cache::GetFrame(...) if frame: .... Also, fixed some issues with MP3 files having the wrong video length detected, and a few other minor issues.
This commit is contained in:
@@ -407,6 +407,11 @@ int64 Frame::GetBytes()
|
||||
// Get pixel data (as packets)
|
||||
const unsigned char* Frame::GetPixels()
|
||||
{
|
||||
// Check for blank image
|
||||
if (!image)
|
||||
// Fill with black
|
||||
AddColor(width, height, "#000000");
|
||||
|
||||
// Return array of pixel packets
|
||||
return image->bits();
|
||||
}
|
||||
@@ -728,30 +733,33 @@ void Frame::AddImage(tr1::shared_ptr<QImage> new_image, bool only_odd_lines)
|
||||
return;
|
||||
|
||||
// Check for blank source image
|
||||
if (!image)
|
||||
if (!image) {
|
||||
// Replace the blank source image
|
||||
AddImage(new_image);
|
||||
|
||||
// Ignore image of different sizes or formats
|
||||
if (image == new_image || image->size() != image->size() || image->format() != image->format())
|
||||
return;
|
||||
} else {
|
||||
|
||||
// Get the frame's image
|
||||
const unsigned char* pixels = image->bits();
|
||||
const unsigned char* new_pixels = new_image->bits();
|
||||
// Ignore image of different sizes or formats
|
||||
if (image == new_image || image->size() != image->size() || image->format() != image->format())
|
||||
return;
|
||||
|
||||
// Loop through the scanlines of the image (even or odd)
|
||||
int start = 0;
|
||||
if (only_odd_lines)
|
||||
start = 1;
|
||||
for (int row = start; row < image->height(); row += 2) {
|
||||
memcpy((unsigned char*)pixels, new_pixels + (row * image->bytesPerLine()), image->bytesPerLine());
|
||||
new_pixels += image->bytesPerLine();
|
||||
// Get the frame's image
|
||||
const unsigned char *pixels = image->bits();
|
||||
const unsigned char *new_pixels = new_image->bits();
|
||||
|
||||
// Loop through the scanlines of the image (even or odd)
|
||||
int start = 0;
|
||||
if (only_odd_lines)
|
||||
start = 1;
|
||||
for (int row = start; row < image->height(); row += 2) {
|
||||
memcpy((unsigned char *) pixels, new_pixels + (row * image->bytesPerLine()), image->bytesPerLine());
|
||||
new_pixels += image->bytesPerLine();
|
||||
}
|
||||
|
||||
// Update height and width
|
||||
width = image->width();
|
||||
height = image->height();
|
||||
}
|
||||
|
||||
// Update height and width
|
||||
width = image->width();
|
||||
height = image->height();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user