Migrating tr1 to std, adding C++11 support to build scripts, fixing crash in FFmpegReader (caused by shared_ptr, buffer, and last_video_frame corruption). Much improved stability with this change. Thanks to Craig and Peter for the help!

This commit is contained in:
Jonathan Thomas
2017-08-20 17:37:39 -05:00
parent 564664737a
commit f12ffe692b
84 changed files with 605 additions and 641 deletions

View File

@@ -52,11 +52,11 @@ void QtImageReader::Open() throw(InvalidFile)
if (!is_open)
{
// Attempt to open file
image = tr1::shared_ptr<QImage>(new QImage());
image = std::shared_ptr<QImage>(new QImage());
bool success = image->load(QString::fromStdString(path));
// Set pixel format
image = tr1::shared_ptr<QImage>(new QImage(image->convertToFormat(QImage::Format_RGBA8888)));
image = std::shared_ptr<QImage>(new QImage(image->convertToFormat(QImage::Format_RGBA8888)));
if (!success)
// raise exception
@@ -127,7 +127,7 @@ void QtImageReader::SetMaxSize(int width, int height)
}
// Get an openshot::Frame object for a specific frame number of this reader.
tr1::shared_ptr<Frame> QtImageReader::GetFrame(long int requested_frame) throw(ReaderClosed)
std::shared_ptr<Frame> QtImageReader::GetFrame(long int requested_frame) throw(ReaderClosed)
{
// Check for open reader (or throw exception)
if (!is_open)
@@ -142,12 +142,12 @@ tr1::shared_ptr<Frame> QtImageReader::GetFrame(long int requested_frame) throw(R
// We need to resize the original image to a smaller image (for performance reasons)
// Only do this once, to prevent tons of unneeded scaling operations
cached_image = tr1::shared_ptr<QImage>(new QImage(image->scaled(max_width, max_height, Qt::KeepAspectRatio, Qt::SmoothTransformation)));
cached_image = tr1::shared_ptr<QImage>(new QImage(cached_image->convertToFormat(QImage::Format_RGBA8888)));
cached_image = std::shared_ptr<QImage>(new QImage(image->scaled(max_width, max_height, Qt::KeepAspectRatio, Qt::SmoothTransformation)));
cached_image = std::shared_ptr<QImage>(new QImage(cached_image->convertToFormat(QImage::Format_RGBA8888)));
}
// Create or get frame object
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));
std::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));
// Add Image data to frame
image_frame->AddImage(cached_image);
@@ -158,7 +158,7 @@ tr1::shared_ptr<Frame> QtImageReader::GetFrame(long int requested_frame) throw(R
} else {
// Use original image (higher quality but slower)
// Create or get frame object
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));
std::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));
// Add Image data to frame
image_frame->AddImage(image);