Clips can name a dissolve into their neighbor (edith 19, storage+format)
Browse files at this commit8369d8eed8c7d1003865fb9f6f2d893fa5e32ac6Parent: c6b5eb7- feat
- clips can name a dissolve into their neighbor (edith 19, storage+format)
14 changed files +312 -55
- crates/engine/examples/bench.rs +1 -0
- crates/engine/src/edith.rs +121 -48
- crates/engine/src/playback.rs +3 -0
- crates/engine/src/project.rs +129 -7
- crates/engine/src/proxy.rs +1 -0
- crates/engine/src/scale.rs +37 -0
- crates/engine/src/silence.rs +1 -0
- crates/engine/src/sweep.rs +1 -0
- crates/engine/tests/audio_export.rs +9 -0
- crates/engine/tests/eq_audio.rs +1 -0
- crates/engine/tests/export.rs +2 -0
- crates/engine/tests/lanes.rs +2 -0
- crates/engine/tests/opus_export.rs +2 -0
- crates/engine/tests/silence.rs +2 -0
crates/engine/examples/bench.rsmodified+1 -0
| @@ -862,6 +862,7 @@ fn export_bench(path: &Path, seat: &str, out_dir: &Path) { | |||
| 862 | let clip = Clip { | 862 | let clip = Clip { |
| 863 | fade_in: 0, | 863 | fade_in: 0, |
| 864 | fade_out: 0, | 864 | fade_out: 0, |
| 865 | + transition_out: 0, | ||
| 865 | start: 0, | 866 | start: 0, |
| 866 | in_frame, | 867 | in_frame, |
| 867 | out_frame: in_frame + span, | 868 | out_frame: in_frame + span, |
crates/engine/src/edith.rsmodified+121 -48
| @@ -110,7 +110,7 @@ | |||
| 110 | //! -- the first colour line is color 0 -- printed and refused by the same rules. | 110 | //! -- the first colour line is color 0 -- printed and refused by the same rules. |
| 111 | //! | 111 | //! |
| 112 | //! A lane line is `<kind> <lane> <start> <in> <out> <source> <link> <eq> | 112 | //! A lane line is `<kind> <lane> <start> <in> <out> <source> <link> <eq> |
| 113 | -//! <color> <fit> <speed> <fade_in> <fade_out>`: which lane the clip is on -- its kind and its 1-based number | 113 | +//! <color> <fit> <speed> <fade_in> <fade_out> <transition_out>`: which lane the clip is on -- its kind and its 1-based number |
| 114 | //! among the lanes of that kind, the [`crate::project::Lane::label`] a header | 114 | //! among the lanes of that kind, the [`crate::project::Lane::label`] a header |
| 115 | //! column shows -- then where the clip sits on the timeline, the half-open | 115 | //! column shows -- then where the clip sits on the timeline, the half-open |
| 116 | //! source range it plays, the file it plays from, its group id, the eq line it | 116 | //! source range it plays, the file it plays from, its group id, the eq line it |
| @@ -120,7 +120,9 @@ | |||
| 120 | //! in thousandths of real time ([`crate::project::Speed`], `1000` for a clip | 120 | //! in thousandths of real time ([`crate::project::Speed`], `1000` for a clip |
| 121 | //! nobody has speeded), and finally its ramp up from silence and ramp down to | 121 | //! nobody has speeded), and finally its ramp up from silence and ramp down to |
| 122 | //! it, in timeline frames ([`crate::project::Clip::fade_in`], | 122 | //! it, in timeline frames ([`crate::project::Clip::fade_in`], |
| 123 | -//! [`crate::project::Clip::fade_out`], `0 0` for a clip nobody has faded). | 123 | +//! [`crate::project::Clip::fade_out`], `0 0` for a clip nobody has faded), and |
| 124 | +//! finally its cross-dissolve into whatever abuts its end | ||
| 125 | +//! ([`crate::project::Clip::transition_out`], `0` for a hard cut). | ||
| 124 | //! Timeline placement is | 126 | //! Timeline placement is |
| 125 | //! explicit, so a *gap* is simply a stretch no line covers -- there is nothing | 127 | //! explicit, so a *gap* is simply a stretch no line covers -- there is nothing |
| 126 | //! to write for one, and nothing that can disagree about its length. The `<in>` | 128 | //! to write for one, and nothing that can disagree about its length. The `<in>` |
| @@ -221,7 +223,8 @@ use crate::subtitle::SubtitleTrack; | |||
| 221 | 223 | ||
| 222 | /// What [`save`] writes. Read support goes back to `edith 1`; see the module | 224 | /// What [`save`] writes. Read support goes back to `edith 1`; see the module |
| 223 | /// docs for what those dialects looked like. | 225 | /// docs for what those dialects looked like. |
| 224 | -const MAGIC: &[u8] = b"edith 18"; | 226 | +const MAGIC: &[u8] = b"edith 19"; |
| 227 | +const MAGIC_V18: &[u8] = b"edith 18"; | ||
| 225 | const MAGIC_V17: &[u8] = b"edith 17"; | 228 | const MAGIC_V17: &[u8] = b"edith 17"; |
| 226 | const MAGIC_V16: &[u8] = b"edith 16"; | 229 | const MAGIC_V16: &[u8] = b"edith 16"; |
| 227 | const MAGIC_V15: &[u8] = b"edith 15"; | 230 | const MAGIC_V15: &[u8] = b"edith 15"; |
| @@ -555,7 +558,7 @@ fn emit( | |||
| 555 | let color = c.color.map_or("-".to_string(), |e| e.to_string()); | 558 | let color = c.color.map_or("-".to_string(), |e| e.to_string()); |
| 556 | out.extend_from_slice( | 559 | out.extend_from_slice( |
| 557 | format!( | 560 | format!( |
| 558 | - "{keyword} {ord} {} {} {} {} {link} {eq} {color} {} {} {} {}\n", | 561 | + "{keyword} {ord} {} {} {} {} {link} {eq} {color} {} {} {} {} {}\n", |
| 559 | c.start, | 562 | c.start, |
| 560 | c.in_frame, | 563 | c.in_frame, |
| 561 | c.out_frame, | 564 | c.out_frame, |
| @@ -564,6 +567,7 @@ fn emit( | |||
| 564 | c.speed.permille(), | 567 | c.speed.permille(), |
| 565 | c.fade_in, | 568 | c.fade_in, |
| 566 | c.fade_out, | 569 | c.fade_out, |
| 570 | + c.transition_out, | ||
| 567 | ) | 571 | ) |
| 568 | .as_bytes(), | 572 | .as_bytes(), |
| 569 | ); | 573 | ); |
| @@ -606,8 +610,10 @@ fn parse(data: &[u8], dir: &Path) -> crate::Result<Document> { | |||
| 606 | // The dialects that wrote a source line without its stream field. Reading | 610 | // The dialects that wrote a source line without its stream field. Reading |
| 607 | // one is the whole of what "an old project still opens" means here. | 611 | // one is the whole of what "an old project still opens" means here. |
| 608 | let streamless = v1 || first == MAGIC_V2; | 612 | let streamless = v1 || first == MAGIC_V2; |
| 609 | - // The one that carries a per-clip fade envelope... | 613 | + // The one that carries a per-clip cross-dissolve into its successor... |
| 610 | - let v18 = first == MAGIC; | 614 | + let v19 = first == MAGIC; |
| 615 | + // ...the one that carries a per-clip fade envelope... | ||
| 616 | + let v18 = v19 || first == MAGIC_V18; | ||
| 611 | // ...the one that carries an explicit sound rate... | 617 | // ...the one that carries an explicit sound rate... |
| 612 | let v17 = v18 || first == MAGIC_V17; | 618 | let v17 = v18 || first == MAGIC_V17; |
| 613 | // ...the one whose captions may carry a group id... | 619 | // ...the one whose captions may carry a group id... |
| @@ -975,6 +981,7 @@ fn parse(data: &[u8], dir: &Path) -> crate::Result<Document> { | |||
| 975 | Clip { | 981 | Clip { |
| 976 | fade_in: 0, | 982 | fade_in: 0, |
| 977 | fade_out: 0, | 983 | fade_out: 0, |
| 984 | + transition_out: 0, | ||
| 978 | start: queued, | 985 | start: queued, |
| 979 | in_frame: number(f[0], n)?, | 986 | in_frame: number(f[0], n)?, |
| 980 | out_frame: number(f[1], n)?, | 987 | out_frame: number(f[1], n)?, |
| @@ -1093,15 +1100,16 @@ fn parse(data: &[u8], dir: &Path) -> crate::Result<Document> { | |||
| 1093 | if numbered && rest.is_empty() { | 1100 | if numbered && rest.is_empty() { |
| 1094 | continue; | 1101 | continue; |
| 1095 | } | 1102 | } |
| 1096 | - // v18 grew the two fade fields, v8 the speed one, v7 the fit | 1103 | + // v18 grew the two fade fields, v19 the transition one, v8 |
| 1097 | - // one, v6 the colour one and v5 the eq one; every older | 1104 | + // the speed one, v7 the fit one, v6 the colour one and v5 the |
| 1098 | - // dialect ends at the link. | 1105 | + // eq one; every older dialect ends at the link. |
| 1099 | let want = 5 | 1106 | let want = 5 |
| 1100 | + usize::from(v5) | 1107 | + usize::from(v5) |
| 1101 | + usize::from(v6) | 1108 | + usize::from(v6) |
| 1102 | + usize::from(v7) | 1109 | + usize::from(v7) |
| 1103 | + usize::from(v8) | 1110 | + usize::from(v8) |
| 1104 | - + 2 * usize::from(v18); | 1111 | + + 2 * usize::from(v18) |
| 1112 | + + usize::from(v19); | ||
| 1105 | let f = fields(rest, want, "clip", n)?; | 1113 | let f = fields(rest, want, "clip", n)?; |
| 1106 | let in_frame = number(f[1], n)?; | 1114 | let in_frame = number(f[1], n)?; |
| 1107 | let out_frame = number(f[2], n)?; | 1115 | let out_frame = number(f[2], n)?; |
| @@ -1115,6 +1123,7 @@ fn parse(data: &[u8], dir: &Path) -> crate::Result<Document> { | |||
| 1115 | Clip { | 1123 | Clip { |
| 1116 | fade_in: number(f.get(9).copied().unwrap_or(b"0"), n)?.min(frames), | 1124 | fade_in: number(f.get(9).copied().unwrap_or(b"0"), n)?.min(frames), |
| 1117 | fade_out: number(f.get(10).copied().unwrap_or(b"0"), n)?.min(frames), | 1125 | fade_out: number(f.get(10).copied().unwrap_or(b"0"), n)?.min(frames), |
| 1126 | + transition_out: number(f.get(11).copied().unwrap_or(b"0"), n)?.min(frames), | ||
| 1118 | start: number(f[0], n)?, | 1127 | start: number(f[0], n)?, |
| 1119 | in_frame, | 1128 | in_frame, |
| 1120 | out_frame, | 1129 | out_frame, |
| @@ -1536,7 +1545,7 @@ mod tests { | |||
| 1536 | video 1 0 0 30 0 - - - fit 1000\n"; | 1545 | video 1 0 0 30 0 - - - fit 1000\n"; |
| 1537 | let old = parse(v9, &dir).expect("v9 still loads"); | 1546 | let old = parse(v9, &dir).expect("v9 still loads"); |
| 1538 | assert_eq!(old.subtitles, Vec::new()); | 1547 | assert_eq!(old.subtitles, Vec::new()); |
| 1539 | - assert!(flat(&dir, &old.sources, &old.lanes, old.playhead).starts_with(b"edith 18\n")); | 1548 | + assert!(flat(&dir, &old.sources, &old.lanes, old.playhead).starts_with(b"edith 19\n")); |
| 1540 | // ...and the line itself is not a v9 line: a dialect may not be mixed. | 1549 | // ...and the line itself is not a v9 line: a dialect may not be mixed. |
| 1541 | let mixed = parse(b"edith 9\nsource 0 a.mp4\nsubtitle - subs.srt\n", &dir) | 1550 | let mixed = parse(b"edith 9\nsource 0 a.mp4\nsubtitle - subs.srt\n", &dir) |
| 1542 | .unwrap_err() | 1551 | .unwrap_err() |
| @@ -1948,6 +1957,7 @@ mod tests { | |||
| 1948 | Clip { | 1957 | Clip { |
| 1949 | fade_in: 0, | 1958 | fade_in: 0, |
| 1950 | fade_out: 0, | 1959 | fade_out: 0, |
| 1960 | + transition_out: 0, | ||
| 1951 | start, | 1961 | start, |
| 1952 | in_frame, | 1962 | in_frame, |
| 1953 | out_frame, | 1963 | out_frame, |
| @@ -2006,10 +2016,10 @@ mod tests { | |||
| 2006 | let bytes = flat(&dir, &sources, &lanes, 12); | 2016 | let bytes = flat(&dir, &sources, &lanes, 12); |
| 2007 | assert_eq!( | 2017 | assert_eq!( |
| 2008 | String::from_utf8_lossy(&bytes), | 2018 | String::from_utf8_lossy(&bytes), |
| 2009 | - "edith 18\nplayhead 12\nresolution 1280 720\nsource 0 a.mp4\n\ | 2019 | + "edith 19\nplayhead 12\nresolution 1280 720\nsource 0 a.mp4\n\ |
| 2010 | source 2 /elsewhere/b.mp4\n\ | 2020 | source 2 /elsewhere/b.mp4\n\ |
| 2011 | - video 1 0 0 30 0 0 - - fit 1000 0 0\nvideo 1 30 10 20 1 1 - - fit 1000 0 0\n\ | 2021 | + video 1 0 0 30 0 0 - - fit 1000 0 0 0\nvideo 1 30 10 20 1 1 - - fit 1000 0 0 0\n\ |
| 2012 | - audio 1 0 0 30 0 0 - - fit 1000 0 0\n", | 2022 | + audio 1 0 0 30 0 0 - - fit 1000 0 0 0\n", |
| 2013 | "the file under the project directory is written relative to it, \ | 2023 | "the file under the project directory is written relative to it, \ |
| 2014 | each with the audio stream it plays" | 2024 | each with the audio stream it plays" |
| 2015 | ); | 2025 | ); |
| @@ -2043,9 +2053,9 @@ mod tests { | |||
| 2043 | let bytes = flat(&dir, &sources, &lanes, 7); | 2053 | let bytes = flat(&dir, &sources, &lanes, 7); |
| 2044 | assert_eq!( | 2054 | assert_eq!( |
| 2045 | String::from_utf8_lossy(&bytes), | 2055 | String::from_utf8_lossy(&bytes), |
| 2046 | - "edith 18\nplayhead 7\nresolution 1280 720\nsource 0 a.mp4\n\ | 2056 | + "edith 19\nplayhead 7\nresolution 1280 720\nsource 0 a.mp4\n\ |
| 2047 | - video 1 0 0 30 0 4 - - fit 1000 0 0\naudio 1\n\ | 2057 | + video 1 0 0 30 0 4 - - fit 1000 0 0 0\naudio 1\n\ |
| 2048 | - video 2 40 0 10 0 - - - fit 1000 0 0\naudio 2 0 0 30 0 4 - - fit 1000 0 0\n", | 2058 | + video 2 40 0 10 0 - - - fit 1000 0 0 0\naudio 2 0 0 30 0 4 - - fit 1000 0 0 0\n", |
| 2049 | "an empty lane is a line of its own; everything else is its clips" | 2059 | "an empty lane is a line of its own; everything else is its clips" |
| 2050 | ); | 2060 | ); |
| 2051 | let back = parse(&bytes, &dir).expect("parse"); | 2061 | let back = parse(&bytes, &dir).expect("parse"); |
| @@ -2131,12 +2141,14 @@ mod tests { | |||
| 2131 | Clip { | 2141 | Clip { |
| 2132 | fade_in: 0, | 2142 | fade_in: 0, |
| 2133 | fade_out: 0, | 2143 | fade_out: 0, |
| 2144 | + transition_out: 0, | ||
| 2134 | eq: Some(0), | 2145 | eq: Some(0), |
| 2135 | ..clip(0, 0, 30, 0, Some(0)) | 2146 | ..clip(0, 0, 30, 0, Some(0)) |
| 2136 | }, | 2147 | }, |
| 2137 | Clip { | 2148 | Clip { |
| 2138 | fade_in: 0, | 2149 | fade_in: 0, |
| 2139 | fade_out: 0, | 2150 | fade_out: 0, |
| 2151 | + transition_out: 0, | ||
| 2140 | eq: Some(1), | 2152 | eq: Some(1), |
| 2141 | ..clip(30, 10, 20, 0, None) | 2153 | ..clip(30, 10, 20, 0, None) |
| 2142 | }, | 2154 | }, |
| @@ -2145,12 +2157,14 @@ mod tests { | |||
| 2145 | Clip { | 2157 | Clip { |
| 2146 | fade_in: 0, | 2158 | fade_in: 0, |
| 2147 | fade_out: 0, | 2159 | fade_out: 0, |
| 2160 | + transition_out: 0, | ||
| 2148 | eq: Some(0), | 2161 | eq: Some(0), |
| 2149 | ..clip(0, 0, 30, 0, Some(0)) | 2162 | ..clip(0, 0, 30, 0, Some(0)) |
| 2150 | }, | 2163 | }, |
| 2151 | Clip { | 2164 | Clip { |
| 2152 | fade_in: 0, | 2165 | fade_in: 0, |
| 2153 | fade_out: 0, | 2166 | fade_out: 0, |
| 2167 | + transition_out: 0, | ||
| 2154 | eq: Some(2), | 2168 | eq: Some(2), |
| 2155 | ..clip(30, 0, 10, 0, None) | 2169 | ..clip(30, 0, 10, 0, None) |
| 2156 | }, | 2170 | }, |
| @@ -2159,12 +2173,12 @@ mod tests { | |||
| 2159 | let bytes = emit(&dir, &sources, &lanes, &eq, &[], (1280, 720), 0); | 2173 | let bytes = emit(&dir, &sources, &lanes, &eq, &[], (1280, 720), 0); |
| 2160 | assert_eq!( | 2174 | assert_eq!( |
| 2161 | String::from_utf8_lossy(&bytes), | 2175 | String::from_utf8_lossy(&bytes), |
| 2162 | - "edith 18\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\ | 2176 | + "edith 19\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\ |
| 2163 | eq 80.0:-3.0:0.707:ls 1000.0:4.5:1.0:pk\n\ | 2177 | eq 80.0:-3.0:0.707:ls 1000.0:4.5:1.0:pk\n\ |
| 2164 | eq 16777215.0:-0.1:3.918315e-39:hs\n\ | 2178 | eq 16777215.0:-0.1:3.918315e-39:hs\n\ |
| 2165 | eq\n\ | 2179 | eq\n\ |
| 2166 | - video 1 0 0 30 0 0 0 - fit 1000 0 0\nvideo 1 30 10 20 0 - 1 - fit 1000 0 0\n\ | 2180 | + video 1 0 0 30 0 0 0 - fit 1000 0 0 0\nvideo 1 30 10 20 0 - 1 - fit 1000 0 0 0\n\ |
| 2167 | - audio 1 0 0 30 0 0 0 - fit 1000 0 0\naudio 1 30 0 10 0 - 2 - fit 1000 0 0\n", | 2181 | + audio 1 0 0 30 0 0 0 - fit 1000 0 0 0\naudio 1 30 0 10 0 - 2 - fit 1000 0 0 0\n", |
| 2168 | "the table comes before the clips, and a clip names a line of it" | 2182 | "the table comes before the clips, and a clip names a line of it" |
| 2169 | ); | 2183 | ); |
| 2170 | 2184 | ||
| @@ -2235,6 +2249,7 @@ mod tests { | |||
| 2235 | Clip { | 2249 | Clip { |
| 2236 | fade_in: 0, | 2250 | fade_in: 0, |
| 2237 | fade_out: 0, | 2251 | fade_out: 0, |
| 2252 | + transition_out: 0, | ||
| 2238 | color: Some(0), | 2253 | color: Some(0), |
| 2239 | fit: FitPolicy::default(), | 2254 | fit: FitPolicy::default(), |
| 2240 | speed: Speed::NORMAL, | 2255 | speed: Speed::NORMAL, |
| @@ -2243,6 +2258,7 @@ mod tests { | |||
| 2243 | Clip { | 2258 | Clip { |
| 2244 | fade_in: 0, | 2259 | fade_in: 0, |
| 2245 | fade_out: 0, | 2260 | fade_out: 0, |
| 2261 | + transition_out: 0, | ||
| 2246 | color: Some(1), | 2262 | color: Some(1), |
| 2247 | fit: FitPolicy::default(), | 2263 | fit: FitPolicy::default(), |
| 2248 | speed: Speed::NORMAL, | 2264 | speed: Speed::NORMAL, |
| @@ -2253,6 +2269,7 @@ mod tests { | |||
| 2253 | Clip { | 2269 | Clip { |
| 2254 | fade_in: 0, | 2270 | fade_in: 0, |
| 2255 | fade_out: 0, | 2271 | fade_out: 0, |
| 2272 | + transition_out: 0, | ||
| 2256 | color: Some(0), | 2273 | color: Some(0), |
| 2257 | fit: FitPolicy::default(), | 2274 | fit: FitPolicy::default(), |
| 2258 | speed: Speed::NORMAL, | 2275 | speed: Speed::NORMAL, |
| @@ -2261,6 +2278,7 @@ mod tests { | |||
| 2261 | Clip { | 2278 | Clip { |
| 2262 | fade_in: 0, | 2279 | fade_in: 0, |
| 2263 | fade_out: 0, | 2280 | fade_out: 0, |
| 2281 | + transition_out: 0, | ||
| 2264 | color: Some(2), | 2282 | color: Some(2), |
| 2265 | fit: FitPolicy::default(), | 2283 | fit: FitPolicy::default(), |
| 2266 | speed: Speed::NORMAL, | 2284 | speed: Speed::NORMAL, |
| @@ -2271,12 +2289,12 @@ mod tests { | |||
| 2271 | let bytes = emit(&dir, &sources, &lanes, &[], &color, (1280, 720), 0); | 2289 | let bytes = emit(&dir, &sources, &lanes, &[], &color, (1280, 720), 0); |
| 2272 | assert_eq!( | 2290 | assert_eq!( |
| 2273 | String::from_utf8_lossy(&bytes), | 2291 | String::from_utf8_lossy(&bytes), |
| 2274 | - "edith 18\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\ | 2292 | + "edith 19\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\ |
| 2275 | color 0.1:1.2:0.9:-0.3\n\ | 2293 | color 0.1:1.2:0.9:-0.3\n\ |
| 2276 | color -1e-7:16777215.0:3.918315e-39:-0.0\n\ | 2294 | color -1e-7:16777215.0:3.918315e-39:-0.0\n\ |
| 2277 | color 0.0:1.0:1.0:0.0\n\ | 2295 | color 0.0:1.0:1.0:0.0\n\ |
| 2278 | - video 1 0 0 30 0 0 - 0 fit 1000 0 0\nvideo 1 30 10 20 0 - - 1 fit 1000 0 0\n\ | 2296 | + video 1 0 0 30 0 0 - 0 fit 1000 0 0 0\nvideo 1 30 10 20 0 - - 1 fit 1000 0 0 0\n\ |
| 2279 | - audio 1 0 0 30 0 0 - 0 fit 1000 0 0\naudio 1 30 0 10 0 - - 2 fit 1000 0 0\n", | 2297 | + audio 1 0 0 30 0 0 - 0 fit 1000 0 0 0\naudio 1 30 0 10 0 - - 2 fit 1000 0 0 0\n", |
| 2280 | "the table comes before the clips, and a clip names a line of it" | 2298 | "the table comes before the clips, and a clip names a line of it" |
| 2281 | ); | 2299 | ); |
| 2282 | 2300 | ||
| @@ -2336,9 +2354,9 @@ mod tests { | |||
| 2336 | (1280, 720), | 2354 | (1280, 720), |
| 2337 | old.playhead | 2355 | old.playhead |
| 2338 | )), | 2356 | )), |
| 2339 | - "edith 18\nplayhead 3\nresolution 1280 720\nsource 0 a.mp4\n\ | 2357 | + "edith 19\nplayhead 3\nresolution 1280 720\nsource 0 a.mp4\n\ |
| 2340 | eq 80.0:-3.0:0.707:ls\n\ | 2358 | eq 80.0:-3.0:0.707:ls\n\ |
| 2341 | - video 1 0 0 30 0 0 0 - fit 1000 0 0\naudio 1 0 0 30 0 0 - - fit 1000 0 0\n" | 2359 | + video 1 0 0 30 0 0 0 - fit 1000 0 0 0\naudio 1 0 0 30 0 0 - - fit 1000 0 0 0\n" |
| 2342 | ); | 2360 | ); |
| 2343 | } | 2361 | } |
| 2344 | 2362 | ||
| @@ -2353,6 +2371,7 @@ mod tests { | |||
| 2353 | let speeded = |start, in_frame, out_frame, permille| Clip { | 2371 | let speeded = |start, in_frame, out_frame, permille| Clip { |
| 2354 | fade_in: 0, | 2372 | fade_in: 0, |
| 2355 | fade_out: 0, | 2373 | fade_out: 0, |
| 2374 | + transition_out: 0, | ||
| 2356 | start, | 2375 | start, |
| 2357 | in_frame, | 2376 | in_frame, |
| 2358 | out_frame, | 2377 | out_frame, |
| @@ -2376,9 +2395,9 @@ mod tests { | |||
| 2376 | let bytes = emit(&dir, &sources, &lanes, &[], &[], (1280, 720), 0); | 2395 | let bytes = emit(&dir, &sources, &lanes, &[], &[], (1280, 720), 0); |
| 2377 | assert_eq!( | 2396 | assert_eq!( |
| 2378 | String::from_utf8_lossy(&bytes), | 2397 | String::from_utf8_lossy(&bytes), |
| 2379 | - "edith 18\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\ | 2398 | + "edith 19\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\ |
| 2380 | - video 1 0 0 30 0 - - - fit 2000 0 0\nvideo 1 15 30 40 0 - - - fit 250 0 0\n\ | 2399 | + video 1 0 0 30 0 - - - fit 2000 0 0 0\nvideo 1 15 30 40 0 - - - fit 250 0 0 0\n\ |
| 2381 | - audio 1 0 0 30 0 - - - fit 2000 0 0\n", | 2400 | + audio 1 0 0 30 0 - - - fit 2000 0 0 0\n", |
| 2382 | "the rate is the clip line's last field, in thousandths" | 2401 | "the rate is the clip line's last field, in thousandths" |
| 2383 | ); | 2402 | ); |
| 2384 | let back = parse(&bytes, &dir).expect("parse"); | 2403 | let back = parse(&bytes, &dir).expect("parse"); |
| @@ -2405,8 +2424,8 @@ mod tests { | |||
| 2405 | (1280, 720), | 2424 | (1280, 720), |
| 2406 | old.playhead | 2425 | old.playhead |
| 2407 | )), | 2426 | )), |
| 2408 | - "edith 18\nplayhead 3\nresolution 1280 720\nsource 0 a.mp4\n\ | 2427 | + "edith 19\nplayhead 3\nresolution 1280 720\nsource 0 a.mp4\n\ |
| 2409 | - video 1 0 0 30 0 0 - - fit 1000 0 0\naudio 1 0 0 30 0 0 - - fit 1000 0 0\n" | 2428 | + video 1 0 0 30 0 0 - - fit 1000 0 0 0\naudio 1 0 0 30 0 0 - - fit 1000 0 0 0\n" |
| 2410 | ); | 2429 | ); |
| 2411 | // A rate outside what the editor can set is a corrupt line, by name. | 2430 | // A rate outside what the editor can set is a corrupt line, by name. |
| 2412 | let bad = b"edith 8\nsource 0 a.mp4\nvideo 1 0 0 30 0 - - - fit 9000\n"; | 2431 | let bad = b"edith 8\nsource 0 a.mp4\nvideo 1 0 0 30 0 - - - fit 9000\n"; |
| @@ -2438,6 +2457,7 @@ mod tests { | |||
| 2438 | let faded = Clip { | 2457 | let faded = Clip { |
| 2439 | fade_in: 5, | 2458 | fade_in: 5, |
| 2440 | fade_out: 7, | 2459 | fade_out: 7, |
| 2460 | + transition_out: 0, | ||
| 2441 | start: 0, | 2461 | start: 0, |
| 2442 | in_frame: 0, | 2462 | in_frame: 0, |
| 2443 | out_frame: 30, | 2463 | out_frame: 30, |
| @@ -2452,14 +2472,67 @@ mod tests { | |||
| 2452 | let bytes = emit(&dir, &sources, &lanes, &[], &[], (1280, 720), 0); | 2472 | let bytes = emit(&dir, &sources, &lanes, &[], &[], (1280, 720), 0); |
| 2453 | assert_eq!( | 2473 | assert_eq!( |
| 2454 | String::from_utf8_lossy(&bytes), | 2474 | String::from_utf8_lossy(&bytes), |
| 2455 | - "edith 18\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\ | 2475 | + "edith 19\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\ |
| 2456 | - video 1 0 0 30 0 - - - fit 1000 5 7\n", | 2476 | + video 1 0 0 30 0 - - - fit 1000 5 7 0\n", |
| 2457 | "the fades are the clip line's last two fields" | 2477 | "the fades are the clip line's last two fields" |
| 2458 | ); | 2478 | ); |
| 2459 | let back = parse(&bytes, &dir).expect("parse"); | 2479 | let back = parse(&bytes, &dir).expect("parse"); |
| 2460 | assert_eq!(back.lanes, lanes, "the fades round trip as the very numbers"); | 2480 | assert_eq!(back.lanes, lanes, "the fades round trip as the very numbers"); |
| 2461 | } | 2481 | } |
| 2462 | 2482 | ||
| 2483 | + /// The whole of the v19 bump, the fade test's twin: a clip's dissolve into | ||
| 2484 | + /// its successor is written as the clip line's own last field, comes back | ||
| 2485 | + /// as the very number that was set, and a v18 file -- which has no such | ||
| 2486 | + /// field -- loads with every clip's [`Clip::transition_out`] at zero and | ||
| 2487 | + /// re-saves saying so. | ||
| 2488 | + #[test] | ||
| 2489 | + fn a_v18_file_loads_with_no_transition_and_transitions_round_trip_bit_exactly() { | ||
| 2490 | + let dir = PathBuf::from("/proj"); | ||
| 2491 | + // The v18 dialect: eleven clip fields, the last the fade-out -- no | ||
| 2492 | + // transition field after it at all, not even a zero. | ||
| 2493 | + let v18 = b"edith 18\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\ | ||
| 2494 | + video 1 0 0 30 0 - - - fit 1000 0 0\naudio 1 0 0 30 0 - - - fit 1000 0 0\n"; | ||
| 2495 | + let old = parse(v18, &dir).expect("v18 parses"); | ||
| 2496 | + assert!( | ||
| 2497 | + old.lanes | ||
| 2498 | + .iter() | ||
| 2499 | + .flat_map(|(_, clips)| clips) | ||
| 2500 | + .all(|c| c.transition_out == 0), | ||
| 2501 | + "nothing before v19 had a dissolve to name" | ||
| 2502 | + ); | ||
| 2503 | + | ||
| 2504 | + // ...and the dialect that does: a nonzero dissolve, written and read | ||
| 2505 | + // back as the very number. | ||
| 2506 | + let sources = vec![Source::new("/proj/a.mp4", 0)]; | ||
| 2507 | + let dissolving = Clip { | ||
| 2508 | + fade_in: 0, | ||
| 2509 | + fade_out: 0, | ||
| 2510 | + transition_out: 9, | ||
| 2511 | + start: 0, | ||
| 2512 | + in_frame: 0, | ||
| 2513 | + out_frame: 30, | ||
| 2514 | + source: 0, | ||
| 2515 | + link: None, | ||
| 2516 | + eq: None, | ||
| 2517 | + color: None, | ||
| 2518 | + fit: FitPolicy::default(), | ||
| 2519 | + speed: Speed::NORMAL, | ||
| 2520 | + }; | ||
| 2521 | + let lanes = vec![(LaneKind::Video, vec![dissolving])]; | ||
| 2522 | + let bytes = emit(&dir, &sources, &lanes, &[], &[], (1280, 720), 0); | ||
| 2523 | + assert_eq!( | ||
| 2524 | + String::from_utf8_lossy(&bytes), | ||
| 2525 | + "edith 19\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\ | ||
| 2526 | + video 1 0 0 30 0 - - - fit 1000 0 0 9\n", | ||
| 2527 | + "the dissolve is the clip line's own last field" | ||
| 2528 | + ); | ||
| 2529 | + let back = parse(&bytes, &dir).expect("parse"); | ||
| 2530 | + assert_eq!( | ||
| 2531 | + back.lanes, lanes, | ||
| 2532 | + "the dissolve round trips as the very number" | ||
| 2533 | + ); | ||
| 2534 | + } | ||
| 2535 | + | ||
| 2463 | /// The whole of the v9 bump, the speed test's twin: the mix a project was | 2536 | /// The whole of the v9 bump, the speed test's twin: the mix a project was |
| 2464 | /// left at -- every track's own volume and the master limiter -- plus the | 2537 | /// left at -- every track's own volume and the master limiter -- plus the |
| 2465 | /// rate it was cut at, all written, all read back as the very numbers, and | 2538 | /// rate it was cut at, all written, all read back as the very numbers, and |
| @@ -2500,10 +2573,10 @@ mod tests { | |||
| 2500 | ); | 2573 | ); |
| 2501 | assert_eq!( | 2574 | assert_eq!( |
| 2502 | String::from_utf8_lossy(&bytes), | 2575 | String::from_utf8_lossy(&bytes), |
| 2503 | - "edith 18\nplayhead 0\nresolution 1280 720\nfps 23.976023976023978\n\ | 2576 | + "edith 19\nplayhead 0\nresolution 1280 720\nfps 23.976023976023978\n\ |
| 2504 | limiter -1.5 on\nsource 0 a.mp4\n\ | 2577 | limiter -1.5 on\nsource 0 a.mp4\n\ |
| 2505 | - video 1 0 0 30 0 - - - fit 1000 0 0\naudio 1 0 0 30 0 - - - fit 1000 0 0\n\ | 2578 | + video 1 0 0 30 0 - - - fit 1000 0 0 0\naudio 1 0 0 30 0 - - - fit 1000 0 0 0\n\ |
| 2506 | - audio 2 0 0 30 0 - - - fit 1000 0 0\n\ | 2579 | + audio 2 0 0 30 0 - - - fit 1000 0 0 0\n\ |
| 2507 | gain audio 1 3.0\ngain audio 2 -6.5\n", | 2580 | gain audio 1 3.0\ngain audio 2 -6.5\n", |
| 2508 | "the mix is lines of its own, the gains after the lanes they name" | 2581 | "the mix is lines of its own, the gains after the lanes they name" |
| 2509 | ); | 2582 | ); |
| @@ -2532,8 +2605,8 @@ mod tests { | |||
| 2532 | (1280, 720), | 2605 | (1280, 720), |
| 2533 | old.playhead | 2606 | old.playhead |
| 2534 | )), | 2607 | )), |
| 2535 | - "edith 18\nplayhead 3\nresolution 1280 720\nsource 0 a.mp4\n\ | 2608 | + "edith 19\nplayhead 3\nresolution 1280 720\nsource 0 a.mp4\n\ |
| 2536 | - video 1 0 0 30 0 - - - fit 1000 0 0\naudio 1 0 0 30 0 - - - fit 1000 0 0\n" | 2609 | + video 1 0 0 30 0 - - - fit 1000 0 0 0\naudio 1 0 0 30 0 - - - fit 1000 0 0 0\n" |
| 2537 | ); | 2610 | ); |
| 2538 | 2611 | ||
| 2539 | // Each of the three refuses by name, on its own line. | 2612 | // Each of the three refuses by name, on its own line. |
| @@ -2696,10 +2769,10 @@ mod tests { | |||
| 2696 | assert!(old.eq.is_empty(), "nothing before v5 equalizes anything"); | 2769 | assert!(old.eq.is_empty(), "nothing before v5 equalizes anything"); |
| 2697 | assert_eq!( | 2770 | assert_eq!( |
| 2698 | String::from_utf8_lossy(&flat(&dir, &old.sources, &old.lanes, old.playhead)), | 2771 | String::from_utf8_lossy(&flat(&dir, &old.sources, &old.lanes, old.playhead)), |
| 2699 | - "edith 18\nplayhead 12\nresolution 1280 720\nsource 0 a.mp4\n\ | 2772 | + "edith 19\nplayhead 12\nresolution 1280 720\nsource 0 a.mp4\n\ |
| 2700 | source 2 /elsewhere/b.mp4\n\ | 2773 | source 2 /elsewhere/b.mp4\n\ |
| 2701 | - video 1 0 0 30 0 0 - - fit 1000 0 0\nvideo 1 30 10 20 1 1 - - fit 1000 0 0\n\ | 2774 | + video 1 0 0 30 0 0 - - fit 1000 0 0 0\nvideo 1 30 10 20 1 1 - - fit 1000 0 0 0\n\ |
| 2702 | - audio 1 0 0 30 0 0 - - fit 1000 0 0\n" | 2775 | + audio 1 0 0 30 0 0 - - fit 1000 0 0 0\n" |
| 2703 | ); | 2776 | ); |
| 2704 | // An empty lane's line is still the whole of that lane, eq or no eq. | 2777 | // An empty lane's line is still the whole of that lane, eq or no eq. |
| 2705 | let empty = parse( | 2778 | let empty = parse( |
| @@ -2749,10 +2822,10 @@ mod tests { | |||
| 2749 | let v5 = flat(&dir, &back.sources, &back.lanes, back.playhead); | 2822 | let v5 = flat(&dir, &back.sources, &back.lanes, back.playhead); |
| 2750 | assert_eq!( | 2823 | assert_eq!( |
| 2751 | String::from_utf8_lossy(&v5), | 2824 | String::from_utf8_lossy(&v5), |
| 2752 | - "edith 18\nplayhead 12\nresolution 1280 720\nsource 0 a.mp4\n\ | 2825 | + "edith 19\nplayhead 12\nresolution 1280 720\nsource 0 a.mp4\n\ |
| 2753 | source 0 /elsewhere/b.mp4\n\ | 2826 | source 0 /elsewhere/b.mp4\n\ |
| 2754 | - video 1 0 0 30 0 0 - - fit 1000 0 0\nvideo 1 30 10 20 1 1 - - fit 1000 0 0\n\ | 2827 | + video 1 0 0 30 0 0 - - fit 1000 0 0 0\nvideo 1 30 10 20 1 1 - - fit 1000 0 0 0\n\ |
| 2755 | - audio 1 0 0 30 0 0 - - fit 1000 0 0\n", | 2828 | + audio 1 0 0 30 0 0 - - fit 1000 0 0 0\n", |
| 2756 | "a re-saved v2 project differs only by its version, the lane \ | 2829 | "a re-saved v2 project differs only by its version, the lane \ |
| 2757 | numbers, the streams it always meant and an equalizer it has none of" | 2830 | numbers, the streams it always meant and an equalizer it has none of" |
| 2758 | ); | 2831 | ); |
| @@ -2781,7 +2854,7 @@ mod tests { | |||
| 2781 | // Saved again it is the current version, which round-trips to the | 2854 | // Saved again it is the current version, which round-trips to the |
| 2782 | // same document. | 2855 | // same document. |
| 2783 | let v5 = flat(&dir, &back.sources, &back.lanes, back.playhead); | 2856 | let v5 = flat(&dir, &back.sources, &back.lanes, back.playhead); |
| 2784 | - assert!(v5.starts_with(b"edith 18\n")); | 2857 | + assert!(v5.starts_with(b"edith 19\n")); |
| 2785 | let again = parse(&v5, &dir).expect("v5 parses"); | 2858 | let again = parse(&v5, &dir).expect("v5 parses"); |
| 2786 | assert_eq!(again.lanes, back.lanes); | 2859 | assert_eq!(again.lanes, back.lanes); |
| 2787 | // A dialect may not be mixed: lane lines under v1, `clip` under v2. | 2860 | // A dialect may not be mixed: lane lines under v1, `clip` under v2. |
| @@ -2891,8 +2964,8 @@ mod tests { | |||
| 2891 | let bytes = std::fs::read(&path).expect("read back"); | 2964 | let bytes = std::fs::read(&path).expect("read back"); |
| 2892 | assert_eq!( | 2965 | assert_eq!( |
| 2893 | String::from_utf8_lossy(&bytes), | 2966 | String::from_utf8_lossy(&bytes), |
| 2894 | - "edith 18\nplayhead 0\nresolution 1280 720\nsource 1 a.mp4\n\ | 2967 | + "edith 19\nplayhead 0\nresolution 1280 720\nsource 1 a.mp4\n\ |
| 2895 | - video 1 0 0 30 0 - - - fit 1000 0 0\naudio 1 0 0 30 0 - - - fit 1000 0 0\n" | 2968 | + video 1 0 0 30 0 - - - fit 1000 0 0 0\naudio 1 0 0 30 0 - - - fit 1000 0 0 0\n" |
| 2896 | ); | 2969 | ); |
| 2897 | // Loading rejoins the *given* directory, so the file is reached by the | 2970 | // Loading rejoins the *given* directory, so the file is reached by the |
| 2898 | // way the project was opened -- the same file, through the link, still | 2971 | // way the project was opened -- the same file, through the link, still |
| @@ -2936,10 +3009,10 @@ mod tests { | |||
| 2936 | #[test] | 3009 | #[test] |
| 2937 | fn a_wrong_first_line_is_refused_by_name() { | 3010 | fn a_wrong_first_line_is_refused_by_name() { |
| 2938 | let dir = PathBuf::from("/proj"); | 3011 | let dir = PathBuf::from("/proj"); |
| 2939 | - let err = parse(b"edith 19\nsource 0 a.mp4\nvideo 0 0 5 0 -\n", &dir) | 3012 | + let err = parse(b"edith 20\nsource 0 a.mp4\nvideo 0 0 5 0 -\n", &dir) |
| 2940 | .unwrap_err() | 3013 | .unwrap_err() |
| 2941 | .to_string(); | 3014 | .to_string(); |
| 2942 | - assert_eq!(err, "line 1: unsupported version 19"); | 3015 | + assert_eq!(err, "line 1: unsupported version 20"); |
| 2943 | for junk in [&b""[..], b"{}\n", b"source a.mp4\n"] { | 3016 | for junk in [&b""[..], b"{}\n", b"source a.mp4\n"] { |
| 2944 | assert_eq!( | 3017 | assert_eq!( |
| 2945 | parse(junk, &dir).unwrap_err().to_string(), | 3018 | parse(junk, &dir).unwrap_err().to_string(), |
crates/engine/src/playback.rsmodified+3 -0
| @@ -620,6 +620,7 @@ impl PlaybackSession { | |||
| 620 | let clip = Clip { | 620 | let clip = Clip { |
| 621 | fade_in: 0, | 621 | fade_in: 0, |
| 622 | fade_out: 0, | 622 | fade_out: 0, |
| 623 | + transition_out: 0, | ||
| 623 | start: 0, | 624 | start: 0, |
| 624 | in_frame: 0, | 625 | in_frame: 0, |
| 625 | out_frame: meta.frame_count, | 626 | out_frame: meta.frame_count, |
| @@ -705,6 +706,7 @@ impl PlaybackSession { | |||
| 705 | let clip = Clip { | 706 | let clip = Clip { |
| 706 | fade_in: 0, | 707 | fade_in: 0, |
| 707 | fade_out: 0, | 708 | fade_out: 0, |
| 709 | + transition_out: 0, | ||
| 708 | start: 0, | 710 | start: 0, |
| 709 | in_frame: 0, | 711 | in_frame: 0, |
| 710 | out_frame: place_frames(meta.frame_count, IMAGE_ONLY_RATE), | 712 | out_frame: place_frames(meta.frame_count, IMAGE_ONLY_RATE), |
| @@ -2631,6 +2633,7 @@ impl PlaybackSession { | |||
| 2631 | let clip = Clip { | 2633 | let clip = Clip { |
| 2632 | fade_in: 0, | 2634 | fade_in: 0, |
| 2633 | fade_out: 0, | 2635 | fade_out: 0, |
| 2636 | + transition_out: 0, | ||
| 2634 | start: 0, | 2637 | start: 0, |
| 2635 | in_frame: 0, | 2638 | in_frame: 0, |
| 2636 | out_frame: match image { | 2639 | out_frame: match image { |
crates/engine/src/project.rsmodified+129 -7
| @@ -439,6 +439,17 @@ pub struct Clip { | |||
| 439 | /// Timeline frames of ramp-down to silence at the clip's own end. Same | 439 | /// Timeline frames of ramp-down to silence at the clip's own end. Same |
| 440 | /// promises as [`Clip::fade_in`]. | 440 | /// promises as [`Clip::fade_in`]. |
| 441 | pub fade_out: u32, | 441 | pub fade_out: u32, |
| 442 | + /// Timeline frames of cross-dissolve into the clip immediately after this | ||
| 443 | + /// one on the same video lane, at this clip's own end -- `0` for a hard | ||
| 444 | + /// cut. Inline like [`Clip::fade_in`]/[`Clip::fade_out`] for the same | ||
| 445 | + /// reason, and clamped the same way by its setter | ||
| 446 | + /// ([`Project::set_transition_out`]): never wider than this clip's own | ||
| 447 | + /// length, nor than the successor it dissolves into. Meaningless -- and | ||
| 448 | + /// left as whatever it was -- the moment the next clip stops abutting | ||
| 449 | + /// this one; a reader that cares checks adjacency itself rather than | ||
| 450 | + /// trusting this field alone, exactly as a stored fade is trusted only | ||
| 451 | + /// because a clip's own length is checked beside it. | ||
| 452 | + pub transition_out: u32, | ||
| 442 | } | 453 | } |
| 443 | 454 | ||
| 444 | impl Clip { | 455 | impl Clip { |
| @@ -881,6 +892,7 @@ impl Project { | |||
| 881 | let clip = Clip { | 892 | let clip = Clip { |
| 882 | fade_in: 0, | 893 | fade_in: 0, |
| 883 | fade_out: 0, | 894 | fade_out: 0, |
| 895 | + transition_out: 0, | ||
| 884 | start: 0, | 896 | start: 0, |
| 885 | in_frame: 0, | 897 | in_frame: 0, |
| 886 | out_frame: frame_count.max(1), | 898 | out_frame: frame_count.max(1), |
| @@ -1263,6 +1275,7 @@ impl Project { | |||
| 1263 | let clip = Clip { | 1275 | let clip = Clip { |
| 1264 | fade_in: 0, | 1276 | fade_in: 0, |
| 1265 | fade_out: 0, | 1277 | fade_out: 0, |
| 1278 | + transition_out: 0, | ||
| 1266 | start, | 1279 | start, |
| 1267 | in_frame: 0, | 1280 | in_frame: 0, |
| 1268 | out_frame: frame_count.max(1), | 1281 | out_frame: frame_count.max(1), |
| @@ -2509,6 +2522,37 @@ impl Project { | |||
| 2509 | true | 2522 | true |
| 2510 | } | 2523 | } |
| 2511 | 2524 | ||
| 2525 | + /// Timeline frames of cross-dissolve the clip at `idx` of `lane` plays | ||
| 2526 | + /// into its successor, at its own end. `0` for an index that is not | ||
| 2527 | + /// there, same as a clip that has none. | ||
| 2528 | + pub fn transition_out_of(&self, lane: Lane, idx: usize) -> u32 { | ||
| 2529 | + self.lane(lane).get(idx).map_or(0, |c| c.transition_out) | ||
| 2530 | + } | ||
| 2531 | + | ||
| 2532 | + /// Sets it, clamped to the clip's own length and to how many frames its | ||
| 2533 | + /// successor on `lane` actually offers -- a dissolve can shrink a clip's | ||
| 2534 | + /// visible middle to nothing but never ask for more than the two clips | ||
| 2535 | + /// between them have. `false` -- no history -- unless `lane` is video, | ||
| 2536 | + /// `idx + 1` is in bounds, and the two clips are adjacent: the second's | ||
| 2537 | + /// [`Clip::start`] is exactly the first's [`Clip::end`], no gap between | ||
| 2538 | + /// them. One undo step like [`Project::set_fade_out`]. | ||
| 2539 | + pub fn set_transition_out(&mut self, lane: Lane, idx: usize, frames: u32) -> bool { | ||
| 2540 | + if lane.kind != LaneKind::Video { | ||
| 2541 | + return false; | ||
| 2542 | + } | ||
| 2543 | + let clips = self.lane(lane); | ||
| 2544 | + let (Some(a), Some(b)) = (clips.get(idx), clips.get(idx + 1)) else { | ||
| 2545 | + return false; | ||
| 2546 | + }; | ||
| 2547 | + if a.end() != b.start { | ||
| 2548 | + return false; | ||
| 2549 | + } | ||
| 2550 | + let cap = a.frames().min(b.frames()); | ||
| 2551 | + self.snapshot(); | ||
| 2552 | + self.lane_mut(lane).expect("checked above")[idx].transition_out = frames.min(cap); | ||
| 2553 | + true | ||
| 2554 | + } | ||
| 2555 | + | ||
| 2512 | /// Crossfades the audio clip at `idx` of `lane` into the one immediately | 2556 | /// Crossfades the audio clip at `idx` of `lane` into the one immediately |
| 2513 | /// after it, over `frames` timeline frames: sets `idx`'s | 2557 | /// after it, over `frames` timeline frames: sets `idx`'s |
| 2514 | /// [`Clip::fade_out`] and its neighbour's [`Clip::fade_in`] to `frames`, | 2558 | /// [`Clip::fade_out`] and its neighbour's [`Clip::fade_in`] to `frames`, |
| @@ -2957,9 +3001,16 @@ impl Project { | |||
| 2957 | // ends, flat -- there was no silence there to ramp out of. | 3001 | // ends, flat -- there was no silence there to ramp out of. |
| 2958 | tail.fade_in = 0; | 3002 | tail.fade_in = 0; |
| 2959 | tail.fade_out = tail.fade_out.min(tail.frames()); | 3003 | tail.fade_out = tail.fade_out.min(tail.frames()); |
| 3004 | + // A dissolve is a promise about the *end* edge, same as | ||
| 3005 | + // `fade_out`: only the half that kept the clip's original end | ||
| 3006 | + // (the tail) keeps it, re-clamped to its own now-shorter length; | ||
| 3007 | + // the head's new end is the cut the razor just made, which starts | ||
| 3008 | + // flat -- there was no successor to dissolve into there. | ||
| 3009 | + tail.transition_out = tail.transition_out.min(tail.frames()); | ||
| 2960 | data.clips[idx].out_frame = tail.in_frame; | 3010 | data.clips[idx].out_frame = tail.in_frame; |
| 2961 | data.clips[idx].link = orig[data_i]; | 3011 | data.clips[idx].link = orig[data_i]; |
| 2962 | data.clips[idx].fade_out = 0; | 3012 | data.clips[idx].fade_out = 0; |
| 3013 | + data.clips[idx].transition_out = 0; | ||
| 2963 | data.clips[idx].fade_in = data.clips[idx].fade_in.min(data.clips[idx].frames()); | 3014 | data.clips[idx].fade_in = data.clips[idx].fade_in.min(data.clips[idx].frames()); |
| 2964 | data.clips.insert(idx + 1, tail); | 3015 | data.clips.insert(idx + 1, tail); |
| 2965 | } | 3016 | } |
| @@ -3294,6 +3345,7 @@ impl Project { | |||
| 3294 | let clip = Clip { | 3345 | let clip = Clip { |
| 3295 | fade_in: 0, | 3346 | fade_in: 0, |
| 3296 | fade_out: 0, | 3347 | fade_out: 0, |
| 3348 | + transition_out: 0, | ||
| 3297 | start: timeline_frame, | 3349 | start: timeline_frame, |
| 3298 | link: None, | 3350 | link: None, |
| 3299 | ..clip | 3351 | ..clip |
| @@ -3335,6 +3387,7 @@ impl Project { | |||
| 3335 | let clip = Clip { | 3387 | let clip = Clip { |
| 3336 | fade_in: 0, | 3388 | fade_in: 0, |
| 3337 | fade_out: 0, | 3389 | fade_out: 0, |
| 3390 | + transition_out: 0, | ||
| 3338 | start: timeline_frame, | 3391 | start: timeline_frame, |
| 3339 | link: Some(self.new_link()), | 3392 | link: Some(self.new_link()), |
| 3340 | ..clip | 3393 | ..clip |
| @@ -3912,6 +3965,7 @@ impl Project { | |||
| 3912 | let clip = Clip { | 3965 | let clip = Clip { |
| 3913 | fade_in: 0, | 3966 | fade_in: 0, |
| 3914 | fade_out: 0, | 3967 | fade_out: 0, |
| 3968 | + transition_out: 0, | ||
| 3915 | start: at, | 3969 | start: at, |
| 3916 | link: Some(self.new_link()), | 3970 | link: Some(self.new_link()), |
| 3917 | ..clip | 3971 | ..clip |
| @@ -4987,6 +5041,7 @@ fn clear(clips: &mut Vec<Clip>, start: u32, end: u32) { | |||
| 4987 | out.push(Clip { | 5041 | out.push(Clip { |
| 4988 | fade_in: 0, | 5042 | fade_in: 0, |
| 4989 | fade_out: 0, | 5043 | fade_out: 0, |
| 5044 | + transition_out: 0, | ||
| 4990 | out_frame: c.in_frame + keep.min(c.len()), | 5045 | out_frame: c.in_frame + keep.min(c.len()), |
| 4991 | link: None, | 5046 | link: None, |
| 4992 | ..c | 5047 | ..c |
| @@ -5002,6 +5057,7 @@ fn clear(clips: &mut Vec<Clip>, start: u32, end: u32) { | |||
| 5002 | out.push(Clip { | 5057 | out.push(Clip { |
| 5003 | fade_in: 0, | 5058 | fade_in: 0, |
| 5004 | fade_out: 0, | 5059 | fade_out: 0, |
| 5060 | + transition_out: 0, | ||
| 5005 | start: end, | 5061 | start: end, |
| 5006 | in_frame: c.out_frame - keep.min(c.len()), | 5062 | in_frame: c.out_frame - keep.min(c.len()), |
| 5007 | link: None, | 5063 | link: None, |
| @@ -5110,6 +5166,7 @@ mod tests { | |||
| 5110 | Clip { | 5166 | Clip { |
| 5111 | fade_in: 0, | 5167 | fade_in: 0, |
| 5112 | fade_out: 0, | 5168 | fade_out: 0, |
| 5169 | + transition_out: 0, | ||
| 5113 | start, | 5170 | start, |
| 5114 | in_frame, | 5171 | in_frame, |
| 5115 | out_frame, | 5172 | out_frame, |
| @@ -5321,6 +5378,62 @@ mod tests { | |||
| 5321 | assert_eq!(v[1].fade_out, 15, "the right half's kept fade-out, unclamped: 15 frames fit in 15"); | 5378 | assert_eq!(v[1].fade_out, 15, "the right half's kept fade-out, unclamped: 15 frames fit in 15"); |
| 5322 | } | 5379 | } |
| 5323 | 5380 | ||
| 5381 | + /// [`Project::set_transition_out`] refuses a non-video lane, a clip with | ||
| 5382 | + /// no successor, and two clips that do not touch, and otherwise clamps | ||
| 5383 | + /// the dissolve to the shorter of the two clips it spans. | ||
| 5384 | + #[test] | ||
| 5385 | + fn set_transition_out_only_dissolves_adjacent_video_clips() { | ||
| 5386 | + let mut p = Project::single(FILE, 20); | ||
| 5387 | + assert!(p.split(15), "a short 5-frame tail to clamp against"); | ||
| 5388 | + assert!( | ||
| 5389 | + !p.set_transition_out(Lane::A1, 0, 5), | ||
| 5390 | + "audio is not a video lane" | ||
| 5391 | + ); | ||
| 5392 | + assert!( | ||
| 5393 | + !p.set_transition_out(Lane::V1, 1, 5), | ||
| 5394 | + "there is no clip after idx 1" | ||
| 5395 | + ); | ||
| 5396 | + assert!( | ||
| 5397 | + p.set_transition_out(Lane::V1, 0, 100), | ||
| 5398 | + "the two halves are adjacent" | ||
| 5399 | + ); | ||
| 5400 | + assert_eq!( | ||
| 5401 | + p.transition_out_of(Lane::V1, 0), | ||
| 5402 | + 5, | ||
| 5403 | + "clamped to the shorter neighbour's 5 frames" | ||
| 5404 | + ); | ||
| 5405 | + | ||
| 5406 | + // A gap between two clips is not adjacency, even on the video lane. | ||
| 5407 | + let mut p2 = Project::single(FILE, 1); | ||
| 5408 | + let v2 = p2.add_lane(LaneKind::Video); | ||
| 5409 | + assert!(p2.place(v2, 0, clip(0, 0, 3, 0))); | ||
| 5410 | + assert!(p2.place(v2, 5, clip(5, 3, 6, 0)), "a gap before this one"); | ||
| 5411 | + assert!(!p2.set_transition_out(v2, 0, 5), "a gap is not adjacent"); | ||
| 5412 | + } | ||
| 5413 | + | ||
| 5414 | + /// The rule [`Project::write_split`] follows for [`Clip::transition_out`], | ||
| 5415 | + /// same shape as [`a_split_clamps_the_kept_fade_and_zeroes_the_cut_edge`]: | ||
| 5416 | + /// only the half that kept the clip's original *end* keeps the dissolve, | ||
| 5417 | + /// re-clamped to its own now-shorter length; the head the cut just made | ||
| 5418 | + /// has no successor to dissolve into and starts flat. | ||
| 5419 | + #[test] | ||
| 5420 | + fn a_split_clamps_the_tail_transition_and_zeroes_the_head() { | ||
| 5421 | + let mut p = Project::single(FILE, 20); | ||
| 5422 | + assert!( | ||
| 5423 | + !p.set_transition_out(Lane::V1, 0, 0), | ||
| 5424 | + "one clip on the lane, no successor to dissolve into yet" | ||
| 5425 | + ); | ||
| 5426 | + // Give the clip a dissolve by hand, then cut it in two. | ||
| 5427 | + p.lane_mut(Lane::V1).unwrap()[0].transition_out = 15; | ||
| 5428 | + assert!(p.split(5)); | ||
| 5429 | + let v = p.lane(Lane::V1); | ||
| 5430 | + assert_eq!(v[0].transition_out, 0, "the cut edge it made has no successor"); | ||
| 5431 | + assert_eq!( | ||
| 5432 | + v[1].transition_out, 15, | ||
| 5433 | + "the tail's kept dissolve, unclamped: 15 frames fit in 15" | ||
| 5434 | + ); | ||
| 5435 | + } | ||
| 5436 | + | ||
| 5324 | /// The music video's own path: the take comes apart into halves that carry | 5437 | /// The music video's own path: the take comes apart into halves that carry |
| 5325 | /// ids of their own, one undo puts it back, and two clips over the same | 5438 | /// ids of their own, one undo puts it back, and two clips over the same |
| 5326 | /// frames become one take again by hand. | 5439 | /// frames become one take again by hand. |
| @@ -6501,15 +6614,18 @@ mod tests { | |||
| 6501 | /// table like the eq and the grade: there is nothing for a table to share. | 6614 | /// table like the eq and the grade: there is nothing for a table to share. |
| 6502 | /// It costs the clip nothing at all -- the fields before it (a `usize` | 6615 | /// It costs the clip nothing at all -- the fields before it (a `usize` |
| 6503 | /// source and two `Option<u16>`s) already left the struct padded to 40 | 6616 | /// source and two `Option<u16>`s) already left the struct padded to 40 |
| 6504 | - /// bytes, and the byte landed in that padding. `fade_in`/`fade_out` are the | 6617 | + /// bytes, and the byte landed in that padding. `fade_in`/`fade_out` are two |
| 6505 | - /// two `u32`s after it, so those cost the clip a full word each: 48 bytes | 6618 | + /// `u32`s after it (48 bytes), and `transition_out` is a third word -- |
| 6506 | - /// total. This is the assert that says so: a clip that grows a word grows | 6619 | + /// 52 bytes of fields, but the struct's own alignment is 8 (from the |
| 6507 | - /// every undo snapshot and every clipboard copy with it. | 6620 | + /// `usize` source and the 8-byte `Option<u32>` link), so an odd number of |
| 6621 | + /// words after it pads out to the next multiple of 8: 56 bytes total. | ||
| 6622 | + /// This is the assert that says so: a clip that grows a word grows every | ||
| 6623 | + /// undo snapshot and every clipboard copy with it. | ||
| 6508 | #[test] | 6624 | #[test] |
| 6509 | fn a_fit_policy_costs_the_clip_no_word() { | 6625 | fn a_fit_policy_costs_the_clip_no_word() { |
| 6510 | assert_eq!( | 6626 | assert_eq!( |
| 6511 | std::mem::size_of::<Clip>(), | 6627 | std::mem::size_of::<Clip>(), |
| 6512 | - 48, | 6628 | + 56, |
| 6513 | "Clip changed size: {} bytes", | 6629 | "Clip changed size: {} bytes", |
| 6514 | std::mem::size_of::<Clip>() | 6630 | std::mem::size_of::<Clip>() |
| 6515 | ); | 6631 | ); |
| @@ -6520,6 +6636,7 @@ mod tests { | |||
| 6520 | const PASTED: Clip = Clip { | 6636 | const PASTED: Clip = Clip { |
| 6521 | fade_in: 0, | 6637 | fade_in: 0, |
| 6522 | fade_out: 0, | 6638 | fade_out: 0, |
| 6639 | + transition_out: 0, | ||
| 6523 | start: 0, | 6640 | start: 0, |
| 6524 | in_frame: 100, | 6641 | in_frame: 100, |
| 6525 | out_frame: 102, | 6642 | out_frame: 102, |
| @@ -6594,6 +6711,7 @@ mod tests { | |||
| 6594 | let copied = Clip { | 6711 | let copied = Clip { |
| 6595 | fade_in: 0, | 6712 | fade_in: 0, |
| 6596 | fade_out: 0, | 6713 | fade_out: 0, |
| 6714 | + transition_out: 0, | ||
| 6597 | source: wav, | 6715 | source: wav, |
| 6598 | ..PASTED | 6716 | ..PASTED |
| 6599 | }; | 6717 | }; |
| @@ -7860,8 +7978,8 @@ mod tests { | |||
| 7860 | fn a_clip_is_still_a_small_copy() { | 7978 | fn a_clip_is_still_a_small_copy() { |
| 7861 | assert_eq!( | 7979 | assert_eq!( |
| 7862 | std::mem::size_of::<Clip>(), | 7980 | std::mem::size_of::<Clip>(), |
| 7863 | - 48, | 7981 | + 56, |
| 7864 | - "Clip changed size -- 32 before the colour index, 40 before the fades, 48 after" | 7982 | + "Clip changed size -- 32 before the colour index, 40 before the fades, 48 after, 56 with the transition" |
| 7865 | ); | 7983 | ); |
| 7866 | } | 7984 | } |
| 7867 | 7985 | ||
| @@ -7945,6 +8063,7 @@ mod tests { | |||
| 7945 | vec![Clip { | 8063 | vec![Clip { |
| 7946 | fade_in: 0, | 8064 | fade_in: 0, |
| 7947 | fade_out: 0, | 8065 | fade_out: 0, |
| 8066 | + transition_out: 0, | ||
| 7948 | eq: Some(i), | 8067 | eq: Some(i), |
| 7949 | ..video[0] | 8068 | ..video[0] |
| 7950 | }] | 8069 | }] |
| @@ -7983,6 +8102,7 @@ mod tests { | |||
| 7983 | vec![Clip { | 8102 | vec![Clip { |
| 7984 | fade_in: 0, | 8103 | fade_in: 0, |
| 7985 | fade_out: 0, | 8104 | fade_out: 0, |
| 8105 | + transition_out: 0, | ||
| 7986 | color: Some(i), | 8106 | color: Some(i), |
| 7987 | fit: FitPolicy::default(), | 8107 | fit: FitPolicy::default(), |
| 7988 | speed: Speed::NORMAL, | 8108 | speed: Speed::NORMAL, |
| @@ -8043,6 +8163,7 @@ mod tests { | |||
| 8043 | let linked = |start, in_frame, out_frame, link| Clip { | 8163 | let linked = |start, in_frame, out_frame, link| Clip { |
| 8044 | fade_in: 0, | 8164 | fade_in: 0, |
| 8045 | fade_out: 0, | 8165 | fade_out: 0, |
| 8166 | + transition_out: 0, | ||
| 8046 | start, | 8167 | start, |
| 8047 | in_frame, | 8168 | in_frame, |
| 8048 | out_frame, | 8169 | out_frame, |
| @@ -8822,6 +8943,7 @@ mod tests { | |||
| 8822 | let one = |start: u32, end: u32, link| Clip { | 8943 | let one = |start: u32, end: u32, link| Clip { |
| 8823 | fade_in: 0, | 8944 | fade_in: 0, |
| 8824 | fade_out: 0, | 8945 | fade_out: 0, |
| 8946 | + transition_out: 0, | ||
| 8825 | start, | 8947 | start, |
| 8826 | in_frame: start, | 8948 | in_frame: start, |
| 8827 | out_frame: end, | 8949 | out_frame: end, |
crates/engine/src/proxy.rsmodified+1 -0
| @@ -489,6 +489,7 @@ fn started(source: &Path, only_if: fn(&VideoMeta) -> bool) -> crate::Result<Opti | |||
| 489 | let clip = Clip { | 489 | let clip = Clip { |
| 490 | fade_in: 0, | 490 | fade_in: 0, |
| 491 | fade_out: 0, | 491 | fade_out: 0, |
| 492 | + transition_out: 0, | ||
| 492 | start: 0, | 493 | start: 0, |
| 493 | in_frame: 0, | 494 | in_frame: 0, |
| 494 | out_frame: meta.frame_count.max(1), | 495 | out_frame: meta.frame_count.max(1), |
crates/engine/src/scale.rsmodified+37 -0
| @@ -487,6 +487,24 @@ impl Composer { | |||
| 487 | } | 487 | } |
| 488 | } | 488 | } |
| 489 | 489 | ||
| 490 | +/// Per-byte lerp of two same-sized I420 frames: `out = a + (b - a) * t`, on | ||
| 491 | +/// every plane. `t` is clamped to `[0, 1]` -- a caller ramping across a | ||
| 492 | +/// cross-dissolve window hands back an in-range fraction already, this is the | ||
| 493 | +/// backstop. `a`/`b`'s planes must be the same length pairwise (Y with Y, U | ||
| 494 | +/// with U, V with V); a mismatched pair panics rather than silently | ||
| 495 | +/// truncating a picture. | ||
| 496 | +pub fn blend_i420(a: (&[u8], &[u8], &[u8]), b: (&[u8], &[u8], &[u8]), t: f32) -> (Vec<u8>, Vec<u8>, Vec<u8>) { | ||
| 497 | + let t = t.clamp(0.0, 1.0); | ||
| 498 | + let plane = |a: &[u8], b: &[u8]| -> Vec<u8> { | ||
| 499 | + assert_eq!(a.len(), b.len(), "blend_i420: mismatched plane sizes"); | ||
| 500 | + a.iter() | ||
| 501 | + .zip(b) | ||
| 502 | + .map(|(&av, &bv)| (av as f32 + (bv as f32 - av as f32) * t).round() as u8) | ||
| 503 | + .collect() | ||
| 504 | + }; | ||
| 505 | + (plane(a.0, b.0), plane(a.1, b.1), plane(a.2, b.2)) | ||
| 506 | +} | ||
| 507 | + | ||
| 490 | /// Resizes `plane` to `len` and sets every byte to `value` -- a canvas reused | 508 | /// Resizes `plane` to `len` and sets every byte to `value` -- a canvas reused |
| 491 | /// across frames is refilled, not reallocated. | 509 | /// across frames is refilled, not reallocated. |
| 492 | fn fill(plane: &mut Vec<u8>, len: usize, value: u8) { | 510 | fn fill(plane: &mut Vec<u8>, len: usize, value: u8) { |
| @@ -1097,4 +1115,23 @@ mod tests { | |||
| 1097 | let ms = t.elapsed().as_secs_f64() * 1000.0 / f64::from(runs); | 1115 | let ms = t.elapsed().as_secs_f64() * 1000.0 / f64::from(runs); |
| 1098 | println!("scale::Composer::place 1280x720 onto 1920x1080 Fit: {ms:.3} ms/frame"); | 1116 | println!("scale::Composer::place 1280x720 onto 1920x1080 Fit: {ms:.3} ms/frame"); |
| 1099 | } | 1117 | } |
| 1118 | + | ||
| 1119 | + /// [`blend_i420`] at the midpoint of two solid-colour frames lands exactly | ||
| 1120 | + /// on the 50/50 average, on every plane -- the synthetic stand-in for "the | ||
| 1121 | + /// dissolve's midpoint frame looks like the average colour" the export | ||
| 1122 | + /// path is built on. | ||
| 1123 | + #[test] | ||
| 1124 | + fn blend_i420_is_50_50_at_the_midpoint() { | ||
| 1125 | + let a = (vec![0u8; 16], vec![10u8; 4], vec![20u8; 4]); | ||
| 1126 | + let b = (vec![100u8; 16], vec![50u8; 4], vec![120u8; 4]); | ||
| 1127 | + let (y, u, v) = blend_i420((&a.0, &a.1, &a.2), (&b.0, &b.1, &b.2), 0.5); | ||
| 1128 | + assert!(y.iter().all(|&p| p == 50), "Y midpoint: {y:?}"); | ||
| 1129 | + assert!(u.iter().all(|&p| p == 30), "U midpoint: {u:?}"); | ||
| 1130 | + assert!(v.iter().all(|&p| p == 70), "V midpoint: {v:?}"); | ||
| 1131 | + // The edges hand back each frame untouched. | ||
| 1132 | + let (y0, _, _) = blend_i420((&a.0, &a.1, &a.2), (&b.0, &b.1, &b.2), 0.0); | ||
| 1133 | + assert_eq!(y0, a.0); | ||
| 1134 | + let (y1, _, _) = blend_i420((&a.0, &a.1, &a.2), (&b.0, &b.1, &b.2), 1.0); | ||
| 1135 | + assert_eq!(y1, b.0); | ||
| 1136 | + } | ||
| 1100 | } | 1137 | } |
crates/engine/src/silence.rsmodified+1 -0
| @@ -297,6 +297,7 @@ mod tests { | |||
| 297 | Clip { | 297 | Clip { |
| 298 | fade_in: 0, | 298 | fade_in: 0, |
| 299 | fade_out: 0, | 299 | fade_out: 0, |
| 300 | + transition_out: 0, | ||
| 300 | start, | 301 | start, |
| 301 | in_frame, | 302 | in_frame, |
| 302 | out_frame, | 303 | out_frame, |
crates/engine/src/sweep.rsmodified+1 -0
| @@ -68,6 +68,7 @@ fn clip(start: u32, in_frame: u32, out_frame: u32) -> Clip { | |||
| 68 | Clip { | 68 | Clip { |
| 69 | fade_in: 0, | 69 | fade_in: 0, |
| 70 | fade_out: 0, | 70 | fade_out: 0, |
| 71 | + transition_out: 0, | ||
| 71 | start, | 72 | start, |
| 72 | in_frame, | 73 | in_frame, |
| 73 | out_frame, | 74 | out_frame, |
crates/engine/tests/audio_export.rsmodified+9 -0
| @@ -63,6 +63,7 @@ fn mixed_project() -> Project { | |||
| 63 | let clip = |start, source| Clip { | 63 | let clip = |start, source| Clip { |
| 64 | fade_in: 0, | 64 | fade_in: 0, |
| 65 | fade_out: 0, | 65 | fade_out: 0, |
| 66 | + transition_out: 0, | ||
| 66 | start, | 67 | start, |
| 67 | in_frame: 0, | 68 | in_frame: 0, |
| 68 | out_frame: 30, | 69 | out_frame: 30, |
| @@ -87,6 +88,7 @@ fn mixed_project() -> Project { | |||
| 87 | vec![Clip { | 88 | vec![Clip { |
| 88 | fade_in: 0, | 89 | fade_in: 0, |
| 89 | fade_out: 0, | 90 | fade_out: 0, |
| 91 | + transition_out: 0, | ||
| 90 | start: 0, | 92 | start: 0, |
| 91 | in_frame: 0, | 93 | in_frame: 0, |
| 92 | out_frame: 90, | 94 | out_frame: 90, |
| @@ -333,6 +335,7 @@ fn a_still_and_a_song_export_as_an_mp4_with_sound() { | |||
| 333 | let clip = |source, frames| Clip { | 335 | let clip = |source, frames| Clip { |
| 334 | fade_in: 0, | 336 | fade_in: 0, |
| 335 | fade_out: 0, | 337 | fade_out: 0, |
| 338 | + transition_out: 0, | ||
| 336 | start: 0, | 339 | start: 0, |
| 337 | in_frame: 0, | 340 | in_frame: 0, |
| 338 | out_frame: frames, | 341 | out_frame: frames, |
| @@ -399,6 +402,7 @@ fn a_fader_is_one_tracks_own_and_the_limiter_holds_the_sum() { | |||
| 399 | let clip = Clip { | 402 | let clip = Clip { |
| 400 | fade_in: 0, | 403 | fade_in: 0, |
| 401 | fade_out: 0, | 404 | fade_out: 0, |
| 405 | + transition_out: 0, | ||
| 402 | start: 0, | 406 | start: 0, |
| 403 | in_frame: 0, | 407 | in_frame: 0, |
| 404 | out_frame: 30, | 408 | out_frame: 30, |
| @@ -637,6 +641,7 @@ fn the_sound_is_written_at_the_rate_that_was_asked_for() { | |||
| 637 | vec![Clip { | 641 | vec![Clip { |
| 638 | fade_in: 0, | 642 | fade_in: 0, |
| 639 | fade_out: 0, | 643 | fade_out: 0, |
| 644 | + transition_out: 0, | ||
| 640 | start: 0, | 645 | start: 0, |
| 641 | in_frame: 0, | 646 | in_frame: 0, |
| 642 | out_frame: 60, | 647 | out_frame: 60, |
| @@ -653,6 +658,7 @@ fn the_sound_is_written_at_the_rate_that_was_asked_for() { | |||
| 653 | vec![Clip { | 658 | vec![Clip { |
| 654 | fade_in: 0, | 659 | fade_in: 0, |
| 655 | fade_out: 0, | 660 | fade_out: 0, |
| 661 | + transition_out: 0, | ||
| 656 | start: 0, | 662 | start: 0, |
| 657 | in_frame: 0, | 663 | in_frame: 0, |
| 658 | out_frame: 60, | 664 | out_frame: 60, |
| @@ -710,6 +716,7 @@ fn a_silent_clip_exports_as_silence_over_its_own_span() { | |||
| 710 | let clip = |start, source| Clip { | 716 | let clip = |start, source| Clip { |
| 711 | fade_in: 0, | 717 | fade_in: 0, |
| 712 | fade_out: 0, | 718 | fade_out: 0, |
| 719 | + transition_out: 0, | ||
| 713 | start, | 720 | start, |
| 714 | in_frame: 0, | 721 | in_frame: 0, |
| 715 | out_frame: 30, | 722 | out_frame: 30, |
| @@ -804,6 +811,7 @@ fn a_51_ac3_source_round_trips_through_a_wav() { | |||
| 804 | vec![Clip { | 811 | vec![Clip { |
| 805 | fade_in: 0, | 812 | fade_in: 0, |
| 806 | fade_out: 0, | 813 | fade_out: 0, |
| 814 | + transition_out: 0, | ||
| 807 | start: 0, | 815 | start: 0, |
| 808 | in_frame: 0, | 816 | in_frame: 0, |
| 809 | out_frame: 30, | 817 | out_frame: 30, |
| @@ -933,6 +941,7 @@ fn a_mono_timeline_exports_as_dual_mono_ogg() { | |||
| 933 | vec![Clip { | 941 | vec![Clip { |
| 934 | fade_in: 0, | 942 | fade_in: 0, |
| 935 | fade_out: 0, | 943 | fade_out: 0, |
| 944 | + transition_out: 0, | ||
| 936 | start: 0, | 945 | start: 0, |
| 937 | in_frame: 0, | 946 | in_frame: 0, |
| 938 | out_frame: 30, | 947 | out_frame: 30, |
crates/engine/tests/eq_audio.rsmodified+1 -0
| @@ -56,6 +56,7 @@ fn clip(start: u32, source: usize, frames: u32) -> Clip { | |||
| 56 | Clip { | 56 | Clip { |
| 57 | fade_in: 0, | 57 | fade_in: 0, |
| 58 | fade_out: 0, | 58 | fade_out: 0, |
| 59 | + transition_out: 0, | ||
| 59 | start, | 60 | start, |
| 60 | in_frame: 0, | 61 | in_frame: 0, |
| 61 | out_frame: frames, | 62 | out_frame: frames, |
crates/engine/tests/export.rsmodified+2 -0
| @@ -236,6 +236,7 @@ fn exports_at_the_project_resolution_with_the_watched_geometry() { | |||
| 236 | let clip = |source: usize, start: u32| engine::Clip { | 236 | let clip = |source: usize, start: u32| engine::Clip { |
| 237 | fade_in: 0, | 237 | fade_in: 0, |
| 238 | fade_out: 0, | 238 | fade_out: 0, |
| 239 | + transition_out: 0, | ||
| 239 | start, | 240 | start, |
| 240 | in_frame: 0, | 241 | in_frame: 0, |
| 241 | out_frame: 10, | 242 | out_frame: 10, |
| @@ -320,6 +321,7 @@ fn exports_the_audio_stream_the_timeline_plays() { | |||
| 320 | let whole = engine::Clip { | 321 | let whole = engine::Clip { |
| 321 | fade_in: 0, | 322 | fade_in: 0, |
| 322 | fade_out: 0, | 323 | fade_out: 0, |
| 324 | + transition_out: 0, | ||
| 323 | start: 0, | 325 | start: 0, |
| 324 | in_frame: 0, | 326 | in_frame: 0, |
| 325 | out_frame: meta.frame_count, | 327 | out_frame: meta.frame_count, |
crates/engine/tests/lanes.rsmodified+2 -0
| @@ -236,6 +236,7 @@ fn the_mp4_copy_follows_the_lane_that_holds_the_sound() { | |||
| 236 | let source = asset("test_av.mp4"); | 236 | let source = asset("test_av.mp4"); |
| 237 | let clip = Clip { | 237 | let clip = Clip { |
| 238 | fade_in: 0, | 238 | fade_in: 0, |
| 239 | + transition_out: 0, | ||
| 239 | fade_out: 0, | 240 | fade_out: 0, |
| 240 | start: 0, | 241 | start: 0, |
| 241 | in_frame: 0, | 242 | in_frame: 0, |
| @@ -300,6 +301,7 @@ fn two_audio_lanes_are_summed() { | |||
| 300 | let doubled = Clip { | 301 | let doubled = Clip { |
| 301 | fade_in: 0, | 302 | fade_in: 0, |
| 302 | fade_out: 0, | 303 | fade_out: 0, |
| 304 | + transition_out: 0, | ||
| 303 | start: TOP_IN, | 305 | start: TOP_IN, |
| 304 | in_frame: TOP_IN, | 306 | in_frame: TOP_IN, |
| 305 | out_frame: TOP_OUT, | 307 | out_frame: TOP_OUT, |
crates/engine/tests/opus_export.rsmodified+2 -0
| @@ -82,6 +82,7 @@ fn project(video: &Path, sound: &Path, sound_in: u32) -> Project { | |||
| 82 | let clip = |source, in_frame, out_frame| Clip { | 82 | let clip = |source, in_frame, out_frame| Clip { |
| 83 | fade_in: 0, | 83 | fade_in: 0, |
| 84 | fade_out: 0, | 84 | fade_out: 0, |
| 85 | + transition_out: 0, | ||
| 85 | start: 0, | 86 | start: 0, |
| 86 | in_frame, | 87 | in_frame, |
| 87 | out_frame, | 88 | out_frame, |
| @@ -425,6 +426,7 @@ fn a_copied_picture_names_the_sound_it_was_written_with() { | |||
| 425 | let clip = |source, out_frame| Clip { | 426 | let clip = |source, out_frame| Clip { |
| 426 | fade_in: 0, | 427 | fade_in: 0, |
| 427 | fade_out: 0, | 428 | fade_out: 0, |
| 429 | + transition_out: 0, | ||
| 428 | start: 0, | 430 | start: 0, |
| 429 | in_frame: 0, | 431 | in_frame: 0, |
| 430 | out_frame, | 432 | out_frame, |
crates/engine/tests/silence.rsmodified+2 -0
| @@ -140,6 +140,7 @@ fn speed_mode_refuses_a_clip_that_laps_over_a_silence() { | |||
| 140 | let broll = Clip { | 140 | let broll = Clip { |
| 141 | fade_in: 0, | 141 | fade_in: 0, |
| 142 | fade_out: 0, | 142 | fade_out: 0, |
| 143 | + transition_out: 0, | ||
| 143 | start: 0, | 144 | start: 0, |
| 144 | in_frame: 0, | 145 | in_frame: 0, |
| 145 | out_frame: 20, | 146 | out_frame: 20, |
| @@ -177,6 +178,7 @@ fn whole(source: usize, frames: u32) -> Clip { | |||
| 177 | Clip { | 178 | Clip { |
| 178 | fade_in: 0, | 179 | fade_in: 0, |
| 179 | fade_out: 0, | 180 | fade_out: 0, |
| 181 | + transition_out: 0, | ||
| 180 | start: 0, | 182 | start: 0, |
| 181 | in_frame: 0, | 183 | in_frame: 0, |
| 182 | out_frame: frames, | 184 | out_frame: frames, |