Skip to content

EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust

Merge pull request #507 from daijro/perf/footage-playback

Claude9093fd180488
diff --cc crates/render/src/lib.rs
index 3e0770454,324e2a5f7..641f79721
--- a/crates/render/src/lib.rs
+++ b/crates/render/src/lib.rs
@@@ -40,9 -40,15 +40,16 @@@ use rayon::prelude::*
pub trait FootageSource: Send + Sync {
/// The frame of `item` at source time `t`, straight from the file (any size).
fn frame(&self, item: ItemId, footage: &Footage, t: Tick) -> Option<Arc<Image>>;
+ /// [`FootageSource::frame`] for a render that shows it at `width` × `height`, at most half its
+ /// size: either that frame or, when the source can make it more cheaply than the whole frame
+ /// (movies, see `effectcraft-media`), the frame already resampled to that size as
+ /// [`effectcraft_raster::resample`] would.
+ fn frame_at_size(&self, item: ItemId, footage: &Footage, t: Tick, _width: u32, _height: u32) -> Option<Arc<Image>> {
+ self.frame(item, footage, t)
+ }
/// `frames` interleaved stereo sample frames of `item`'s audio from source time `t` at
- /// `rate` Hz (`None` when unavailable).
+ /// `rate` Hz (`None` when unavailable). The first sample is `t.to_units_floor(rate)`;
+ /// a sample boundary uses the earliest representable tick that selects that sample.
fn audio(&self, _item: ItemId, _footage: &Footage, _t: Tick, _frames: usize, _rate: u32) -> Option<Vec<f32>> {
None
}