forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'main' into worktree-agent-a6b6dbdb311480b83

Browse files at this commit

6f06feaba9faf61f3d978bdc6b90f51e2145e82eAhmet Kaan GümüşParent: 03073e650af5b5
crates/app/src/export_ui.rsmodified+52 -5
@@ -71,7 +71,7 @@ impl Quality {
7171 }
7272 other => format!(
7373 "{} Mbps",
74- export_settings(other, 0, Format::Mp4, DEFAULT_AUDIO_KBPS)
74+ export_settings(other, 0, Format::Mp4, DEFAULT_AUDIO_KBPS, EncoderSeat::Auto)
7575 .bitrate
7676 .unwrap_or_default()
7777 / 1_000_000
@@ -459,6 +459,52 @@ pub(crate) fn audio_rate_choices(current: u32) -> Vec<ChoiceRow> {
459459 .collect()
460460 }
461461
462+/// How a seat is named where a person reads it: the card row, the notice and
463+/// the list row all say the same word ([`engine::export::EncoderSeat`]).
464+pub(crate) fn encoder_label(seat: EncoderSeat) -> &'static str {
465+ match seat {
466+ EncoderSeat::Auto => "Auto",
467+ EncoderSeat::Hardware => "Hardware",
468+ EncoderSeat::Software => "Software",
469+ }
470+}
471+
472+/// The encoder list's rows: all three seats, the one in force marked, and what
473+/// each one *does* beside it -- in the fewest words that fit inside `MENU_W`,
474+/// the truncation every list above already met. Always offered, whatever this
475+/// machine has: a row that vanished with the plugin would be a setting nobody
476+/// could find, and the answer to "is there a seat here?" is the planned line
477+/// under the rows ([`engine::export::planned_video`]), which is measured.
478+pub(crate) fn encoder_choices(current: EncoderSeat) -> Vec<ChoiceRow> {
479+ EncoderSeat::ALL
480+ .into_iter()
481+ .map(|seat| {
482+ (
483+ Choice::Encoder(seat),
484+ encoder_label(seat).into(),
485+ match seat {
486+ EncoderSeat::Auto => "the GPU if there is one",
487+ EncoderSeat::Hardware => "the GPU or a refusal",
488+ EncoderSeat::Software => "the CPU, always",
489+ }
490+ .into(),
491+ seat == current,
492+ )
493+ })
494+ .collect()
495+}
496+
497+/// The row under the encoder one where -- and only where -- a person has asked
498+/// for the GPU on an AV1 export: this project's own driver reset the GPU on the
499+/// vendored AV1 encoder (2026-08-10), so the pick is theirs to make and the
500+/// risk is theirs to be told about. `None` for every other pair, which is what
501+/// keeps this from becoming a row nobody reads.
502+pub(crate) fn av1_hw_warning(format: Format, seat: EncoderSeat) -> Option<&'static str> {
503+ (seat == EncoderSeat::Hardware && matches!(format, Format::Av1 | Format::Av1Mp4)).then_some(
504+ "AV1 on the GPU reset this machine's driver once — Software is the safe seat",
505+ )
506+}
507+
462508 /// How a rendition is named where a person reads it: the panel button, the
463509 /// notice and the list row all say the same word ([`engine::tonemap::Preset`]).
464510 pub(crate) fn tone_label(preset: Preset) -> &'static str {
@@ -623,6 +669,7 @@ pub(crate) fn export_settings(
623669 custom_mbps: u32,
624670 format: Format,
625671 audio_kbps: u32,
672+ seat: EncoderSeat,
626673 ) -> ExportSettings {
627674 ExportSettings {
628675 format,
@@ -637,10 +684,10 @@ pub(crate) fn export_settings(
637684 Quality::High => Some(12_000_000),
638685 Quality::Custom => Some(u64::from(custom_mbps) * 1_000_000),
639686 },
640- // No row of its own: the software pin is for a driver that encodes
641- // badly, which is a thing about the machine and not about the output --
642- // `VE_SW_ENC` already says it, and to the whole run rather than once.
643- force_sw: false,
687+ // The card's own row now ([`encoder_choices`]), kept with the project:
688+ // it was a `VE_SW_ENC` env pin and nothing else, which is a switch
689+ // nobody exporting a film would ever find.
690+ seat,
644691 // The picked track is put on by `start_export`, which is the only
645692 // caller that writes a file; the rest of them are asking about the
646693 // bitrate and the format.
crates/app/src/keymap.rsmodified+7 -1
@@ -420,7 +420,7 @@ fn codec_chord() -> String {
420420 .join(" / ")
421421 }
422422
423-pub static FIXED: std::sync::LazyLock<[Fixed; 29]> = std::sync::LazyLock::new(|| {
423+pub static FIXED: std::sync::LazyLock<[Fixed; 30]> = std::sync::LazyLock::new(|| {
424424 [
425425 // Not a chord at all but a way of pressing one, and the only place the
426426 // editor can say so: holding a key that moves a *value* runs it, and
@@ -487,6 +487,12 @@ pub static FIXED: std::sync::LazyLock<[Fixed; 29]> = std::sync::LazyLock::new(||
487487 category: Category::File,
488488 reach: Reach::Click("sound"),
489489 },
490+ Fixed {
491+ chord: "e".into(),
492+ label: "Step the export encoder seat: Auto, Hardware or Software",
493+ category: Category::File,
494+ reach: Reach::Click("encoder"),
495+ },
490496 Fixed {
491497 chord: "d".into(),
492498 label: "Choose where the export is written",
crates/app/src/main.rsmodified+1 -1
@@ -56,7 +56,7 @@ use engine::audio::StreamInfo;
5656 use engine::color::ColorParams;
5757 use engine::decode::Backend;
5858 use engine::eq::{Band, BandKind, EqParams};
59-use engine::export::{AUDIO_KBPS, DEFAULT_AUDIO_KBPS, ExportSettings, Format};
59+use engine::export::{AUDIO_KBPS, DEFAULT_AUDIO_KBPS, EncoderSeat, ExportSettings, Format};
6060 use engine::limiter::Limiter;
6161 use engine::project::{Edge, Lane, LaneKind, Source, Speed};
6262 use engine::scale::FitPolicy;
crates/app/src/menus.rsmodified+5 -0
@@ -61,6 +61,10 @@ pub(crate) enum Pick {
6161 /// here that is nobody's project: it is the person's, so it outlives the
6262 /// timeline and every file opened in it.
6363 Theme,
64+ /// Which encoder an export writes the picture with
65+ /// ([`engine::export::EncoderSeat`]). Opened from the card's Encoder row,
66+ /// which is the only place it means anything.
67+ Encoder,
6468 }
6569
6670 /// One value a list offers, carrying everything picking it needs -- so a click
@@ -77,6 +81,7 @@ pub(crate) enum Choice {
7781 AudioRate(u32),
7882 Tone(Preset),
7983 Theme(ui::theme::PaletteId),
84+ Encoder(EncoderSeat),
8085 }
8186
8287 /// One row of an open list: the value, its name, the small print beside it, and
crates/app/src/player/cards.rsmodified+5 -0
@@ -94,6 +94,10 @@ impl Player {
9494 Choice::Fps(fps) => self.apply_frame_rate(fps, cx),
9595 Choice::Fit(lane, idx, fit) => self.apply_fit(lane, idx, fit, cx),
9696 Choice::Tone(preset) => self.apply_tone(preset, cx),
97+ // The project's, like the tone map above and unlike the palette
98+ // below: kept in the `.edith` and read straight back out of the
99+ // session by the card and by the export.
100+ Choice::Encoder(seat) => self.apply_encoder(seat, cx),
97101 // In force for the next paint -- every token is read through
98102 // [`ui::theme::palette`], so one store repaints the whole window --
99103 // and kept for the next launch. A file that could not be written is
@@ -151,6 +155,7 @@ impl Player {
151155 }
152156 Pick::AudioRate => audio_rate_choices(self.audio_kbps),
153157 Pick::Tone => tone_choices(session.tone()),
158+ Pick::Encoder => encoder_choices(session.encoder_seat()),
154159 // Answered above, with or without a timeline.
155160 Pick::Theme => Vec::new(),
156161 }
crates/app/src/player/export.rsmodified+52 -2
@@ -219,7 +219,13 @@ impl Player {
219219 return;
220220 };
221221 let settings =
222- export_settings(self.quality, self.custom_mbps, self.format, self.audio_kbps);
222+ export_settings(
223+ self.quality,
224+ self.custom_mbps,
225+ self.format,
226+ self.audio_kbps,
227+ self.encoder_seat(),
228+ );
223229 if !self.export_open {
224230 return;
225231 }
@@ -380,6 +386,44 @@ impl Player {
380386 self.audio_kbps = next_audio_kbps(self.audio_kbps);
381387 }
382388
389+ /// Which encoder an export of this project would write the picture with
390+ /// ([`engine::export::EncoderSeat`]). The session's, because it is saved
391+ /// with the project -- there is no card-local copy to drift from it -- and
392+ /// the default with no timeline open, where the card shows nothing anyway.
393+ pub(crate) fn encoder_seat(&self) -> EncoderSeat {
394+ self.session
395+ .as_ref()
396+ .map_or_else(EncoderSeat::default, PlaybackSession::encoder_seat)
397+ }
398+
399+ /// Pick the seat. Said out loud like every other pick that changes what a
400+ /// file will be written by -- and the card's planned line re-probes by
401+ /// itself, since the settings it is keyed on have changed
402+ /// ([`Self::cache_export_seat`]).
403+ pub(crate) fn apply_encoder(&mut self, seat: EncoderSeat, cx: &mut Context<Self>) {
404+ if let Some(session) = &mut self.session {
405+ session.set_encoder_seat(seat);
406+ self.notify_user(format!("Encoder: {}", encoder_label(seat)).into());
407+ }
408+ cx.notify();
409+ }
410+
411+ /// The seat by keyboard, wrapping through the three -- the Sound row's
412+ /// rule, for the row beside it. Refused by name with no timeline: a key
413+ /// that silently does nothing is the card looking broken.
414+ pub(crate) fn cycle_encoder(&mut self, cx: &mut Context<Self>) {
415+ let Some(session) = &self.session else {
416+ self.notify_user("no timeline to export — open a file first".into());
417+ cx.notify();
418+ return;
419+ };
420+ let at = EncoderSeat::ALL
421+ .iter()
422+ .position(|&s| s == session.encoder_seat())
423+ .unwrap_or(0);
424+ self.apply_encoder(EncoderSeat::ALL[(at + 1) % EncoderSeat::ALL.len()], cx);
425+ }
426+
383427 /// Why the sound row is not a choice right now, the engine answering about
384428 /// the very project it would export. No session is the same answer as no
385429 /// sound: there is nothing to write either way.
@@ -517,7 +561,13 @@ impl Player {
517561 return;
518562 }
519563 let mut settings =
520- export_settings(self.quality, self.custom_mbps, self.format, self.audio_kbps);
564+ export_settings(
565+ self.quality,
566+ self.custom_mbps,
567+ self.format,
568+ self.audio_kbps,
569+ self.encoder_seat(),
570+ );
521571 // Whatever is on the timeline travels -- every track with a cue in the
522572 // exported range, not the one row the overlay happens to be drawing.
523573 // Set here rather than inside `export_settings`, which the card also
crates/app/src/render.rsmodified+5 -0
@@ -246,6 +246,11 @@ impl Render for Player {
246246 // The sound's rate, `q`'s pair for the other half of
247247 // the file. Not a digit: those are the picture's.
248248 this.cycle_audio_kbps();
249+ } else if key == "e" {
250+ // Which encoder writes the picture, `b`'s neighbour for
251+ // the other thing about the file a person picks rather
252+ // than types. Card-local like the rest of these.
253+ this.cycle_encoder(cx);
249254 } else if key == "d" {
250255 // The save dialog, which was the one row here a
251256 // keyboard could not open.
crates/app/src/tests/cards.rsmodified+39 -10
@@ -815,24 +815,24 @@ fn a_quality_row_is_the_bitrate_it_promises() {
815815 // a number typed against the custom row must not leak into it.
816816 let mp4 = Format::Mp4;
817817 assert_eq!(
818- export_settings(Quality::Auto, 7, mp4, DEFAULT_AUDIO_KBPS).bitrate,
818+ export_settings(Quality::Auto, 7, mp4, DEFAULT_AUDIO_KBPS, EncoderSeat::Auto).bitrate,
819819 None
820820 );
821821 assert_eq!(
822- export_settings(Quality::Low, 0, mp4, DEFAULT_AUDIO_KBPS).bitrate,
822+ export_settings(Quality::Low, 0, mp4, DEFAULT_AUDIO_KBPS, EncoderSeat::Auto).bitrate,
823823 Some(2_000_000)
824824 );
825825 assert_eq!(
826- export_settings(Quality::Medium, 0, mp4, DEFAULT_AUDIO_KBPS).bitrate,
826+ export_settings(Quality::Medium, 0, mp4, DEFAULT_AUDIO_KBPS, EncoderSeat::Auto).bitrate,
827827 Some(6_000_000)
828828 );
829829 assert_eq!(
830- export_settings(Quality::High, 0, mp4, DEFAULT_AUDIO_KBPS).bitrate,
830+ export_settings(Quality::High, 0, mp4, DEFAULT_AUDIO_KBPS, EncoderSeat::Auto).bitrate,
831831 Some(12_000_000)
832832 );
833833 // Megabits as typed, and as the row says it back.
834834 assert_eq!(
835- export_settings(Quality::Custom, 7, mp4, DEFAULT_AUDIO_KBPS).bitrate,
835+ export_settings(Quality::Custom, 7, mp4, DEFAULT_AUDIO_KBPS, EncoderSeat::Auto).bitrate,
836836 Some(7_000_000)
837837 );
838838 assert_eq!(Quality::Low.detail(0), "2 Mbps");
@@ -840,7 +840,7 @@ fn a_quality_row_is_the_bitrate_it_promises() {
840840 // choice the engine never hears about.
841841 for format in [Format::Mp4, Format::Wav, Format::Flac] {
842842 assert_eq!(
843- export_settings(Quality::Auto, 0, format, DEFAULT_AUDIO_KBPS).format,
843+ export_settings(Quality::Auto, 0, format, DEFAULT_AUDIO_KBPS, EncoderSeat::Auto).format,
844844 format
845845 );
846846 }
@@ -849,7 +849,7 @@ fn a_quality_row_is_the_bitrate_it_promises() {
849849 // silently changes -- the ceiling row included, which is the one a
850850 // raised cap could have walked out past.
851851 for quality in Quality::ALL {
852- let settings = export_settings(quality, MBPS_MAX, mp4, DEFAULT_AUDIO_KBPS);
852+ let settings = export_settings(quality, MBPS_MAX, mp4, DEFAULT_AUDIO_KBPS, EncoderSeat::Auto);
853853 if let Some(bitrate) = settings.bitrate {
854854 assert!(
855855 (u64::from(MBPS_MIN) * 1_000_000..=u64::from(MBPS_MAX) * 1_000_000)
@@ -857,8 +857,9 @@ fn a_quality_row_is_the_bitrate_it_promises() {
857857 "{quality:?} outside the engine clamp"
858858 );
859859 }
860- // The software pin is the environment's to set, never a row's.
861- assert!(!settings.force_sw);
860+ // The seat travels exactly as it was picked, and an unpicked project
861+ // exports on the seat this machine has.
862+ assert_eq!(settings.seat, EncoderSeat::Auto);
862863 }
863864 }
864865
@@ -879,7 +880,7 @@ fn the_sound_row_carries_its_rate_into_both_kinds_of_file() {
879880 for format in [Format::Mp4, Format::Av1, Format::Hevc, Format::Mp3] {
880881 for kbps in AUDIO_KBPS {
881882 assert_eq!(
882- export_settings(Quality::Auto, 0, format, kbps).audio_kbps,
883+ export_settings(Quality::Auto, 0, format, kbps, EncoderSeat::Auto).audio_kbps,
883884 Some(kbps),
884885 "{format:?} at {kbps} kbps"
885886 );
@@ -1198,6 +1199,34 @@ fn a_choice_list_offers_every_value_and_fits_the_smallest_window() {
11981199 }
11991200 assert!(tones[1].3, "the rendition in force is not marked");
12001201
1202+ // The encoder list, the export card's own: all three seats, the one in
1203+ // force marked, and a row each saying what it does. The AV1 warning
1204+ // belongs to exactly one pair -- the GPU on an AV1 file -- so it cannot
1205+ // become a line nobody reads.
1206+ let seats = encoder_choices(EncoderSeat::Software);
1207+ assert_eq!(seats.len(), EncoderSeat::ALL.len());
1208+ assert_eq!(seats.iter().filter(|(.., picked)| *picked).count(), 1);
1209+ for (row, seat) in seats.iter().zip(EncoderSeat::ALL) {
1210+ assert_eq!(row.0, Choice::Encoder(seat));
1211+ assert_eq!(row.1.as_ref(), encoder_label(seat));
1212+ assert!(!row.2.is_empty(), "{seat:?} says nothing about itself");
1213+ assert!(row.2.chars().count() < 26, "{} loses its tail", row.2);
1214+ }
1215+ assert!(seats[2].3, "the seat in force is not marked");
1216+ for format in [Format::Av1, Format::Av1Mp4] {
1217+ assert!(av1_hw_warning(format, EncoderSeat::Hardware).is_some());
1218+ for seat in [EncoderSeat::Auto, EncoderSeat::Software] {
1219+ assert_eq!(av1_hw_warning(format, seat), None, "{seat:?} is the safe seat");
1220+ }
1221+ }
1222+ for format in [Format::Mp4, Format::Hevc, Format::HevcMp4, Format::Wav] {
1223+ assert_eq!(
1224+ av1_hw_warning(format, EncoderSeat::Hardware),
1225+ None,
1226+ "{format:?} is not the encoder that reset the driver"
1227+ );
1228+ }
1229+
12011230 // The open list fits the floor the menus are measured against: the
12021231 // longest of them is the rate ladder with an odd rate cycled in, and it
12031232 // hangs at the pointer with every row on screen. Rows are click targets
crates/app/src/tests/mod.rsmodified+3 -2
@@ -13,7 +13,7 @@ use super::{
1313 ACCENT_PRIMARY, AUDIO_KBPS, COLOR_BANDS, COLOR_BAR_W, COLOR_STEP, COLOR_W, CONTROL_H, Clip, Ctx, DEFAULT_AUDIO_KBPS, EQ_BANDS_MAX,
1414 EQ_CURVE_STEPS, EQ_FFT, EQ_FREQ_HIGH, EQ_FREQ_LOW, EQ_FREQ_STEP, EQ_GAIN_LIMIT, EQ_GRAPH_H,
1515 EQ_HANDLE, EQ_Q_HIGH, EQ_Q_LOW, EQ_Q_STEP, EQ_SPECTRUM_DB, EQ_TICKS, EQ_W_MAX, ESCAPE,
16- EXPORT_FIXED_H, EXPORT_ROWS_H, EXPORT_W, Enable, FORMATS,
16+ EXPORT_FIXED_H, EXPORT_ROWS_H, EXPORT_W, Enable, EncoderSeat, FORMATS,
1717 Format, HEADER_GAP, HEADER_H, HEADER_W, HIST_BINS, HIST_H, HIST_SAMPLES, HIT_MIN, FG_PRIMARY,
1818 FG_SECONDARY, KEYS_ROW_H, KEYS_ROWS_H, KEYS_W, KeyRow, LABEL_H, LABEL_MIN_W, LANE_H, LANES_MAX,
1919 BG_CANVAS, LIBRARY_MAX_W, LIBRARY_MIN_W, Lane, MENU_ITEMS, MENU_PAD, MENU_ROW_H,
@@ -41,7 +41,8 @@ use super::{
4141 use super::{
4242 Choice, EDGE_W, ETA_SPAN, Edge, FITS, FRAME_RATES, LaneKind, PPS_DEFAULT, PPS_MIN, Preset, RESOLUTIONS, Repeat,
4343 Scale, View,
44- ZOOM_MIN_FRAMES, ZOOM_OUT_MARGIN, ZOOM_STEP, audio_rate_choices, clock, eta_secs, file_name, file_uri,
44+ ZOOM_MIN_FRAMES, ZOOM_OUT_MARGIN, ZOOM_STEP, audio_rate_choices, av1_hw_warning, clock,
45+ encoder_choices, encoder_label, eta_secs, file_name, file_uri,
4546 fit_choices, landing, lane_refuses, library_rows, live_idx, next_fit, next_resolution,
4647 note_progress, px_along,
4748 IMPORT_STALL, Import, ImportStage, SEEK_STALL, ScanKey, ScanPlan, SilenceScan, import_line,
crates/app/src/ui/cards.rsmodified+40 -1
@@ -286,6 +286,39 @@ impl Player {
286286 }));
287287 }
288288 list.push(r.into_any_element());
289+ // Which encoder writes the picture, which was an env pin and therefore
290+ // no choice at all. Three seats, so the pointer gets the *list* of them
291+ // ([`Pick::Encoder`]) and never a button clicked round -- the Sound
292+ // row's rule, one row above. Only where there is a picture to encode:
293+ // a WAV has no seat to pick and the row would be a question about
294+ // nothing.
295+ if self.format.has_video() {
296+ let seat = self.encoder_seat();
297+ list.push(
298+ entry(
299+ ("encoder", 0),
300+ "e",
301+ "Encoder".into(),
302+ format!("{} — e steps", encoder_label(seat)).into(),
303+ false,
304+ true,
305+ )
306+ .on_click(cx.listener(|this, event: &ClickEvent, _, cx| {
307+ this.open_picker(Pick::Encoder, event.position(), cx)
308+ }))
309+ .into_any_element(),
310+ );
311+ // ...and, under it, the one thing about that pick a person cannot
312+ // know from the words in the list: this box's driver reset itself
313+ // on the vendored AV1 encoder. A dimmed row and not a modal -- the
314+ // pick is theirs, and the export runs.
315+ if let Some(warning) = av1_hw_warning(self.format, seat) {
316+ list.push(
317+ entry(("encoder-av1", 0), "", "".into(), warning.into(), false, false)
318+ .into_any_element(),
319+ );
320+ }
321+ }
289322 // What happens to the subtitles on this timeline, in one line: how many
290323 // are written into the file and under what names, or the reason each one
291324 // is not. Which tracks travel is not a pick -- everything with a cue on
@@ -431,7 +464,13 @@ impl Player {
431464 |(_, audio)| audio,
432465 );
433466 let settings =
434- export_settings(self.quality, self.custom_mbps, self.format, self.audio_kbps);
467+ export_settings(
468+ self.quality,
469+ self.custom_mbps,
470+ self.format,
471+ self.audio_kbps,
472+ self.encoder_seat(),
473+ );
435474 let size = estimated_bytes(
436475 settings.bitrate.filter(|_| self.format.has_video()),
437476 self.session
crates/engine/examples/bench.rsmodified+8 -8
@@ -44,7 +44,7 @@
4444 use std::path::{Path, PathBuf};
4545 use std::time::{Duration, Instant};
4646
47-use engine::export::{ExportSettings, Format};
47+use engine::export::{EncoderSeat, ExportSettings, Format};
4848 use engine::project::{Clip, LaneKind, Project, Source, Speed};
4949
5050 // `posix_fadvise(2)`, straight from libc, which std already links: dropping
@@ -617,15 +617,15 @@ fn scrub_bench(path: &Path) {
617617 /// The rate is frames the worker reported written over wall seconds, so a run
618618 /// stopped at the cap still reports a rate; the row says `CAPPED` when it was.
619619 fn export_bench(path: &Path, seat: &str, out_dir: &Path) {
620- let (format, force_sw) = match seat {
621- "h264sw" => (Format::Mp4, true),
622- "h264hw" => (Format::Mp4, false),
623- "av1" => (Format::Av1, true),
620+ let (format, pick) = match seat {
621+ "h264sw" => (Format::Mp4, EncoderSeat::Software),
622+ "h264hw" => (Format::Mp4, EncoderSeat::Auto),
623+ "av1" => (Format::Av1, EncoderSeat::Software),
624624 // `hevc` keeps meaning the software intra seat, so a row measured
625625 // against an older baseline still compares with the one beside it; the
626626 // GPU seat is the new name.
627- "hevc" => (Format::Hevc, true),
628- "hevchw" => (Format::Hevc, false),
627+ "hevc" => (Format::Hevc, EncoderSeat::Software),
628+ "hevchw" => (Format::Hevc, EncoderSeat::Auto),
629629 _ => usage(),
630630 };
631631 // The sound is opt-in and named in the row, so an `_av` number is never
@@ -675,7 +675,7 @@ fn export_bench(path: &Path, seat: &str, out_dir: &Path) {
675675 }
676676 };
677677 let settings = ExportSettings {
678- force_sw,
678+ seat: pick,
679679 format,
680680 ..ExportSettings::default()
681681 };
crates/engine/src/edith.rsmodified+149 -23
@@ -1,13 +1,14 @@
11 //! The project file: a line of text per thing, and nothing else.
22 //!
33 //! ```text
4-//! edith 13
4+//! edith 14
55 //! playhead 90
66 //! resolution 1920 1080
77 //! fps 30.0
88 //! tonemap vivid
99 //! proxy on
1010 //! autoproxy off
11+//! encoder hardware
1112 //! limiter -1.0 on
1213 //! source 0 test_av.mp4
1314 //! source 1 /elsewhere/test_av2.mp4
@@ -61,6 +62,15 @@
6162 //! stand-ins this project is missing -- which is the only way to ask, so a
6263 //! project that never wants them never spends a minute of encode on one.
6364 //!
65+//! The `encoder` line is which seat an export of this project writes its
66+//! picture with ([`crate::export::EncoderSeat`]), spelled `auto`, `hardware` or
67+//! `software`. Left out when it is `auto` -- hardware where this machine has a
68+//! seat and software everywhere else -- which is what every dialect before v14
69+//! did and could not be told otherwise. It is the project's and not the
70+//! machine's for the reason the tone map is: a person who picked the software
71+//! encoder for *this* delivery picked it for every export of it, and a pick
72+//! that vanished on a reload is a pick nobody could keep.
73+//!
6474 //! The `limiter` line is the master limiter over the whole mix
6575 //! ([`crate::limiter`]): its ceiling in dBFS and whether it is in circuit,
6676 //! spelled `on` or `off`. Left out when it is the default, which is off.
@@ -117,7 +127,10 @@
117127 //! is the only way an empty lane could still be there on the way back. A lane
118128 //! number may not skip one of its kind.
119129 //!
120-//! **Version 12** was this without the `autoproxy` line: such a project makes a
130+//! **Version 13** was this without the `encoder` line: an export of such a
131+//! project takes the hardware seat where there is one and the software encoder
132+//! everywhere else, which is the only choice those projects had.
133+//! **Version 12** was that without the `autoproxy` line: such a project makes a
121134 //! stand-in for every film that wants one the moment it arrives, which is all
122135 //! any project could do.
123136 //! **Version 11** was that without the `proxy` line: such a project is cut on
@@ -145,7 +158,7 @@
145158 //! what a v1 timeline meant, and an older file simply equalizes and grades
146159 //! nothing, and an older one plays everything at real time, and an older one
147160 //! mixes flat, and an older one shows no subtitles, and an older one is shown
148-//! in the reference rendition -- and saving any of them writes v13. An older
161+//! in the reference rendition -- and saving any of them writes v14. An older
149162 //! reader refuses a newer file by name.
150163 //!
151164 //! Text because an edit list is a few integers and a path, and a path is
@@ -181,7 +194,8 @@ use crate::subtitle::SubtitleTrack;
181194
182195 /// What [`save`] writes. Read support goes back to `edith 1`; see the module
183196 /// docs for what those dialects looked like.
184-const MAGIC: &[u8] = b"edith 13";
197+const MAGIC: &[u8] = b"edith 14";
198+const MAGIC_V13: &[u8] = b"edith 13";
185199 const MAGIC_V12: &[u8] = b"edith 12";
186200 const MAGIC_V11: &[u8] = b"edith 11";
187201 const MAGIC_V10: &[u8] = b"edith 10";
@@ -248,6 +262,11 @@ pub struct Document {
248262 /// file that leaves the line out, which both mean by itself -- the only
249263 /// thing those projects did.
250264 pub auto_proxy: bool,
265+ /// Which encoder an export writes the picture with
266+ /// ([`crate::export::EncoderSeat`]). `Auto` for every dialect before v14 and
267+ /// for a v14 file that leaves the line out, which both mean the seat this
268+ /// machine has -- the only choice those projects offered.
269+ pub encoder: crate::export::EncoderSeat,
251270 pub playhead: u32,
252271 }
253272
@@ -269,6 +288,7 @@ pub fn save(
269288 tone: crate::tonemap::Preset,
270289 proxy: bool,
271290 auto_proxy: bool,
291+ encoder: crate::export::EncoderSeat,
272292 limiter: Limiter,
273293 playhead: u32,
274294 ) -> crate::Result<()> {
@@ -284,7 +304,7 @@ pub fn save(
284304 .and_then(|mut f| {
285305 f.write_all(&emit(
286306 &dir, sources, lanes, gains, subtitles, eq, color, resolution, fps, tone, proxy,
287- auto_proxy, limiter, playhead,
307+ auto_proxy, encoder, limiter, playhead,
288308 ))?;
289309 f.sync_all()
290310 })
@@ -329,6 +349,7 @@ fn emit(
329349 tone: crate::tonemap::Preset,
330350 proxy: bool,
331351 auto_proxy: bool,
352+ encoder: crate::export::EncoderSeat,
332353 limiter: Limiter,
333354 playhead: u32,
334355 ) -> Vec<u8> {
@@ -359,6 +380,12 @@ fn emit(
359380 if !auto_proxy {
360381 out.extend_from_slice(b"autoproxy off\n");
361382 }
383+ // ...and which encoder writes the picture, by the same rule again: `auto`
384+ // is what every project before this line did, so only a project whose owner
385+ // picked a seat says anything here.
386+ if encoder != crate::export::EncoderSeat::default() {
387+ out.extend_from_slice(format!("encoder {}\n", encoder.name()).as_bytes());
388+ }
362389 // Written only when it is not the default, so a project nobody has limited
363390 // is the same bytes it was in v8 bar the version line.
364391 if limiter != Limiter::default() {
@@ -497,8 +524,10 @@ fn parse(data: &[u8], dir: &Path) -> crate::Result<Document> {
497524 // The dialects that wrote a source line without its stream field. Reading
498525 // one is the whole of what "an old project still opens" means here.
499526 let streamless = v1 || first == MAGIC_V2;
500- // The one that says whether the stand-ins are made by themselves...
501- let v13 = first == MAGIC;
527+ // The one that says which encoder an export takes...
528+ let v14 = first == MAGIC;
529+ // ...the ones that say whether the stand-ins are made by themselves...
530+ let v13 = v14 || first == MAGIC_V13;
502531 // ...the ones that say whether it is cut on stand-ins...
503532 let v12 = v13 || first == MAGIC_V12;
504533 // ...the ones that carry an HDR rendition...
@@ -554,6 +583,10 @@ fn parse(data: &[u8], dir: &Path) -> crate::Result<Document> {
554583 // that wanted a stand-in got one, which is what leaving the line out
555584 // still means.
556585 auto_proxy: true,
586+ // ...and nothing before v14 could be told *which* encoder: an export
587+ // took the seat this machine had, which is what leaving the line out
588+ // still means.
589+ encoder: crate::export::EncoderSeat::default(),
557590 fps: None,
558591 playhead: 0,
559592 };
@@ -662,6 +695,20 @@ fn parse(data: &[u8], dir: &Path) -> crate::Result<Document> {
662695 }
663696 };
664697 }
698+ b"encoder" if v14 => {
699+ if !doc.sources.is_empty() {
700+ return Err(
701+ format!("line {n}: encoder belongs once, before the sources").into()
702+ );
703+ }
704+ let f = fields(rest, 1, "encoder", n)?;
705+ doc.encoder = crate::export::EncoderSeat::from_name(f[0]).ok_or_else(|| {
706+ format!(
707+ "line {n}: encoder is auto, hardware or software, not {:?}",
708+ String::from_utf8_lossy(f[0])
709+ )
710+ })?;
711+ }
665712 b"limiter" if v9 => {
666713 if !doc.sources.is_empty() {
667714 return Err(
@@ -1183,6 +1230,7 @@ mod tests {
11831230 crate::tonemap::Preset::default(),
11841231 false,
11851232 true,
1233+ crate::export::EncoderSeat::default(),
11861234 Limiter::default(),
11871235 playhead,
11881236 )
@@ -1228,6 +1276,7 @@ mod tests {
12281276 crate::tonemap::Preset::default(),
12291277 false,
12301278 true,
1279+ crate::export::EncoderSeat::default(),
12311280 Limiter::default(),
12321281 0,
12331282 );
@@ -1256,7 +1305,7 @@ mod tests {
12561305 video 1 0 0 30 0 - - - fit 1000\n";
12571306 let old = parse(v9, &dir).expect("v9 still loads");
12581307 assert_eq!(old.subtitles, Vec::new());
1259- assert!(flat(&dir, &old.sources, &old.lanes, old.playhead).starts_with(b"edith 13\n"));
1308+ assert!(flat(&dir, &old.sources, &old.lanes, old.playhead).starts_with(b"edith 14\n"));
12601309 // ...and the line itself is not a v9 line: a dialect may not be mixed.
12611310 let mixed = parse(b"edith 9\nsource 0 a.mp4\nsubtitle - subs.srt\n", &dir)
12621311 .unwrap_err()
@@ -1293,6 +1342,7 @@ mod tests {
12931342 crate::tonemap::Preset::default(),
12941343 proxy,
12951344 true,
1345+ crate::export::EncoderSeat::default(),
12961346 Limiter::default(),
12971347 0,
12981348 )
@@ -1354,6 +1404,7 @@ mod tests {
13541404 crate::tonemap::Preset::default(),
13551405 proxy,
13561406 auto,
1407+ crate::export::EncoderSeat::default(),
13571408 Limiter::default(),
13581409 0,
13591410 )
@@ -1395,6 +1446,78 @@ mod tests {
13951446 }
13961447 }
13971448
1449+ /// The v14 line: which encoder an export writes the picture with, by name,
1450+ /// read back as the very seat -- and the dialect before it, which had no
1451+ /// way to say one and took whatever this machine had.
1452+ #[test]
1453+ fn the_encoder_seat_round_trips_by_name_and_a_v13_file_takes_the_machines() {
1454+ use crate::export::EncoderSeat;
1455+ let dir = PathBuf::from("/proj");
1456+ let (_, sources, lanes) = doc();
1457+ let bytes = |seat| {
1458+ super::emit(
1459+ &dir,
1460+ &sources,
1461+ &lanes,
1462+ &[],
1463+ &[],
1464+ &[],
1465+ &[],
1466+ (1280, 720),
1467+ None,
1468+ crate::tonemap::Preset::default(),
1469+ false,
1470+ true,
1471+ seat,
1472+ Limiter::default(),
1473+ 0,
1474+ )
1475+ };
1476+ // The default is the line left out, so a project nobody has picked a
1477+ // seat for is the bytes a v13 file was bar the version line.
1478+ let auto = bytes(EncoderSeat::Auto);
1479+ assert!(
1480+ !String::from_utf8_lossy(&auto).contains("encoder"),
1481+ "auto is the line left out: {}",
1482+ String::from_utf8_lossy(&auto)
1483+ );
1484+ assert_eq!(
1485+ parse(&auto, &dir).expect("v14 parses").encoder,
1486+ EncoderSeat::Auto
1487+ );
1488+ for seat in [EncoderSeat::Hardware, EncoderSeat::Software] {
1489+ let written = bytes(seat);
1490+ let text = String::from_utf8_lossy(&written).to_string();
1491+ assert!(text.contains(&format!("encoder {}\n", seat.name())), "{text}");
1492+ assert_eq!(parse(&written, &dir).expect("v14 parses").encoder, seat);
1493+ }
1494+
1495+ // A v13 project took the seat this machine had and could not be told
1496+ // otherwise.
1497+ let v13 = b"edith 13\nplayhead 0\nresolution 1280 720\nautoproxy off\nsource 0 a.mp4\n\
1498+ video 1 0 0 30 0 - - - fit 1000\n";
1499+ let old = parse(v13, &dir).expect("v13 still loads");
1500+ assert_eq!(
1501+ old.encoder,
1502+ EncoderSeat::Auto,
1503+ "a v13 project exported on whatever seat there was"
1504+ );
1505+ assert!(!old.auto_proxy, "the rest of it came back too");
1506+ // ...and the line is not a v13 line: a dialect may not be mixed.
1507+ let mixed = parse(b"edith 13\nsource 0 a.mp4\nencoder software\n", &dir)
1508+ .unwrap_err()
1509+ .to_string();
1510+ assert_eq!(mixed, "line 3: unknown keyword \"encoder\"");
1511+ // Anything but the three names is a corrupt line, by name.
1512+ for line in ["encoder\n", "encoder gpu\n", "encoder Hardware\n"] {
1513+ let file = format!("edith 14\nsource 0 a.mp4\n{line}");
1514+ assert!(
1515+ parse(file.as_bytes(), &dir).is_err(),
1516+ "{line:?} is not an encoder line"
1517+ );
1518+ }
1519+ }
1520+
13981521 /// The v11 line: the HDR rendition, written by name, read back as the very
13991522 /// preset -- and the dialect before it, which had no way to say one and
14001523 /// meant the published conversion.
@@ -1416,6 +1539,7 @@ mod tests {
14161539 preset,
14171540 false,
14181541 true,
1542+ crate::export::EncoderSeat::default(),
14191543 Limiter::default(),
14201544 0,
14211545 );
@@ -1510,7 +1634,7 @@ mod tests {
15101634 let bytes = flat(&dir, &sources, &lanes, 12);
15111635 assert_eq!(
15121636 String::from_utf8_lossy(&bytes),
1513- "edith 13\nplayhead 12\nresolution 1280 720\nsource 0 a.mp4\n\
1637+ "edith 14\nplayhead 12\nresolution 1280 720\nsource 0 a.mp4\n\
15141638 source 2 /elsewhere/b.mp4\n\
15151639 video 1 0 0 30 0 0 - - fit 1000\nvideo 1 30 10 20 1 1 - - fit 1000\n\
15161640 audio 1 0 0 30 0 0 - - fit 1000\n",
@@ -1547,7 +1671,7 @@ mod tests {
15471671 let bytes = flat(&dir, &sources, &lanes, 7);
15481672 assert_eq!(
15491673 String::from_utf8_lossy(&bytes),
1550- "edith 13\nplayhead 7\nresolution 1280 720\nsource 0 a.mp4\n\
1674+ "edith 14\nplayhead 7\nresolution 1280 720\nsource 0 a.mp4\n\
15511675 video 1 0 0 30 0 4 - - fit 1000\naudio 1\n\
15521676 video 2 40 0 10 0 - - - fit 1000\naudio 2 0 0 30 0 4 - - fit 1000\n",
15531677 "an empty lane is a line of its own; everything else is its clips"
@@ -1655,7 +1779,7 @@ mod tests {
16551779 let bytes = emit(&dir, &sources, &lanes, &eq, &[], (1280, 720), 0);
16561780 assert_eq!(
16571781 String::from_utf8_lossy(&bytes),
1658- "edith 13\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\
1782+ "edith 14\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\
16591783 eq 80.0:-3.0:0.707:ls 1000.0:4.5:1.0:pk\n\
16601784 eq 16777215.0:-0.1:3.918315e-39:hs\n\
16611785 eq\n\
@@ -1759,7 +1883,7 @@ mod tests {
17591883 let bytes = emit(&dir, &sources, &lanes, &[], &color, (1280, 720), 0);
17601884 assert_eq!(
17611885 String::from_utf8_lossy(&bytes),
1762- "edith 13\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\
1886+ "edith 14\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\
17631887 color 0.1:1.2:0.9:-0.3\n\
17641888 color -1e-7:16777215.0:3.918315e-39:-0.0\n\
17651889 color 0.0:1.0:1.0:0.0\n\
@@ -1824,7 +1948,7 @@ mod tests {
18241948 (1280, 720),
18251949 old.playhead
18261950 )),
1827- "edith 13\nplayhead 3\nresolution 1280 720\nsource 0 a.mp4\n\
1951+ "edith 14\nplayhead 3\nresolution 1280 720\nsource 0 a.mp4\n\
18281952 eq 80.0:-3.0:0.707:ls\n\
18291953 video 1 0 0 30 0 0 0 - fit 1000\naudio 1 0 0 30 0 0 - - fit 1000\n"
18301954 );
@@ -1862,7 +1986,7 @@ mod tests {
18621986 let bytes = emit(&dir, &sources, &lanes, &[], &[], (1280, 720), 0);
18631987 assert_eq!(
18641988 String::from_utf8_lossy(&bytes),
1865- "edith 13\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\
1989+ "edith 14\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\
18661990 video 1 0 0 30 0 - - - fit 2000\nvideo 1 15 30 40 0 - - - fit 250\n\
18671991 audio 1 0 0 30 0 - - - fit 2000\n",
18681992 "the rate is the clip line's last field, in thousandths"
@@ -1891,7 +2015,7 @@ mod tests {
18912015 (1280, 720),
18922016 old.playhead
18932017 )),
1894- "edith 13\nplayhead 3\nresolution 1280 720\nsource 0 a.mp4\n\
2018+ "edith 14\nplayhead 3\nresolution 1280 720\nsource 0 a.mp4\n\
18952019 video 1 0 0 30 0 0 - - fit 1000\naudio 1 0 0 30 0 0 - - fit 1000\n"
18962020 );
18972021 // A rate outside what the editor can set is a corrupt line, by name.
@@ -1934,12 +2058,13 @@ mod tests {
19342058 crate::tonemap::Preset::default(),
19352059 false,
19362060 true,
2061+ crate::export::EncoderSeat::default(),
19372062 limiter,
19382063 0,
19392064 );
19402065 assert_eq!(
19412066 String::from_utf8_lossy(&bytes),
1942- "edith 13\nplayhead 0\nresolution 1280 720\nfps 23.976023976023978\n\
2067+ "edith 14\nplayhead 0\nresolution 1280 720\nfps 23.976023976023978\n\
19432068 limiter -1.5 on\nsource 0 a.mp4\n\
19442069 video 1 0 0 30 0 - - - fit 1000\naudio 1 0 0 30 0 - - - fit 1000\n\
19452070 audio 2 0 0 30 0 - - - fit 1000\n\
@@ -1971,7 +2096,7 @@ mod tests {
19712096 (1280, 720),
19722097 old.playhead
19732098 )),
1974- "edith 13\nplayhead 3\nresolution 1280 720\nsource 0 a.mp4\n\
2099+ "edith 14\nplayhead 3\nresolution 1280 720\nsource 0 a.mp4\n\
19752100 video 1 0 0 30 0 - - - fit 1000\naudio 1 0 0 30 0 - - - fit 1000\n"
19762101 );
19772102
@@ -2135,7 +2260,7 @@ mod tests {
21352260 assert!(old.eq.is_empty(), "nothing before v5 equalizes anything");
21362261 assert_eq!(
21372262 String::from_utf8_lossy(&flat(&dir, &old.sources, &old.lanes, old.playhead)),
2138- "edith 13\nplayhead 12\nresolution 1280 720\nsource 0 a.mp4\n\
2263+ "edith 14\nplayhead 12\nresolution 1280 720\nsource 0 a.mp4\n\
21392264 source 2 /elsewhere/b.mp4\n\
21402265 video 1 0 0 30 0 0 - - fit 1000\nvideo 1 30 10 20 1 1 - - fit 1000\n\
21412266 audio 1 0 0 30 0 0 - - fit 1000\n"
@@ -2188,7 +2313,7 @@ mod tests {
21882313 let v5 = flat(&dir, &back.sources, &back.lanes, back.playhead);
21892314 assert_eq!(
21902315 String::from_utf8_lossy(&v5),
2191- "edith 13\nplayhead 12\nresolution 1280 720\nsource 0 a.mp4\n\
2316+ "edith 14\nplayhead 12\nresolution 1280 720\nsource 0 a.mp4\n\
21922317 source 0 /elsewhere/b.mp4\n\
21932318 video 1 0 0 30 0 0 - - fit 1000\nvideo 1 30 10 20 1 1 - - fit 1000\n\
21942319 audio 1 0 0 30 0 0 - - fit 1000\n",
@@ -2220,7 +2345,7 @@ mod tests {
22202345 // Saved again it is the current version, which round-trips to the
22212346 // same document.
22222347 let v5 = flat(&dir, &back.sources, &back.lanes, back.playhead);
2223- assert!(v5.starts_with(b"edith 13\n"));
2348+ assert!(v5.starts_with(b"edith 14\n"));
22242349 let again = parse(&v5, &dir).expect("v5 parses");
22252350 assert_eq!(again.lanes, back.lanes);
22262351 // A dialect may not be mixed: lane lines under v1, `clip` under v2.
@@ -2320,6 +2445,7 @@ mod tests {
23202445 crate::tonemap::Preset::default(),
23212446 false,
23222447 true,
2448+ crate::export::EncoderSeat::default(),
23232449 Limiter::default(),
23242450 0,
23252451 )
@@ -2327,7 +2453,7 @@ mod tests {
23272453 let bytes = std::fs::read(&path).expect("read back");
23282454 assert_eq!(
23292455 String::from_utf8_lossy(&bytes),
2330- "edith 13\nplayhead 0\nresolution 1280 720\nsource 1 a.mp4\n\
2456+ "edith 14\nplayhead 0\nresolution 1280 720\nsource 1 a.mp4\n\
23312457 video 1 0 0 30 0 - - - fit 1000\naudio 1 0 0 30 0 - - - fit 1000\n"
23322458 );
23332459 // Loading rejoins the *given* directory, so the file is reached by the
@@ -2372,10 +2498,10 @@ mod tests {
23722498 #[test]
23732499 fn a_wrong_first_line_is_refused_by_name() {
23742500 let dir = PathBuf::from("/proj");
2375- let err = parse(b"edith 14\nsource 0 a.mp4\nvideo 0 0 5 0 -\n", &dir)
2501+ let err = parse(b"edith 15\nsource 0 a.mp4\nvideo 0 0 5 0 -\n", &dir)
23762502 .unwrap_err()
23772503 .to_string();
2378- assert_eq!(err, "line 1: unsupported version 14");
2504+ assert_eq!(err, "line 1: unsupported version 15");
23792505 for junk in [&b""[..], b"{}\n", b"source a.mp4\n"] {
23802506 assert_eq!(
23812507 parse(junk, &dir).unwrap_err().to_string(),
crates/engine/src/export.rsmodified+112 -32
@@ -263,6 +263,48 @@ impl Format {
263263 }
264264 }
265265
266+/// Which encoder writes the picture, as a person picks it on a card. Three
267+/// discrete choices and not a switch, because "whatever is best" and "the GPU,
268+/// and say so if there is none" are different answers: a driver that encodes
269+/// badly wants [`Software`](Self::Software), and a person who *needs* the GPU
270+/// (a long delivery, a machine whose CPU is doing something else) wants to be
271+/// told when it is not there rather than to wait out a silent fallback.
272+#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
273+pub enum EncoderSeat {
274+ /// Hardware where this machine has a seat for the picked codec, software
275+ /// everywhere else -- what every export did before there was a choice, and
276+ /// still what an unpicked project does.
277+ #[default]
278+ Auto,
279+ /// The GPU or nothing: no silent fallback, and [`Enc::open`] refuses in
280+ /// words before a byte is written. The only way to the plugin's AV1 seat,
281+ /// which [`Auto`](Self::Auto) will not enter (see [`Enc::open_av1`]).
282+ Hardware,
283+ /// The software encoder even where a seat exists -- for a driver that
284+ /// encodes badly, and for the AV1 pair, where it is what `Auto` picks too.
285+ Software,
286+}
287+
288+impl EncoderSeat {
289+ pub const ALL: [EncoderSeat; 3] = [Self::Auto, Self::Hardware, Self::Software];
290+
291+ /// What a card row and a project file call it. The file's keyword too, so
292+ /// the two can never drift ([`crate::edith`]).
293+ pub fn name(self) -> &'static str {
294+ match self {
295+ Self::Auto => "auto",
296+ Self::Hardware => "hardware",
297+ Self::Software => "software",
298+ }
299+ }
300+
301+ /// Reads one back. `None` for anything else, which a project file refuses
302+ /// by name rather than silently exporting on another seat.
303+ pub fn from_name(name: &[u8]) -> Option<Self> {
304+ Self::ALL.into_iter().find(|s| s.name().as_bytes() == name)
305+ }
306+}
307+
266308 /// What the caller gets to decide about the output. The codec is not among it:
267309 /// [`Format`] names a container *and* what goes in it, because every pair we
268310 /// can write is a pair we can also read back.
@@ -271,9 +313,11 @@ pub struct ExportSettings {
271313 /// Bits per second, clamped to the same sane range the automatic value uses.
272314 /// `None` picks it from the picture size and frame rate. Video only.
273315 pub bitrate: Option<u64>,
274- /// Skip the hardware encoder even where it is available -- an escape hatch
275- /// for a driver that encodes badly, matching the `VE_SW_ENC` env pin.
276- pub force_sw: bool,
316+ /// Which encoder writes the picture ([`EncoderSeat`]). Was a `force_sw`
317+ /// flag, which could say "not the GPU" and never "the GPU or say so".
318+ /// [`EncoderSeat::Software`] is what the `VE_SW_ENC` env pin still forces
319+ /// on every export of a run.
320+ pub seat: EncoderSeat,
277321 /// The file to write. Defaults to [`Format::Mp4`], which is what every
278322 /// caller wrote before there was a choice.
279323 pub format: Format,
@@ -528,14 +572,35 @@ fn audio_kbps_of(settings: &ExportSettings) -> u32 {
528572 }
529573
530574 /// The hardware seat for these settings, opened exactly as the export opens it
531-/// -- the same pins, the same AV1 opt-in, the same dimensions a driver may
532-/// refuse -- or `None` where the software encoder takes the file. The single
533-/// place that choice is made, which is what lets [`planned_video`] *measure* it
534-/// instead of promising it.
535-fn hw_seat(meta: &VideoMeta, settings: &ExportSettings) -> Option<HwEncoder> {
536- if settings.force_sw || forced("VE_SW_ENC") {
537- return None;
575+/// -- the same pins, the same dimensions a driver may refuse -- or `None` where
576+/// the software encoder takes the file. The single place that choice is made,
577+/// which is what lets [`planned_video`] *measure* it instead of promising it.
578+///
579+/// `Err` is the one answer the software encoder does **not** take over from:
580+/// [`EncoderSeat::Hardware`] asked for the GPU by name and this machine has no
581+/// seat for the codec, so the export refuses in words rather than falling back
582+/// to an encoder nobody picked. Every caller is before a file exists
583+/// ([`Enc::open`] runs ahead of the muxer), which is what makes the refusal
584+/// free.
585+fn hw_seat(meta: &VideoMeta, settings: &ExportSettings) -> crate::Result<Option<HwEncoder>> {
586+ if settings.seat == EncoderSeat::Software || forced("VE_SW_ENC") {
587+ return Ok(None);
588+ }
589+ let opened = open_hw_seat(meta, settings);
590+ if opened.is_none() && settings.seat == EncoderSeat::Hardware {
591+ return Err(format!(
592+ "hardware encoding was asked for and this machine has no VA-API seat for {}: \
593+ pick Auto or Software on the export card",
594+ settings.format.name()
595+ )
596+ .into());
538597 }
598+ Ok(opened)
599+}
600+
601+/// The plugin half of [`hw_seat`]: what the driver gives for this codec and
602+/// this picture, with no policy in it but the AV1 one.
603+fn open_hw_seat(meta: &VideoMeta, settings: &ExportSettings) -> Option<HwEncoder> {
539604 let (fps_num, fps_den) = crate::mux::frame_timing(meta.frame_rate).ok()?;
540605 let bitrate = bitrate_of(meta, settings);
541606 match settings.format {
@@ -561,9 +626,10 @@ fn hw_seat(meta: &VideoMeta, settings: &ExportSettings) -> Option<HwEncoder> {
561626 bitrate,
562627 ColorDescription::output(meta.height),
563628 ),
564- // Opt-in only, for the reason [`Enc::open_av1`] states in full. Both
629+ // Asked for by name only, for the reason [`Enc::open_av1`] states in
630+ // full: `Auto` takes the software encoder here and nowhere else. Both
565631 // AV1 formats sit on it: the container is not the encoder's business.
566- format if format.is_av1() && !forced("VE_HW_AV1") => None,
632+ format if format.is_av1() && settings.seat != EncoderSeat::Hardware => None,
567633 format if format.is_av1() => {
568634 HwEncoder::open_av1(meta.width, meta.height, fps_num, fps_den, bitrate)
569635 }
@@ -585,6 +651,15 @@ fn hw_seat(meta: &VideoMeta, settings: &ExportSettings) -> Option<HwEncoder> {
585651 }
586652 }
587653
654+/// What a hardware encode is called wherever one is named -- the card's line
655+/// before the export and the progress line during it.
656+const HW_LABEL: &str = "HW encode (VA-API)";
657+
658+/// ...and what a card says instead where [`EncoderSeat::Hardware`] was picked
659+/// and there is no seat: the export's own refusal in the width of a card row,
660+/// shown *before* the button is pressed rather than a minute into a file.
661+pub const NO_HW_SEAT: &str = "no HW seat here — pick Auto or Software";
662+
588663 /// How a front-end names a video seat: which of the two encoders has the file,
589664 /// and which library that is. Not the codec -- a caller shows this beside the
590665 /// format it picked, and `rav1e` names AV1 as `rusty_h264` names H.264. One
@@ -592,7 +667,7 @@ fn hw_seat(meta: &VideoMeta, settings: &ExportSettings) -> Option<HwEncoder> {
592667 /// during one cannot drift apart.
593668 fn video_label(format: Format, hw: bool) -> &'static str {
594669 match (format, hw) {
595- (_, true) => "HW encode (VA-API)",
670+ (_, true) => HW_LABEL,
596671 (Format::Hevc | Format::HevcMp4, false) => "SW encode (oxideav-h265 intra)",
597672 (Format::Av1 | Format::Av1Mp4, false) => "SW encode (rav1e)",
598673 (_, false) => "SW encode (rusty_h264)",
@@ -925,10 +1000,12 @@ pub fn planned_subtitles(
9251000 /// Costs that open (~100 ms here): ask it off a render thread and keep the
9261001 /// answer until the format, the resolution or the bitrate changes.
9271002 pub fn planned_video(meta: &VideoMeta, settings: &ExportSettings) -> Option<&'static str> {
928- settings
929- .format
930- .has_video()
931- .then(|| video_label(settings.format, hw_seat(meta, settings).is_some()))
1003+ settings.format.has_video().then(|| match hw_seat(meta, settings) {
1004+ Ok(hw) => video_label(settings.format, hw.is_some()),
1005+ // The seat the settings demand and this machine has not: the very
1006+ // refusal [`start`] would settle with, said on the card instead.
1007+ Err(_) => NO_HW_SEAT,
1008+ })
9321009 }
9331010
9341011 /// What [`start`] would open for *this* timeline: the picture's seat -- or the
@@ -954,7 +1031,7 @@ pub fn planned_seats(
9541031 let video = settings.format.has_video().then(|| {
9551032 match CopyPlan::of(project, meta, settings).is_some() {
9561033 true => "copy (source packets)",
957- false => video_label(settings.format, hw_seat(meta, settings).is_some()),
1034+ false => planned_video(meta, settings).unwrap_or(NO_HW_SEAT),
9581035 }
9591036 });
9601037 // The half [`audio_label`] cannot know from the format: a copy is a *sample
@@ -3041,7 +3118,7 @@ impl Enc {
30413118 // hand 24000/1001 over as a rounded 23.976, which is the same
30423119 // truncation the container timing had.
30433120 crate::mux::frame_timing(meta.frame_rate)?;
3044- if let Some(hw) = hw_seat(meta, settings) {
3121+ if let Some(hw) = hw_seat(meta, settings)? {
30453122 eprintln!("export encoder: hardware (VA-API plugin)");
30463123 return Ok(Self::Hw(hw));
30473124 }
@@ -3074,25 +3151,28 @@ impl Enc {
30743151 /// simply has none and this falls through -- the same "no" a GPU without an
30753152 /// AV1 encode entrypoint gives, and the same silent fallback either way.
30763153 ///
3077- /// It is **opt-in**, which is the one place this pair does not mirror the
3078- /// H.264 one: the vendored cros-codecs AV1 encoder hung the GPU on this
3079- /// project's own radeonsi box -- `engine_hw: operation failed`, then an
3080- /// amdgpu hard recovery and a lost context, measured 2026-08-10 exporting
3081- /// the 720p fixture. A software encoder that takes half a minute is a worse
3082- /// export than a hardware one; a driver reset is not an export at all. So
3083- /// the plugin's AV1 seat is wired, kept and only entered when `VE_HW_AV1=1`
3084- /// asks for it by name.
3154+ /// It is **asked for by name**, which is the one place this pair does not
3155+ /// mirror the H.264 one: the vendored cros-codecs AV1 encoder hung the GPU
3156+ /// on this project's own radeonsi box -- `engine_hw: operation failed`,
3157+ /// then an amdgpu hard recovery and a lost context, measured 2026-08-10
3158+ /// exporting the 720p fixture. A software encoder that takes half a minute
3159+ /// is a worse export than a hardware one; a driver reset is not an export
3160+ /// at all. So [`EncoderSeat::Auto`] takes `rav1e` here and only
3161+ /// [`EncoderSeat::Hardware`] -- a person picking the GPU for AV1 on the
3162+ /// card, under a row that names the risk -- enters the plugin's seat. It
3163+ /// was an env pin (`VE_HW_AV1=1`) until the card could ask, which is a
3164+ /// switch nobody exporting a film would ever find.
30853165 ///
30863166 /// corner-cut: the upgrade path is a driver this was reproduced against (or a
30873167 /// cros-codecs release that fixes it) plus a probe encode of one frame at
3088- /// open, after which this can prefer hardware the way H.264 does.
3168+ /// open, after which `Auto` can prefer hardware the way H.264 does.
30893169 fn open_av1(meta: &VideoMeta, settings: &ExportSettings) -> crate::Result<Self> {
30903170 let bitrate = bitrate_of(meta, settings);
30913171 let (fps_num, fps_den) = crate::mux::frame_timing(meta.frame_rate)?;
30923172 // Two seconds between keyframes, as the H.264 seat does: a seek may only
30933173 // land on one, and this is what a cluster of the Matroska file is.
30943174 let gop = (meta.frame_rate * 2.0).round().max(1.0) as u64;
3095- if let Some(hw) = hw_seat(meta, settings) {
3175+ if let Some(hw) = hw_seat(meta, settings)? {
30963176 eprintln!("export encoder: hardware AV1 (VA-API plugin)");
30973177 return Ok(Self::Av1Hw(hw));
30983178 }
@@ -3179,7 +3259,7 @@ impl Enc {
31793259 )
31803260 .into());
31813261 }
3182- if let Some(hw) = hw_seat(meta, settings) {
3262+ if let Some(hw) = hw_seat(meta, settings)? {
31833263 eprintln!("export encoder: hardware HEVC intra (VA-API plugin)");
31843264 return Ok(Self::HevcHw(hw));
31853265 }
@@ -3295,8 +3375,8 @@ impl Enc {
32953375 /// being read back -- `None` for every seat that reads bytes, which is both
32963376 /// software encoders and the intra HEVC one.
32973377 ///
3298- /// The AV1 hardware seat is left out on purpose: it is opt-in behind
3299- /// `VE_HW_AV1` because the vendored encoder reset this project's GPU
3378+ /// The AV1 hardware seat is left out on purpose: it is entered only when a
3379+ /// person picks it by name because the vendored encoder reset this project's GPU
33003380 /// ([`Enc::open_av1`]), and a path that cannot be measured is not one to
33013381 /// widen.
33023382 fn dma_want(&self, meta: &VideoMeta) -> Option<crate::hw::DmaWant> {
crates/engine/src/hw.rsmodified+4 -3
@@ -556,9 +556,10 @@ impl HwEncoder {
556556 /// really fires, and the caller's software AV1 encoder takes the export
557557 /// without saying anything about it.
558558 ///
559- /// The caller only reaches this behind `VE_HW_AV1=1`: the vendored encoder
560- /// reset this project's own GPU, which [`crate::export::Enc::open_av1`]
561- /// states in full.
559+ /// The caller only reaches this when a person picked
560+ /// [`crate::export::EncoderSeat::Hardware`] for an AV1 export: the vendored
561+ /// encoder reset this project's own GPU, which
562+ /// [`crate::export::Enc::open_av1`] states in full.
562563 pub fn open_av1(
563564 width: u32,
564565 height: u32,
crates/engine/src/playback.rsmodified+30 -0
@@ -394,6 +394,11 @@ pub struct PlaybackSession {
394394 /// the project like the one above it, and read by the front end: the engine
395395 /// starts no encode of its own.
396396 auto_proxies: bool,
397+ /// Which encoder an export of this project writes its picture with
398+ /// ([`crate::export::EncoderSeat`]). The project's, saved with it like the
399+ /// two switches above, and read by the front end: the engine starts no
400+ /// export of its own.
401+ encoder_seat: crate::export::EncoderSeat,
397402 }
398403
399404 /// What an edit dirtied -- which half of the pipeline has to be rebuilt for the
@@ -512,6 +517,7 @@ impl PlaybackSession {
512517 // A file just opened is a project nobody has picked stand-ins for.
513518 proxies: false,
514519 auto_proxies: true,
520+ encoder_seat: crate::export::EncoderSeat::default(),
515521 })
516522 }
517523
@@ -628,6 +634,7 @@ impl PlaybackSession {
628634 // A file just opened is a project nobody has picked stand-ins for.
629635 proxies: false,
630636 auto_proxies: true,
637+ encoder_seat: crate::export::EncoderSeat::default(),
631638 })
632639 }
633640
@@ -708,6 +715,7 @@ impl PlaybackSession {
708715 // A file just opened is a project nobody has picked stand-ins for.
709716 proxies: false,
710717 auto_proxies: true,
718+ encoder_seat: crate::export::EncoderSeat::default(),
711719 })
712720 }
713721
@@ -1008,6 +1016,9 @@ impl PlaybackSession {
10081016 // ...and what it says about making them, which is "yes" for every
10091017 // dialect before v13 and for one that leaves the line out.
10101018 auto_proxies: doc.auto_proxy,
1019+ // ...and which encoder it exports with, which is the seat this
1020+ // machine has for every dialect before v14.
1021+ encoder_seat: doc.encoder,
10111022 };
10121023 // The scaffolding above opened source 0 from its first frame and the
10131024 // whole of its audio; this puts both onto the clip the playhead is
@@ -1271,6 +1282,10 @@ impl PlaybackSession {
12711282 // question from whether it cuts on them and the only one an import
12721283 // asks ([`Self::auto_proxies`]).
12731284 self.auto_proxies,
1285+ // ...and which encoder an export of it opens, for the same reason:
1286+ // a project delivered on the software encoder is delivered on it
1287+ // again after a reload.
1288+ self.encoder_seat,
12741289 self.project.limiter(),
12751290 playhead,
12761291 )
@@ -2087,6 +2102,21 @@ impl PlaybackSession {
20872102 self.seek(now);
20882103 }
20892104
2105+ /// Which encoder an export of this project would open its picture on
2106+ /// ([`crate::export::EncoderSeat`]). What a front-end puts into the
2107+ /// [`ExportSettings`](crate::export::ExportSettings) it starts an export
2108+ /// with -- and what the export card shows -- so the pick, the prediction
2109+ /// and the file are one answer.
2110+ pub fn encoder_seat(&self) -> crate::export::EncoderSeat {
2111+ self.encoder_seat
2112+ }
2113+
2114+ /// Pick the seat. Nothing to reseek and nothing to re-probe here: this
2115+ /// decides what an *export* opens, never what plays.
2116+ pub fn set_encoder_seat(&mut self, seat: crate::export::EncoderSeat) {
2117+ self.encoder_seat = seat;
2118+ }
2119+
20902120 /// Whether an imported film that wants a stand-in gets one made for it
20912121 /// there and then ([`Self::set_auto_proxies`]).
20922122 pub fn auto_proxies(&self) -> bool {
crates/engine/tests/av1.rsmodified+2 -2
@@ -371,7 +371,7 @@ fn av1_settings() -> ExportSettings {
371371 format: engine::export::Format::Av1,
372372 // The software encoder, on every machine: the hardware twin below is
373373 // where the plugin's AV1 seat is exercised.
374- force_sw: true,
374+ seat: engine::export::EncoderSeat::Software,
375375 ..Default::default()
376376 }
377377 }
@@ -466,7 +466,7 @@ fn an_av1_export_carries_the_timelines_sound_in_either_container() {
466466 let out = Scratch::file("ve_av1_sound", ext);
467467 let settings = ExportSettings {
468468 format,
469- force_sw: true,
469+ seat: engine::export::EncoderSeat::Software,
470470 ..Default::default()
471471 };
472472 let handle = session.export_to_with(&out, &settings);
crates/engine/tests/backends.rsmodified+58 -13
@@ -13,7 +13,7 @@ use std::time::{Duration, Instant};
1313
1414 use engine::Codec;
1515 use engine::decode::{Backend, probe};
16-use engine::export::{ExportSettings, Format};
16+use engine::export::{EncoderSeat, ExportSettings, Format};
1717 use engine::scratch::Scratch;
1818 use engine::{ExportHandle, PlaybackSession};
1919
@@ -144,15 +144,18 @@ fn the_planned_encoders_are_the_ones_the_job_opens() {
144144
145145 /// The same pin, swept over the two things that *move* the seat under a user's
146146 /// hand: the picture size (the plugin refuses HEVC below the driver's 384x384
147-/// floor and the software intra encoder takes the file) and the software pin on
148-/// the card. The export card reads [`engine::export::planned_video`] for every
149-/// one of these combinations, so a size that flips the seat and a card that kept
150-/// the old line is the exact lie this sweep exists to catch.
147+/// floor and the software intra encoder takes the file) and the seat picked on
148+/// the card ([`engine::export::EncoderSeat`]). The export card reads
149+/// [`engine::export::planned_video`] for every one of these combinations, so a
150+/// size that flips the seat and a card that kept the old line is the exact lie
151+/// this sweep exists to catch.
151152 ///
152-/// Not swept: the hardware AV1 seat. It is `VE_HW_AV1=1` opt-in because opening
153-/// it hung this box's GPU into a driver reset (2026-08-10), and a test suite is
154-/// not the place to find out whether that is fixed -- `av1.rs` keeps that one
155-/// `#[ignore]`d and by name.
153+/// Not swept: the hardware AV1 seat, which is what `Hardware` means for the two
154+/// AV1 rows. Opening it hung this box's GPU into a driver reset (2026-08-10) and
155+/// a test suite is not the place to find out whether that is fixed -- `av1.rs`
156+/// keeps that one `#[ignore]`d and by name -- so `Hardware` is swept over the
157+/// formats whose seat is safe to open, and the AV1 pair only over the seats that
158+/// open no plugin at all.
156159 #[test]
157160 fn the_planned_seat_follows_the_size_and_the_pin() {
158161 for (format, ext) in [
@@ -163,10 +166,13 @@ fn the_planned_seat_follows_the_size_and_the_pin() {
163166 (Format::HevcMp4, "mp4"),
164167 ] {
165168 for (width, height) in [(320, 180), (1280, 720), (1920, 1080)] {
166- for force_sw in [false, true] {
169+ for seat in EncoderSeat::ALL {
170+ if seat == EncoderSeat::Hardware && matches!(format, Format::Av1 | Format::Av1Mp4) {
171+ continue;
172+ }
167173 let settings = ExportSettings {
168174 format,
169- force_sw,
175+ seat,
170176 ..ExportSettings::default()
171177 };
172178 let mut session =
@@ -178,7 +184,7 @@ fn the_planned_seat_follows_the_size_and_the_pin() {
178184 .expect("these formats carry picture");
179185 // A pinned job is software by definition, whatever the machine
180186 // has -- the one seat this file may assert outright.
181- if force_sw {
187+ if seat == EncoderSeat::Software {
182188 assert!(
183189 planned.starts_with("SW encode"),
184190 "{ext} {width}x{height}: a pinned job is software, got {planned}"
@@ -186,13 +192,52 @@ fn the_planned_seat_follows_the_size_and_the_pin() {
186192 }
187193 let out = out_path("seat", ext);
188194 let handle = session.export_to_with(&out, &settings);
195+ // `Hardware` on a box with no seat for this size is the one
196+ // combination that opens nothing: the job refuses in words and
197+ // the card said the same before the button ([`NO_HW_SEAT`]),
198+ // which is the claim -- a refusal that fires while a seat *is*
199+ // there would be caught by the branch below, where the export
200+ // then has to open one.
201+ if planned == engine::export::NO_HW_SEAT {
202+ // The verdict is read here rather than through `wind_down`,
203+ // which takes it out of the handle on its way past.
204+ let started = Instant::now();
205+ let err = loop {
206+ if let Some(result) = handle.result() {
207+ break result
208+ .expect_err("hardware was demanded and refused")
209+ .to_string();
210+ }
211+ assert!(
212+ started.elapsed() < Duration::from_secs(60),
213+ "{ext}: a refused export never settled"
214+ );
215+ std::thread::sleep(Duration::from_millis(10));
216+ };
217+ assert!(
218+ err.contains("no VA-API seat"),
219+ "{ext} {width}x{height}: the refusal names the missing seat, got {err}"
220+ );
221+ assert!(
222+ !out.exists(),
223+ "{ext} {width}x{height}: a refused export wrote a file"
224+ );
225+ continue;
226+ }
189227 let opened = published_encoders(&handle, &format!("{ext} {width}x{height}"));
190228 handle.cancel();
191229 wind_down(&handle);
192230 assert!(
193231 opened.starts_with(planned),
194- "{ext} {width}x{height} force_sw={force_sw}: the card said {planned}, the job opened {opened}"
232+ "{ext} {width}x{height} seat={seat:?}: the card said {planned}, the job opened {opened}"
195233 );
234+ if seat == EncoderSeat::Hardware {
235+ assert!(
236+ opened.starts_with("HW encode"),
237+ "{ext} {width}x{height}: hardware was demanded and not refused, so the \
238+ job runs on it -- got {opened}"
239+ );
240+ }
196241 }
197242 }
198243 }
crates/engine/tests/export.rsmodified+2 -2
@@ -481,7 +481,7 @@ fn a_higher_bitrate_writes_a_bigger_file() {
481481 let out = out_path(&format!("bitrate_{bitrate}"));
482482 let settings = ExportSettings {
483483 bitrate: Some(bitrate),
484- force_sw: true,
484+ seat: engine::export::EncoderSeat::Software,
485485 ..Default::default()
486486 };
487487 let handle = session.export_to_with(&out, &settings);
@@ -985,7 +985,7 @@ fn a_proxy_is_picture_only_every_frame_a_starting_point_and_cached() {
985985 session.set_proxies(true);
986986 session.save_project(&project).expect("save");
987987 let text = std::fs::read_to_string(&project).expect("read the project back");
988- assert!(text.starts_with("edith 13\n"), "{text}");
988+ assert!(text.starts_with("edith 14\n"), "{text}");
989989 assert!(text.contains("\nproxy on\n"), "{text}");
990990 let reopened = PlaybackSession::open_project(&project).expect("load");
991991 assert!(reopened.proxies(), "the switch came back on");
crates/engine/tests/saveload.rsmodified+52 -6
@@ -134,6 +134,52 @@ fn both_proxy_switches_survive_a_save_and_a_reopen() {
134134 std::fs::remove_dir_all(&dir).expect("cleanup");
135135 }
136136
137+/// The export card's encoder pick through the same front door: which seat a
138+/// delivery is written on is the project's, so it survives a save and a reopen
139+/// -- and a project nobody picked for exports on whatever this machine has,
140+/// which is what every project did before the row existed.
141+#[test]
142+fn the_encoder_seat_survives_a_save_and_a_reopen() {
143+ use engine::export::EncoderSeat;
144+
145+ let dir = scratch("encoderseat");
146+ let media = copy_in(&dir, "test_av.mp4");
147+ let mut session = PlaybackSession::open(&media).expect("open the fixture");
148+ session.set_gain(0.0);
149+ assert_eq!(
150+ session.encoder_seat(),
151+ EncoderSeat::Auto,
152+ "a fresh project takes the seat this machine has"
153+ );
154+
155+ let path = dir.join("seat.edith");
156+ for seat in [EncoderSeat::Software, EncoderSeat::Hardware] {
157+ session.set_encoder_seat(seat);
158+ session.save_project(&path).expect("save");
159+ let text = std::fs::read_to_string(&path).expect("read back");
160+ assert!(text.contains(&format!("encoder {}\n", seat.name())), "{text}");
161+ assert_eq!(
162+ PlaybackSession::open_project(&path)
163+ .expect("reopen")
164+ .encoder_seat(),
165+ seat
166+ );
167+ }
168+
169+ // ...and the default is the line left out, which is what a v13 file is.
170+ session.set_encoder_seat(EncoderSeat::Auto);
171+ session.save_project(&path).expect("save");
172+ let text = std::fs::read_to_string(&path).expect("read back");
173+ assert!(!text.contains("encoder"), "auto is written by saying nothing");
174+ assert_eq!(
175+ PlaybackSession::open_project(&path)
176+ .expect("reopen")
177+ .encoder_seat(),
178+ EncoderSeat::Auto
179+ );
180+ std::fs::remove_dir_all(&dir).expect("cleanup");
181+}
182+
137183 /// Why a trim's tail stops where the file ends: a clip reaching past the last
138184 /// frame of its source is a project that will not open again (`open_project`
139185 /// refuses it by name). Pulled in on both ends and then dragged out as far as
@@ -245,7 +291,7 @@ fn a_version_1_project_loads_fully_grouped_and_saves_as_version_7() {
245291 let v2 = dir.join("new.edith");
246292 loaded.save_project(&v2).expect("save");
247293 let text = std::fs::read_to_string(&v2).expect("read back");
248- assert!(text.starts_with("edith 13\n"), "{text}");
294+ assert!(text.starts_with("edith 14\n"), "{text}");
249295 assert!(
250296 text.contains("\nresolution 1280 720\n"),
251297 "a project with no resolution of its own is saved at source 0's: {text}"
@@ -333,7 +379,7 @@ fn a_version_4_project_holds_more_than_two_lanes() {
333379 loaded.save_project(&again).expect("save");
334380 assert_eq!(
335381 std::fs::read_to_string(&again).expect("read back"),
336- "edith 13\nplayhead 0\nresolution 1280 720\nfps 30.0\nsource 0 test_av.mp4\n\
382+ "edith 14\nplayhead 0\nresolution 1280 720\nfps 30.0\nsource 0 test_av.mp4\n\
337383 video 1 0 0 30 0 3 - - fit 1000\naudio 1\n\
338384 video 2 40 0 20 0 - - - fit 1000\naudio 2 0 0 30 0 3 - - fit 1000\n",
339385 "a four-lane project is written as it was read, three versions on"
@@ -363,7 +409,7 @@ fn a_version_5_project_carries_per_clip_equalizers() {
363409 loaded.save_project(&again).expect("save");
364410 assert_eq!(
365411 std::fs::read_to_string(&again).expect("read back"),
366- "edith 13\nplayhead 0\nresolution 1280 720\nfps 30.0\nsource 0 test_av.mp4\n\
412+ "edith 14\nplayhead 0\nresolution 1280 720\nfps 30.0\nsource 0 test_av.mp4\n\
367413 eq 80.0:-3.0:0.707:ls 1000.0:4.5:1.0:pk\n\
368414 eq 12000.0:6.25:0.5:hs\n\
369415 video 1 0 0 30 0 - 0 - fit 1000\nvideo 1 30 30 60 0 - 1 - fit 1000\n\
@@ -398,7 +444,7 @@ fn a_version_6_project_carries_per_clip_colours() {
398444 loaded.save_project(&again).expect("save");
399445 assert_eq!(
400446 std::fs::read_to_string(&again).expect("read back"),
401- "edith 13\nplayhead 0\nresolution 1280 720\nfps 30.0\nsource 0 test_av.mp4\n\
447+ "edith 14\nplayhead 0\nresolution 1280 720\nfps 30.0\nsource 0 test_av.mp4\n\
402448 eq 80.0:-3.0:0.707:ls\n\
403449 color 0.1:1.2:0.9:-0.3\n\
404450 color -0.25:1.0:0.0:0.5\n\
@@ -448,7 +494,7 @@ fn a_version_7_project_carries_a_resolution_and_fit_policies() {
448494 loaded.save_project(&again).expect("save");
449495 assert_eq!(
450496 std::fs::read_to_string(&again).expect("read back"),
451- "edith 13\nplayhead 0\nresolution 960 720\nfps 30.0\nsource 0 test_av.mp4\n\
497+ "edith 14\nplayhead 0\nresolution 960 720\nfps 30.0\nsource 0 test_av.mp4\n\
452498 video 1 0 0 30 0 - - - fill 1000\nvideo 1 30 30 60 0 - - - center 1000\n\
453499 audio 1 0 0 60 0 - - - fit 1000\n",
454500 "a v7 project is written back as the v8 it now is: the same clips, each \
@@ -706,7 +752,7 @@ fn malformed_files_are_numbered_errors_and_never_panics() {
706752
707753 for (text, want) in [
708754 (
709- "edith 14\nsource 0 test_av.mp4\nvideo 1 0 0 30 0 - - - fit\n",
755+ "edith 15\nsource 0 test_av.mp4\nvideo 1 0 0 30 0 - - - fit\n",
710756 "line 1",
711757 ),
712758 // An eq index the table does not hold, and a band shape there is none.
crates/engine/tests/silence.rsmodified+1 -0
@@ -378,6 +378,7 @@ fn scanning_a_clip_and_cutting_what_it_finds() {
378378 p.tone(),
379379 false,
380380 true,
381+ engine::export::EncoderSeat::default(),
381382 p.limiter(),
382383 0,
383384 )
crates/engine/tests/subtitles.rsmodified+1 -1
@@ -260,7 +260,7 @@ fn a_project_keeps_its_subtitles_across_a_save() {
260260 let project = dir.join("cut.edith");
261261 session.save_project(&project).expect("save");
262262 let text = std::fs::read_to_string(&project).expect("read the project back");
263- assert!(text.starts_with("edith 13\n"), "{text}");
263+ assert!(text.starts_with("edith 14\n"), "{text}");
264264 assert!(
265265 text.contains("\nsubtitle - test_subs.srt\n"),
266266 "the reference is written relative, and no cue is: {text}"