The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.
Rust ffmpegfree-video-editormodel-context-protocolnon-linear-editoroffline-firstopen-source-video-editorself-hostedvideo-editingvideo-editing-automationvideo-editing-softwarevideo-editing-toolsvideo-editorvoice-cloningyoutube-automationyoutube-shorts
feat(timeline): Reverse writes the clip's span backwards into the cache, and freeze, reverse, mirror and rotate go behind one mark on the tray
Jareer9ea1252888f5
diff --git a/docs/api/edits.md b/docs/api/edits.mdindex c7d63461..a6b83c39 100644--- a/docs/api/edits.md+++ b/docs/api/edits.md@@ -148,13 +148,15 @@ the export alike. Stored in the document; absent means "as tagged".### `replaceClipMedia`Points a clip at another file, adding it to the bin first if it is not-there. The clip keeps its in-point, length, looks and name; the copy stands-in frame for frame. The bin keeps the original.+there. The clip keeps its length, looks and name, and its in-point unless+`sourceStart` moves it: an enhanced copy stands in frame for frame, a+reversed span starts at its own zero. The bin keeps the original.| Field | Type | Meaning ||---|---|---|| `clipId` | string | The clip. Unknown id: no-op || `item` | *NewMedia* | The probed file |+| `sourceStart` | number | *optional*. A new in-point in the copy, in seconds |---diff --git a/src/crates/concat-host/src/enhance.rs b/src/crates/concat-host/src/enhance.rsindex b2b51b0a..bf254778 100644--- a/src/crates/concat-host/src/enhance.rs+++ b/src/crates/concat-host/src/enhance.rs@@ -288,7 +288,7 @@ fn footage(/// `frame` cut to `width` by `height` from its top-left, or the frame/// itself when it is that size already.-fn crop(frame: &concat_core::Frame, width: u32, height: u32) -> concat_core::Frame {+pub(crate) fn crop(frame: &concat_core::Frame, width: u32, height: u32) -> concat_core::Frame {if frame.width() == width && frame.height() == height {return frame.clone();}diff --git a/src/crates/concat-host/src/lib.rs b/src/crates/concat-host/src/lib.rsindex 07f1d272..7ca9c5d9 100644--- a/src/crates/concat-host/src/lib.rs+++ b/src/crates/concat-host/src/lib.rs@@ -31,6 +31,7 @@ pub mod playback;pub mod preview;pub mod projects;pub mod proxy;+pub mod reverse;pub mod session;pub mod templates;pub mod titles;@@ -41,6 +42,7 @@ pub use dirs::AppDirs;pub use enhance::{EnhanceRequest, Enhancers};pub use jobs::{Job, SingleFlight};pub use projects::ProjectInfo;+pub use reverse::{ReverseRequest, Reversers};pub use session::{EditorView, Session, SettingsView};pub use titles::{TitleClip, Titles};diff --git a/src/crates/concat-host/src/reverse.rs b/src/crates/concat-host/src/reverse.rsnew file mode 100644index 00000000..08feb1a9--- /dev/null+++ b/src/crates/concat-host/src/reverse.rs@@ -0,0 +1,434 @@+// SPDX-License-Identifier: AGPL-3.0-or-later+// SPDX-FileCopyrightText: 2026 Jareer and Concat contributors++//! Reverse: the span a clip covers of a media file, written backwards,+//! once.+//!+//! Playing a file backwards live means seeking to every frame in turn,+//! and each seek is a decode from the keyframe before it: choppy at best,+//! and wrong where a seek lands short of its frame. So a reverse is not+//! played, it is written. The span the clip covers is read forwards once,+//! turned round, and put in the project's cache as a file of its own,+//! picture and sound, which the clip then shows like any other file. The+//! import is never touched; the bin keeps it.+//!+//! Turning a span round without holding it whole - a minute of 4K is+//! tens of gigabytes of pixels - takes two passes. The first reads the+//! span forwards in runs of a few hundred megabytes, writes each run+//! backwards into a segment of its own, and moves on. The second reads+//! the segments last to first into the copy. Every frame is decoded and+//! encoded twice, the segments near-losslessly, and nothing is sought but+//! the span's start. The sound goes through the mixer's own graph with+//! `areverse`, which holds the span's samples - a few hundred megabytes+//! an hour - and is muxed in beside the picture.+//!+//! One job at a time through a [`SingleFlight`], like every long job the+//! host runs. The copy is named after the file's path, size and+//! modification time and the span it covers, so a file replaced on disk+//! gets a fresh one and the same span asked for twice gets the one+//! already there.++use std::hash::{Hash, Hasher};+use std::path::{Path, PathBuf};+use std::sync::Arc;++use concat_core::{Frame, FrameRate, Rational};+use concat_media::audio::{AudioClip, mix_to_file, mux};+use concat_media::{+ DecodeOptions, Decoder, EncodeOptions, Encoder, FrameSink, FrameSource, RateMode, VideoCodec,+};++use crate::jobs::SingleFlight;++/// What one reverse covers.+#[derive(Clone, Debug)]+pub struct ReverseRequest {+ /// The media file to read.+ pub media_path: String,+ /// A sound clip: no picture to turn, only the samples.+ pub audio_only: bool,+ /// Seconds into the file where the span begins.+ pub start: f64,+ /// Seconds of the file the span covers.+ pub duration: f64,+ /// Where the copy goes; see [`target_for`].+ pub target: PathBuf,+}++/// The reverse service: the one-job slot.+pub struct Reversers {+ gate: Arc<SingleFlight>,+}++/// Pixels a run of frames may hold before it is written out as a segment:+/// a hundred-odd frames of 1080p, a couple of dozen of 4K.+const RUN_BYTES: usize = 384 << 20;++/// Where the reversed copy of `media`'s span lives under `project`: in+/// the cache, named by the file's path, size and modification time and+/// the span in milliseconds. None for a file that cannot be stat'ed,+/// which cannot be read either.+pub fn target_for(+ project: &Path,+ media: &str,+ start: f64,+ duration: f64,+ audio_only: bool,+) -> Option<PathBuf> {+ let meta = std::fs::metadata(media).ok()?;+ let mut hasher = std::collections::hash_map::DefaultHasher::new();+ media.hash(&mut hasher);+ meta.len().hash(&mut hasher);+ if let Ok(modified) = meta.modified()+ && let Ok(since) = modified.duration_since(std::time::UNIX_EPOCH)+ {+ since.as_secs().hash(&mut hasher);+ }+ let extension = if audio_only { "m4a" } else { "mp4" };+ Some(project.join("cache").join(format!(+ "reverse-{:016x}-{}-{}.{extension}",+ hasher.finish(),+ (start * 1000.0).round() as u64,+ (duration * 1000.0).round() as u64+ )))+}++impl Default for Reversers {+ fn default() -> Self {+ Self::new()+ }+}++impl Reversers {+ /// A service with its slot free.+ pub fn new() -> Reversers {+ Reversers {+ gate: Arc::new(SingleFlight::new()),+ }+ }++ /// Whether a reverse is running.+ pub fn is_busy(&self) -> bool {+ self.gate.is_busy()+ }++ /// Asks the running reverse to stop after the frame in hand.+ pub fn cancel(&self) {+ self.gate.cancel();+ }++ /// Writes the copy `request` asks for, or finds it already written.+ /// Blocks until done, so run it on its own thread; `progress` is+ /// called with a fraction as it goes. Returns where the copy is.+ pub fn reverse(+ &self,+ request: &ReverseRequest,+ progress: &mut dyn FnMut(f32),+ ) -> Result<PathBuf, String> {+ if request.target.is_file() {+ return Ok(request.target.clone());+ }+ if !request.start.is_finite() || !request.duration.is_finite() || request.duration <= 0.0 {+ return Err("nothing to reverse".to_owned());+ }+ let job = self.gate.begin("reverse")?;+ if let Some(folder) = request.target.parent() {+ std::fs::create_dir_all(folder)+ .map_err(|error| format!("{}: {error}", folder.display()))?;+ }+ progress(0.0);+ let result = if request.audio_only {+ sound(request)+ } else {+ footage(request, &job, progress)+ };+ result.map(|()| request.target.clone())+ }+}++/// The span as the mixer sees it, with `chain` on it.+fn span_clip(request: &ReverseRequest, chain: &str) -> AudioClip {+ AudioClip {+ path: PathBuf::from(&request.media_path),+ stream: None,+ start: 0.0,+ duration: request.duration,+ source_start: request.start,+ speed: 1.0,+ preserve_pitch: true,+ volume: 1.0,+ volume_curve: concat_core::animate::Track::new(Vec::new()),+ fade_in: 0.0,+ fade_out: 0.0,+ filter_chain: chain.to_owned(),+ }+}++/// A partial file moved into place, or cleared away with the error.+fn land(partial: &Path, target: &Path, written: Result<(), String>) -> Result<(), String> {+ match written {+ Ok(()) => std::fs::rename(partial, target)+ .map_err(|error| format!("{}: {error}", target.display())),+ Err(error) => {+ let _ = std::fs::remove_file(partial);+ Err(error)+ }+ }+}++/// The span's sound, backwards, as a file of its own: the mixer's graph+/// with `areverse` on it.+fn sound(request: &ReverseRequest) -> Result<(), String> {+ let partial = request.target.with_extension("part.m4a");+ let written = mix_to_file(+ &[span_clip(request, "areverse")],+ request.duration,+ &partial,+ )+ .map_err(|error| error.to_string());+ land(&partial, &request.target, written)+}++/// The span's picture, backwards, with its sound beside it when the file+/// has any. Written under partial names and moved into place only when+/// whole, so a copy that is there is a copy that is complete.+fn footage(+ request: &ReverseRequest,+ job: &crate::jobs::Job,+ progress: &mut dyn FnMut(f32),+) -> Result<(), String> {+ let info = concat_media::probe(&request.media_path).map_err(|error| error.to_string())?;+ let video = info+ .video+ .as_ref()+ .ok_or_else(|| "no video stream".to_owned())?;+ let rate = video.frame_rate;+ // About how many frames the span holds, for the readout and for a+ // container that keeps no clock.+ let expected = (request.duration * rate.fps().as_f64()).max(1.0);+ // Even sides, which the encoder wants: a stray pixel at the right or+ // bottom is cropped rather than the whole copy refused.+ let width = video.width & !1;+ let height = video.height & !1;+ if width == 0 || height == 0 {+ return Err("the picture is too small to reverse".to_owned());+ }+ let end = request.start + request.duration;+ let partial_video = request.target.with_extension("part.mp4");++ // Pass one: the span forwards, in runs, each run written backwards as+ // a segment of its own.+ let start = Rational::approximate(request.start).unwrap_or(Rational::ZERO);+ let options = DecodeOptions::default()+ .in_software()+ .threaded(2)+ .starting_at(start);+ let mut decoder =+ Decoder::open(&request.media_path, &options).map_err(|error| error.to_string())?;+ let frame_bytes = width as usize * height as usize * concat_core::frame::BYTES_PER_PIXEL;+ let run = (RUN_BYTES / frame_bytes.max(1)).clamp(2, 240);+ let mut segments: Vec<PathBuf> = Vec::new();+ let mut held: Vec<Frame> = Vec::with_capacity(run);+ let mut count = 0u64;+ let passes = (|| -> Result<(), String> {+ loop {+ if job.cancelled() {+ return Err("reverse cancelled".to_owned());+ }+ let Some(frame) = decoder.next_frame().map_err(|error| error.to_string())? else {+ break;+ };+ // The span's end by the frame's own clock where the container+ // keeps one, and by count where it does not.+ let past = match decoder.position() {+ Some(at) => at.as_f64() >= end,+ None => count as f64 >= expected,+ };+ if past {+ break;+ }+ held.push(crate::enhance::crop(&frame, width, height));+ count += 1;+ if held.len() >= run {+ write_segment(request, &mut segments, &mut held, rate)?;+ }+ progress((0.5 * count as f64 / expected).min(0.5) as f32);+ }+ if !held.is_empty() {+ write_segment(request, &mut segments, &mut held, rate)?;+ }+ if segments.is_empty() {+ return Err("the span holds no frames".to_owned());+ }++ // Pass two: the segments last to first, into the copy.+ let mut encoder = Encoder::create(&partial_video, width, height, rate, ©_options())+ .map_err(|error| error.to_string())?;+ let mut written = 0u64;+ let encoded = (|| -> Result<(), String> {+ for segment in segments.iter().rev() {+ let mut reader =+ Decoder::open(segment, &DecodeOptions::default().in_software().threaded(2))+ .map_err(|error| error.to_string())?;+ while let Some(frame) = reader.next_frame().map_err(|error| error.to_string())? {+ if job.cancelled() {+ return Err("reverse cancelled".to_owned());+ }+ encoder+ .write_frame(&frame)+ .map_err(|error| error.to_string())?;+ written += 1;+ progress((0.5 + 0.5 * written as f64 / count.max(1) as f64).min(0.99) as f32);+ }+ }+ encoder.finish().map_err(|error| error.to_string())+ })();+ if let Err(error) = encoded {+ let _ = std::fs::remove_file(&partial_video);+ return Err(error);+ }+ Ok(())+ })();+ for segment in &segments {+ let _ = std::fs::remove_file(segment);+ }+ passes?;++ // The sound, when the file has any, backwards beside the picture.+ if info.audio.is_none() {+ return land(&partial_video, &request.target, Ok(()));+ }+ let partial_audio = request.target.with_extension("part.m4a");+ let partial_muxed = request.target.with_extension("muxed.part.mp4");+ let muxed = mix_to_file(+ &[span_clip(request, "areverse")],+ request.duration,+ &partial_audio,+ )+ .and_then(|()| mux(&partial_video, &partial_audio, &partial_muxed))+ .map_err(|error| error.to_string());+ let _ = std::fs::remove_file(&partial_video);+ let _ = std::fs::remove_file(&partial_audio);+ land(&partial_muxed, &request.target, muxed)+}++/// The run in `held`, backwards, as the next segment; the run is emptied+/// either way.+fn write_segment(+ request: &ReverseRequest,+ segments: &mut Vec<PathBuf>,+ held: &mut Vec<Frame>,+ rate: FrameRate,+) -> Result<(), String> {+ let path = request+ .target+ .with_extension(format!("seg{:04}.part.mp4", segments.len()));+ let Some(first) = held.first() else {+ return Ok(());+ };+ let (width, height) = (first.width(), first.height());+ let written = Encoder::create(&path, width, height, rate, &segment_options())+ .and_then(|mut encoder| {+ for frame in held.iter().rev() {+ encoder.write_frame(frame)?;+ }+ encoder.finish()+ })+ .map_err(|error| error.to_string());+ held.clear();+ match written {+ Ok(()) => {+ segments.push(path);+ Ok(())+ }+ Err(error) => {+ let _ = std::fs::remove_file(&path);+ Err(error)+ }+ }+}++/// A segment lives minutes and is read once: the fastest preset there is,+/// at a quality nothing is lost through.+fn segment_options() -> EncodeOptions {+ EncodeOptions {+ codec: VideoCodec::H264,+ preset: "ultrafast".to_owned(),+ crf: 8,+ rate_mode: RateMode::Vbr,+ bitrate_kbps: 0,+ ten_bit: false,+ color_range: concat_media::ColorRange::Limited,+ hardware: false,+ threads: 2,+ }+}++/// The copy the timeline reads for as long as the project lives:+/// near-transparent quality, as the enhanced copy is written.+fn copy_options() -> EncodeOptions {+ EncodeOptions {+ codec: VideoCodec::H264,+ preset: "medium".to_owned(),+ crf: 16,+ rate_mode: RateMode::Vbr,+ bitrate_kbps: 0,+ ten_bit: false,+ color_range: concat_media::ColorRange::Limited,+ hardware: false,+ threads: 2,+ }+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn the_copy_is_named_after_the_file_and_the_span() {+ let dir = std::env::temp_dir().join(format!("concat-reverse-{}", std::process::id()));+ std::fs::create_dir_all(&dir).expect("mkdir");+ let media = dir.join("clip.mp4");+ std::fs::write(&media, b"not really").expect("write");+ let media = media.to_string_lossy().into_owned();+ let project = dir.join("project");+ let span = target_for(&project, &media, 1.5, 4.0, false).expect("named");+ assert!(span.starts_with(project.join("cache")));+ assert!(+ span.to_string_lossy().ends_with("-1500-4000.mp4"),+ "{span:?}"+ );+ assert_eq!(+ target_for(&project, &media, 1.5, 4.0, false),+ Some(span.clone())+ );+ assert_ne!(+ target_for(&project, &media, 2.0, 4.0, false),+ Some(span.clone())+ );+ let sound = target_for(&project, &media, 1.5, 4.0, true).expect("named");+ assert!(sound.to_string_lossy().ends_with(".m4a"), "{sound:?}");+ assert_eq!(+ target_for(+ &project,+ &dir.join("gone.mp4").to_string_lossy(),+ 0.0,+ 1.0,+ false+ ),+ None+ );+ // A file with different bytes is a different copy.+ std::fs::write(&media, b"not really, but longer").expect("write");+ assert_ne!(target_for(&project, &media, 1.5, 4.0, false), Some(span));+ let _ = std::fs::remove_dir_all(&dir);+ }++ #[test]+ fn a_run_is_sized_to_the_frame() {+ let hd = RUN_BYTES / (1920 * 1080 * 4);+ let uhd = RUN_BYTES / (3840 * 2160 * 4);+ assert!(hd > uhd && uhd >= 2, "{hd} {uhd}");+ assert_eq!((RUN_BYTES / (7680 * 4320 * 4)).clamp(2, 240), 3);+ }+}diff --git a/src/crates/concat-host/tests/export.rs b/src/crates/concat-host/tests/export.rsindex e867d32c..cceb1512 100644--- a/src/crates/concat-host/tests/export.rs+++ b/src/crates/concat-host/tests/export.rs@@ -37,7 +37,7 @@ use concat_host::dirs::AppDirs;use concat_host::export::{self, ExportSpec};use concat_host::session::Session;use concat_host::titles::Titles;-use concat_host::{media, projects};+use concat_host::{media, projects, reverse};use concat_media::audio::{self as sound, AudioClip};use concat_media::{AudioDecoder, AudioOptions, DecodeOptions, Decoder, EncodeOptions, Encoder,@@ -1315,3 +1315,101 @@ fn an_export_decodes_on_the_hardware_when_preferred() {exported.expect_quiet(4.5);}}++/// A reversed copy of a span plays its seconds backwards, picture and+/// sound, and comes out of the host's reverse job as one file the+/// timeline reads like any other. The screen recording's seconds 1 to 6+/// are three hundred frames, which span two of the job's segments, so the+/// segments come back in the right order too; the clock's tone, on the+/// source's odd seconds, falls where those seconds land in the copy.+/// Asked again, the copy already written is handed back untouched. A+/// sound clip's span comes back as a file of sound alone.+#[test]+fn a_reversed_span_plays_its_seconds_backwards() {+ let scratch = Scratch::new("reverse");+ let sources = Sources::make(scratch.path());+ let project = scratch.path().join("project");+ let reversers = reverse::Reversers::new();++ let peek = sources.peek.to_string_lossy().into_owned();+ let request = reverse::ReverseRequest {+ target: reverse::target_for(&project, &peek, 1.0, 5.0, false).expect("named"),+ media_path: peek,+ audio_only: false,+ start: 1.0,+ duration: 5.0,+ };+ let mut last = 0.0f32;+ let written = reversers+ .reverse(&request, &mut |fraction| {+ assert!(+ fraction >= last,+ "progress went back from {last} to {fraction}"+ );+ last = fraction;+ })+ .expect("reverses the span");+ assert_eq!(written, request.target);+ assert!(!reversers.is_busy(), "the slot is free again");++ let copy = Exported::read("reversed", &written, (60, 1));+ copy.expect_length(5.0);+ copy.expect_sound(5.0);+ // The copy's second t is the source's 6 - t: seconds 5, 4, 3, 2, 1.+ copy.expect_second(0.25, 5);+ copy.expect_second(2.5, 3);+ copy.expect_second(4.75, 1);+ // The clock rang on the odd seconds, which now open and close the+ // copy with a quiet even second between each pair.+ copy.expect_tone(0.25);+ copy.expect_quiet(1.5);+ copy.expect_tone(2.5);+ copy.expect_quiet(3.5);+ copy.expect_tone(4.75);++ let again = reversers+ .reverse(&request, &mut |_| {+ panic!("a copy on disk is not written again")+ })+ .expect("finds the copy");+ assert_eq!(again, written);++ let aac = sources.aac.to_string_lossy().into_owned();+ let sound_request = reverse::ReverseRequest {+ target: reverse::target_for(&project, &aac, 2.0, 3.0, true).expect("named"),+ media_path: aac,+ audio_only: true,+ start: 2.0,+ duration: 3.0,+ };+ let sound = reversers+ .reverse(&sound_request, &mut |_| {})+ .expect("reverses the sound");+ let info = concat_media::probe(&sound).expect("probes the sound");+ assert!(+ info.video.is_none() && info.audio.is_some(),+ "a sound clip's copy is sound alone"+ );+ let mut decoder = AudioDecoder::open(+ &sound,+ &AudioOptions {+ rate: RATE,+ channels: 2,+ format: SampleFormat::F32,+ ..AudioOptions::default()+ },+ )+ .expect("opens the sound");+ let heard = Exported {+ label: "reversed sound".to_owned(),+ fps: 1.0,+ frames: Vec::new(),+ audio: Some(decoder.collect_f32().expect("decodes the sound")),+ };+ heard.expect_sound(3.0);+ // Seconds 2 to 5 backwards: the copy's second t is the source's 5 - t,+ // so the odd second, 3, rings in the middle with quiet either side.+ heard.expect_quiet(0.5);+ heard.expect_tone(1.5);+ heard.expect_quiet(2.5);+}diff --git a/src/crates/concat-project/src/commands/clips.rs b/src/crates/concat-project/src/commands/clips.rsindex 2037ec16..538f4c2b 100644--- a/src/crates/concat-project/src/commands/clips.rs+++ b/src/crates/concat-project/src/commands/clips.rs@@ -305,7 +305,11 @@ pub(super) fn apply(})}- Command::ReplaceClipMedia { clip_id, item } => {+ Command::ReplaceClipMedia {+ clip_id,+ item,+ source_start,+ } => {if project.active().clip(&clip_id).is_none() {return Ok(Outcome::default());}@@ -341,10 +345,13 @@ pub(super) fn apply(let Some(index) = timeline.clips.iter().position(|clip| clip.id == clip_id) else {return Ok(Outcome::default());};- if timeline.clips[index].media_id == media_id {+ let clip = timeline.clip_at_mut(index);+ // Bitwise so no assignment is short-circuited away.+ let applied = assign(&mut clip.media_id, media_id.clone())+ | source_start.is_some_and(|start| assign(&mut clip.source_start, start.max(0.0)));+ if !applied {return Ok(Outcome::default());}- timeline.clip_at_mut(index).media_id = media_id.clone();Ok(Outcome {created_id: Some(media_id),applied: true,diff --git a/src/crates/concat-project/src/commands/mod.rs b/src/crates/concat-project/src/commands/mod.rsindex 6b314426..f5030911 100644--- a/src/crates/concat-project/src/commands/mod.rs+++ b/src/crates/concat-project/src/commands/mod.rs@@ -475,17 +475,23 @@ pub enum Command {/// The cut point, in timeline seconds.time: f64,},- /// Points a clip at another file - the enhanced copy of its media -- /// adding the file to the bin first when it is not there. The clip's- /// in-point, length, looks and name are kept: the copy stands in for- /// the original frame for frame, at the same rate and length. The bin- /// keeps the original, since other clips may show it and undo may- /// want it back. An unknown clip is a no-op.+ /// Points a clip at another file - the enhanced or reversed copy of+ /// its media - adding the file to the bin first when it is not there.+ /// The clip's length, looks and name are kept, and its in-point unless+ /// `source_start` moves it: an enhanced copy stands in for the original+ /// frame for frame, a reversed one covers the span the clip showed and+ /// starts at its own zero. The bin keeps the original, since other+ /// clips may show it and undo may want it back. An unknown clip is a+ /// no-op.ReplaceClipMedia {/// The clip to re-point.clip_id: String,/// The probed copy, as described by the host.item: NewMedia,+ /// A new in-point in the copy, in seconds, floored at 0. Absent+ /// keeps the clip's.+ #[serde(default)]+ source_start: Option<f64>,},/// A freeze frame at `time`: splits `clip_id`, inserts a still of/// `duration` on the same track, and ripples later clips on that track@@ -899,7 +905,9 @@ impl Command {Command::TrimClip { delta, .. } => bad([*delta]),Command::SplitClips { time, .. } => bad([*time]),Command::FreezeFrame { time, duration, .. } => bad([*time]) || bad(*duration),- Command::ReplaceClipMedia { item, .. } => bad(item.duration) || bad(item.frame_rate),+ Command::ReplaceClipMedia {+ item, source_start, ..+ } => bad(item.duration) || bad(item.frame_rate) || bad(*source_start),Command::UpdateClip { patch, .. } => {bad(patch.volume)|| bad(patch.fade_in)diff --git a/src/crates/concat-project/src/lib.rs b/src/crates/concat-project/src/lib.rsindex 43049cf3..aaac3126 100644--- a/src/crates/concat-project/src/lib.rs+++ b/src/crates/concat-project/src/lib.rs@@ -619,6 +619,47 @@ mod tests {assert_eq!(editor.project().media.len(), 1);}+ #[test]+ fn replace_clip_media_can_move_the_in_point_to_the_copy() {+ let (mut editor, _, clip_id) = fixture();+ editor+ .apply(Command::TrimClip {+ clip_id: clip_id.clone(),+ edge: TrimEdge::Start,+ delta: 2.0,+ ripple: false,+ })+ .expect("trims");+ let trimmed = editor.project().active().clip(&clip_id).expect("clip");+ assert_eq!((trimmed.source_start, trimmed.duration), (2.0, 8.0));+ let copy = NewMedia {+ path: "/project/cache/reverse-1-2000-8000.mp4".into(),+ name: "a.mp4 (reversed)".into(),+ duration: Some(8.0),+ kind: MediaKind::Video,+ width: Some(1920),+ height: Some(1080),+ frame_rate: Some(30.0),+ frame_rate_fraction: Some("30/1".into()),+ video_codec: Some("h264".into()),+ audio_codec: None,+ has_audio: false,+ audio_tracks: Vec::new(),+ origin: None,+ };+ let outcome = editor+ .apply(Command::ReplaceClipMedia {+ clip_id: clip_id.clone(),+ item: copy,+ source_start: Some(0.0),+ })+ .expect("replaces");+ assert!(outcome.applied);+ let clip = editor.project().active().clip(&clip_id).expect("clip");+ assert_eq!(clip.source_start, 0.0, "the copy starts at its own zero");+ assert_eq!(clip.duration, 8.0, "the length is kept");+ }+#[test]fn replace_clip_media_points_the_clip_at_the_copy_and_keeps_the_original() {let (mut editor, media_id, clip_id) = fixture();@@ -641,6 +682,7 @@ mod tests {.apply(Command::ReplaceClipMedia {clip_id: clip_id.clone(),item: copy.clone(),+ source_start: None,}).expect("replaces");assert!(outcome.applied);@@ -664,6 +706,7 @@ mod tests {.apply(Command::ReplaceClipMedia {clip_id: clip_id.clone(),item: copy.clone(),+ source_start: None,}).expect("no-op");assert!(!again.applied);@@ -677,6 +720,7 @@ mod tests {path: "/elsewhere.mp4".into(),..copy},+ source_start: None,}).expect("no-op");assert!(!nobody.applied);@@ -707,6 +751,7 @@ mod tests {.apply(Command::ReplaceClipMedia {clip_id: clip_id.clone(),item: bad,+ source_start: None,}).is_err());diff --git a/src/crates/concat/locales/de.json b/src/crates/concat/locales/de.jsonindex 644f9789..2342bbc5 100644--- a/src/crates/concat/locales/de.json+++ b/src/crates/concat/locales/de.json@@ -361,6 +361,8 @@"Format": "Format","Frame": "Bild","Frame rate": "Bildrate",+ "Freeze": "Einfrieren",+ "Freeze, mirror or rotate the selected clip": "Ausgewählten Clip einfrieren, spiegeln oder drehen","French": "Französisch","Frequency": "Frequenz","Fresh": "Fresh",@@ -695,6 +697,12 @@"Retro 70s": "Retro 70er","Retro Cartoon": "Retro Cartoon","Retro CRT scanlines and barrel screen curvature.": "Retro-CRT-Scanlinien und tonnenförmige Bildschirmkrümmung.",+ "Reverse": "Rückwärts",+ "Reverse is already at work; one clip at a time": "Rückwärts läuft bereits; ein Clip nach dem anderen",+ "Reverse: {0}": "Rückwärts: {0}",+ "Reversed; the clip now shows the copy": "Umgekehrt; der Clip zeigt jetzt die Kopie",+ "Reversing {0}…": "{0} wird umgekehrt…",+ "Reversing… {0}%": "Wird umgekehrt… {0} %","RGB Glitch": "RGB-Glitch","RGB Split": "RGB-Versatz","RGB split": "RGB-Versatz",@@ -708,6 +716,7 @@"Room": "Raum","Rose": "Rosé","Rosy": "Rosig",+ "Rotate": "Drehen","Rotation": "Drehung","Rotational vortex twist around a focal point.": "Drehender Wirbel um einen Brennpunkt.","Row height": "Zeilenhöhe",@@ -846,6 +855,7 @@"The café look: warm brown through the middle, greens muted to olive, contrast eased. Cosy, and kind to wood and skin alike.": "The café look: warm brown through the middle, greens muted to olive, contrast eased. Cosy, and kind to wood and skin alike.","The centre of the picture bulges outward, or pinches inward below zero.": "Die Bildmitte wölbt sich nach außen, oder zieht sich unter null nach innen.","The chain runs top to bottom — reorder it with the chevrons. The eye bypasses one link without losing the values you dialled into it.": "Die Kette läuft von oben nach unten — ordne sie mit den Pfeilen um. Das Auge umgeht ein Glied, ohne die eingestellten Werte zu verlieren.",+ "The clip changed while it was being reversed; reverse it again": "Der Clip hat sich während des Umkehrens geändert; bitte erneut umkehren","The clip is no longer on the timeline": "The clip is no longer on the timeline","The closest to a studio voice. Reads at its own pace, in one of Pocket's two recordings or in any sample from the bin, and reads [laugh], [chuckle] and [sigh] as what they say.": "Am nächsten an einer Studiostimme. Liest in eigenem Tempo, in einer der zwei Aufnahmen von Pocket oder in jeder Probe aus den Medien, und liest [laugh], [chuckle] und [sigh] als das, was sie sagen.","The colour channels pull apart through the cut and snap back together.": "Die Farbkanäle ziehen sich durch den Schnitt auseinander und schnappen wieder zusammen.",diff --git a/src/crates/concat/locales/en.json b/src/crates/concat/locales/en.jsonindex 7c30a71b..c6d5b751 100644--- a/src/crates/concat/locales/en.json+++ b/src/crates/concat/locales/en.json@@ -361,6 +361,8 @@"Format": "Format","Frame": "Frame","Frame rate": "Frame rate",+ "Freeze": "Freeze",+ "Freeze, mirror or rotate the selected clip": "Freeze, mirror or rotate the selected clip","French": "French","Frequency": "Frequency","Fresh": "Fresh",@@ -695,6 +697,12 @@"Retro 70s": "Retro 70s","Retro Cartoon": "Retro Cartoon","Retro CRT scanlines and barrel screen curvature.": "Retro CRT scanlines and barrel screen curvature.",+ "Reverse": "Reverse",+ "Reverse is already at work; one clip at a time": "Reverse is already at work; one clip at a time",+ "Reverse: {0}": "Reverse: {0}",+ "Reversed; the clip now shows the copy": "Reversed; the clip now shows the copy",+ "Reversing {0}…": "Reversing {0}…",+ "Reversing… {0}%": "Reversing… {0}%","RGB Glitch": "RGB Glitch","RGB Split": "RGB Split","RGB split": "RGB split",@@ -708,6 +716,7 @@"Room": "Room","Rose": "Rose","Rosy": "Rosy",+ "Rotate": "Rotate","Rotation": "Rotation","Rotational vortex twist around a focal point.": "Rotational vortex twist around a focal point.","Row height": "Row height",@@ -846,6 +855,7 @@"The café look: warm brown through the middle, greens muted to olive, contrast eased. Cosy, and kind to wood and skin alike.": "The café look: warm brown through the middle, greens muted to olive, contrast eased. Cosy, and kind to wood and skin alike.","The centre of the picture bulges outward, or pinches inward below zero.": "The centre of the picture bulges outward, or pinches inward below zero.","The chain runs top to bottom — reorder it with the chevrons. The eye bypasses one link without losing the values you dialled into it.": "The chain runs top to bottom — reorder it with the chevrons. The eye bypasses one link without losing the values you dialled into it.",+ "The clip changed while it was being reversed; reverse it again": "The clip changed while it was being reversed; reverse it again","The clip is no longer on the timeline": "The clip is no longer on the timeline","The closest to a studio voice. Reads at its own pace, in one of Pocket's two recordings or in any sample from the bin, and reads [laugh], [chuckle] and [sigh] as what they say.": "The closest to a studio voice. Reads at its own pace, in one of Pocket's two recordings or in any sample from the bin, and reads [laugh], [chuckle] and [sigh] as what they say.","The colour channels pull apart through the cut and snap back together.": "The colour channels pull apart through the cut and snap back together.",diff --git a/src/crates/concat/locales/es.json b/src/crates/concat/locales/es.jsonindex e8214613..35e9f474 100644--- a/src/crates/concat/locales/es.json+++ b/src/crates/concat/locales/es.json@@ -361,6 +361,8 @@"Format": "Formato","Frame": "Fotograma","Frame rate": "Fotogramas por segundo",+ "Freeze": "Congelar",+ "Freeze, mirror or rotate the selected clip": "Congelar, reflejar o rotar el clip seleccionado","French": "Francés","Frequency": "Frecuencia","Fresh": "Fresh",@@ -695,6 +697,12 @@"Retro 70s": "Retro años 70","Retro Cartoon": "Retro Cartoon","Retro CRT scanlines and barrel screen curvature.": "Líneas de CRT retro y curvatura de pantalla en barril.",+ "Reverse": "Invertir",+ "Reverse is already at work; one clip at a time": "Invertir ya está en marcha; un clip a la vez",+ "Reverse: {0}": "Invertir: {0}",+ "Reversed; the clip now shows the copy": "Invertido; el clip ahora muestra la copia",+ "Reversing {0}…": "Invirtiendo {0}…",+ "Reversing… {0}%": "Invirtiendo… {0}%","RGB Glitch": "Glitch RGB","RGB Split": "Separación RGB","RGB split": "Separación RGB",@@ -708,6 +716,7 @@"Room": "Habitación","Rose": "Rosa","Rosy": "Rosado",+ "Rotate": "Rotar","Rotation": "Rotación","Rotational vortex twist around a focal point.": "Torsión de vórtice giratorio alrededor de un punto focal.","Row height": "Alto de fila",@@ -846,6 +855,7 @@"The café look: warm brown through the middle, greens muted to olive, contrast eased. Cosy, and kind to wood and skin alike.": "The café look: warm brown through the middle, greens muted to olive, contrast eased. Cosy, and kind to wood and skin alike.","The centre of the picture bulges outward, or pinches inward below zero.": "El centro de la imagen se abomba hacia fuera, o se pellizca hacia dentro por debajo de cero.","The chain runs top to bottom — reorder it with the chevrons. The eye bypasses one link without losing the values you dialled into it.": "La cadena va de arriba abajo: reordénala con las flechas. El ojo omite un eslabón sin perder los valores que ajustaste.",+ "The clip changed while it was being reversed; reverse it again": "El clip cambió mientras se invertía; inviértelo de nuevo","The clip is no longer on the timeline": "The clip is no longer on the timeline","The closest to a studio voice. Reads at its own pace, in one of Pocket's two recordings or in any sample from the bin, and reads [laugh], [chuckle] and [sigh] as what they say.": "La más cercana a una voz de estudio. Lee a su propio ritmo, con una de las dos grabaciones de Pocket o con cualquier muestra de la biblioteca de medios, y lee [laugh], [chuckle] y [sigh] como lo que dicen.","The colour channels pull apart through the cut and snap back together.": "Los canales de color se separan a lo largo del corte y vuelven a unirse de golpe.",diff --git a/src/crates/concat/locales/fa.json b/src/crates/concat/locales/fa.jsonindex 0539ac5c..4dee3fd3 100644--- a/src/crates/concat/locales/fa.json+++ b/src/crates/concat/locales/fa.json@@ -361,6 +361,8 @@"Format": "فرمت","Frame": "فریم","Frame rate": "نرخ فریم",+ "Freeze": "فریز",+ "Freeze, mirror or rotate the selected clip": "فریز، آینه یا چرخش کلیپ انتخابشده","French": "فرانسوی","Frequency": "فرکانس","Fresh": "تازه",@@ -695,6 +697,12 @@"Retro 70s": "رترو دهه 70","Retro Cartoon": "کارتون رترو","Retro CRT scanlines and barrel screen curvature.": "خطوط اسکن CRT رترو و انحنای بشکهای صفحه.",+ "Reverse": "معکوس",+ "Reverse is already at work; one clip at a time": "معکوسکردن در حال انجام است؛ هر بار یک کلیپ",+ "Reverse: {0}": "معکوس: {0}",+ "Reversed; the clip now shows the copy": "معکوس شد؛ کلیپ اکنون نسخهٔ کپی را نشان میدهد",+ "Reversing {0}…": "در حال معکوسکردن {0}…",+ "Reversing… {0}%": "در حال معکوسکردن… {0}٪","RGB Glitch": "گلیچ RGB","RGB Split": "جداسازی RGB","RGB split": "تفکیک RGB",@@ -708,6 +716,7 @@"Room": "اتاق","Rose": "گلی","Rosy": "گلگون",+ "Rotate": "چرخش","Rotation": "چرخش","Rotational vortex twist around a focal point.": "پیچش گردابی چرخشی حول یک نقطه کانونی.","Row height": "ارتفاع ردیف",@@ -846,6 +855,7 @@"The café look: warm brown through the middle, greens muted to olive, contrast eased. Cosy, and kind to wood and skin alike.": "ظاهر Café: قهوهای گرم در Midtoneها، سبزهای Muted متمایل به زیتونی و کنتراست ملایم؛ دنج و مناسب چوب و پوست.","The centre of the picture bulges outward, or pinches inward below zero.": "مرکز تصویر به بیرون برآمده میشود، یا با مقدار کمتر از صفر به داخل فرو میرود.","The chain runs top to bottom — reorder it with the chevrons. The eye bypasses one link without losing the values you dialled into it.": "زنجیره از بالا به پایین اجرا میشود؛ با فلشها ترتیب آن را تغییر دهید. آیکون چشم یک مرحله را غیرفعال میکند بدون اینکه مقادیر تنظیمشده از بین بروند.",+ "The clip changed while it was being reversed; reverse it again": "کلیپ در حین معکوسکردن تغییر کرد؛ دوباره معکوس کنید","The clip is no longer on the timeline": "این کلیپ دیگر روی تایملاین نیست","The closest to a studio voice. Reads at its own pace, in one of Pocket's two recordings or in any sample from the bin, and reads [laugh], [chuckle] and [sigh] as what they say.": "نزدیکترین به یک صدای استودیویی. با سرعت خودش میخواند، با یکی از دو ضبط Pocket یا هر نمونهای از Bin، و [laugh]، [chuckle] و [sigh] را همانطور که هستند اجرا میکند.","The colour channels pull apart through the cut and snap back together.": "کانالهای رنگ در طول برش از هم جدا میشوند و دوباره به هم میچسبند.",diff --git a/src/crates/concat/locales/fr.json b/src/crates/concat/locales/fr.jsonindex 9d757cd5..97e95df5 100644--- a/src/crates/concat/locales/fr.json+++ b/src/crates/concat/locales/fr.json@@ -361,6 +361,8 @@"Format": "Format","Frame": "Image","Frame rate": "Cadence",+ "Freeze": "Figer",+ "Freeze, mirror or rotate the selected clip": "Figer, refléter ou pivoter le clip sélectionné","French": "Français","Frequency": "Fréquence","Fresh": "Fresh",@@ -695,6 +697,12 @@"Retro 70s": "Rétro années 70","Retro Cartoon": "Retro Cartoon","Retro CRT scanlines and barrel screen curvature.": "Des lignes de balayage CRT rétro et une courbure d'écran en barillet.",+ "Reverse": "Inverser",+ "Reverse is already at work; one clip at a time": "Une inversion est déjà en cours ; un clip à la fois",+ "Reverse: {0}": "Inversion : {0}",+ "Reversed; the clip now shows the copy": "Inversé ; le clip affiche désormais la copie",+ "Reversing {0}…": "Inversion de {0}…",+ "Reversing… {0}%": "Inversion… {0} %","RGB Glitch": "Glitch RVB","RGB Split": "Séparation RVB","RGB split": "Séparation RVB",@@ -708,6 +716,7 @@"Room": "Pièce","Rose": "Rose","Rosy": "Rosé",+ "Rotate": "Pivoter","Rotation": "Rotation","Rotational vortex twist around a focal point.": "Une torsion en vortex autour d'un point focal.","Row height": "Hauteur de rangée",@@ -846,6 +855,7 @@"The café look: warm brown through the middle, greens muted to olive, contrast eased. Cosy, and kind to wood and skin alike.": "The café look: warm brown through the middle, greens muted to olive, contrast eased. Cosy, and kind to wood and skin alike.","The centre of the picture bulges outward, or pinches inward below zero.": "Le centre de l'image se bombe vers l'extérieur, ou se pince vers l'intérieur sous zéro.","The chain runs top to bottom — reorder it with the chevrons. The eye bypasses one link without losing the values you dialled into it.": "La chaîne va de haut en bas : réordonnez-la avec les chevrons. L'œil contourne un maillon sans perdre les valeurs que vous y avez réglées.",+ "The clip changed while it was being reversed; reverse it again": "Le clip a changé pendant l'inversion ; recommencez","The clip is no longer on the timeline": "The clip is no longer on the timeline","The closest to a studio voice. Reads at its own pace, in one of Pocket's two recordings or in any sample from the bin, and reads [laugh], [chuckle] and [sigh] as what they say.": "Ce qui se rapproche le plus d'une voix de studio. Lit à son propre rythme, avec l'un des deux enregistrements de Pocket ou n'importe quel échantillon du chutier, et lit [laugh], [chuckle] et [sigh] comme ce qu'ils disent.","The colour channels pull apart through the cut and snap back together.": "Les canaux de couleur se séparent le temps de la coupe et se recollent d'un coup.",diff --git a/src/crates/concat/locales/hr.json b/src/crates/concat/locales/hr.jsonindex 1298858f..12c68f82 100644--- a/src/crates/concat/locales/hr.json+++ b/src/crates/concat/locales/hr.json@@ -361,6 +361,8 @@"Format": "Format","Frame": "Kadar","Frame rate": "Broj sličica",+ "Freeze": "Zamrzni",+ "Freeze, mirror or rotate the selected clip": "Zamrzni, zrcali ili zakreni odabrani klip","French": "francuski","Frequency": "Frekvencija","Fresh": "Svježe",@@ -695,6 +697,12 @@"Retro 70s": "Retro 70-e","Retro Cartoon": "Retro crtić","Retro CRT scanlines and barrel screen curvature.": "Retro CRT linije i bačvasta zakrivljenost zaslona.",+ "Reverse": "Obrnuto",+ "Reverse is already at work; one clip at a time": "Obrtanje je već u tijeku; jedan po jedan klip",+ "Reverse: {0}": "Obrtanje: {0}",+ "Reversed; the clip now shows the copy": "Obrnuto; klip sada prikazuje kopiju",+ "Reversing {0}…": "Obrtanje {0}…",+ "Reversing… {0}%": "Obrtanje… {0}%","RGB Glitch": "RGB glitch","RGB Split": "RGB razdvajanje","RGB split": "RGB razdvajanje",@@ -708,6 +716,7 @@"Room": "Soba","Rose": "Ruža","Rosy": "Ružičasto",+ "Rotate": "Zakreni","Rotation": "Rotacija","Rotational vortex twist around a focal point.": "Rotacijsko vrtložno uvijanje oko žarišne točke.","Row height": "Visina retka",@@ -846,6 +855,7 @@"The café look: warm brown through the middle, greens muted to olive, contrast eased. Cosy, and kind to wood and skin alike.": "Kafić izgled: topla smeđa kroz sredinu, zelene prigušene u maslinasto, kontrast ublažen. Ugodno i ljubazno prema drvu i koži podjednako.","The centre of the picture bulges outward, or pinches inward below zero.": "Sredina slike ispupčuje se prema van ili se uvlači prema unutra ispod nule.","The chain runs top to bottom — reorder it with the chevrons. The eye bypasses one link without losing the values you dialled into it.": "Lanac ide odozgo prema dolje — presložite ga strelicama. Oko zaobilazi jednu kariku bez gubitka vrijednosti koje ste u nju unijeli.",+ "The clip changed while it was being reversed; reverse it again": "Klip se promijenio tijekom obrtanja; obrni ga ponovno","The clip is no longer on the timeline": "Klip više nije na vremenskoj liniji","The closest to a studio voice. Reads at its own pace, in one of Pocket's two recordings or in any sample from the bin, and reads [laugh], [chuckle] and [sigh] as what they say.": "Najbliže studijskom glasu. Čita vlastitim tempom, u jednoj od dviju Pocketovih snimki ili u bilo kojem uzorku iz spremnika, a [laugh], [chuckle] i [sigh] čita kao ono što znače.","The colour channels pull apart through the cut and snap back together.": "Kanali boje razdvajaju se kroz rez i naglo se ponovno spajaju.",diff --git a/src/crates/concat/locales/it.json b/src/crates/concat/locales/it.jsonindex 297493d0..e3eff9cd 100644--- a/src/crates/concat/locales/it.json+++ b/src/crates/concat/locales/it.json@@ -361,6 +361,8 @@"Format": "Formato","Frame": "Fotogramma","Frame rate": "Frequenza fotogrammi",+ "Freeze": "Blocca",+ "Freeze, mirror or rotate the selected clip": "Blocca, specchia o ruota la clip selezionata","French": "Francese","Frequency": "Frequenza","Fresh": "Fresh",@@ -695,6 +697,12 @@"Retro 70s": "Retro anni 70","Retro Cartoon": "Retro Cartoon","Retro CRT scanlines and barrel screen curvature.": "Scanline CRT retrò e curvatura a barilotto dello schermo.",+ "Reverse": "Inverti",+ "Reverse is already at work; one clip at a time": "Un'inversione è già in corso; una clip alla volta",+ "Reverse: {0}": "Inversione: {0}",+ "Reversed; the clip now shows the copy": "Invertita; la clip ora mostra la copia",+ "Reversing {0}…": "Inversione di {0}…",+ "Reversing… {0}%": "Inversione… {0}%","RGB Glitch": "Glitch RGB","RGB Split": "Separazione RGB","RGB split": "Separazione RGB",@@ -708,6 +716,7 @@"Room": "Stanza","Rose": "Rosa","Rosy": "Roseo",+ "Rotate": "Ruota","Rotation": "Rotazione","Rotational vortex twist around a focal point.": "Una torsione a vortice attorno a un punto focale.","Row height": "Altezza riga",@@ -846,6 +855,7 @@"The café look: warm brown through the middle, greens muted to olive, contrast eased. Cosy, and kind to wood and skin alike.": "The café look: warm brown through the middle, greens muted to olive, contrast eased. Cosy, and kind to wood and skin alike.","The centre of the picture bulges outward, or pinches inward below zero.": "Il centro dell'immagine si gonfia verso l'esterno, o si restringe verso l'interno sotto lo zero.","The chain runs top to bottom — reorder it with the chevrons. The eye bypasses one link without losing the values you dialled into it.": "La catena va dall'alto in basso: riordinala con le frecce. L'occhio bypassa un anello senza perdere i valori che hai impostato.",+ "The clip changed while it was being reversed; reverse it again": "La clip è cambiata durante l'inversione; ripeti l'operazione","The clip is no longer on the timeline": "The clip is no longer on the timeline","The closest to a studio voice. Reads at its own pace, in one of Pocket's two recordings or in any sample from the bin, and reads [laugh], [chuckle] and [sigh] as what they say.": "La più vicina a una voce da studio. Legge al proprio ritmo, con una delle due registrazioni di Pocket o con qualsiasi campione dal pannello Media, e legge [laugh], [chuckle] e [sigh] come ciò che dicono.","The colour channels pull apart through the cut and snap back together.": "I canali del colore si separano attraverso il taglio e tornano di scatto insieme.",diff --git a/src/crates/concat/locales/ja.json b/src/crates/concat/locales/ja.jsonindex 8c41f6bf..892a08f3 100644--- a/src/crates/concat/locales/ja.json+++ b/src/crates/concat/locales/ja.json@@ -361,6 +361,8 @@"Format": "形式","Frame": "フレーム","Frame rate": "フレームレート",+ "Freeze": "フリーズ",+ "Freeze, mirror or rotate the selected clip": "選択したクリップをフリーズ、ミラー、回転","French": "フランス語","Frequency": "周波数","Fresh": "Fresh",@@ -695,6 +697,12 @@"Retro 70s": "レトロ 70 年代","Retro Cartoon": "Retro Cartoon","Retro CRT scanlines and barrel screen curvature.": "レトロな CRT の走査線と樽型の画面の湾曲。",+ "Reverse": "逆再生",+ "Reverse is already at work; one clip at a time": "逆再生の処理中です。一度に1クリップまで",+ "Reverse: {0}": "逆再生: {0}",+ "Reversed; the clip now shows the copy": "逆再生になりました。クリップはコピーを表示しています",+ "Reversing {0}…": "{0} を逆再生に変換中…",+ "Reversing… {0}%": "逆再生を作成中… {0}%","RGB Glitch": "RGB グリッチ","RGB Split": "RGB 分離","RGB split": "RGB ずれ",@@ -708,6 +716,7 @@"Room": "ルーム","Rose": "ローズ","Rosy": "ロージー",+ "Rotate": "回転","Rotation": "回転","Rotational vortex twist around a focal point.": "焦点を中心とした回転する渦のねじれ。","Row height": "行の高さ",@@ -846,6 +855,7 @@"The café look: warm brown through the middle, greens muted to olive, contrast eased. Cosy, and kind to wood and skin alike.": "The café look: warm brown through the middle, greens muted to olive, contrast eased. Cosy, and kind to wood and skin alike.","The centre of the picture bulges outward, or pinches inward below zero.": "画面の中心が外へ膨らみ、ゼロ未満では内へ縮みます。","The chain runs top to bottom — reorder it with the chevrons. The eye bypasses one link without losing the values you dialled into it.": "チェーンは上から下へ処理されます。矢印で並べ替えてください。目のアイコンは設定値を失わずに一つの項目をバイパスします。",+ "The clip changed while it was being reversed; reverse it again": "逆再生の処理中にクリップが変更されました。もう一度実行してください","The clip is no longer on the timeline": "The clip is no longer on the timeline","The closest to a studio voice. Reads at its own pace, in one of Pocket's two recordings or in any sample from the bin, and reads [laugh], [chuckle] and [sigh] as what they say.": "スタジオの声に最も近いもの。Pocket の二つの録音のどちらか、またはビンの任意のサンプルの声で、自分のペースで読み上げ、[laugh]、[chuckle]、[sigh] はその意味どおりに読みます。","The colour channels pull apart through the cut and snap back together.": "色チャンネルがカットを通じて引き離され、ぱっと元に戻ります。",diff --git a/src/crates/concat/locales/ko.json b/src/crates/concat/locales/ko.jsonindex 413ecd21..2a316e6c 100644--- a/src/crates/concat/locales/ko.json+++ b/src/crates/concat/locales/ko.json@@ -361,6 +361,8 @@"Format": "형식","Frame": "프레임","Frame rate": "프레임 속도",+ "Freeze": "정지",+ "Freeze, mirror or rotate the selected clip": "선택한 클립을 정지, 반전 또는 회전","French": "프랑스어","Frequency": "빈도","Fresh": "Fresh",@@ -695,6 +697,12 @@"Retro 70s": "레트로 70년대","Retro Cartoon": "Retro Cartoon","Retro CRT scanlines and barrel screen curvature.": "레트로 CRT 주사선과 볼록한 화면 곡률.",+ "Reverse": "역재생",+ "Reverse is already at work; one clip at a time": "역재생 처리가 이미 진행 중입니다. 한 번에 한 클립만",+ "Reverse: {0}": "역재생: {0}",+ "Reversed; the clip now shows the copy": "역재생 완료. 클립이 이제 복사본을 표시합니다",+ "Reversing {0}…": "{0} 역재생 처리 중…",+ "Reversing… {0}%": "역재생 처리 중… {0}%","RGB Glitch": "RGB 글리치","RGB Split": "RGB 분리","RGB split": "RGB 분리",@@ -708,6 +716,7 @@"Room": "룸","Rose": "로즈","Rosy": "장밋빛",+ "Rotate": "회전","Rotation": "회전","Rotational vortex twist around a focal point.": "초점을 중심으로 소용돌이치는 회전 비틀림.","Row height": "행 높이",@@ -846,6 +855,7 @@"The café look: warm brown through the middle, greens muted to olive, contrast eased. Cosy, and kind to wood and skin alike.": "The café look: warm brown through the middle, greens muted to olive, contrast eased. Cosy, and kind to wood and skin alike.","The centre of the picture bulges outward, or pinches inward below zero.": "화면 가운데가 바깥으로 볼록해지고, 0 아래에서는 안으로 오목해집니다.","The chain runs top to bottom — reorder it with the chevrons. The eye bypasses one link without losing the values you dialled into it.": "체인은 위에서 아래로 실행됩니다. 화살표로 순서를 바꾸세요. 눈 아이콘은 설정한 값을 잃지 않고 한 항목을 우회합니다.",+ "The clip changed while it was being reversed; reverse it again": "역재생 처리 중에 클립이 바뀌었습니다. 다시 실행하세요","The clip is no longer on the timeline": "The clip is no longer on the timeline","The closest to a studio voice. Reads at its own pace, in one of Pocket's two recordings or in any sample from the bin, and reads [laugh], [chuckle] and [sigh] as what they say.": "스튜디오 목소리에 가장 가깝습니다. Pocket의 녹음 두 개 중 하나나 미디어 빈의 어떤 샘플로든 제 속도로 읽고, [laugh], [chuckle], [sigh]는 그 뜻대로 소리 냅니다.","The colour channels pull apart through the cut and snap back together.": "컷을 지나며 색 채널이 갈라졌다가 다시 딱 맞물립니다.",diff --git a/src/crates/concat/locales/pt-BR.json b/src/crates/concat/locales/pt-BR.jsonindex 37836977..6bf5b8e3 100644--- a/src/crates/concat/locales/pt-BR.json+++ b/src/crates/concat/locales/pt-BR.json@@ -361,6 +361,8 @@"Format": "Formato","Frame": "Quadro","Frame rate": "Taxa de quadros",+ "Freeze": "Congelar",+ "Freeze, mirror or rotate the selected clip": "Congelar, espelhar ou girar o clipe selecionado","French": "Francês","Frequency": "Frequência","Fresh": "Fresh",@@ -695,6 +697,12 @@"Retro 70s": "Retrô anos 70","Retro Cartoon": "Retro Cartoon","Retro CRT scanlines and barrel screen curvature.": "Linhas de varredura CRT retrô e curvatura de tela em barril.",+ "Reverse": "Reverter",+ "Reverse is already at work; one clip at a time": "Reverter já está em andamento; um clipe por vez",+ "Reverse: {0}": "Reverter: {0}",+ "Reversed; the clip now shows the copy": "Revertido; o clipe agora mostra a cópia",+ "Reversing {0}…": "Revertendo {0}…",+ "Reversing… {0}%": "Revertendo… {0}%","RGB Glitch": "Glitch RGB","RGB Split": "Separação RGB","RGB split": "Separação RGB",@@ -708,6 +716,7 @@"Room": "Sala","Rose": "Rosa","Rosy": "Rosado",+ "Rotate": "Girar","Rotation": "Rotação","Rotational vortex twist around a focal point.": "Torção em vórtice rotacional em torno de um ponto focal.","Row height": "Altura da linha",@@ -846,6 +855,7 @@"The café look: warm brown through the middle, greens muted to olive, contrast eased. Cosy, and kind to wood and skin alike.": "The café look: warm brown through the middle, greens muted to olive, contrast eased. Cosy, and kind to wood and skin alike.","The centre of the picture bulges outward, or pinches inward below zero.": "O centro da imagem infla para fora, ou se comprime para dentro abaixo de zero.","The chain runs top to bottom — reorder it with the chevrons. The eye bypasses one link without losing the values you dialled into it.": "A cadeia vai de cima para baixo — reordene com as setas. O olho ignora um elo sem perder os valores que você ajustou.",+ "The clip changed while it was being reversed; reverse it again": "O clipe mudou enquanto era revertido; reverta de novo","The clip is no longer on the timeline": "The clip is no longer on the timeline","The closest to a studio voice. Reads at its own pace, in one of Pocket's two recordings or in any sample from the bin, and reads [laugh], [chuckle] and [sigh] as what they say.": "A mais próxima de uma voz de estúdio. Lê no próprio ritmo, numa das duas gravações do Pocket ou em qualquer amostra da biblioteca, e lê [laugh], [chuckle] e [sigh] como o que eles dizem.","The colour channels pull apart through the cut and snap back together.": "Os canais de cor se separam ao longo do corte e voltam a se juntar de repente.",diff --git a/src/crates/concat/locales/ru.json b/src/crates/concat/locales/ru.jsonindex ff8d621c..e6ec57a9 100644--- a/src/crates/concat/locales/ru.json+++ b/src/crates/concat/locales/ru.json@@ -361,6 +361,8 @@"Format": "Формат","Frame": "Кадр","Frame rate": "Частота кадров",+ "Freeze": "Стоп-кадр",+ "Freeze, mirror or rotate the selected clip": "Стоп-кадр, отражение или поворот выбранного клипа","French": "Французский","Frequency": "Частота","Fresh": "Свежесть",@@ -695,6 +697,12 @@"Retro 70s": "Ретро 70-х","Retro Cartoon": "Ретро-мультфильм","Retro CRT scanlines and barrel screen curvature.": "Ретро-строки кинескопа и бочкообразная кривизна экрана.",+ "Reverse": "Реверс",+ "Reverse is already at work; one clip at a time": "Реверс уже выполняется; по одному клипу за раз",+ "Reverse: {0}": "Реверс: {0}",+ "Reversed; the clip now shows the copy": "Реверс готов; клип теперь показывает копию",+ "Reversing {0}…": "Реверс {0}…",+ "Reversing… {0}%": "Реверс… {0}%","RGB Glitch": "RGB-глитч","RGB Split": "Разделение RGB","RGB split": "RGB-сдвиг",@@ -708,6 +716,7 @@"Room": "Комната","Rose": "Розовый","Rosy": "Румянец",+ "Rotate": "Повернуть","Rotation": "Поворот","Rotational vortex twist around a focal point.": "Вихревое закручивание вокруг точки фокуса.","Row height": "Высота строки",@@ -846,6 +855,7 @@"The café look: warm brown through the middle, greens muted to olive, contrast eased. Cosy, and kind to wood and skin alike.": "Кофейный вид: тёплый коричневый в средних тонах, зелень приглушена до оливкового, контраст смягчён. Уютно, и одинаково ласково к дереву и коже.","The centre of the picture bulges outward, or pinches inward below zero.": "Центр картинки выпирает наружу, а ниже нуля втягивается внутрь.","The chain runs top to bottom — reorder it with the chevrons. The eye bypasses one link without losing the values you dialled into it.": "Цепочка идёт сверху вниз — меняйте порядок стрелками. Глаз обходит звено, не теряя выставленных значений.",+ "The clip changed while it was being reversed; reverse it again": "Клип изменился во время реверса; повторите","The clip is no longer on the timeline": "Клипа больше нет на таймлайне","The closest to a studio voice. Reads at its own pace, in one of Pocket's two recordings or in any sample from the bin, and reads [laugh], [chuckle] and [sigh] as what they say.": "Ближе всего к студийному голосу. Читает в своём темпе, одной из двух записей Pocket или любым образцом из медиа, а [laugh], [chuckle] и [sigh] исполняет как написано.","The colour channels pull apart through the cut and snap back together.": "Цветовые каналы расходятся через склейку и резко сходятся обратно.",diff --git a/src/crates/concat/locales/tr.json b/src/crates/concat/locales/tr.jsonindex f9c0656c..90a275b8 100644--- a/src/crates/concat/locales/tr.json+++ b/src/crates/concat/locales/tr.json@@ -361,6 +361,8 @@"Format": "Biçim","Frame": "Kare","Frame rate": "Kare hızı",+ "Freeze": "Dondur",+ "Freeze, mirror or rotate the selected clip": "Seçili klibi dondur, aynala veya döndür","French": "Fransızca","Frequency": "Frekans","Fresh": "Fresh",@@ -695,6 +697,12 @@"Retro 70s": "Retro 70'ler","Retro Cartoon": "Retro Cartoon","Retro CRT scanlines and barrel screen curvature.": "Retro CRT tarama çizgileri ve fıçı biçimli ekran eğriliği.",+ "Reverse": "Ters",+ "Reverse is already at work; one clip at a time": "Ters çevirme zaten sürüyor; her seferinde bir klip",+ "Reverse: {0}": "Ters çevirme: {0}",+ "Reversed; the clip now shows the copy": "Ters çevrildi; klip artık kopyayı gösteriyor",+ "Reversing {0}…": "{0} ters çevriliyor…",+ "Reversing… {0}%": "Ters çevriliyor… {0}%","RGB Glitch": "RGB glitch","RGB Split": "RGB ayrımı","RGB split": "RGB ayrımı",@@ -708,6 +716,7 @@"Room": "Oda","Rose": "Gül","Rosy": "Pembemsi",+ "Rotate": "Döndür","Rotation": "Döndürme","Rotational vortex twist around a focal point.": "Bir odak noktası çevresinde dönen girdap burgusu.","Row height": "Satır yüksekliği",@@ -846,6 +855,7 @@"The café look: warm brown through the middle, greens muted to olive, contrast eased. Cosy, and kind to wood and skin alike.": "The café look: warm brown through the middle, greens muted to olive, contrast eased. Cosy, and kind to wood and skin alike.","The centre of the picture bulges outward, or pinches inward below zero.": "Görüntünün ortası dışa doğru şişer ya da sıfırın altında içe doğru büzülür.","The chain runs top to bottom — reorder it with the chevrons. The eye bypasses one link without losing the values you dialled into it.": "Zincir yukarıdan aşağıya çalışır; oklarla yeniden sıralayın. Göz simgesi, ayarladığınız değerleri kaybetmeden bir halkayı atlar.",+ "The clip changed while it was being reversed; reverse it again": "Klip ters çevrilirken değişti; yeniden ters çevir","The clip is no longer on the timeline": "The clip is no longer on the timeline","The closest to a studio voice. Reads at its own pace, in one of Pocket's two recordings or in any sample from the bin, and reads [laugh], [chuckle] and [sigh] as what they say.": "Stüdyo sesine en yakın olanı. Kendi temposunda, Pocket'ın iki kaydından biriyle ya da medya kutusundaki herhangi bir örnekle okur; [laugh], [chuckle] ve [sigh] etiketlerini söyledikleri gibi okur.","The colour channels pull apart through the cut and snap back together.": "Renk kanalları kesim boyunca ayrılır ve yeniden bir araya çarpar.",diff --git a/src/crates/concat/locales/zh-Hans.json b/src/crates/concat/locales/zh-Hans.jsonindex 699c7a33..95315a8b 100644--- a/src/crates/concat/locales/zh-Hans.json+++ b/src/crates/concat/locales/zh-Hans.json@@ -361,6 +361,8 @@"Format": "格式","Frame": "帧","Frame rate": "帧率",+ "Freeze": "定格",+ "Freeze, mirror or rotate the selected clip": "定格、镜像或旋转所选片段","French": "法语","Frequency": "频率","Fresh": "清新",@@ -695,6 +697,12 @@"Retro 70s": "复古 70 年代","Retro Cartoon": "复古卡通","Retro CRT scanlines and barrel screen curvature.": "复古 CRT 扫描线与桶形屏幕曲面。",+ "Reverse": "倒放",+ "Reverse is already at work; one clip at a time": "倒放处理已在进行;一次一个片段",+ "Reverse: {0}": "倒放:{0}",+ "Reversed; the clip now shows the copy": "已倒放;片段现在显示副本",+ "Reversing {0}…": "正在倒放处理 {0}…",+ "Reversing… {0}%": "正在倒放处理… {0}%","RGB Glitch": "RGB 故障","RGB Split": "RGB 分离","RGB split": "RGB 分离",@@ -708,6 +716,7 @@"Room": "房间","Rose": "玫瑰","Rosy": "红润",+ "Rotate": "旋转","Rotation": "旋转","Rotational vortex twist around a focal point.": "围绕焦点旋转的漩涡扭曲。","Row height": "行高",@@ -846,6 +855,7 @@"The café look: warm brown through the middle, greens muted to olive, contrast eased. Cosy, and kind to wood and skin alike.": "咖啡馆风格:中间调暖棕,绿色压成橄榄色,对比度放缓。温馨舒适,对木头与肤色都很友好。","The centre of the picture bulges outward, or pinches inward below zero.": "画面中心向外鼓出,数值低于零时则向内收缩。","The chain runs top to bottom — reorder it with the chevrons. The eye bypasses one link without losing the values you dialled into it.": "效果链自上而下运行——可用箭头调整顺序。眼睛图标可跳过某一环节,而不会丢失你为它调好的数值。",+ "The clip changed while it was being reversed; reverse it again": "倒放处理期间片段已更改;请重新倒放","The clip is no longer on the timeline": "该片段已不在时间线上","The closest to a studio voice. Reads at its own pace, in one of Pocket's two recordings or in any sample from the bin, and reads [laugh], [chuckle] and [sigh] as what they say.": "最接近录音室人声。按自己的节奏朗读,可使用 Pocket 的两段录音之一或素材箱中的任意样本,并会把 [laugh]、[chuckle] 和 [sigh] 读成相应的笑声与叹息。","The colour channels pull apart through the cut and snap back together.": "颜色通道随转场分离,再迅速合拢。",diff --git a/src/crates/concat/locales/zh-TW.json b/src/crates/concat/locales/zh-TW.jsonindex 0a7fb36f..44f6caef 100644--- a/src/crates/concat/locales/zh-TW.json+++ b/src/crates/concat/locales/zh-TW.json@@ -361,6 +361,8 @@"Format": "格式","Frame": "影格","Frame rate": "影格率",+ "Freeze": "定格",+ "Freeze, mirror or rotate the selected clip": "定格、鏡像或旋轉所選片段","French": "法文","Frequency": "頻率","Fresh": "清新",@@ -695,6 +697,12 @@"Retro 70s": "復古 70 年代","Retro Cartoon": "復古卡通","Retro CRT scanlines and barrel screen curvature.": "復古 CRT 掃描線與桶形螢幕曲面。",+ "Reverse": "倒轉播放",+ "Reverse is already at work; one clip at a time": "倒轉處理已在進行;一次一個片段",+ "Reverse: {0}": "倒轉:{0}",+ "Reversed; the clip now shows the copy": "已倒轉;片段現在顯示副本",+ "Reversing {0}…": "正在倒轉處理 {0}…",+ "Reversing… {0}%": "正在倒轉處理… {0}%","RGB Glitch": "RGB 故障","RGB Split": "RGB 分離","RGB split": "RGB 分離",@@ -708,6 +716,7 @@"Room": "房間","Rose": "玫瑰","Rosy": "紅潤",+ "Rotate": "旋轉","Rotation": "旋轉","Rotational vortex twist around a focal point.": "圍繞焦點旋轉的漩渦扭曲。","Row height": "列高",@@ -846,6 +855,7 @@"The café look: warm brown through the middle, greens muted to olive, contrast eased. Cosy, and kind to wood and skin alike.": "咖啡館風格:中間調暖棕,綠色壓成橄欖色,對比度放緩。溫馨舒適,對木頭與膚色都很友善。","The centre of the picture bulges outward, or pinches inward below zero.": "畫面中心向外鼓出,數值低於零時則向內收縮。","The chain runs top to bottom — reorder it with the chevrons. The eye bypasses one link without losing the values you dialled into it.": "效果鏈由上而下執行——可用箭頭調整順序。眼睛圖示可略過某一環節,而不會遺失你為它調好的數值。",+ "The clip changed while it was being reversed; reverse it again": "倒轉處理期間片段已變更;請重新倒轉","The clip is no longer on the timeline": "該片段已不在時間軸上","The closest to a studio voice. Reads at its own pace, in one of Pocket's two recordings or in any sample from the bin, and reads [laugh], [chuckle] and [sigh] as what they say.": "最接近錄音室人聲。依自己的節奏朗讀,可使用 Pocket 的兩段錄音之一或素材箱中的任意樣本,並會把 [laugh]、[chuckle] 和 [sigh] 讀成相應的笑聲與嘆息。","The colour channels pull apart through the cut and snap back together.": "顏色通道隨轉場分離,再迅速合攏。",diff --git a/src/crates/concat/src/host.rs b/src/crates/concat/src/host.rsindex 8858fca1..6e2f6701 100644--- a/src/crates/concat/src/host.rs+++ b/src/crates/concat/src/host.rs@@ -48,6 +48,7 @@ pub struct Host {pub brushes: Arc<concat_host::Brushes>,/// The restoration model, and the enhanced copies it writes.pub enhancers: Arc<concat_host::Enhancers>,+ pub reversers: Arc<concat_host::Reversers>,/// The Concat API on a socket, while the Remote page has it on. Its/// own sessions, apart from the window's: a caller edits projects of/// its own, never the one on screen, which `open_projects` keeps it@@ -71,6 +72,7 @@ impl Host {cutouts: Arc::new(concat_host::Cutouts::new(&dirs.data)),brushes: Arc::new(concat_host::Brushes::new(&dirs.data)),enhancers: Arc::new(concat_host::Enhancers::new(&dirs.data)),+ reversers: Arc::new(concat_host::Reversers::new()),dirs,playback: Playback::start(Arc::new(Events))?,monitor: match gpu {diff --git a/src/crates/concat/src/studio.rs b/src/crates/concat/src/studio.rsindex 665e9e86..9335b6f3 100644--- a/src/crates/concat/src/studio.rs+++ b/src/crates/concat/src/studio.rs@@ -772,6 +772,8 @@ pub struct Studio {/// Enhance at work, by clip id: whether the model is still/// downloading, and how far along. One at a time, like every long job.enhance_jobs: HashMap<String, (bool, f32)>,+ /// Reverse writing a clip's backwards copy, by clip: how far along.+ reverse_jobs: HashMap<String, f32>,/// The smart stroke being read, by the same name, while one is.region_job: Option<String>,/// The last smart stroke as the stage drew it, kept on screen from the@@ -1508,6 +1510,7 @@ impl Studio {painting: true,cutout_jobs: HashMap::new(),enhance_jobs: HashMap::new(),+ reverse_jobs: HashMap::new(),region_job: None,pending_stroke: None,host,@@ -4825,6 +4828,127 @@ impl Studio {);}+ /// Writes the span clip `id` covers of its file backwards into the+ /// project's cache, and points the clip at the copy when it is there;+ /// see `concat_host::reverse`. The import is never touched.+ pub fn reverse_clip(&mut self, id: &str) {+ if !self.reverse_jobs.is_empty() || self.host.reversers.is_busy() {+ self.notify(&t("Reverse is already at work; one clip at a time"), true);+ return;+ }+ let Some(clip) = self.clip(id).cloned() else {+ return;+ };+ let audio_only = match clip.kind {+ model::ClipKind::Video => false,+ model::ClipKind::Audio => true,+ _ => return,+ };+ if self.locked(&clip.track_id) {+ return;+ }+ let Some(media) = self+ .project()+ .media+ .iter()+ .find(|item| item.id == clip.media_id)+ .cloned()+ else {+ return;+ };+ let Some(session) = self.session.as_ref() else {+ return;+ };+ let project = std::path::PathBuf::from(session.path());+ // The span the clip covers of the file: its in-point, and its+ // length at its rate - the curve's mean when it has one, which is+ // what `speed` holds then.+ let start = clip.source_start;+ let covered = clip.duration * clip.speed;+ let Some(target) =+ concat_host::reverse::target_for(&project, &media.path, start, covered, audio_only)+ else {+ self.notify(&tf("Could not read {0}", &[&media.path]), true);+ return;+ };+ let request = concat_host::ReverseRequest {+ media_path: media.path.clone(),+ audio_only,+ start,+ duration: covered,+ target,+ };+ let clip_id = clip.id.clone();+ self.reverse_jobs.insert(clip_id.clone(), 0.0);+ self.notify(&tf("Reversing {0}…", &[&media.name]), false);+ let reversers = Arc::clone(&self.host.reversers);+ let epoch = crate::host::project_epoch();+ spawn_in_project(+ move || {+ let mut last = -1.0f32;+ let reporting = clip_id.clone();+ let result = reversers.reverse(&request, &mut |fraction| {+ if fraction - last >= 0.01 {+ last = fraction;+ let id = reporting.clone();+ on_ui_in_project(epoch, move |studio, _, _| {+ if let Some(held) = studio.reverse_jobs.get_mut(&id) {+ *held = fraction;+ }+ });+ }+ });+ (clip_id, start, covered, result)+ },+ |studio, _, _, (clip_id, start, covered, result)| {+ studio.reverse_jobs.remove(&clip_id);+ match result {+ Ok(path) => studio.adopt_reversed(&clip_id, &path, start, covered),+ Err(error) if error.contains("cancelled") => {}+ Err(error) => studio.notify(&tf("Reverse: {0}", &[&error]), true),+ }+ },+ );+ }++ /// Points clip `id` at the reversed copy at `path`, its in-point at+ /// the copy's own zero, and shows it - unless the clip has moved on+ /// its file meanwhile, in which case the copy covers a span the clip+ /// no longer shows, and the ask has to be made again.+ fn adopt_reversed(&mut self, id: &str, path: &std::path::Path, start: f64, covered: f64) {+ let Some(clip) = self.clip(id).cloned() else {+ return;+ };+ if (clip.source_start - start).abs() > 1e-6+ || (clip.duration * clip.speed - covered).abs() > 1e-6+ {+ self.notify(+ &t("The clip changed while it was being reversed; reverse it again"),+ true,+ );+ return;+ }+ let summary = match media::probe(&path.to_string_lossy()) {+ Ok(summary) => summary,+ Err(error) => {+ self.notify(&tf("Reverse: {0}", &[&error]), true);+ return;+ }+ };+ let mut item = summary.to_new_media();+ if let Some(original) = self.project().media.iter().find(|m| m.id == clip.media_id) {+ item.name = format!("{} (reversed)", original.name);+ }+ item.origin = Some(model::MediaOrigin::Processed);+ self.apply(Command::ReplaceClipMedia {+ clip_id: id.to_owned(),+ item,+ source_start: Some(0.0),+ });+ self.request_preview();+ self.notify(&t("Reversed; the clip now shows the copy"), false);+ }+/// Points clip `id` at the enhanced copy at `path`, probed the way an/// import is, and shows it.fn adopt_enhanced(&mut self, id: &str, path: &std::path::Path) {@@ -4847,6 +4971,7 @@ impl Studio {self.apply(Command::ReplaceClipMedia {clip_id: id.to_owned(),item,+ source_start: None,});self.request_preview();self.notify(&t("Enhanced; the clip now shows the copy"), false);@@ -5322,6 +5447,43 @@ impl Studio {)}+ /// What the selection offers the tray's picture verbs: a picture on an+ /// unlocked lane, to mirror or turn; with one clip selected, a video or+ /// a still the playhead is inside of, to freeze there; and one video+ /// or sound clip to reverse, while no reverse is running.+ fn transform_tools(&self) -> (bool, bool, bool) {+ let at = f64::from(self.playhead);+ let edge = f64::from(MIN_DURATION);+ let sole = self.selection.len() == 1;+ let mut picture = false;+ let mut freezable = false;+ let mut reversible = false;+ for clip in self.selection.iter().filter_map(|id| self.clip(id)) {+ if self.locked(&clip.track_id) {+ continue;+ }+ let video = clip.kind == model::ClipKind::Video;+ if sole+ && self.reverse_jobs.is_empty()+ && (video || clip.kind == model::ClipKind::Audio)+ {+ reversible = true;+ }+ if clip.kind == model::ClipKind::Audio {+ continue;+ }+ picture = true;+ if sole+ && (video || clip.kind == model::ClipKind::Image)+ && at > clip.start + edge+ && at < clip.start + clip.duration - edge+ {+ freezable = true;+ }+ }+ (picture, freezable, reversible)+ }+/// Where a clip's sound is: whether it is a video clip whose sound is/// still on its picture, to take off, and whether it is a picture whose/// sound is off it - or that sound itself - to put back.@@ -5475,7 +5637,9 @@ impl Studio {self.pause();self.host.cutouts.cancel();self.host.enhancers.cancel();+ self.host.reversers.cancel();self.enhance_jobs.clear();+ self.reverse_jobs.clear();self.cutout_jobs.clear();self.region_job = None;if let Some(session) = self.session.as_mut() {@@ -6061,6 +6225,10 @@ impl Studio {let (sound_selected, title_selected) = self.sound_tools();editor.set_sound_selected(sound_selected);editor.set_title_selected(title_selected);+ let (picture_selected, freezable, reversible) = self.transform_tools();+ editor.set_picture_selected(picture_selected);+ editor.set_freezable(freezable);+ editor.set_reversible(reversible);editor.set_merge_blocked_because(match self.merge_blocked() {Some(reason) => reason.into(),None => SharedString::new(),@@ -7027,6 +7195,7 @@ impl Studio {.enhance_jobs.get(&clip.id).is_some_and(|(fetching, _)| *fetching),+ reverse_progress: self.reverse_jobs.get(&clip.id).copied().unwrap_or(-1.0),}}@@ -7901,6 +8070,59 @@ impl Studio {}}+ /// A quarter turn clockwise on every selected picture, at the playhead:+ /// a keyed rotation gets a key there and a constant one turns whole, as+ /// the stage's own rotate grip writes it. One undo step for the lot.+ pub fn rotate_selected(&mut self) {+ self.flush_commit();+ let playhead = self.playhead;+ let ids: Vec<String> = self+ .selection+ .iter()+ .filter(|id| {+ self.clip(id).is_some_and(|clip| {+ clip.kind != model::ClipKind::Audio && !self.locked(&clip.track_id)+ })+ })+ .cloned()+ .collect();+ let mut commands = Vec::new();+ for id in ids {+ let Some(before) = self.clip(&id).cloned() else {+ continue;+ };+ let mut after = before.clone();+ let at = place_in(&after, playhead);+ // Kept in the inspector's range, wrapping rather than stopping,+ // as the grip does.+ let next = (shown(&after, model::KeyProperty::Rotation, at) + 90.0 + 180.0)+ .rem_euclid(360.0)+ - 180.0;+ write_keyable(&mut after, model::KeyProperty::Rotation, next, at);+ if after.rotation != before.rotation {+ commands.push(Command::SetClipTransform {+ clip_id: id.clone(),+ scale: Some(after.scale),+ offset_x: Some(after.offset_x),+ offset_y: Some(after.offset_y),+ rotation: Some(after.rotation),+ stretch_x: Some(after.stretch_x),+ stretch_y: Some(after.stretch_y),+ });+ }+ commands.extend(key_commands(&id, &before, &after));+ }+ match commands.len() {+ 0 => {}+ 1 => {+ self.apply(commands.remove(0));+ }+ _ => {+ self.apply(Command::Batch { commands });+ }+ }+ }+pub fn toggle_flip_h(&mut self) {if self.selection.is_empty() {return;@@ -8006,6 +8228,20 @@ impl Studio {}"flip-h" => self.toggle_flip_h(),"flip-v" => self.toggle_flip_v(),+ // The tray's picture verbs. Mirror is the flip the H key does,+ // without the setting that gates the key: a button on the tray+ // is not a key someone might press by accident.+ "mirror" => self.toggle_flip_h(),+ "rotate" => self.rotate_selected(),+ "reverse" => {+ if let Some(id) = self.sole_selection() {+ self.reverse_clip(&id);+ }+ }+ "freeze" => {+ self.menu_target = None;+ self.freeze_at_playhead();+ }"paste" => {let Some(held) = self.clipboard.clone() else {return;diff --git a/src/crates/concat/ui/editor.slint b/src/crates/concat/ui/editor.slintindex 16a8a3eb..e1498ca4 100644--- a/src/crates/concat/ui/editor.slint+++ b/src/crates/concat/ui/editor.slint@@ -268,6 +268,13 @@ export global Editor {/// Hints, not gates - both sheets open without them.in-out property <bool> sound-selected;in-out property <bool> title-selected;+ /// And its picture verbs, freeze, reverse, mirror and rotate: a+ /// picture on an unlocked lane to mirror or turn, one the playhead is+ /// inside to freeze, and one video or sound clip to reverse while+ /// none is being reversed.+ in-out property <bool> picture-selected;+ in-out property <bool> freezable;+ in-out property <bool> reversible;in-out property <float> playhead;/// The selected clip's keys, as instants on the timeline: the ruler's/// diamonds. Empty unless exactly one clip is selected.diff --git a/src/crates/concat/ui/icons.slint b/src/crates/concat/ui/icons.slintindex 39b6a4e1..a783c9b5 100644--- a/src/crates/concat/ui/icons.slint+++ b/src/crates/concat/ui/icons.slint@@ -55,6 +55,12 @@ export enum Glyph {copy,flip-h,flip-v,+ /// the tray's picture verbs, freeze, mirror and rotate, behind one+ /// mark; and the quarter turn among them+ mirror-rotate,+ rotate,+ /// the turn the other way: a clip played backwards+ reverse,keyframe,/// the Keyframes pane's two views: bars stepping down a sheet, and an/// arc between two nodes@@ -692,6 +698,26 @@ export component Icon inherits Rectangle {commands: "M 4 8 L 20 8 M 4 16 L 20 16 M 8 4 L 8 20 M 16 4 L 16 20";}+ // lucide/flip-horizontal-2: two triangles either side of a dashed+ // axis, the mark over freeze, mirror and rotate on the tray.+ if root.glyph == Glyph.mirror-rotate: Stroked {+ size: root.size; tint: root.tint; weight: root.weight;+ commands: "m3 7 5 5-5 5V7 M21 7l-5 5 5 5V7 M12 20v2 M12 14v2 M12 8v2 M12 2v2";+ }++ // lucide/rotate-cw+ if root.glyph == Glyph.rotate: Stroked {+ size: root.size; tint: root.tint; weight: root.weight;+ commands: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8 M21 3v5h-5";+ }++ // lucide/rotate-ccw: the turn the other way, for a clip played+ // backwards.+ if root.glyph == Glyph.reverse: Stroked {+ size: root.size; tint: root.tint; weight: root.weight;+ commands: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8 M3 3v5h5";+ }+// hand-drawn: no library carries itif root.glyph == Glyph.flip-h: Stroked {size: root.size; tint: root.tint; weight: root.weight;diff --git a/src/crates/concat/ui/inspector/clip-inspector.slint b/src/crates/concat/ui/inspector/clip-inspector.slintindex aa674c0f..8ae9519d 100644--- a/src/crates/concat/ui/inspector/clip-inspector.slint+++ b/src/crates/concat/ui/inspector/clip-inspector.slint@@ -803,6 +803,20 @@ component EnhanceRow inherits Row {}}+/// Reverse at work on the clip's media: the span read forwards and written+/// back, into the copy the clip will show.+component ReverseRow inherits Row {+ in property <float> progress;++ label: I18n.t("Reverse");+ Text {+ text: I18n.t1("Reversing… {0}%", "\{Math.round(root.progress * 100)}");+ color: Theme.fg-muted;+ font-size: Theme.fs;+ vertical-alignment: center;+ }+}+// A rule between blocks inside one section, inset to the section's padding// where a Section's own hairline runs edge to edge.component Hairline inherits HorizontalLayout {@@ -1595,6 +1609,10 @@ export component SpeedPanel inherits VerticalLayout {}if speed.open: SectionBody {+ if root.selected.reverse-progress >= 0: ReverseRow {+ progress: root.selected.reverse-progress;+ }+Param {label: I18n.t("Rate");value <=> root.speed;diff --git a/src/crates/concat/ui/timeline/model.slint b/src/crates/concat/ui/timeline/model.slintindex 6e2312f9..e388cf95 100644--- a/src/crates/concat/ui/timeline/model.slint+++ b/src/crates/concat/ui/timeline/model.slint@@ -320,6 +320,9 @@ export struct SelectedClipData {// than frames being restoredenhance-progress: float,enhance-fetching: bool,+ /// Reverse writing this clip's backwards copy: -1 when it is not,+ /// else how far along+ reverse-progress: float,// the overlay, when this is a text clipcontent: string,diff --git a/src/crates/concat/ui/timeline/tray.slint b/src/crates/concat/ui/timeline/tray.slintindex 0a966d91..66bdcfa6 100644--- a/src/crates/concat/ui/timeline/tray.slint+++ b/src/crates/concat/ui/timeline/tray.slint@@ -74,6 +74,11 @@ export component TimelineTray inherits Rectangle {/// clip's worth of truth, decided by Rust; see the Editor global.in property <bool> sound-selected;in property <bool> title-selected;+ /// What the selection offers the picture verbs behind one mark: a+ /// picture to mirror or turn, and one the playhead is inside, to+ /// freeze. Rust's answers, like the two above.+ in property <bool> picture-selected;+ in property <bool> freezable;callback tool-changed(tool: TimelineTool);callback snap-changed(snap: bool);@@ -84,6 +89,9 @@ export component TimelineTray inherits Rectangle {/// at this x, in the tray's coordinates. The pane hosts the menu; see/// there for why.callback axis-menu-requested(x: length);+ /// The mark over freeze, mirror and rotate: open its menu under the+ /// button at this x, hosted by the pane like the axis menu.+ callback transform-menu-requested(x: length);callback undo();callback redo();callback split();@@ -181,6 +189,30 @@ export component TimelineTray inherits Rectangle {vertical-alignment: center;}+ // Freeze, mirror and rotate behind one mark: three verbs about the+ // selected clip's picture, and a tray has no room for three more+ // buttons. The mark and the chevron both open the menu, set flush+ // like the preview axis pair so they read as one control.+ verbs := HorizontalLayout {+ spacing: 0;++ TrayButton {+ glyph: Glyph.mirror-rotate;+ label: I18n.t("Freeze, mirror or rotate the selected clip");+ icon-size: 16px;+ enabled: root.selected-count > 0;+ clicked => { root.transform-menu-requested(verbs.x); }+ }+ TrayButton {+ width: 16px;+ glyph: Glyph.chevron-down;+ label: I18n.t("Freeze, mirror or rotate the selected clip");+ icon-size: 11px;+ enabled: root.selected-count > 0;+ clicked => { root.transform-menu-requested(verbs.x); }+ }+ }+Divider { }TrayButton {diff --git a/src/crates/concat/ui/workspace/seat.slint b/src/crates/concat/ui/workspace/seat.slintindex 29649432..df0b5c1c 100644--- a/src/crates/concat/ui/workspace/seat.slint+++ b/src/crates/concat/ui/workspace/seat.slint@@ -341,6 +341,9 @@ export component Seat inherits Rectangle {merge-blocked-because: Editor.merge-blocked-because;sound-selected: Editor.sound-selected;title-selected: Editor.title-selected;+ picture-selected: Editor.picture-selected;+ freezable: Editor.freezable;+ reversible: Editor.reversible;playhead: Editor.playhead;frame-rate: Editor.frame-rate;scroll-left: Editor.scroll-left;@@ -357,6 +360,7 @@ export component Seat inherits Rectangle {pan-changed(on) => { Editor.pan-changed(on); }preview-axis-changed(on) => { Editor.preview-axis-changed(on); }preview-axis-audio-changed(on) => { Editor.preview-axis-audio-changed(on); }+ clip-verb(action) => { Editor.shortcut(action); }hovered(seconds) => { Editor.hovered(seconds); }hover-ended => { Editor.hover-ended(); }undo => { Editor.undo(); }diff --git a/src/crates/concat/ui/workspace/timeline-pane.slint b/src/crates/concat/ui/workspace/timeline-pane.slintindex 262ebd3e..12c282cf 100644--- a/src/crates/concat/ui/workspace/timeline-pane.slint+++ b/src/crates/concat/ui/workspace/timeline-pane.slint@@ -47,6 +47,9 @@ export component TimelinePane inherits Rectangle {in property <string> merge-blocked-because;in property <bool> sound-selected;in property <bool> title-selected;+ in property <bool> picture-selected;+ in property <bool> freezable;+ in property <bool> reversible;callback tool-changed(tool: TimelineTool);callback snap-changed(snap: bool);@@ -59,6 +62,10 @@ export component TimelinePane inherits Rectangle {callback hover-ended();/// Bumped to open the preview axis menu; see ContextMenu.token.property <int> axis-token;+ /// Bumped to open the freeze, mirror and rotate menu.+ property <int> transform-token;+ /// One of that menu's verbs, by name: freeze, mirror, rotate.+ callback clip-verb(action: string);callback undo();callback redo();callback split();@@ -199,6 +206,63 @@ export component TimelinePane inherits Rectangle {selected(id) => { root.preview-axis-audio-changed(id == "axis-audio"); }}+ // The tray's picture verbs, hosted here for the same reason.+ transform-menu := ContextMenu {+ x: 0;+ y: 0;+ width: parent.width;+ height: parent.height;+ items: [+ {+ id: "freeze",+ label: I18n.t("Freeze"),+ kind: MenuRow.action,+ glyph: Glyph.frame,+ shortcut: "",+ enabled: root.freezable,+ danger: false,+ checkable: false,+ checked: false,+ },+ {+ id: "reverse",+ label: I18n.t("Reverse"),+ kind: MenuRow.action,+ glyph: Glyph.reverse,+ shortcut: "",+ enabled: root.reversible,+ danger: false,+ checkable: false,+ checked: false,+ },+ {+ id: "mirror",+ label: I18n.t("Mirror"),+ kind: MenuRow.action,+ glyph: Glyph.flip-h,+ shortcut: "",+ enabled: root.picture-selected,+ danger: false,+ checkable: false,+ checked: false,+ },+ {+ id: "rotate",+ label: I18n.t("Rotate"),+ kind: MenuRow.action,+ glyph: Glyph.rotate,+ shortcut: "",+ enabled: root.picture-selected,+ danger: false,+ checkable: false,+ checked: false,+ },+ ];+ menu-height: 4 * MenuMetrics.action + MenuMetrics.padding;+ token: root.transform-token;+ selected(id) => { root.clip-verb(id); }+ }+Pane {// The one edge kept when the outlines came off. The timeline sits// under the three panes above it rather than beside anything, so its@@ -244,6 +308,8 @@ export component TimelinePane inherits Rectangle {merge-blocked-because: root.merge-blocked-because;sound-selected: root.sound-selected;title-selected: root.title-selected;+ picture-selected: root.picture-selected;+ freezable: root.freezable;tool-changed(tool) => { root.tool-changed(tool); }snap-changed(snap) => { root.snap-changed(snap); }@@ -259,6 +325,12 @@ export component TimelinePane inherits Rectangle {+ tray.height;root.axis-token += 1;}+ transform-menu-requested(x) => {+ transform-menu.request-x = tray.absolute-position.x - root.absolute-position.x + x;+ transform-menu.request-y = tray.absolute-position.y - root.absolute-position.y+ + tray.height;+ root.transform-token += 1;+ }undo => { root.undo(); }redo => { root.redo(); }split => { root.split(); }