build(ffmpeg): make ffmpeg-next an unconditional dependency
Some checks failed
ci / fmt + clippy + test (push) Has been cancelled
Some checks failed
ci / fmt + clippy + test (push) Has been cancelled
The decoder is intrinsic to what beat does, so gating it behind an off-by-default feature produced a green build that excluded the core capability — a false signal. Remove the `ffmpeg` feature from beat-data and beat-cli, drop the cfg gates on the decode module and the no-ffmpeg process_one fallback, and revert the readme build note. Building and testing now require the FFmpeg dev libraries, as they should. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,11 +10,6 @@ authors.workspace = true
|
||||
name = "beat"
|
||||
path = "src/main.rs"
|
||||
|
||||
[features]
|
||||
# Enables the ffmpeg-next decoder in beat-data. Required to process real videos;
|
||||
# left off by default so the workspace builds without the FFmpeg dev libraries.
|
||||
ffmpeg = ["beat-data/ffmpeg"]
|
||||
|
||||
[dependencies]
|
||||
beat-entities = { workspace = true }
|
||||
beat-core = { workspace = true }
|
||||
|
||||
@@ -19,7 +19,6 @@ pub fn file_key(path: &Path) -> Result<FileKey> {
|
||||
}
|
||||
|
||||
/// Decode a video and run the full pipeline into a [`VideoResult`].
|
||||
#[cfg(feature = "ffmpeg")]
|
||||
async fn decode_and_process<L: LlmClient + Sync>(
|
||||
path: &Path,
|
||||
config: &Config,
|
||||
@@ -47,15 +46,6 @@ async fn decode_and_process<L: LlmClient + Sync>(
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "ffmpeg"))]
|
||||
async fn decode_and_process<L: LlmClient + Sync>(
|
||||
_path: &Path,
|
||||
_config: &Config,
|
||||
_llm: &L,
|
||||
) -> anyhow::Result<VideoResult> {
|
||||
anyhow::bail!("beat was built without the `ffmpeg` feature; rebuild with --features ffmpeg")
|
||||
}
|
||||
|
||||
/// Process one video file end-to-end: claim → decode → describe → summarise →
|
||||
/// write → record. Returns `true` if processed, `false` if skipped (already
|
||||
/// done / in progress and `force` is not set).
|
||||
|
||||
@@ -6,17 +6,6 @@ rust-version.workspace = true
|
||||
license.workspace = true
|
||||
authors.workspace = true
|
||||
|
||||
[features]
|
||||
# The ffmpeg-next decoder is OFF by default so the rest of the workspace builds
|
||||
# and tests without the FFmpeg development libraries installed. CI (which
|
||||
# installs the libs) builds with `--all-features`; production builds and
|
||||
# `beat run` against real videos use `--features ffmpeg` (forwarded from
|
||||
# beat-cli's `ffmpeg` feature).
|
||||
default = []
|
||||
ffmpeg = ["dep:ffmpeg-next"]
|
||||
# Placeholder for the future ONNX/YOLO object-detection signal.
|
||||
object-detection = []
|
||||
|
||||
[dependencies]
|
||||
beat-entities = { workspace = true }
|
||||
beat-core = { workspace = true }
|
||||
@@ -35,7 +24,7 @@ notify = { workspace = true }
|
||||
redb = { workspace = true }
|
||||
walkdir = { workspace = true }
|
||||
tempfile = { workspace = true }
|
||||
ffmpeg-next = { workspace = true, optional = true }
|
||||
ffmpeg-next = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
wiremock = { workspace = true }
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
//! I/O implementations: ffmpeg decoding, LLM HTTP client, filesystem watcher,
|
||||
//! processed-file ledger, and sidecar writers.
|
||||
|
||||
#[cfg(feature = "ffmpeg")]
|
||||
pub mod decode;
|
||||
pub mod ledger;
|
||||
pub mod llm;
|
||||
pub mod output;
|
||||
pub mod watcher;
|
||||
|
||||
#[cfg(feature = "ffmpeg")]
|
||||
pub use decode::{FfmpegAudioSource, FfmpegFrameSource};
|
||||
pub use ledger::RedbLedger;
|
||||
pub use llm::HttpLlmClient;
|
||||
|
||||
@@ -121,13 +121,7 @@ beat --config ./beat.toml run /path/to/video.mkv
|
||||
## Building
|
||||
|
||||
```sh
|
||||
cargo build --release --features ffmpeg
|
||||
```
|
||||
|
||||
The `ffmpeg` feature (off by default) compiles the in-process `ffmpeg-next` decoder. It is gated so the rest of the workspace — and its tests — build without the FFmpeg development libraries installed; CI builds with `--all-features`. A binary built without the feature runs but refuses to process videos, prompting a rebuild with `--features ffmpeg`. To build and test the non-decoder crates without FFmpeg:
|
||||
|
||||
```sh
|
||||
cargo test # workspace tests, no FFmpeg libs required
|
||||
cargo build --release
|
||||
```
|
||||
|
||||
`beat` links against the FFmpeg shared libraries (libavcodec, libavformat, libavutil, libswscale) through `ffmpeg-next`. These must be present at build and run time. On Fedora:
|
||||
|
||||
@@ -76,8 +76,8 @@ resolve_secret() {
|
||||
}
|
||||
|
||||
# --- Build once for this commit ---
|
||||
info "building beat (release, ffmpeg feature)"
|
||||
run cargo build --release --manifest-path "${REPO_ROOT}/Cargo.toml" -p beat-cli --features ffmpeg
|
||||
info "building beat (release)"
|
||||
run cargo build --release --manifest-path "${REPO_ROOT}/Cargo.toml" -p beat-cli
|
||||
readonly BINARY="${REPO_ROOT}/target/release/beat"
|
||||
|
||||
deploy_worker() {
|
||||
|
||||
Reference in New Issue
Block a user