ff_filter/animation/mod.rs
1//! Keyframe animation system for time-varying filter parameters.
2//!
3//! The animation system is built in layers:
4//!
5//! 1. [`Lerp`] — trait for component-wise linear interpolation (#351)
6//! 2. [`Easing`] — six easing functions: `Hold`, `Linear`, `EaseIn`, `EaseOut`,
7//! `EaseInOut`, `Bezier` (#352–#357)
8//! 3. [`Keyframe<T>`] — timestamp + value + per-segment easing (#349)
9//! 4. [`AnimationTrack<T>`] — sorted collection with `value_at(t)` (#350)
10//! 5. [`AnimatedValue<T>`] — `Static(T)` or `Track(AnimationTrack<T>)` (#358)
11//! 6. [`AnimationEntry`] — registered animation track for a specific filter parameter (#359)
12
13mod easing;
14mod keyframe;
15mod lerp;
16mod track;
17mod value;
18
19pub use easing::Easing;
20pub use keyframe::Keyframe;
21pub use lerp::Lerp;
22pub use track::AnimationTrack;
23pub use value::AnimatedValue;
24
25/// A registered animation track for a specific filter parameter.
26///
27/// Accumulated in [`crate::FilterGraphBuilder`] and transferred to
28/// [`crate::FilterGraph`] on [`build()`](crate::FilterGraphBuilder::build).
29/// Per-frame `avfilter_graph_send_command` updates are applied during playback
30/// in issue #363.
31#[derive(Debug, Clone)]
32pub struct AnimationEntry {
33 /// `FFmpeg` filter node name, e.g. `"crop_0"` or `"gblur_0"`.
34 pub node_name: String,
35 /// `FFmpeg` `send_command` parameter name, e.g. `"w"`, `"h"`, `"x"`, `"y"`,
36 /// or `"sigma"`.
37 pub param: &'static str,
38 /// The animation track providing the value over time.
39 pub track: AnimationTrack<f64>,
40 /// Optional suffix appended to the formatted value before sending, e.g.
41 /// `"dB"` for the `volume` filter. Use `""` for dimensionless parameters.
42 pub suffix: &'static str,
43}