forge
Explore
Log in

Don't you dare go Hollow

✨ MCP reads back pan, pitch, deinterlace, lane pan, speed-ramp and gain keys, and saved looks

Browse files at this commit

b3755d579f85c61d12f2eec950903d188f7d6b49Ahmet Kaan GümüşParent: b0e72a4
MCP.mdmodified+8 -2
@@ -224,7 +224,7 @@ in **bold**; optional ones follow the name.
224224 | `project_collect` | folder | copies every file the project plays into `folder` (default `<project stem>_media` beside the project file, made if missing) and points the project at the copies; one undo step, unsaved until `project_save`. Skips generated sources, names and skips missing files, leaves sources already in the folder, renames clashes to `name-2.ext`, reuses identical bytes already there. A failed copy changes nothing. The window's File > Collect media does the same, with progress and cancel |
225225 | `project_export_timeline` | format, path? | writes the active sequence for another editor: `otio` (OpenTimelineIO: tracks, clips with absolute file paths, gaps, transitions, markers), `fcpxml` (Final Cut Pro XML 1.10, read by Final Cut Pro, Resolve and Premiere) or `edl` (CMX3600: V1 and audio on A1/A2, dissolves as `D`, `FROM CLIP NAME` comments). Default path: beside the project file. Subtitles are left out and the reply says so. Only the file is written; the project does not change. The window's File > Export timeline as does the same into the default export folder |
226226 | `project_import_timeline` | path | reads an `.otio` file as a new sequence of the project and makes it the active one; each clip is relinked by its path, and a missing file becomes an offline clip. One undo step, unsaved until `project_save`. The window takes the same file from File > Import timeline (OTIO) or from the command line |
227-| `project_status` | — | path, saved or dirty, canvas size, fps, duration, lanes with clip counts, sources, undo and redo depth, running exports, settings (and the notes, when there are any); an `OFFLINE: src:N <path>` line per offline source, and the fixes an open made to load (dirty until saved) |
227+| `project_status` | — | path, saved or dirty, canvas size, fps, duration, lanes with clip counts, sources, the colour looks (a `looks:` line naming the built-in looks and the saved ones, the names the `look` op takes; `structuredContent` has them as `looks.builtin` and `looks.saved`), undo and redo depth, running exports, settings (and the notes, when there are any); an `OFFLINE: src:N <path>` line per offline source, and the fixes an open made to load (dirty until saved) |
228228 | `project_settings` | resolution, fps, tonemap, notes, still_secs, proxies, auto_proxies, encoder, limiter, captions | the `ProjectSettings` knobs. An fps change keeps clips, captions and titles at the same seconds; their frame numbers and addresses change. `notes` is free text (several lines; `""` clears it), saved with the project as format v52; `still_secs` is how long a still is placed for, 0.5 to 600 s, 5 s by default, and only stills placed after the change take it. Both are one undo step each |
229229 | `templates` | (none) | lists the project templates: the built-ins (YouTube 1080p 30, Vertical 1080×1920 30, Square 1080 30) and the ones saved from the window with File > Save as template, each marked built-in or saved and whether it keeps clips |
230230 | `checkpoint` | **name** | save the whole project under a name (letters, digits, `-`, `_`), as a copy in `<project dir>/checkpoints/<stem>/` (the project's path, from `project_new {path}` or `project_save`; with no path at all, the temp dir, lost on reboot) |
@@ -251,7 +251,7 @@ when decoded. A wider file onto a mono timeline is refused.
251251 | tool | args | does |
252252 |---|---|---|
253253 | `timeline` | detail (brief\|full), lanes, range, page | the timeline as text (brief lists at most 40 clips per lane, within about 4 KB of text, and says how many more there are; `page` pages one lane 40 clips at a time), one line per clip with its address, span, source, source span (`src 3.0s–15.4s`, the part of the file it plays) and effect flags |
254-| `clip_info` | **clip** | everything about one clip: lane, span, source range, speed, fades, transition (kind and length), fit, visualizer, EQ bands, colour, transform, group members, and how far each edge can trim; with `at` (a time inside the clip) also match frame: the source (src:N, file) and source time shown there |
254+| `clip_info` | **clip** | everything about one clip: lane, span, source range, speed (a speed ramp lists every key as `at clip 1.000s speed 1.5x`, in clip time, the time the speed_ramp op's `at` takes), gain and its volume envelope (text shows the first 12 gain keys and `(+N more)`; `structuredContent` carries every key as `gain_keys`), pan, pitch and deinterlace (text shows each only when set; JSON always), fades, transition (kind and length), fit, visualizer, EQ bands, colour, transform, group members, and how far each edge can trim; with `at` (a time inside the clip) also match frame: the source (src:N, file) and source time shown there |
255255 | `captions` | lane, range, page | cues on caption lanes, in timeline time, one line per cue, 40 to a page. `range` is `{from, to}`: from inclusive, to exclusive, seconds exact (a cue starting at `to` is not listed) |
256256
257257 `timeline` example (illustrative; real output has the same shape):
@@ -274,6 +274,12 @@ the file the clip plays. The clip's in and out frames are stored at the timeline
274274 rate, so the seconds are `in / fps` and `out / fps`. `clip_info` gives the same span
275275 with timecodes and the source's own frame count.
276276
277+Readbacks for the audio and picture settings: a lane's header shows its pan
278+(`pan -0.3`) next to its gain, and its JSON has `pan`. An audio clip's row shows
279+`pan` and `pitch +3` and a video clip's row shows `deinterlace field`; brief rows
280+show them only when they are off their defaults, and `detail: full` rows always
281+show them (pan 0, pitch +0, deinterlace frame included), as does the full JSON.
282+
277283 ### 4.4 See and hear
278284
279285 | tool | args | does |
crates/mcp/src/tools/look.rsmodified+133 -8
@@ -34,12 +34,13 @@ const TIME_DOC: &str = "A time: 450f (frames), 15.0s or 15 (seconds), 01:02.500
3434
3535 const TIMELINE_DOC: &str = "The timeline as text: one block per lane, one line per clip with its \
3636 address (LANE@START), timeline span, source file and in/out frames, and any effect flags. \
37-Also lists lane gain and mute/hide/lock state, and the gap count per media lane. \
37+Also lists lane gain and pan, mute/hide/lock state, and the gap count per media lane. \
3838 Use range to read a stretch, and clip_info for everything about one clip.";
3939
4040 const CLIP_INFO_DOC: &str = "Everything about one clip: its lane and address, timeline span, source \
41-file and in/out frames, speed, fades, dissolve, fit, visualizer, EQ bands, colour, transform, \
42-link-group members, and how far each edge can be trimmed. With `at` (a timeline time inside the clip) it also answers match frame: the source file, its src:N number and the source time shown on that frame.";
41+file and in/out frames, speed (a speed ramp lists every key, in clip time), reverse, gain and its \
42+volume envelope (every gain key), pan, pitch, deinterlace, fades, dissolve, fit, visualizer, EQ bands, \
43+colour, transform, link-group members, and how far each edge can be trimmed. With `at` (a timeline time inside the clip) it also answers match frame: the source file, its src:N number and the source time shown on that frame.";
4344
4445 pub fn tools() -> Vec<Tool> {
4546 vec![
@@ -88,7 +89,7 @@ fn timeline_schema() -> Value {
8889 "detail": {
8990 "type": "string",
9091 "enum": ["brief", "full"],
91- "description": "brief (default) caps the text at about 4 KB, shared out equally among the lanes that have clips: each lane lists as many clips as its share holds, never more than 40 (a lane of few clips lists them all), and says how many clips were cut from it (use range, or lanes [one lane] with page, to see them). full lists every clip. structuredContent follows it: brief gives each clip's address, span, link and track; full gives every field (source, in/out, effects) as clip_info does."
92+ "description": "brief (default) caps the text at about 4 KB, shared out equally among the lanes that have clips: each lane lists as many clips as its share holds, never more than 40 (a lane of few clips lists them all), and says how many clips were cut from it (use range, or lanes [one lane] with page, to see them). full lists every clip, with its pan, pitch and deinterlace even at their defaults. brief shows those three only when they are set. structuredContent follows it: brief gives each clip's address, span, link and track; full gives every field (source, in/out, effects, pan, pitch, deinterlace) as clip_info does."
9293 },
9394 "page": {
9495 "type": "integer",
@@ -134,6 +135,8 @@ struct LaneView {
134135 /// The name the user gave the lane, if any.
135136 name: Option<String>,
136137 gain_db: f32,
138+ /// The lane's pan, `-1.0..=1.0`; 0 for the middle and for a lane with no sound.
139+ pan: f32,
137140 hidden: bool,
138141 muted: bool,
139142 locked: bool,
@@ -189,6 +192,9 @@ impl LaneView {
189192 if self.gain_db != 0.0 {
190193 f.push(format!("gain {}dB", num(f64::from(self.gain_db))));
191194 }
195+ if self.pan != 0.0 {
196+ f.push(format!("pan {}", num(f64::from(self.pan))));
197+ }
192198 for d in &self.ducks {
193199 f.push(duck_text(d));
194200 }
@@ -248,7 +254,7 @@ fn timeline(server: &mut Server, args: &Value) -> Reply {
248254 Some(w) => known.iter().copied().filter(|l| w.contains(l)).collect(),
249255 };
250256
251- let mut views: Vec<LaneView> = shown.iter().map(|&l| lane_view(s, l, fps, range)).collect();
257+ let mut views: Vec<LaneView> = shown.iter().map(|&l| lane_view(s, l, fps, range, full)).collect();
252258 if let (Some(number), [view]) = (page, views.as_mut_slice()) {
253259 let lp = LanePage::of(number, view.rows.len());
254260 if number > lp.pages {
@@ -334,6 +340,7 @@ fn timeline(server: &mut Server, args: &Value) -> Reply {
334340 "lane": parse::lane_name(v.lane),
335341 "name": v.name,
336342 "gain_db": v.gain_db,
343+ "pan": v.pan,
337344 "hidden": v.hidden,
338345 "muted": v.muted,
339346 "locked": v.locked,
@@ -564,15 +571,16 @@ fn lanes_arg(args: &Value, known: &[Lane]) -> Result<Option<Vec<Lane>>, Reply> {
564571 Ok(Some(wanted))
565572 }
566573
567-fn lane_view(s: &PlaybackSession, lane: Lane, fps: f64, range: Option<(u32, u32)>) -> LaneView {
574+fn lane_view(s: &PlaybackSession, lane: Lane, fps: f64, range: Option<(u32, u32)>, full: bool) -> LaneView {
568575 let rows = match lane.kind {
569576 LaneKind::Subtitle => sub_rows(s, lane, fps, range),
570- _ => media_rows(s, lane, fps, range),
577+ _ => media_rows(s, lane, fps, range, full),
571578 };
572579 LaneView {
573580 lane,
574581 name: s.lane_name(lane).map(str::to_string),
575582 gain_db: s.lane_gain_db(lane),
583+ pan: s.lane_pan(lane),
576584 hidden: s.lane_hidden(lane),
577585 muted: s.lane_muted(lane),
578586 locked: s.lane_locked(lane),
@@ -617,7 +625,7 @@ fn duck_json(d: Option<&Duck>) -> Value {
617625 })
618626 }
619627
620-fn media_rows(s: &PlaybackSession, lane: Lane, fps: f64, range: Option<(u32, u32)>) -> Vec<Row> {
628+fn media_rows(s: &PlaybackSession, lane: Lane, fps: f64, range: Option<(u32, u32)>, full: bool) -> Vec<Row> {
621629 let mut rows = Vec::new();
622630 // Sources whose file is not on disk: a clip on one is marked, since its picture or sound is missing.
623631 let offline: Vec<usize> = s.offline_sources().iter().map(|(i, _)| *i).collect();
@@ -663,6 +671,22 @@ fn media_rows(s: &PlaybackSession, lane: Lane, fps: f64, range: Option<(u32, u32
663671 if keys > 0 {
664672 body.push_str(&format!(" keys {keys}"));
665673 }
674+ // Pan and pitch belong to audio clips, deinterlace to video clips. Full detail shows them
675+ // always; brief shows only the ones set off their default.
676+ let (pan, pitch, deint) = (
677+ s.clip_pan_of(lane, idx).unwrap_or(0.0),
678+ s.clip_pitch_of(lane, idx).unwrap_or(0),
679+ s.deinterlace_of(lane, idx),
680+ );
681+ if lane.kind == LaneKind::Audio && (full || pan != 0.0) {
682+ body.push_str(&format!(" pan {}", num(f64::from(pan))));
683+ }
684+ if lane.kind == LaneKind::Audio && (full || pitch != 0) {
685+ body.push_str(&format!(" pitch {pitch:+}"));
686+ }
687+ if lane.kind == LaneKind::Video && (full || deint != engine::project::Deinterlace::Frame) {
688+ body.push_str(&format!(" deinterlace {}", deint.name()));
689+ }
666690 let (okeys, ckeys) = (s.opacity_keys_of(lane, idx).len(), s.color_keys_of(lane, idx).len());
667691 if okeys > 0 {
668692 body.push_str(&format!(" opacity keys {okeys}"));
@@ -706,6 +730,9 @@ fn media_rows(s: &PlaybackSession, lane: Lane, fps: f64, range: Option<(u32, u32
706730 "opacity_keys": okeys,
707731 "color_keys": ckeys,
708732 "env": !c.gain_keys.is_empty(),
733+ "pan": pan,
734+ "pitch": pitch,
735+ "deinterlace": deint.name(),
709736 "visualizer": c.visualizer != 0,
710737 });
711738 rows.push(Row {
@@ -832,6 +859,7 @@ impl LaneView {
832859 lane,
833860 name: None,
834861 gain_db: 0.0,
862+ pan: 0.0,
835863 hidden: false,
836864 muted: false,
837865 locked: false,
@@ -1002,6 +1030,41 @@ fn effect_keys_json(c: &Clip, fps: f64, effects: &[Effect]) -> Value {
10021030 )
10031031 }
10041032
1033+/// A speed ramp's keys, one line each: the clip-relative time they sit at, which is the time the
1034+/// speed_ramp op's `at` takes, and the speed there.
1035+fn speed_key_lines(fps: f64, keys: &[engine::project::SpeedKey]) -> Vec<String> {
1036+ keys.iter()
1037+ .map(|k| format!(" at clip {:.3}s speed {}x", f64::from(k.at) / fps, num(k.speed.as_f64())))
1038+ .collect()
1039+}
1040+
1041+/// The speed ramp as JSON, every key: its clip-relative time in seconds and its speed.
1042+fn speed_keys_json(fps: f64, keys: &[engine::project::SpeedKey]) -> Value {
1043+ Value::Array(
1044+ keys.iter()
1045+ .map(|k| json!({"clip_time": f64::from(k.at) / fps, "speed": k.speed.as_f64()}))
1046+ .collect(),
1047+ )
1048+}
1049+
1050+/// The volume envelope as JSON, every point (the text cuts it short): its timeline time, its
1051+/// source frame, its dB and the ease that leaves it.
1052+fn gain_keys_json(c: &Clip, fps: f64) -> Value {
1053+ Value::Array(
1054+ c.gain_keys
1055+ .iter()
1056+ .map(|k| {
1057+ json!({
1058+ "time": timeline_of(c, k.at) / fps,
1059+ "source_frame": k.at,
1060+ "db": k.db,
1061+ "ease": k.ease.name(),
1062+ })
1063+ })
1064+ .collect(),
1065+ )
1066+}
1067+
10051068 fn opacity_keys_json(c: &Clip, fps: f64, keys: &[OpacityKey]) -> Value {
10061069 Value::Array(
10071070 keys.iter()
@@ -1322,6 +1385,30 @@ fn media_info(s: &PlaybackSession, lane: Lane, idx: usize, fps: f64) -> Reply {
13221385 if c.gain_db != 0.0 {
13231386 lines.push(format!("gain {}dB", num(f64::from(c.gain_db))));
13241387 }
1388+ // Pan, pitch and deinterlace, each shown only when it is off its default.
1389+ let (pan, pitch, deint) = (
1390+ s.clip_pan_of(lane, idx).unwrap_or(0.0),
1391+ s.clip_pitch_of(lane, idx).unwrap_or(0),
1392+ s.deinterlace_of(lane, idx),
1393+ );
1394+ let mut tweaks = Vec::new();
1395+ if pan != 0.0 {
1396+ tweaks.push(format!("pan {}", num(f64::from(pan))));
1397+ }
1398+ if pitch != 0 {
1399+ tweaks.push(format!("pitch {pitch:+} semitones"));
1400+ }
1401+ if deint != engine::project::Deinterlace::Frame {
1402+ tweaks.push(format!("deinterlace {}", deint.name()));
1403+ }
1404+ if !tweaks.is_empty() {
1405+ lines.push(tweaks.join(" · "));
1406+ }
1407+ // Every key of a speed ramp, so the ramp can be read and edited key by key.
1408+ if !c.speed_keys.is_empty() {
1409+ lines.push(format!("speed keys: {}", c.speed_keys.len()));
1410+ lines.extend(speed_key_lines(fps, &c.speed_keys));
1411+ }
13251412 // The volume envelope, in timeline times; only an audio clip can have one.
13261413 if !c.gain_keys.is_empty() {
13271414 lines.push(format!(
@@ -1397,6 +1484,12 @@ fn media_info(s: &PlaybackSession, lane: Lane, idx: usize, fps: f64) -> Reply {
13971484 "duck": duck_json(ducks.first()),
13981485 "ducks": ducks_json(&ducks),
13991486 "voice": voice_json_of(&voice),
1487+ "pan": pan,
1488+ "pitch": pitch,
1489+ "deinterlace": deint.name(),
1490+ "speed_keys": speed_keys_json(fps, &c.speed_keys),
1491+ "gain_db": c.gain_db,
1492+ "gain_keys": gain_keys_json(c, fps),
14001493 });
14011494 Reply::ok(lines.join("\n")).with(structured)
14021495 }
@@ -2211,6 +2304,38 @@ mod tests {
22112304 assert!(tl.text.contains("speed ramp 1.00x→2.00x (3 keys)"), "{}", tl.text);
22122305 }
22132306
2307+ #[test]
2308+ fn clip_info_reads_back_pan_pitch_deinterlace_and_every_ramp_key() {
2309+ let mut srv = server();
2310+ let r = crate::tools::edit::run_edit(
2311+ &mut srv,
2312+ &json!({"ops": [
2313+ {"op": "pan", "clip": "A1#0", "pan": -0.5},
2314+ {"op": "pitch", "clip": "A1#0", "semitones": 3},
2315+ {"op": "deinterlace", "clip": "V1#0", "mode": "field"},
2316+ {"op": "speed_ramp", "clip": "V1#0", "keys": [
2317+ {"at": "0s", "speed": 1.0}, {"at": "1s", "speed": 1.5}, {"at": "2s", "speed": 2.0}
2318+ ]}
2319+ ]}),
2320+ );
2321+ assert!(!r.is_error, "{}", r.text);
2322+ let audio = call(&mut srv, "clip_info", json!({"clip": "A1#0"}));
2323+ assert!(audio.text.contains("pan -0.5 · pitch +3 semitones"), "{}", audio.text);
2324+ assert_eq!(audio.structured.as_ref().unwrap()["pan"], -0.5);
2325+ assert_eq!(audio.structured.as_ref().unwrap()["pitch"], 3);
2326+ let video = call(&mut srv, "clip_info", json!({"clip": "V1#0"}));
2327+ assert!(video.text.contains("deinterlace field"), "{}", video.text);
2328+ assert!(video.text.contains("speed keys: 3\n at clip 0.000s speed 1x\n at clip 1.000s speed 1.5x\n at clip 2.000s speed 2x"), "{}", video.text);
2329+ let v = video.structured.as_ref().unwrap();
2330+ assert_eq!(v["deinterlace"], "field");
2331+ assert_eq!(v["speed_keys"].as_array().unwrap().len(), 3);
2332+ assert_eq!(v["speed_keys"][1]["clip_time"], 1.0);
2333+ // Brief timeline rows name a pitch that is set, and leave out a deinterlace at its default.
2334+ let tl = call(&mut srv, "timeline", json!({}));
2335+ assert!(tl.text.contains("pitch +3"), "{}", tl.text);
2336+ assert!(!tl.text.contains("deinterlace frame"), "{}", tl.text);
2337+ }
2338+
22142339 #[test]
22152340 fn reverse_toggles_with_on_and_shows_in_clip_info_and_timeline() {
22162341 let mut srv = server();
crates/mcp/src/tools/project.rsmodified+11 -2
@@ -121,7 +121,7 @@ pub fn tools() -> Vec<Tool> {
121121 },
122122 Tool {
123123 name: "project_status",
124- description: "Project path, saved or dirty, canvas size, frame rate, duration, lanes with clip counts, sources, undo and redo steps, running exports, and settings.",
124+ description: "Project path, saved or dirty, canvas size, frame rate, duration, lanes with clip counts, sources, undo and redo steps, running exports, the colour looks (built-in and saved, by name, for the look op), and settings.",
125125 schema: || schema(json!({}), &[]),
126126 run: project_status,
127127 },
@@ -2176,6 +2176,14 @@ fn status_reply(server: &Server) -> Reply {
21762176 };
21772177 let tone = s.tone().name();
21782178 let encoder = s.encoder_seat().name();
2179+ // The colour looks the look op takes by name: the built-in ones and the saved ones, A to Z.
2180+ let builtin_looks: Vec<&str> = engine::looks::builtins().iter().map(|(n, _)| *n).collect();
2181+ let saved_looks = engine::looks::saved_names();
2182+ let looks_text = format!(
2183+ "\nlooks: built-in {} · saved {}",
2184+ builtin_looks.join(", "),
2185+ if saved_looks.is_empty() { "none".to_string() } else { saved_looks.join(", ") }
2186+ );
21792187
21802188 // Each offline source is named on its own line, with the fix; a clip on it is still on the timeline.
21812189 let offline = s.offline_sources();
@@ -2205,7 +2213,7 @@ fn status_reply(server: &Server) -> Reply {
22052213 let text = format!(
22062214 "{path} · {state} · {w}x{h} @{} · {} ({end}f) · undo {undo} · redo {redo} · {running} export job(s) running\n\
22072215 lanes: {lane_text}{ducks_text}{voice_text}\n\
2208- {recent_text}sources: {} {}\n\
2216+ {recent_text}sources: {} {}{looks_text}\n\
22092217 settings: tonemap {tone} · proxies {} · auto proxies {} · encoder {encoder} · limiter {limiter_text} · sample rate {sample_rate} · still {:.1} s{offline_text}{fix_text}{notes_text}{render_text}",
22102218 fmt_fps(fps),
22112219 parse::clock(end, fps),
@@ -2244,6 +2252,7 @@ fn status_reply(server: &Server) -> Reply {
22442252 "redo_steps": redo,
22452253 "recent_steps": recent_steps,
22462254 "jobs_running": running,
2255+ "looks": {"builtin": builtin_looks, "saved": saved_looks},
22472256 "unrecovered_autosave": unrecovered,
22482257 "settings": {
22492258 "captions": caption_json(s.caption_style()),