ff_filter/lib.rs
1//! Video and audio filter graph operations — the Rust way.
2//!
3//! This crate provides a safe, ergonomic API for constructing and running
4//! `FFmpeg` libavfilter filter graphs. All `unsafe` `FFmpeg` internals are
5//! encapsulated in the `filter_inner` module; users never need to write `unsafe` code.
6//!
7//! ## Quick start
8//!
9//! ```ignore
10//! use ff_filter::{FilterGraph, ToneMap};
11//! use std::time::Duration;
12//!
13//! // Build a filter graph: scale to 1280×720, then apply tone mapping.
14//! let mut graph = FilterGraph::builder()
15//! .scale(1280, 720)
16//! .tone_map(ToneMap::Hable)
17//! .build()?;
18//!
19//! // Push decoded VideoFrames in …
20//! graph.push_video(0, &decoded_frame)?;
21//!
22//! // … and pull filtered frames out.
23//! while let Some(frame) = graph.pull_video()? {
24//! // encode or display `frame`
25//! }
26//! ```
27//!
28//! ## Module structure
29//!
30//! - [`graph`] — public types: [`FilterGraph`], [`FilterGraphBuilder`], [`ToneMap`], [`HwAccel`]
31//! - [`error`] — [`FilterError`]
32//! - `filter_inner` — `pub(crate)` unsafe `FFmpeg` calls (not part of the public API)
33
34pub mod error;
35mod filter_inner;
36pub mod graph;
37
38pub use error::FilterError;
39pub use graph::{FilterGraph, FilterGraphBuilder, HwAccel, ToneMap};