This commit is contained in:
2026-06-03 14:52:32 +08:00
parent 2181669825
commit a2af4b5bf6
7 changed files with 56 additions and 3 deletions
+1 -1
View File
@@ -104,4 +104,4 @@ AGENTS.md
.codex .codex
operations-log.md operations-log.md
verification.md verification.md
act act
+27
View File
@@ -210,6 +210,33 @@ list(APPEND OLIVE_LIBRARIES
FFMPEG::swresample 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 <libavutil/pixfmt.h>
int main() { AVPixelFormat f = AV_PIX_FMT_GRAYF16; (void)f; return 0; }
" HAVE_AV_PIX_FMT_GRAYF16)
check_cxx_source_compiles("
#include <libavutil/pixfmt.h>
int main() { AVPixelFormat f = AV_PIX_FMT_RGBF16; (void)f; return 0; }
" HAVE_AV_PIX_FMT_RGBF16)
check_cxx_source_compiles("
#include <libavutil/pixfmt.h>
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. # Static FFmpeg (e.g. our Linux CI build) needs system libs for libavcodec/libavformat.
find_package(ZLIB REQUIRED) find_package(ZLIB REQUIRED)
list(APPEND OLIVE_LIBRARIES ZLIB::ZLIB) list(APPEND OLIVE_LIBRARIES ZLIB::ZLIB)
BIN
View File
Binary file not shown.
+8
View File
@@ -170,7 +170,11 @@ AVPixelFormat FFmpegUtils::GetFFmpegPixelFormat(const PixelFormat &pix_fmt,
case PixelFormat::U16: case PixelFormat::U16:
return AV_PIX_FMT_RGB48; return AV_PIX_FMT_RGB48;
case PixelFormat::F16: case PixelFormat::F16:
#ifdef HAVE_AV_PIX_FMT_RGBF16
return AV_PIX_FMT_RGBF16; return AV_PIX_FMT_RGBF16;
#else
return AV_PIX_FMT_RGB48;
#endif
case PixelFormat::F32: case PixelFormat::F32:
return AV_PIX_FMT_RGBF32; return AV_PIX_FMT_RGBF32;
case PixelFormat::INVALID: case PixelFormat::INVALID:
@@ -184,7 +188,11 @@ AVPixelFormat FFmpegUtils::GetFFmpegPixelFormat(const PixelFormat &pix_fmt,
case PixelFormat::U16: case PixelFormat::U16:
return AV_PIX_FMT_RGBA64; return AV_PIX_FMT_RGBA64;
case PixelFormat::F16: case PixelFormat::F16:
#ifdef HAVE_AV_PIX_FMT_RGBAF16
return AV_PIX_FMT_RGBAF16; return AV_PIX_FMT_RGBAF16;
#else
return AV_PIX_FMT_RGBA64;
#endif
case PixelFormat::F32: case PixelFormat::F32:
return AV_PIX_FMT_RGBAF32; return AV_PIX_FMT_RGBAF32;
case PixelFormat::INVALID: case PixelFormat::INVALID:
+8
View File
@@ -93,7 +93,11 @@ static AVPixelFormat GetOfxAVPixelFormat(const OFX::Host::ImageEffect::Image &im
} else if (pixel_format == olive::core::PixelFormat::U16) { } else if (pixel_format == olive::core::PixelFormat::U16) {
pix_fmt = AV_PIX_FMT_GRAY16LE; pix_fmt = AV_PIX_FMT_GRAY16LE;
} else if (pixel_format == olive::core::PixelFormat::F16) { } else if (pixel_format == olive::core::PixelFormat::F16) {
#ifdef HAVE_AV_PIX_FMT_GRAYF16
pix_fmt = 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) { } else if (pixel_format == olive::core::PixelFormat::F32) {
pix_fmt = AV_PIX_FMT_GRAYF32; pix_fmt = AV_PIX_FMT_GRAYF32;
} }
@@ -871,7 +875,11 @@ static AVPixelFormat GetDestinationAVPixelFormat(const olive::VideoParams &param
} else if (params.format() == olive::core::PixelFormat::U16) { } else if (params.format() == olive::core::PixelFormat::U16) {
pix_fmt = AV_PIX_FMT_GRAY16LE; pix_fmt = AV_PIX_FMT_GRAY16LE;
} else if (params.format() == olive::core::PixelFormat::F16) { } else if (params.format() == olive::core::PixelFormat::F16) {
#ifdef HAVE_AV_PIX_FMT_GRAYF16
pix_fmt = 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) { } else if (params.format() == olive::core::PixelFormat::F32) {
pix_fmt = AV_PIX_FMT_GRAYF32; pix_fmt = AV_PIX_FMT_GRAYF32;
} }
+6 -1
View File
@@ -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(); auto *cache = OFX::Host::PluginCache::getPluginCache();
OFX::Host::Plugin *found = nullptr; OFX::Host::Plugin *found = nullptr;
+6 -1
View File
@@ -215,7 +215,12 @@ bool ShouldSkipTest() {
static bool plugins_loaded = false; static bool plugins_loaded = false;
if (!plugins_loaded) { 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; plugins_loaded = true;
} }