forge
Explore
Log in

Don't you dare go Hollow

The seat that writes the picture is picked on the card, not by an env pin

Browse files at this commit

50af5b50923fbaa9412e9ef6af51549b6385b91dAhmet Kaan GümüşParent: 0dac66e
  • feat
    • the seat that writes the picture is picked on the card, not by an env pin
Show full message
✨ feat(app): the seat that writes the picture is picked on the card, not by an env pin

The export card gains an Encoder row: Auto, Hardware or Software, three rows in a
list like every other setting with more than two values -- `e` steps it, a click
opens the list, and the planned line under the rows re-probes and says which seat
it measured.

Auto is what every export did before (the GPU where there is one). Hardware is
the GPU or a refusal in words -- `Enc::open` refuses before the muxer exists, so
nothing is written -- and it is now the only door to the plugin's AV1 seat, which
`VE_HW_AV1=1` used to guard: an env pin nobody exporting a film would ever find.
A person who picks it for AV1 gets a plain row naming what happened on this box's
driver, and the pick still stands.

Software forces the CPU encoder, which also takes the zero-copy path off the
table by construction (`Enc::dma_want` answers only for the two hardware seats).

Kept with the project: `.edith` gains an `encoder` line at v14, written only when
it is not Auto, and a v13 file loads as Auto.

- engine: `ExportSettings::force_sw` -> `seat: EncoderSeat`; `hw_seat` returns the
  refusal instead of falling back; `planned_video` says `NO_HW_SEAT` where it would
- app: `Pick::Encoder`/`Choice::Encoder`, card row, `e` in the card's own keyboard
  and in the keys menu (`FIXED`)
- tests: the backends sweep runs all three seats (the AV1 hardware seat excepted,
  as before), and asserts the refusal is only what a missing seat produces
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() {
@@ -488,8 +515,10 @@ fn parse(data: &[u8], dir: &Path) -> crate::Result<Document> {
488515 // The dialects that wrote a source line without its stream field. Reading
489516 // one is the whole of what "an old project still opens" means here.
490517 let streamless = v1 || first == MAGIC_V2;
491- // The one that says whether the stand-ins are made by themselves...
492- let v13 = first == MAGIC;
518+ // The one that says which encoder an export takes...
519+ let v14 = first == MAGIC;
520+ // ...the ones that say whether the stand-ins are made by themselves...
521+ let v13 = v14 || first == MAGIC_V13;
493522 // ...the ones that say whether it is cut on stand-ins...
494523 let v12 = v13 || first == MAGIC_V12;
495524 // ...the ones that carry an HDR rendition...
@@ -545,6 +574,10 @@ fn parse(data: &[u8], dir: &Path) -> crate::Result<Document> {
545574 // that wanted a stand-in got one, which is what leaving the line out
546575 // still means.
547576 auto_proxy: true,
577+ // ...and nothing before v14 could be told *which* encoder: an export
578+ // took the seat this machine had, which is what leaving the line out
579+ // still means.
580+ encoder: crate::export::EncoderSeat::default(),
548581 fps: None,
549582 playhead: 0,
550583 };
@@ -653,6 +686,20 @@ fn parse(data: &[u8], dir: &Path) -> crate::Result<Document> {
653686 }
654687 };
655688 }
689+ b"encoder" if v14 => {
690+ if !doc.sources.is_empty() {
691+ return Err(
692+ format!("line {n}: encoder belongs once, before the sources").into()
693+ );
694+ }
695+ let f = fields(rest, 1, "encoder", n)?;
696+ doc.encoder = crate::export::EncoderSeat::from_name(f[0]).ok_or_else(|| {
697+ format!(
698+ "line {n}: encoder is auto, hardware or software, not {:?}",
699+ String::from_utf8_lossy(f[0])
700+ )
701+ })?;
702+ }
656703 b"limiter" if v9 => {
657704 if !doc.sources.is_empty() {
658705 return Err(
@@ -1174,6 +1221,7 @@ mod tests {
11741221 crate::tonemap::Preset::default(),
11751222 false,
11761223 true,
1224+ crate::export::EncoderSeat::default(),
11771225 Limiter::default(),
11781226 playhead,
11791227 )
@@ -1219,6 +1267,7 @@ mod tests {
12191267 crate::tonemap::Preset::default(),
12201268 false,
12211269 true,
1270+ crate::export::EncoderSeat::default(),
12221271 Limiter::default(),
12231272 0,
12241273 );
@@ -1247,7 +1296,7 @@ mod tests {
12471296 video 1 0 0 30 0 - - - fit 1000\n";
12481297 let old = parse(v9, &dir).expect("v9 still loads");
12491298 assert_eq!(old.subtitles, Vec::new());
1250- assert!(flat(&dir, &old.sources, &old.lanes, old.playhead).starts_with(b"edith 13\n"));
1299+ assert!(flat(&dir, &old.sources, &old.lanes, old.playhead).starts_with(b"edith 14\n"));
12511300 // ...and the line itself is not a v9 line: a dialect may not be mixed.
12521301 let mixed = parse(b"edith 9\nsource 0 a.mp4\nsubtitle - subs.srt\n", &dir)
12531302 .unwrap_err()
@@ -1284,6 +1333,7 @@ mod tests {
12841333 crate::tonemap::Preset::default(),
12851334 proxy,
12861335 true,
1336+ crate::export::EncoderSeat::default(),
12871337 Limiter::default(),
12881338 0,
12891339 )
@@ -1345,6 +1395,7 @@ mod tests {
13451395 crate::tonemap::Preset::default(),
13461396 proxy,
13471397 auto,
1398+ crate::export::EncoderSeat::default(),
13481399 Limiter::default(),
13491400 0,
13501401 )
@@ -1386,6 +1437,78 @@ mod tests {
13861437 }
13871438 }
13881439
1440+ /// The v14 line: which encoder an export writes the picture with, by name,
1441+ /// read back as the very seat -- and the dialect before it, which had no
1442+ /// way to say one and took whatever this machine had.
1443+ #[test]
1444+ fn the_encoder_seat_round_trips_by_name_and_a_v13_file_takes_the_machines() {
1445+ use crate::export::EncoderSeat;
1446+ let dir = PathBuf::from("/proj");
1447+ let (_, sources, lanes) = doc();
1448+ let bytes = |seat| {
1449+ super::emit(
1450+ &dir,
1451+ &sources,
1452+ &lanes,
1453+ &[],
1454+ &[],
1455+ &[],
1456+ &[],
1457+ (1280, 720),
1458+ None,
1459+ crate::tonemap::Preset::default(),
1460+ false,
1461+ true,
1462+ seat,
1463+ Limiter::default(),
1464+ 0,
1465+ )
1466+ };
1467+ // The default is the line left out, so a project nobody has picked a
1468+ // seat for is the bytes a v13 file was bar the version line.
1469+ let auto = bytes(EncoderSeat::Auto);
1470+ assert!(
1471+ !String::from_utf8_lossy(&auto).contains("encoder"),
1472+ "auto is the line left out: {}",
1473+ String::from_utf8_lossy(&auto)
1474+ );
1475+ assert_eq!(
1476+ parse(&auto, &dir).expect("v14 parses").encoder,
1477+ EncoderSeat::Auto
1478+ );
1479+ for seat in [EncoderSeat::Hardware, EncoderSeat::Software] {
1480+ let written = bytes(seat);
1481+ let text = String::from_utf8_lossy(&written).to_string();
1482+ assert!(text.contains(&format!("encoder {}\n", seat.name())), "{text}");
1483+ assert_eq!(parse(&written, &dir).expect("v14 parses").encoder, seat);
1484+ }
1485+
1486+ // A v13 project took the seat this machine had and could not be told
1487+ // otherwise.
1488+ let v13 = b"edith 13\nplayhead 0\nresolution 1280 720\nautoproxy off\nsource 0 a.mp4\n\
1489+ video 1 0 0 30 0 - - - fit 1000\n";
1490+ let old = parse(v13, &dir).expect("v13 still loads");
1491+ assert_eq!(
1492+ old.encoder,
1493+ EncoderSeat::Auto,
1494+ "a v13 project exported on whatever seat there was"
1495+ );
1496+ assert!(!old.auto_proxy, "the rest of it came back too");
1497+ // ...and the line is not a v13 line: a dialect may not be mixed.
1498+ let mixed = parse(b"edith 13\nsource 0 a.mp4\nencoder software\n", &dir)
1499+ .unwrap_err()
1500+ .to_string();
1501+ assert_eq!(mixed, "line 3: unknown keyword \"encoder\"");
1502+ // Anything but the three names is a corrupt line, by name.
1503+ for line in ["encoder\n", "encoder gpu\n", "encoder Hardware\n"] {
1504+ let file = format!("edith 14\nsource 0 a.mp4\n{line}");
1505+ assert!(
1506+ parse(file.as_bytes(), &dir).is_err(),
1507+ "{line:?} is not an encoder line"
1508+ );
1509+ }
1510+ }
1511+
13891512 /// The v11 line: the HDR rendition, written by name, read back as the very
13901513 /// preset -- and the dialect before it, which had no way to say one and
13911514 /// meant the published conversion.
@@ -1407,6 +1530,7 @@ mod tests {
14071530 preset,
14081531 false,
14091532 true,
1533+ crate::export::EncoderSeat::default(),
14101534 Limiter::default(),
14111535 0,
14121536 );
@@ -1501,7 +1625,7 @@ mod tests {
15011625 let bytes = flat(&dir, &sources, &lanes, 12);
15021626 assert_eq!(
15031627 String::from_utf8_lossy(&bytes),
1504- "edith 13\nplayhead 12\nresolution 1280 720\nsource 0 a.mp4\n\
1628+ "edith 14\nplayhead 12\nresolution 1280 720\nsource 0 a.mp4\n\
15051629 source 2 /elsewhere/b.mp4\n\
15061630 video 1 0 0 30 0 0 - - fit 1000\nvideo 1 30 10 20 1 1 - - fit 1000\n\
15071631 audio 1 0 0 30 0 0 - - fit 1000\n",
@@ -1538,7 +1662,7 @@ mod tests {
15381662 let bytes = flat(&dir, &sources, &lanes, 7);
15391663 assert_eq!(
15401664 String::from_utf8_lossy(&bytes),
1541- "edith 13\nplayhead 7\nresolution 1280 720\nsource 0 a.mp4\n\
1665+ "edith 14\nplayhead 7\nresolution 1280 720\nsource 0 a.mp4\n\
15421666 video 1 0 0 30 0 4 - - fit 1000\naudio 1\n\
15431667 video 2 40 0 10 0 - - - fit 1000\naudio 2 0 0 30 0 4 - - fit 1000\n",
15441668 "an empty lane is a line of its own; everything else is its clips"
@@ -1646,7 +1770,7 @@ mod tests {
16461770 let bytes = emit(&dir, &sources, &lanes, &eq, &[], (1280, 720), 0);
16471771 assert_eq!(
16481772 String::from_utf8_lossy(&bytes),
1649- "edith 13\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\
1773+ "edith 14\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\
16501774 eq 80.0:-3.0:0.707:ls 1000.0:4.5:1.0:pk\n\
16511775 eq 16777215.0:-0.1:3.918315e-39:hs\n\
16521776 eq\n\
@@ -1750,7 +1874,7 @@ mod tests {
17501874 let bytes = emit(&dir, &sources, &lanes, &[], &color, (1280, 720), 0);
17511875 assert_eq!(
17521876 String::from_utf8_lossy(&bytes),
1753- "edith 13\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\
1877+ "edith 14\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\
17541878 color 0.1:1.2:0.9:-0.3\n\
17551879 color -1e-7:16777215.0:3.918315e-39:-0.0\n\
17561880 color 0.0:1.0:1.0:0.0\n\
@@ -1815,7 +1939,7 @@ mod tests {
18151939 (1280, 720),
18161940 old.playhead
18171941 )),
1818- "edith 13\nplayhead 3\nresolution 1280 720\nsource 0 a.mp4\n\
1942+ "edith 14\nplayhead 3\nresolution 1280 720\nsource 0 a.mp4\n\
18191943 eq 80.0:-3.0:0.707:ls\n\
18201944 video 1 0 0 30 0 0 0 - fit 1000\naudio 1 0 0 30 0 0 - - fit 1000\n"
18211945 );
@@ -1853,7 +1977,7 @@ mod tests {
18531977 let bytes = emit(&dir, &sources, &lanes, &[], &[], (1280, 720), 0);
18541978 assert_eq!(
18551979 String::from_utf8_lossy(&bytes),
1856- "edith 13\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\
1980+ "edith 14\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\
18571981 video 1 0 0 30 0 - - - fit 2000\nvideo 1 15 30 40 0 - - - fit 250\n\
18581982 audio 1 0 0 30 0 - - - fit 2000\n",
18591983 "the rate is the clip line's last field, in thousandths"
@@ -1882,7 +2006,7 @@ mod tests {
18822006 (1280, 720),
18832007 old.playhead
18842008 )),
1885- "edith 13\nplayhead 3\nresolution 1280 720\nsource 0 a.mp4\n\
2009+ "edith 14\nplayhead 3\nresolution 1280 720\nsource 0 a.mp4\n\
18862010 video 1 0 0 30 0 0 - - fit 1000\naudio 1 0 0 30 0 0 - - fit 1000\n"
18872011 );
18882012 // A rate outside what the editor can set is a corrupt line, by name.
@@ -1925,12 +2049,13 @@ mod tests {
19252049 crate::tonemap::Preset::default(),
19262050 false,
19272051 true,
2052+ crate::export::EncoderSeat::default(),
19282053 limiter,
19292054 0,
19302055 );
19312056 assert_eq!(
19322057 String::from_utf8_lossy(&bytes),
1933- "edith 13\nplayhead 0\nresolution 1280 720\nfps 23.976023976023978\n\
2058+ "edith 14\nplayhead 0\nresolution 1280 720\nfps 23.976023976023978\n\
19342059 limiter -1.5 on\nsource 0 a.mp4\n\
19352060 video 1 0 0 30 0 - - - fit 1000\naudio 1 0 0 30 0 - - - fit 1000\n\
19362061 audio 2 0 0 30 0 - - - fit 1000\n\
@@ -1962,7 +2087,7 @@ mod tests {
19622087 (1280, 720),
19632088 old.playhead
19642089 )),
1965- "edith 13\nplayhead 3\nresolution 1280 720\nsource 0 a.mp4\n\
2090+ "edith 14\nplayhead 3\nresolution 1280 720\nsource 0 a.mp4\n\
19662091 video 1 0 0 30 0 - - - fit 1000\naudio 1 0 0 30 0 - - - fit 1000\n"
19672092 );
19682093
@@ -2126,7 +2251,7 @@ mod tests {
21262251 assert!(old.eq.is_empty(), "nothing before v5 equalizes anything");
21272252 assert_eq!(
21282253 String::from_utf8_lossy(&flat(&dir, &old.sources, &old.lanes, old.playhead)),
2129- "edith 13\nplayhead 12\nresolution 1280 720\nsource 0 a.mp4\n\
2254+ "edith 14\nplayhead 12\nresolution 1280 720\nsource 0 a.mp4\n\
21302255 source 2 /elsewhere/b.mp4\n\
21312256 video 1 0 0 30 0 0 - - fit 1000\nvideo 1 30 10 20 1 1 - - fit 1000\n\
21322257 audio 1 0 0 30 0 0 - - fit 1000\n"
@@ -2179,7 +2304,7 @@ mod tests {
21792304 let v5 = flat(&dir, &back.sources, &back.lanes, back.playhead);
21802305 assert_eq!(
21812306 String::from_utf8_lossy(&v5),
2182- "edith 13\nplayhead 12\nresolution 1280 720\nsource 0 a.mp4\n\
2307+ "edith 14\nplayhead 12\nresolution 1280 720\nsource 0 a.mp4\n\
21832308 source 0 /elsewhere/b.mp4\n\
21842309 video 1 0 0 30 0 0 - - fit 1000\nvideo 1 30 10 20 1 1 - - fit 1000\n\
21852310 audio 1 0 0 30 0 0 - - fit 1000\n",
@@ -2211,7 +2336,7 @@ mod tests {
22112336 // Saved again it is the current version, which round-trips to the
22122337 // same document.
22132338 let v5 = flat(&dir, &back.sources, &back.lanes, back.playhead);
2214- assert!(v5.starts_with(b"edith 13\n"));
2339+ assert!(v5.starts_with(b"edith 14\n"));
22152340 let again = parse(&v5, &dir).expect("v5 parses");
22162341 assert_eq!(again.lanes, back.lanes);
22172342 // A dialect may not be mixed: lane lines under v1, `clip` under v2.
@@ -2311,6 +2436,7 @@ mod tests {
23112436 crate::tonemap::Preset::default(),
23122437 false,
23132438 true,
2439+ crate::export::EncoderSeat::default(),
23142440 Limiter::default(),
23152441 0,
23162442 )
@@ -2318,7 +2444,7 @@ mod tests {
23182444 let bytes = std::fs::read(&path).expect("read back");
23192445 assert_eq!(
23202446 String::from_utf8_lossy(&bytes),
2321- "edith 13\nplayhead 0\nresolution 1280 720\nsource 1 a.mp4\n\
2447+ "edith 14\nplayhead 0\nresolution 1280 720\nsource 1 a.mp4\n\
23222448 video 1 0 0 30 0 - - - fit 1000\naudio 1 0 0 30 0 - - - fit 1000\n"
23232449 );
23242450 // Loading rejoins the *given* directory, so the file is reached by the
@@ -2363,10 +2489,10 @@ mod tests {
23632489 #[test]
23642490 fn a_wrong_first_line_is_refused_by_name() {
23652491 let dir = PathBuf::from("/proj");
2366- let err = parse(b"edith 14\nsource 0 a.mp4\nvideo 0 0 5 0 -\n", &dir)
2492+ let err = parse(b"edith 15\nsource 0 a.mp4\nvideo 0 0 5 0 -\n", &dir)
23672493 .unwrap_err()
23682494 .to_string();
2369- assert_eq!(err, "line 1: unsupported version 14");
2495+ assert_eq!(err, "line 1: unsupported version 15");
23702496 for junk in [&b""[..], b"{}\n", b"source a.mp4\n"] {
23712497 assert_eq!(
23722498 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
@@ -1267,6 +1278,10 @@ impl PlaybackSession {
12671278 // question from whether it cuts on them and the only one an import
12681279 // asks ([`Self::auto_proxies`]).
12691280 self.auto_proxies,
1281+ // ...and which encoder an export of it opens, for the same reason:
1282+ // a project delivered on the software encoder is delivered on it
1283+ // again after a reload.
1284+ self.encoder_seat,
12701285 self.project.limiter(),
12711286 playhead,
12721287 )
@@ -2014,6 +2029,21 @@ impl PlaybackSession {
20142029 self.seek(now);
20152030 }
20162031
2032+ /// Which encoder an export of this project would open its picture on
2033+ /// ([`crate::export::EncoderSeat`]). What a front-end puts into the
2034+ /// [`ExportSettings`](crate::export::ExportSettings) it starts an export
2035+ /// with -- and what the export card shows -- so the pick, the prediction
2036+ /// and the file are one answer.
2037+ pub fn encoder_seat(&self) -> crate::export::EncoderSeat {
2038+ self.encoder_seat
2039+ }
2040+
2041+ /// Pick the seat. Nothing to reseek and nothing to re-probe here: this
2042+ /// decides what an *export* opens, never what plays.
2043+ pub fn set_encoder_seat(&mut self, seat: crate::export::EncoderSeat) {
2044+ self.encoder_seat = seat;
2045+ }
2046+
20172047 /// Whether an imported film that wants a stand-in gets one made for it
20182048 /// there and then ([`Self::set_auto_proxies`]).
20192049 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
@@ -259,7 +259,7 @@ fn a_project_keeps_its_subtitles_across_a_save() {
259259 let project = dir.join("cut.edith");
260260 session.save_project(&project).expect("save");
261261 let text = std::fs::read_to_string(&project).expect("read the project back");
262- assert!(text.starts_with("edith 13\n"), "{text}");
262+ assert!(text.starts_with("edith 14\n"), "{text}");
263263 assert!(
264264 text.contains("\nsubtitle - test_subs.srt\n"),
265265 "the reference is written relative, and no cue is: {text}"