FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust
Export: start/end times without a range mean a custom range
storybored3798776168a637e
diff --git a/crates/engine/src/export_tests.rs b/crates/engine/src/export_tests.rsindex f45566a16..ae02fa763 100644--- a/crates/engine/src/export_tests.rs+++ b/crates/engine/src/export_tests.rs@@ -411,6 +411,9 @@ fn ranges_resolve_and_sidecar_captions_are_written() {assert_eq!(frames(&mut s, json!({"preset": "PNG Sequence"})), io, "In/Out is the default");assert!(s.execute("export.resolve", json!({"range": "workArea"})).is_err(), "no work area");assert_eq!(frames(&mut s, json!({"preset": "Animated GIF 640×360", "range": "custom", "startSeconds": 0, "endSeconds": 2})), 30, "15 fps");+ let bare = frames(&mut s, json!({"preset": "Animated GIF 640×360", "startSeconds": 0, "endSeconds": 2}));+ assert_eq!(bare, 30, "start/end times without `range` are a custom range, not the In/Out or whole sequence");+ assert!(s.execute("export.resolve", json!({"startSeconds": 1})).is_err(), "a start without an end is an error");let res = s.execute("export.resolve", json!({"preset": "YouTube 2160p 4K Ultra HD"})).unwrap();assert_eq!(res["output"]["width"], 3840);assert!(res["summary"]["video"].as_str().unwrap().contains("3840x2160"));diff --git a/crates/engine/src/export_tools.rs b/crates/engine/src/export_tools.rsindex 3ea600395..3269c8e5a 100644--- a/crates/engine/src/export_tools.rs+++ b/crates/engine/src/export_tools.rs@@ -244,12 +244,14 @@ pub fn sequence_param(s: &Session, p: &Value, cmd: &str) -> Result<ItemId> {}/// Export ▸ Range: `entire` | `inOut` | `workArea` | `custom` (`start…` / `end…` times).-/// None = the default (In/Out when set, else the whole sequence).+/// None = the default (In/Out when set, else the whole sequence); bare `start…` / `end…` times+/// without a `range` mean `custom`.pub fn range_param(s: &Session, project: &Project, seq: ItemId, v: Option<&Value>, p: &Value, cmd: &str) -> Result<Option<TimeRange>> {let q = project.sequence(seq).ok_or(EngineError::NoSequence)?;let fd = q.settings.frame_rate.frame_duration();let whole = TimeRange::from_bounds(Tick::ZERO, q.duration().max(fd));let mode = match v {+ None | Some(Value::Null) if time_p(s, p, "start").is_some() || time_p(s, p, "end").is_some() => "custom".to_string(),None | Some(Value::Null) => return Ok(None),Some(Value::String(m)) => m.to_ascii_lowercase().replace(['-', '_', ' ', '/'], ""),Some(o @ Value::Object(_)) => return range_param(s, project, seq, o.get("mode").or(Some(&json!("custom"))), o, cmd),