Skip to content

Commit 6050ff7

Browse files
committed
fix: resolve CI failures — add missing output.rs, fix fmt and clippy
- Add previously untracked crates/veac-codegen/src/ffmpeg/output.rs - Fix .gitignore output.* rule to only match root-level output files - Apply cargo fmt across all crates - Fix clippy errors: use .clamp(), rename ambiguous from_str to parse, allow large_enum_variant and too_many_arguments where appropriate
1 parent 4b35be2 commit 6050ff7

47 files changed

Lines changed: 965 additions & 343 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ demo-screen/assets/
3030
demo-mix/
3131

3232
# Rendered output
33-
output.*
33+
/output.*
3434

3535
# IDE
3636
.idea/

crates/veac-cli/src/commands/batch.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/// Batch render: apply CSV variable overrides to a template and render each row.
2-
32
use std::path::Path;
43
use std::process;
54

@@ -24,11 +23,7 @@ pub fn cmd_batch(
2423

2524
// Read CSV: first row is headers (variable names), subsequent rows are values.
2625
let mut reader = csv::Reader::from_path(params)?;
27-
let headers: Vec<String> = reader
28-
.headers()?
29-
.iter()
30-
.map(|h| h.to_string())
31-
.collect();
26+
let headers: Vec<String> = reader.headers()?.iter().map(|h| h.to_string()).collect();
3227

3328
let records: Vec<csv::StringRecord> = reader.records().collect::<Result<_, _>>()?;
3429
let total = records.len();
@@ -76,7 +71,10 @@ pub fn cmd_batch(
7671

7772
// Execute each output
7873
for plan in &plans {
79-
print!("[{row_num}/{total}] Rendering {}...", plan.output_path.display());
74+
print!(
75+
"[{row_num}/{total}] Rendering {}...",
76+
plan.output_path.display()
77+
);
8078
let args = plan.to_args();
8179
let status = process::Command::new("ffmpeg")
8280
.args(&args)

crates/veac-cli/src/commands/build.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ pub fn cmd_build(file: &Path, output: &Path) -> Result<(), Box<dyn std::error::E
2222
let plans = veac_codegen::ffmpeg::generate_all(&ir, output);
2323

2424
for plan in &plans {
25-
println!("Building: {} -> {}", file.display(), plan.output_path.display());
25+
println!(
26+
"Building: {} -> {}",
27+
file.display(),
28+
plan.output_path.display()
29+
);
2630

2731
// Execute FFmpeg
2832
let args = plan.to_args();

crates/veac-cli/src/commands/probe.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ pub fn cmd_probe(file: &Path) -> Result<(), Box<dyn std::error::Error>> {
99

1010
let output = process::Command::new("ffprobe")
1111
.args([
12-
"-v", "quiet",
13-
"-print_format", "json",
12+
"-v",
13+
"quiet",
14+
"-print_format",
15+
"json",
1416
"-show_format",
1517
"-show_streams",
1618
])

crates/veac-cli/src/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ fn main() {
7171
Command::Plan { file } => commands::cmd_plan(&file),
7272
Command::Fmt { file } => commands::cmd_fmt(&file),
7373
Command::Probe { file } => commands::cmd_probe(&file),
74-
Command::Batch { file, params, output } => commands::cmd_batch(&file, &params, &output),
74+
Command::Batch {
75+
file,
76+
params,
77+
output,
78+
} => commands::cmd_batch(&file, &params, &output),
7579
};
7680

7781
if let Err(e) = result {

crates/veac-codegen/src/ffmpeg/clips.rs

Lines changed: 75 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/// Build filter chains for clips with transitions, speed, and effects.
2-
32
use std::collections::HashMap;
43

54
use veac_lang::ir::{IrClip, IrTrackItem, IrTransition};
@@ -32,7 +31,8 @@ pub fn build_clip_filters(
3231
let mut v_labels = vec![v_label.clone()];
3332
let mut a_labels = vec![a_label.clone()];
3433
for _ in 1..count {
35-
let (vl, al) = process_single_clip(clip, input_map, graph, width, height, fps);
34+
let (vl, al) =
35+
process_single_clip(clip, input_map, graph, width, height, fps);
3636
v_labels.push(vl);
3737
a_labels.push(al);
3838
}
@@ -48,7 +48,13 @@ pub fn build_clip_filters(
4848
if let Some(trans) = pending_transition.take() {
4949
if let Some(prev) = segments.last_mut() {
5050
let offset = (cumulative_duration - trans.duration_sec).max(0.0);
51-
prev.0 = graph.add_xfade(&prev.0, &v_label, trans.kind.to_ffmpeg(), trans.duration_sec, offset);
51+
prev.0 = graph.add_xfade(
52+
&prev.0,
53+
&v_label,
54+
trans.kind.to_ffmpeg(),
55+
trans.duration_sec,
56+
offset,
57+
);
5258
prev.1 = graph.add_acrossfade(&prev.1, &a_label, trans.duration_sec);
5359
cumulative_duration += estimate_clip_duration(clip) - trans.duration_sec;
5460
}
@@ -69,7 +75,8 @@ pub fn build_clip_filters(
6975
IrTrackItem::Freeze(freeze) => {
7076
let idx = input_map[&freeze.asset_name];
7177
let v_in = format!("{idx}:v");
72-
let trimmed = graph.add_trim(&v_in, Some(freeze.at_sec), Some(freeze.at_sec + 0.04));
78+
let trimmed =
79+
graph.add_trim(&v_in, Some(freeze.at_sec), Some(freeze.at_sec + 0.04));
7380
let scaled = graph.add_scale(&trimmed, &width.to_string(), &height.to_string());
7481
let v_label = graph.add_tpad(&scaled, freeze.duration_sec);
7582
let a_label = graph.add_silence(freeze.duration_sec);
@@ -121,28 +128,54 @@ fn apply_video_effects(
121128
// Order: crop → rotate → flip → scale → zoompan → speed → eq
122129
// → blur → sharpen → vignette → grain → opacity
123130
// → reverse → chromakey → stabilize
124-
if let Some(ref spec) = clip.crop { v = graph.add_crop(&v, spec); }
125-
if let Some(deg) = clip.rotate { v = graph.add_rotate(&v, deg); }
126-
if let Some(ref mode) = clip.flip { v = graph.add_flip(&v, mode); }
131+
if let Some(ref spec) = clip.crop {
132+
v = graph.add_crop(&v, spec);
133+
}
134+
if let Some(deg) = clip.rotate {
135+
v = graph.add_rotate(&v, deg);
136+
}
137+
if let Some(ref mode) = clip.flip {
138+
v = graph.add_flip(&v, mode);
139+
}
127140

128141
v = graph.add_scale(&v, &width.to_string(), &height.to_string());
129142

130143
if let Some(peak) = clip.zoom {
131144
let dur = estimate_clip_duration_raw(clip);
132145
v = graph.add_zoompan(&v, peak, dur, width, height, fps, clip.pan_x, clip.pan_y);
133146
}
134-
if let Some(spd) = clip.speed { v = graph.add_speed(&v, spd); }
147+
if let Some(spd) = clip.speed {
148+
v = graph.add_speed(&v, spd);
149+
}
135150
if clip.brightness.is_some() || clip.contrast.is_some() || clip.saturation.is_some() {
136151
v = graph.add_eq(&v, clip.brightness, clip.contrast, clip.saturation);
137152
}
138-
if let Some(b) = clip.blur { v = graph.add_blur(&v, b); }
139-
if let Some(s) = clip.sharpen { v = graph.add_sharpen(&v, s); }
140-
if let Some(val) = clip.vignette { v = graph.add_vignette(&v, val); }
141-
if let Some(g) = clip.grain { v = graph.add_grain(&v, g); }
142-
if let Some(o) = clip.opacity { if o < 1.0 { v = graph.add_opacity(&v, o); } }
143-
if clip.reverse == Some(true) { v = graph.add_reverse(&v); }
144-
if let Some(ref color) = clip.chromakey { v = graph.add_chromakey(&v, color); }
145-
if clip.stabilize == Some(true) { v = graph.add_deshake(&v); }
153+
if let Some(b) = clip.blur {
154+
v = graph.add_blur(&v, b);
155+
}
156+
if let Some(s) = clip.sharpen {
157+
v = graph.add_sharpen(&v, s);
158+
}
159+
if let Some(val) = clip.vignette {
160+
v = graph.add_vignette(&v, val);
161+
}
162+
if let Some(g) = clip.grain {
163+
v = graph.add_grain(&v, g);
164+
}
165+
if let Some(o) = clip.opacity {
166+
if o < 1.0 {
167+
v = graph.add_opacity(&v, o);
168+
}
169+
}
170+
if clip.reverse == Some(true) {
171+
v = graph.add_reverse(&v);
172+
}
173+
if let Some(ref color) = clip.chromakey {
174+
v = graph.add_chromakey(&v, color);
175+
}
176+
if clip.stabilize == Some(true) {
177+
v = graph.add_deshake(&v);
178+
}
146179
v
147180
}
148181

@@ -154,25 +187,43 @@ fn apply_audio_chain(clip: &IrClip, idx: usize, graph: &mut FilterGraph) -> Stri
154187
graph.add_silence(estimate_clip_duration(clip))
155188
};
156189

157-
if let Some(vol) = clip.volume { a = graph.add_volume(&a, vol); }
158-
if let Some(spd) = clip.speed { a = graph.add_atempo(&a, spd); }
159-
if let Some(fi) = clip.fade_in_sec { a = graph.add_afade(&a, "in", 0.0, fi); }
190+
if let Some(vol) = clip.volume {
191+
a = graph.add_volume(&a, vol);
192+
}
193+
if let Some(spd) = clip.speed {
194+
a = graph.add_atempo(&a, spd);
195+
}
196+
if let Some(fi) = clip.fade_in_sec {
197+
a = graph.add_afade(&a, "in", 0.0, fi);
198+
}
160199
if let Some(fo) = clip.fade_out_sec {
161200
let start = (estimate_clip_duration(clip) - fo).max(0.0);
162201
a = graph.add_afade(&a, "out", start, fo);
163202
}
164-
if clip.reverse == Some(true) { a = graph.add_areverse(&a); }
165-
if clip.normalize == Some(true) { a = graph.add_loudnorm(&a); }
203+
if clip.reverse == Some(true) {
204+
a = graph.add_areverse(&a);
205+
}
206+
if clip.normalize == Some(true) {
207+
a = graph.add_loudnorm(&a);
208+
}
166209
a
167210
}
168211

169212
fn estimate_clip_duration(clip: &IrClip) -> f64 {
170213
let base = estimate_clip_duration_raw(clip);
171-
if let Some(spd) = clip.speed { base / spd } else { base }
214+
if let Some(spd) = clip.speed {
215+
base / spd
216+
} else {
217+
base
218+
}
172219
}
173220

174221
fn estimate_clip_duration_raw(clip: &IrClip) -> f64 {
175-
if let Some(d) = clip.duration_sec { return d; }
176-
if let (Some(from), Some(to)) = (clip.from_sec, clip.to_sec) { return to - from; }
222+
if let Some(d) = clip.duration_sec {
223+
return d;
224+
}
225+
if let (Some(from), Some(to)) = (clip.from_sec, clip.to_sec) {
226+
return to - from;
227+
}
177228
10.0
178229
}

0 commit comments

Comments
 (0)