The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.
Rust ffmpegfree-video-editormodel-context-protocolnon-linear-editoroffline-firstopen-source-video-editorself-hostedvideo-editingvideo-editing-automationvideo-editing-softwarevideo-editing-toolsvideo-editorvoice-cloningyoutube-automationyoutube-shorts
fix(ffi): use the platform's real AVERROR(EAGAIN) and unhardcode dev paths
Jareera1439a61fa79
diff --git a/engine/.cargo/config.toml b/engine/.cargo/config.tomlindex 6ddf9d14..38c75ca8 100644--- a/engine/.cargo/config.toml+++ b/engine/.cargo/config.toml@@ -1,17 +1,21 @@-# Where the FFmpeg development build lives.+# Where the FFmpeg development build lives - machine configuration, not+# repository configuration.#-# Only the optional `ffi` feature of relay-media reads these. A normal build --# which talks to FFmpeg as a subprocess - ignores them entirely, so setting-# them here is harmless even on a machine with no `vendor/` directory.+# Only the optional `ffi` feature of relay-media needs FFmpeg headers and+# libraries at build time. A normal build - which talks to FFmpeg as a+# subprocess - needs nothing here. Do not commit machine paths into this+# file: rusty_ffmpeg panics on an FFMPEG_INCLUDE_DIR that does not exist,+# which breaks `--features ffi` for everyone else.#-# `relative = true` resolves against this file's parent, so the paths follow-# the repository rather than whoever checked it out.-[env]-# Note the deliberate absence of FFMPEG_DLL_PATH. rusty_ffmpeg turns that one-# into the linker's /LIBPATH, which sends it hunting for `avcodec.lib` in-# `bin/` - where only the DLLs live. The import libraries are in `lib/`, so-# FFMPEG_LIBS_DIR is the one that matters at link time.+# To build the ffi feature, set the variables in your own environment (or a+# cargo config outside the repository):#-# The DLLs still have to be findable at *run* time.-FFMPEG_INCLUDE_DIR = { value = "../vendor/ffmpeg-n8.1-latest-win64-gpl-shared-8.1/include", relative = true }-FFMPEG_LIBS_DIR = { value = "../vendor/ffmpeg-n8.1-latest-win64-gpl-shared-8.1/lib", relative = true }+# macOS / Linux, package-manager FFmpeg with dev files:+# export FFMPEG_PKG_CONFIG_PATH="$(brew --prefix ffmpeg)/lib/pkgconfig"+#+# Windows, a -shared dev build (gyan.dev / BtbN) unpacked into vendor/:+# FFMPEG_INCLUDE_DIR = <build>/include+# FFMPEG_LIBS_DIR = <build>/lib+# (Deliberately not FFMPEG_DLL_PATH: rusty_ffmpeg turns that into the+# linker's /LIBPATH, which hunts for import libraries in bin/ where only+# the DLLs live. The DLLs still have to be findable at run time.)diff --git a/engine/crates/relay-media/src/ffi.rs b/engine/crates/relay-media/src/ffi.rsindex c282c218..d2060636 100644--- a/engine/crates/relay-media/src/ffi.rs+++ b/engine/crates/relay-media/src/ffi.rs@@ -66,8 +66,25 @@ fn describe(code: i32) -> String {////// Spelled out rather than taken from the bindings because `EAGAIN` comes from/// the C library's `errno.h`, which is not part of the FFmpeg headers and is-/// therefore not always present in generated bindings. 11 on every platform-/// FFmpeg supports.+/// therefore not always present in generated bindings. The value is *not* the+/// same everywhere: 11 on Linux and on Windows FFmpeg builds, 35 on macOS,+/// iOS and the BSDs - discovered the honest way, as "Resource temporarily+/// unavailable" errors from a perfectly healthy decoder.+#[cfg(any(+ target_os = "macos",+ target_os = "ios",+ target_os = "freebsd",+ target_os = "openbsd",+ target_os = "netbsd",+))]+const AVERROR_EAGAIN: i32 = -35;+#[cfg(not(any(+ target_os = "macos",+ target_os = "ios",+ target_os = "freebsd",+ target_os = "openbsd",+ target_os = "netbsd",+)))]const AVERROR_EAGAIN: i32 = -11;/// A decoder that links FFmpeg rather than spawning it.