app: route all FFmpeg access through the ffmpeg_bridge C API
Replace every direct FFmpeg call in the editor and the render worker with the pure C ffmpeg_bridge API, wrapped in thin C++ adapters that preserve the original interfaces: - avframeptr.h: olive::AVFrame adapter around FBFrame handles - ffmpegutils: format conversion helpers on FB_* constants; the int overload is renamed GetCompatibleBridgePixelFormat to avoid a silent overload-resolution trap with the PixelFormat enum - ffmpegdecoder/ffmpegencoder: rewritten as handle-based adapters over FBDecoder/FBProbe/FBEncoder/FBScaler/FBResampler - audioprocessor: FBAudioGraph push/pull adapter - pluginrenderer/OliveClip: sws/pixdesc usage converted to FBScaler and fb_pix_fmt_* queries - AudioParams/channel layouts are plain uint64_t masks everywhere Build integration: the root project no longer links FFMPEG directly; only ffmpeg_bridge does. Binaries resolve the bridge library at runtime via @loader_path inside the macOS app bundle (copied there post-build) and via $ORIGIN/../ffmpeg_bridge/bin on Linux; on Windows the DLL is installed next to the executables, so packages on all three platforms ship the bridge library. ffmpeg_bridge gains the extra API the adapters need: fb_frame_make_writable, fb_decoder_get_format_duration, fb_resampler_convert_frame, FB_PIX_FMT_YUV440P, SRT validation in fb_probe_read_subtitle_stream, packed/planar fixes in fb_encoder_write_audio, and a component-size fix in fb_pix_fmt_component_size.
This commit is contained in:
+4
-61
@@ -203,68 +203,11 @@ list(APPEND OLIVE_LIBRARIES
|
||||
# Link OFX HostSupport wherever libolive-editor objects are used.
|
||||
list(APPEND OLIVE_LIBRARIES OfxHost)
|
||||
|
||||
# Link FFmpeg
|
||||
find_package(FFMPEG 6.0 REQUIRED
|
||||
COMPONENTS
|
||||
avutil
|
||||
avcodec
|
||||
avformat
|
||||
avfilter
|
||||
swscale
|
||||
swresample
|
||||
)
|
||||
list(APPEND OLIVE_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS})
|
||||
list(APPEND OLIVE_LIBRARIES
|
||||
FFMPEG::avutil
|
||||
FFMPEG::avcodec
|
||||
FFMPEG::avformat
|
||||
FFMPEG::avfilter
|
||||
FFMPEG::swscale
|
||||
FFMPEG::swresample
|
||||
)
|
||||
|
||||
# FFmpeg isolation: all FFmpeg access is being moved behind this shared
|
||||
# library's pure C API. Built early so the app can link it.
|
||||
# FFmpeg isolation: all FFmpeg access in the editor goes through this shared
|
||||
# library's pure C API. It is the only component that links FFmpeg.
|
||||
add_subdirectory(ffmpeg_bridge)
|
||||
|
||||
# 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.
|
||||
find_package(ZLIB REQUIRED)
|
||||
list(APPEND OLIVE_LIBRARIES ZLIB::ZLIB)
|
||||
|
||||
find_package(BZip2 REQUIRED)
|
||||
list(APPEND OLIVE_LIBRARIES BZip2::BZip2)
|
||||
|
||||
find_package(LibLZMA)
|
||||
if (LIBLZMA_FOUND)
|
||||
list(APPEND OLIVE_LIBRARIES ${LIBLZMA_LIBRARIES})
|
||||
endif()
|
||||
list(APPEND OLIVE_LIBRARIES ffmpeg_bridge)
|
||||
list(APPEND OLIVE_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg_bridge/include)
|
||||
|
||||
# Link PortAudio
|
||||
find_package(PortAudio REQUIRED)
|
||||
|
||||
Reference in New Issue
Block a user