OIIO: added support for OIIO 1.x
OIIO 2.x uses std::unique_ptr while 1.x uses raw pointers. Olive can now handle both, manually destroying the raw pointers when necessary if running on OIIO 1.x.
This commit is contained in:
@@ -139,6 +139,9 @@ void OIIODecoder::Close()
|
||||
{
|
||||
if (image_ != nullptr) {
|
||||
image_->close();
|
||||
#if OIIO_VERSION < 10903
|
||||
OIIO::ImageInput::destroy(image_);
|
||||
#endif
|
||||
image_ = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,11 @@ public:
|
||||
virtual bool SupportsVideo() override;
|
||||
|
||||
private:
|
||||
#if OIIO_VERSION < 10903
|
||||
OIIO::ImageInput* image_;
|
||||
#else
|
||||
std::unique_ptr<OIIO::ImageInput> image_;
|
||||
#endif
|
||||
|
||||
int width_;
|
||||
|
||||
|
||||
@@ -211,6 +211,10 @@ const char *VideoRenderBackend::GetCachedFrame(const rational &time)
|
||||
|
||||
in->close();
|
||||
|
||||
#if OIIO_VERSION < 10903
|
||||
OIIO::ImageInput::destroy(in);
|
||||
#endif
|
||||
|
||||
return cache_frame_load_buffer_.constData();
|
||||
} else {
|
||||
qWarning() << "OIIO Error:" << OIIO::geterror().c_str();
|
||||
|
||||
@@ -226,12 +226,16 @@ void VideoRenderWorker::Download(QVariant texture, QString filename)
|
||||
|
||||
std::string working_fn_std = filename.toStdString();
|
||||
|
||||
std::unique_ptr<OIIO::ImageOutput> out = OIIO::ImageOutput::create(working_fn_std);
|
||||
auto out = OIIO::ImageOutput::create(working_fn_std);
|
||||
|
||||
if (out) {
|
||||
out->open(working_fn_std, spec);
|
||||
out->write_image(format_info.oiio_desc, download_buffer_.data());
|
||||
out->close();
|
||||
|
||||
#if OIIO_VERSION < 10903
|
||||
OIIO::ImageOutput::destroy(out);
|
||||
#endif
|
||||
} else {
|
||||
qWarning() << "Failed to open output file:" << filename;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user