diff --git a/.gitignore b/.gitignore index 7c61fcff1..7b8ac41c9 100644 --- a/.gitignore +++ b/.gitignore @@ -104,4 +104,4 @@ AGENTS.md .codex operations-log.md verification.md -act \ No newline at end of file +act diff --git a/CMakeLists.txt b/CMakeLists.txt index 4de9d9b9a..5712a3cd6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -210,6 +210,33 @@ list(APPEND OLIVE_LIBRARIES FFMPEG::swresample ) +# Detect FFmpeg pixel formats that may not exist in all versions +include(CheckCXXSourceCompiles) +set(CMAKE_REQUIRED_INCLUDES ${FFMPEG_INCLUDE_DIRS}) +check_cxx_source_compiles(" +#include +int main() { AVPixelFormat f = AV_PIX_FMT_GRAYF16; (void)f; return 0; } +" HAVE_AV_PIX_FMT_GRAYF16) +check_cxx_source_compiles(" +#include +int main() { AVPixelFormat f = AV_PIX_FMT_RGBF16; (void)f; return 0; } +" HAVE_AV_PIX_FMT_RGBF16) +check_cxx_source_compiles(" +#include +int main() { AVPixelFormat f = AV_PIX_FMT_RGBAF16; (void)f; return 0; } +" HAVE_AV_PIX_FMT_RGBAF16) +unset(CMAKE_REQUIRED_INCLUDES) + +if(HAVE_AV_PIX_FMT_GRAYF16) + add_compile_definitions(HAVE_AV_PIX_FMT_GRAYF16) +endif() +if(HAVE_AV_PIX_FMT_RGBF16) + add_compile_definitions(HAVE_AV_PIX_FMT_RGBF16) +endif() +if(HAVE_AV_PIX_FMT_RGBAF16) + add_compile_definitions(HAVE_AV_PIX_FMT_RGBAF16) +endif() + # Static FFmpeg (e.g. our Linux CI build) needs system libs for libavcodec/libavformat. find_package(ZLIB REQUIRED) list(APPEND OLIVE_LIBRARIES ZLIB::ZLIB) diff --git a/act b/act deleted file mode 100755 index d23696743..000000000 Binary files a/act and /dev/null differ diff --git a/app/common/ffmpegutils.cpp b/app/common/ffmpegutils.cpp index c693ee712..cd6427896 100644 --- a/app/common/ffmpegutils.cpp +++ b/app/common/ffmpegutils.cpp @@ -170,7 +170,11 @@ AVPixelFormat FFmpegUtils::GetFFmpegPixelFormat(const PixelFormat &pix_fmt, case PixelFormat::U16: return AV_PIX_FMT_RGB48; case PixelFormat::F16: +#ifdef HAVE_AV_PIX_FMT_RGBF16 return AV_PIX_FMT_RGBF16; +#else + return AV_PIX_FMT_RGB48; +#endif case PixelFormat::F32: return AV_PIX_FMT_RGBF32; case PixelFormat::INVALID: @@ -184,7 +188,11 @@ AVPixelFormat FFmpegUtils::GetFFmpegPixelFormat(const PixelFormat &pix_fmt, case PixelFormat::U16: return AV_PIX_FMT_RGBA64; case PixelFormat::F16: +#ifdef HAVE_AV_PIX_FMT_RGBAF16 return AV_PIX_FMT_RGBAF16; +#else + return AV_PIX_FMT_RGBA64; +#endif case PixelFormat::F32: return AV_PIX_FMT_RGBAF32; case PixelFormat::INVALID: diff --git a/app/render/plugin/pluginrenderer.cpp b/app/render/plugin/pluginrenderer.cpp index 5994317b9..311666ba7 100644 --- a/app/render/plugin/pluginrenderer.cpp +++ b/app/render/plugin/pluginrenderer.cpp @@ -93,7 +93,11 @@ static AVPixelFormat GetOfxAVPixelFormat(const OFX::Host::ImageEffect::Image &im } else if (pixel_format == olive::core::PixelFormat::U16) { pix_fmt = AV_PIX_FMT_GRAY16LE; } else if (pixel_format == olive::core::PixelFormat::F16) { +#ifdef HAVE_AV_PIX_FMT_GRAYF16 pix_fmt = AV_PIX_FMT_GRAYF16; +#else + pix_fmt = AV_PIX_FMT_GRAY16LE; +#endif } else if (pixel_format == olive::core::PixelFormat::F32) { pix_fmt = AV_PIX_FMT_GRAYF32; } @@ -871,7 +875,11 @@ static AVPixelFormat GetDestinationAVPixelFormat(const olive::VideoParams ¶m } else if (params.format() == olive::core::PixelFormat::U16) { pix_fmt = AV_PIX_FMT_GRAY16LE; } else if (params.format() == olive::core::PixelFormat::F16) { +#ifdef HAVE_AV_PIX_FMT_GRAYF16 pix_fmt = AV_PIX_FMT_GRAYF16; +#else + pix_fmt = AV_PIX_FMT_GRAY16LE; +#endif } else if (params.format() == olive::core::PixelFormat::F32) { pix_fmt = AV_PIX_FMT_GRAYF32; } diff --git a/tests/gtest/plugin_ofx_integration_test.cpp b/tests/gtest/plugin_ofx_integration_test.cpp index 5585de241..9951225f1 100644 --- a/tests/gtest/plugin_ofx_integration_test.cpp +++ b/tests/gtest/plugin_ofx_integration_test.cpp @@ -65,7 +65,12 @@ TEST(PluginIntegration, ChromaKeyerCreateAndRender) } } - olive::plugin::loadPlugins(QString::fromUtf8(path)); + QString raw = QString::fromUtf8(path); + const QChar separator = QDir::listSeparator(); + const QStringList paths = raw.split(separator, Qt::SkipEmptyParts); + for (const QString &p : paths) { + olive::plugin::loadPlugins(p); + } auto *cache = OFX::Host::PluginCache::getPluginCache(); OFX::Host::Plugin *found = nullptr; diff --git a/tests/gtest/plugin_ofx_misc_test.cpp b/tests/gtest/plugin_ofx_misc_test.cpp index c08ae5e1c..89741e4fa 100644 --- a/tests/gtest/plugin_ofx_misc_test.cpp +++ b/tests/gtest/plugin_ofx_misc_test.cpp @@ -215,7 +215,12 @@ bool ShouldSkipTest() { static bool plugins_loaded = false; if (!plugins_loaded) { - loadPlugins(QString::fromUtf8(path)); + QString raw = QString::fromUtf8(path); + const QChar separator = QDir::listSeparator(); + const QStringList paths = raw.split(separator, Qt::SkipEmptyParts); + for (const QString &p : paths) { + loadPlugins(p); + } plugins_loaded = true; }