From cef64f42b771cb4161e895e66b7bdbabb91d0903 Mon Sep 17 00:00:00 2001 From: Thomas Wilshaw Date: Wed, 18 Nov 2020 23:22:40 +0000 Subject: [PATCH] Update fix for old OIIO versions. --- app/common/oiioutils.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/common/oiioutils.cpp b/app/common/oiioutils.cpp index f98b435b4..1c3067ccc 100644 --- a/app/common/oiioutils.cpp +++ b/app/common/oiioutils.cpp @@ -19,7 +19,9 @@ ***/ #include "oiioutils.h" - +#if OIIO_VERSION < 20112 +#include "render/videoparams.h" +#endif namespace olive { void OIIOUtils::FrameToBuffer(const Frame* frame, OIIO::ImageBuf *buf) @@ -30,7 +32,7 @@ void OIIOUtils::FrameToBuffer(const Frame* frame, OIIO::ImageBuf *buf) // // See more: https://github.com/OpenImageIO/oiio/pull/2487 // - int width_in_bytes = frame->width() * PixelFormat::BytesPerPixel(frame->format()); + int width_in_bytes = frame->width() * VideoParams::GetBytesPerPixel(frame->format(), frame->channel_count()); for (int i=0;ispec().height;i++) { memcpy( @@ -39,7 +41,7 @@ void OIIOUtils::FrameToBuffer(const Frame* frame, OIIO::ImageBuf *buf) #else reinterpret_cast(buf->localpixels()) + i * buf->scanline_stride(), #endif - frame->data() + i * frame->linesize_bytes(), + frame->const_data() + i * frame->linesize_bytes(), width_in_bytes); } #else @@ -59,7 +61,7 @@ void OIIOUtils::BufferToFrame(OIIO::ImageBuf *buf, Frame* frame) // // See more: https://github.com/OpenImageIO/oiio/pull/2487 // - int width_in_bytes = frame->width() * PixelFormat::BytesPerPixel(frame->format()); + int width_in_bytes = frame->width() * VideoParams::GetBytesPerPixel(frame->format(), frame->channel_count()); for (int i=0;ispec().height;i++) { memcpy(frame->data() + i * frame->linesize_bytes(),