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 {
71 }71 }
72 other => format!(72 other => format!(
73 "{} Mbps",73 "{} Mbps",
74- export_settings(other, 0, Format::Mp4, DEFAULT_AUDIO_KBPS)74+ export_settings(other, 0, Format::Mp4, DEFAULT_AUDIO_KBPS, EncoderSeat::Auto)
75 .bitrate75 .bitrate
76 .unwrap_or_default()76 .unwrap_or_default()
77 / 1_000_00077 / 1_000_000
@@ -459,6 +459,52 @@ pub(crate) fn audio_rate_choices(current: u32) -> Vec<ChoiceRow> {
459 .collect()459 .collect()
460 }460 }
461 461
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+
462 /// How a rendition is named where a person reads it: the panel button, the508 /// How a rendition is named where a person reads it: the panel button, the
463 /// notice and the list row all say the same word ([`engine::tonemap::Preset`]).509 /// notice and the list row all say the same word ([`engine::tonemap::Preset`]).
464 pub(crate) fn tone_label(preset: Preset) -> &'static str {510 pub(crate) fn tone_label(preset: Preset) -> &'static str {
@@ -623,6 +669,7 @@ pub(crate) fn export_settings(
623 custom_mbps: u32,669 custom_mbps: u32,
624 format: Format,670 format: Format,
625 audio_kbps: u32,671 audio_kbps: u32,
672+ seat: EncoderSeat,
626 ) -> ExportSettings {673 ) -> ExportSettings {
627 ExportSettings {674 ExportSettings {
628 format,675 format,
@@ -637,10 +684,10 @@ pub(crate) fn export_settings(
637 Quality::High => Some(12_000_000),684 Quality::High => Some(12_000_000),
638 Quality::Custom => Some(u64::from(custom_mbps) * 1_000_000),685 Quality::Custom => Some(u64::from(custom_mbps) * 1_000_000),
639 },686 },
640- // No row of its own: the software pin is for a driver that encodes687+ // The card's own row now ([`encoder_choices`]), kept with the project:
641- // badly, which is a thing about the machine and not about the output --688+ // it was a `VE_SW_ENC` env pin and nothing else, which is a switch
642- // `VE_SW_ENC` already says it, and to the whole run rather than once.689+ // nobody exporting a film would ever find.
643- force_sw: false,690+ seat,
644 // The picked track is put on by `start_export`, which is the only691 // The picked track is put on by `start_export`, which is the only
645 // caller that writes a file; the rest of them are asking about the692 // caller that writes a file; the rest of them are asking about the
646 // bitrate and the format.693 // bitrate and the format.
crates/app/src/keymap.rsmodified+7 -1
@@ -420,7 +420,7 @@ fn codec_chord() -> String {
420 .join(" / ")420 .join(" / ")
421 }421 }
422 422
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(|| {
424 [424 [
425 // Not a chord at all but a way of pressing one, and the only place the425 // Not a chord at all but a way of pressing one, and the only place the
426 // editor can say so: holding a key that moves a *value* runs it, and426 // 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(||
487 category: Category::File,487 category: Category::File,
488 reach: Reach::Click("sound"),488 reach: Reach::Click("sound"),
489 },489 },
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+ },
490 Fixed {496 Fixed {
491 chord: "d".into(),497 chord: "d".into(),
492 label: "Choose where the export is written",498 label: "Choose where the export is written",
crates/app/src/main.rsmodified+1 -1
@@ -56,7 +56,7 @@ use engine::audio::StreamInfo;
56 use engine::color::ColorParams;56 use engine::color::ColorParams;
57 use engine::decode::Backend;57 use engine::decode::Backend;
58 use engine::eq::{Band, BandKind, EqParams};58 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};
60 use engine::limiter::Limiter;60 use engine::limiter::Limiter;
61 use engine::project::{Edge, Lane, LaneKind, Source, Speed};61 use engine::project::{Edge, Lane, LaneKind, Source, Speed};
62 use engine::scale::FitPolicy;62 use engine::scale::FitPolicy;
crates/app/src/menus.rsmodified+5 -0
@@ -61,6 +61,10 @@ pub(crate) enum Pick {
61 /// here that is nobody's project: it is the person's, so it outlives the61 /// here that is nobody's project: it is the person's, so it outlives the
62 /// timeline and every file opened in it.62 /// timeline and every file opened in it.
63 Theme,63 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,
64 }68 }
65 69
66 /// One value a list offers, carrying everything picking it needs -- so a click70 /// One value a list offers, carrying everything picking it needs -- so a click
@@ -77,6 +81,7 @@ pub(crate) enum Choice {
77 AudioRate(u32),81 AudioRate(u32),
78 Tone(Preset),82 Tone(Preset),
79 Theme(ui::theme::PaletteId),83 Theme(ui::theme::PaletteId),
84+ Encoder(EncoderSeat),
80 }85 }
81 86
82 /// One row of an open list: the value, its name, the small print beside it, and87 /// 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 {
94 Choice::Fps(fps) => self.apply_frame_rate(fps, cx),94 Choice::Fps(fps) => self.apply_frame_rate(fps, cx),
95 Choice::Fit(lane, idx, fit) => self.apply_fit(lane, idx, fit, cx),95 Choice::Fit(lane, idx, fit) => self.apply_fit(lane, idx, fit, cx),
96 Choice::Tone(preset) => self.apply_tone(preset, cx),96 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),
97 // In force for the next paint -- every token is read through101 // In force for the next paint -- every token is read through
98 // [`ui::theme::palette`], so one store repaints the whole window --102 // [`ui::theme::palette`], so one store repaints the whole window --
99 // and kept for the next launch. A file that could not be written is103 // and kept for the next launch. A file that could not be written is
@@ -151,6 +155,7 @@ impl Player {
151 }155 }
152 Pick::AudioRate => audio_rate_choices(self.audio_kbps),156 Pick::AudioRate => audio_rate_choices(self.audio_kbps),
153 Pick::Tone => tone_choices(session.tone()),157 Pick::Tone => tone_choices(session.tone()),
158+ Pick::Encoder => encoder_choices(session.encoder_seat()),
154 // Answered above, with or without a timeline.159 // Answered above, with or without a timeline.
155 Pick::Theme => Vec::new(),160 Pick::Theme => Vec::new(),
156 }161 }
crates/app/src/player/export.rsmodified+52 -2
@@ -219,7 +219,13 @@ impl Player {
219 return;219 return;
220 };220 };
221 let settings =221 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+ );
223 if !self.export_open {229 if !self.export_open {
224 return;230 return;
225 }231 }
@@ -380,6 +386,44 @@ impl Player {
380 self.audio_kbps = next_audio_kbps(self.audio_kbps);386 self.audio_kbps = next_audio_kbps(self.audio_kbps);
381 }387 }
382 388
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+
383 /// Why the sound row is not a choice right now, the engine answering about427 /// Why the sound row is not a choice right now, the engine answering about
384 /// the very project it would export. No session is the same answer as no428 /// the very project it would export. No session is the same answer as no
385 /// sound: there is nothing to write either way.429 /// sound: there is nothing to write either way.
@@ -517,7 +561,13 @@ impl Player {
517 return;561 return;
518 }562 }
519 let mut settings =563 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+ );
521 // Whatever is on the timeline travels -- every track with a cue in the571 // Whatever is on the timeline travels -- every track with a cue in the
522 // exported range, not the one row the overlay happens to be drawing.572 // exported range, not the one row the overlay happens to be drawing.
523 // Set here rather than inside `export_settings`, which the card also573 // 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 {
246 // The sound's rate, `q`'s pair for the other half of246 // The sound's rate, `q`'s pair for the other half of
247 // the file. Not a digit: those are the picture's.247 // the file. Not a digit: those are the picture's.
248 this.cycle_audio_kbps();248 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);
249 } else if key == "d" {254 } else if key == "d" {
250 // The save dialog, which was the one row here a255 // The save dialog, which was the one row here a
251 // keyboard could not open.256 // 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() {
815 // a number typed against the custom row must not leak into it.815 // a number typed against the custom row must not leak into it.
816 let mp4 = Format::Mp4;816 let mp4 = Format::Mp4;
817 assert_eq!(817 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,
819 None819 None
820 );820 );
821 assert_eq!(821 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,
823 Some(2_000_000)823 Some(2_000_000)
824 );824 );
825 assert_eq!(825 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,
827 Some(6_000_000)827 Some(6_000_000)
828 );828 );
829 assert_eq!(829 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,
831 Some(12_000_000)831 Some(12_000_000)
832 );832 );
833 // Megabits as typed, and as the row says it back.833 // Megabits as typed, and as the row says it back.
834 assert_eq!(834 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,
836 Some(7_000_000)836 Some(7_000_000)
837 );837 );
838 assert_eq!(Quality::Low.detail(0), "2 Mbps");838 assert_eq!(Quality::Low.detail(0), "2 Mbps");
@@ -840,7 +840,7 @@ fn a_quality_row_is_the_bitrate_it_promises() {
840 // choice the engine never hears about.840 // choice the engine never hears about.
841 for format in [Format::Mp4, Format::Wav, Format::Flac] {841 for format in [Format::Mp4, Format::Wav, Format::Flac] {
842 assert_eq!(842 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,
844 format844 format
845 );845 );
846 }846 }
@@ -849,7 +849,7 @@ fn a_quality_row_is_the_bitrate_it_promises() {
849 // silently changes -- the ceiling row included, which is the one a849 // silently changes -- the ceiling row included, which is the one a
850 // raised cap could have walked out past.850 // raised cap could have walked out past.
851 for quality in Quality::ALL {851 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);
853 if let Some(bitrate) = settings.bitrate {853 if let Some(bitrate) = settings.bitrate {
854 assert!(854 assert!(
855 (u64::from(MBPS_MIN) * 1_000_000..=u64::from(MBPS_MAX) * 1_000_000)855 (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() {
857 "{quality:?} outside the engine clamp"857 "{quality:?} outside the engine clamp"
858 );858 );
859 }859 }
860- // The software pin is the environment's to set, never a row's.860+ // The seat travels exactly as it was picked, and an unpicked project
861- assert!(!settings.force_sw);861+ // exports on the seat this machine has.
862+ assert_eq!(settings.seat, EncoderSeat::Auto);
862 }863 }
863 }864 }
864 865
@@ -879,7 +880,7 @@ fn the_sound_row_carries_its_rate_into_both_kinds_of_file() {
879 for format in [Format::Mp4, Format::Av1, Format::Hevc, Format::Mp3] {880 for format in [Format::Mp4, Format::Av1, Format::Hevc, Format::Mp3] {
880 for kbps in AUDIO_KBPS {881 for kbps in AUDIO_KBPS {
881 assert_eq!(882 assert_eq!(
882- export_settings(Quality::Auto, 0, format, kbps).audio_kbps,883+ export_settings(Quality::Auto, 0, format, kbps, EncoderSeat::Auto).audio_kbps,
883 Some(kbps),884 Some(kbps),
884 "{format:?} at {kbps} kbps"885 "{format:?} at {kbps} kbps"
885 );886 );
@@ -1198,6 +1199,34 @@ fn a_choice_list_offers_every_value_and_fits_the_smallest_window() {
1198 }1199 }
1199 assert!(tones[1].3, "the rendition in force is not marked");1200 assert!(tones[1].3, "the rendition in force is not marked");
1200 1201
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+
1201 // The open list fits the floor the menus are measured against: the1230 // The open list fits the floor the menus are measured against: the
1202 // longest of them is the rate ladder with an odd rate cycled in, and it1231 // longest of them is the rate ladder with an odd rate cycled in, and it
1203 // hangs at the pointer with every row on screen. Rows are click targets1232 // 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::{
13 ACCENT_PRIMARY, AUDIO_KBPS, COLOR_BANDS, COLOR_BAR_W, COLOR_STEP, COLOR_W, CONTROL_H, Clip, Ctx, DEFAULT_AUDIO_KBPS, EQ_BANDS_MAX,13 ACCENT_PRIMARY, AUDIO_KBPS, COLOR_BANDS, COLOR_BAR_W, COLOR_STEP, COLOR_W, CONTROL_H, Clip, Ctx, DEFAULT_AUDIO_KBPS, EQ_BANDS_MAX,
14 EQ_CURVE_STEPS, EQ_FFT, EQ_FREQ_HIGH, EQ_FREQ_LOW, EQ_FREQ_STEP, EQ_GAIN_LIMIT, EQ_GRAPH_H,14 EQ_CURVE_STEPS, EQ_FFT, EQ_FREQ_HIGH, EQ_FREQ_LOW, EQ_FREQ_STEP, EQ_GAIN_LIMIT, EQ_GRAPH_H,
15 EQ_HANDLE, EQ_Q_HIGH, EQ_Q_LOW, EQ_Q_STEP, EQ_SPECTRUM_DB, EQ_TICKS, EQ_W_MAX, ESCAPE,15 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,
17 Format, HEADER_GAP, HEADER_H, HEADER_W, HIST_BINS, HIST_H, HIST_SAMPLES, HIT_MIN, FG_PRIMARY,17 Format, HEADER_GAP, HEADER_H, HEADER_W, HIST_BINS, HIST_H, HIST_SAMPLES, HIT_MIN, FG_PRIMARY,
18 FG_SECONDARY, KEYS_ROW_H, KEYS_ROWS_H, KEYS_W, KeyRow, LABEL_H, LABEL_MIN_W, LANE_H, LANES_MAX,18 FG_SECONDARY, KEYS_ROW_H, KEYS_ROWS_H, KEYS_W, KeyRow, LABEL_H, LABEL_MIN_W, LANE_H, LANES_MAX,
19 BG_CANVAS, LIBRARY_MAX_W, LIBRARY_MIN_W, Lane, MENU_ITEMS, MENU_PAD, MENU_ROW_H,19 BG_CANVAS, LIBRARY_MAX_W, LIBRARY_MIN_W, Lane, MENU_ITEMS, MENU_PAD, MENU_ROW_H,
@@ -41,7 +41,8 @@ use super::{
41 use super::{41 use super::{
42 Choice, EDGE_W, ETA_SPAN, Edge, FITS, FRAME_RATES, LaneKind, PPS_DEFAULT, PPS_MIN, Preset, RESOLUTIONS, Repeat,42 Choice, EDGE_W, ETA_SPAN, Edge, FITS, FRAME_RATES, LaneKind, PPS_DEFAULT, PPS_MIN, Preset, RESOLUTIONS, Repeat,
43 Scale, View,43 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,
45 fit_choices, landing, lane_refuses, library_rows, live_idx, next_fit, next_resolution,46 fit_choices, landing, lane_refuses, library_rows, live_idx, next_fit, next_resolution,
46 note_progress, px_along,47 note_progress, px_along,
47 IMPORT_STALL, Import, ImportStage, SEEK_STALL, ScanKey, ScanPlan, SilenceScan, import_line,48 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 {
286 }));286 }));
287 }287 }
288 list.push(r.into_any_element());288 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+ }
289 // What happens to the subtitles on this timeline, in one line: how many322 // What happens to the subtitles on this timeline, in one line: how many
290 // are written into the file and under what names, or the reason each one323 // are written into the file and under what names, or the reason each one
291 // is not. Which tracks travel is not a pick -- everything with a cue on324 // is not. Which tracks travel is not a pick -- everything with a cue on
@@ -431,7 +464,13 @@ impl Player {
431 |(_, audio)| audio,464 |(_, audio)| audio,
432 );465 );
433 let settings =466 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+ );
435 let size = estimated_bytes(474 let size = estimated_bytes(
436 settings.bitrate.filter(|_| self.format.has_video()),475 settings.bitrate.filter(|_| self.format.has_video()),
437 self.session476 self.session
crates/engine/examples/bench.rsmodified+8 -8
@@ -44,7 +44,7 @@
44 use std::path::{Path, PathBuf};44 use std::path::{Path, PathBuf};
45 use std::time::{Duration, Instant};45 use std::time::{Duration, Instant};
46 46
47-use engine::export::{ExportSettings, Format};47+use engine::export::{EncoderSeat, ExportSettings, Format};
48 use engine::project::{Clip, LaneKind, Project, Source, Speed};48 use engine::project::{Clip, LaneKind, Project, Source, Speed};
49 49
50 // `posix_fadvise(2)`, straight from libc, which std already links: dropping50 // `posix_fadvise(2)`, straight from libc, which std already links: dropping
@@ -617,15 +617,15 @@ fn scrub_bench(path: &Path) {
617 /// The rate is frames the worker reported written over wall seconds, so a run617 /// The rate is frames the worker reported written over wall seconds, so a run
618 /// stopped at the cap still reports a rate; the row says `CAPPED` when it was.618 /// stopped at the cap still reports a rate; the row says `CAPPED` when it was.
619 fn export_bench(path: &Path, seat: &str, out_dir: &Path) {619 fn export_bench(path: &Path, seat: &str, out_dir: &Path) {
620- let (format, force_sw) = match seat {620+ let (format, pick) = match seat {
621- "h264sw" => (Format::Mp4, true),621+ "h264sw" => (Format::Mp4, EncoderSeat::Software),
622- "h264hw" => (Format::Mp4, false),622+ "h264hw" => (Format::Mp4, EncoderSeat::Auto),
623- "av1" => (Format::Av1, true),623+ "av1" => (Format::Av1, EncoderSeat::Software),
624 // `hevc` keeps meaning the software intra seat, so a row measured624 // `hevc` keeps meaning the software intra seat, so a row measured
625 // against an older baseline still compares with the one beside it; the625 // against an older baseline still compares with the one beside it; the
626 // GPU seat is the new name.626 // GPU seat is the new name.
627- "hevc" => (Format::Hevc, true),627+ "hevc" => (Format::Hevc, EncoderSeat::Software),
628- "hevchw" => (Format::Hevc, false),628+ "hevchw" => (Format::Hevc, EncoderSeat::Auto),
629 _ => usage(),629 _ => usage(),
630 };630 };
631 // The sound is opt-in and named in the row, so an `_av` number is never631 // 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) {
675 }675 }
676 };676 };
677 let settings = ExportSettings {677 let settings = ExportSettings {
678- force_sw,678+ seat: pick,
679 format,679 format,
680 ..ExportSettings::default()680 ..ExportSettings::default()
681 };681 };
crates/engine/src/edith.rsmodified+149 -23
@@ -1,13 +1,14 @@
1 //! The project file: a line of text per thing, and nothing else.1 //! The project file: a line of text per thing, and nothing else.
2 //!2 //!
3 //! ```text3 //! ```text
4-//! edith 134+//! edith 14
5 //! playhead 905 //! playhead 90
6 //! resolution 1920 10806 //! resolution 1920 1080
7 //! fps 30.07 //! fps 30.0
8 //! tonemap vivid8 //! tonemap vivid
9 //! proxy on9 //! proxy on
10 //! autoproxy off10 //! autoproxy off
11+//! encoder hardware
11 //! limiter -1.0 on12 //! limiter -1.0 on
12 //! source 0 test_av.mp413 //! source 0 test_av.mp4
13 //! source 1 /elsewhere/test_av2.mp414 //! source 1 /elsewhere/test_av2.mp4
@@ -61,6 +62,15 @@
61 //! stand-ins this project is missing -- which is the only way to ask, so a62 //! stand-ins this project is missing -- which is the only way to ask, so a
62 //! project that never wants them never spends a minute of encode on one.63 //! project that never wants them never spends a minute of encode on one.
63 //!64 //!
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+//!
64 //! The `limiter` line is the master limiter over the whole mix74 //! The `limiter` line is the master limiter over the whole mix
65 //! ([`crate::limiter`]): its ceiling in dBFS and whether it is in circuit,75 //! ([`crate::limiter`]): its ceiling in dBFS and whether it is in circuit,
66 //! spelled `on` or `off`. Left out when it is the default, which is off.76 //! spelled `on` or `off`. Left out when it is the default, which is off.
@@ -117,7 +127,10 @@
117 //! is the only way an empty lane could still be there on the way back. A lane127 //! is the only way an empty lane could still be there on the way back. A lane
118 //! number may not skip one of its kind.128 //! number may not skip one of its kind.
119 //!129 //!
120-//! **Version 12** was this without the `autoproxy` line: such a project makes a130+//! **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
121 //! stand-in for every film that wants one the moment it arrives, which is all134 //! stand-in for every film that wants one the moment it arrives, which is all
122 //! any project could do.135 //! any project could do.
123 //! **Version 11** was that without the `proxy` line: such a project is cut on136 //! **Version 11** was that without the `proxy` line: such a project is cut on
@@ -145,7 +158,7 @@
145 //! what a v1 timeline meant, and an older file simply equalizes and grades158 //! what a v1 timeline meant, and an older file simply equalizes and grades
146 //! nothing, and an older one plays everything at real time, and an older one159 //! nothing, and an older one plays everything at real time, and an older one
147 //! mixes flat, and an older one shows no subtitles, and an older one is shown160 //! 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 older161+//! in the reference rendition -- and saving any of them writes v14. An older
149 //! reader refuses a newer file by name.162 //! reader refuses a newer file by name.
150 //!163 //!
151 //! Text because an edit list is a few integers and a path, and a path is164 //! Text because an edit list is a few integers and a path, and a path is
@@ -181,7 +194,8 @@ use crate::subtitle::SubtitleTrack;
181 194
182 /// What [`save`] writes. Read support goes back to `edith 1`; see the module195 /// What [`save`] writes. Read support goes back to `edith 1`; see the module
183 /// docs for what those dialects looked like.196 /// 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";
185 const MAGIC_V12: &[u8] = b"edith 12";199 const MAGIC_V12: &[u8] = b"edith 12";
186 const MAGIC_V11: &[u8] = b"edith 11";200 const MAGIC_V11: &[u8] = b"edith 11";
187 const MAGIC_V10: &[u8] = b"edith 10";201 const MAGIC_V10: &[u8] = b"edith 10";
@@ -248,6 +262,11 @@ pub struct Document {
248 /// file that leaves the line out, which both mean by itself -- the only262 /// file that leaves the line out, which both mean by itself -- the only
249 /// thing those projects did.263 /// thing those projects did.
250 pub auto_proxy: bool,264 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,
251 pub playhead: u32,270 pub playhead: u32,
252 }271 }
253 272
@@ -269,6 +288,7 @@ pub fn save(
269 tone: crate::tonemap::Preset,288 tone: crate::tonemap::Preset,
270 proxy: bool,289 proxy: bool,
271 auto_proxy: bool,290 auto_proxy: bool,
291+ encoder: crate::export::EncoderSeat,
272 limiter: Limiter,292 limiter: Limiter,
273 playhead: u32,293 playhead: u32,
274 ) -> crate::Result<()> {294 ) -> crate::Result<()> {
@@ -284,7 +304,7 @@ pub fn save(
284 .and_then(|mut f| {304 .and_then(|mut f| {
285 f.write_all(&emit(305 f.write_all(&emit(
286 &dir, sources, lanes, gains, subtitles, eq, color, resolution, fps, tone, proxy,306 &dir, sources, lanes, gains, subtitles, eq, color, resolution, fps, tone, proxy,
287- auto_proxy, limiter, playhead,307+ auto_proxy, encoder, limiter, playhead,
288 ))?;308 ))?;
289 f.sync_all()309 f.sync_all()
290 })310 })
@@ -329,6 +349,7 @@ fn emit(
329 tone: crate::tonemap::Preset,349 tone: crate::tonemap::Preset,
330 proxy: bool,350 proxy: bool,
331 auto_proxy: bool,351 auto_proxy: bool,
352+ encoder: crate::export::EncoderSeat,
332 limiter: Limiter,353 limiter: Limiter,
333 playhead: u32,354 playhead: u32,
334 ) -> Vec<u8> {355 ) -> Vec<u8> {
@@ -359,6 +380,12 @@ fn emit(
359 if !auto_proxy {380 if !auto_proxy {
360 out.extend_from_slice(b"autoproxy off\n");381 out.extend_from_slice(b"autoproxy off\n");
361 }382 }
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+ }
362 // Written only when it is not the default, so a project nobody has limited389 // Written only when it is not the default, so a project nobody has limited
363 // is the same bytes it was in v8 bar the version line.390 // is the same bytes it was in v8 bar the version line.
364 if limiter != Limiter::default() {391 if limiter != Limiter::default() {
@@ -497,8 +524,10 @@ fn parse(data: &[u8], dir: &Path) -> crate::Result<Document> {
497 // The dialects that wrote a source line without its stream field. Reading524 // The dialects that wrote a source line without its stream field. Reading
498 // one is the whole of what "an old project still opens" means here.525 // one is the whole of what "an old project still opens" means here.
499 let streamless = v1 || first == MAGIC_V2;526 let streamless = v1 || first == MAGIC_V2;
500- // The one that says whether the stand-ins are made by themselves...527+ // The one that says which encoder an export takes...
501- let v13 = first == MAGIC;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;
502 // ...the ones that say whether it is cut on stand-ins...531 // ...the ones that say whether it is cut on stand-ins...
503 let v12 = v13 || first == MAGIC_V12;532 let v12 = v13 || first == MAGIC_V12;
504 // ...the ones that carry an HDR rendition...533 // ...the ones that carry an HDR rendition...
@@ -554,6 +583,10 @@ fn parse(data: &[u8], dir: &Path) -> crate::Result<Document> {
554 // that wanted a stand-in got one, which is what leaving the line out583 // that wanted a stand-in got one, which is what leaving the line out
555 // still means.584 // still means.
556 auto_proxy: true,585 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(),
557 fps: None,590 fps: None,
558 playhead: 0,591 playhead: 0,
559 };592 };
@@ -662,6 +695,20 @@ fn parse(data: &[u8], dir: &Path) -> crate::Result<Document> {
662 }695 }
663 };696 };
664 }697 }
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+ }
665 b"limiter" if v9 => {712 b"limiter" if v9 => {
666 if !doc.sources.is_empty() {713 if !doc.sources.is_empty() {
667 return Err(714 return Err(
@@ -1183,6 +1230,7 @@ mod tests {
1183 crate::tonemap::Preset::default(),1230 crate::tonemap::Preset::default(),
1184 false,1231 false,
1185 true,1232 true,
1233+ crate::export::EncoderSeat::default(),
1186 Limiter::default(),1234 Limiter::default(),
1187 playhead,1235 playhead,
1188 )1236 )
@@ -1228,6 +1276,7 @@ mod tests {
1228 crate::tonemap::Preset::default(),1276 crate::tonemap::Preset::default(),
1229 false,1277 false,
1230 true,1278 true,
1279+ crate::export::EncoderSeat::default(),
1231 Limiter::default(),1280 Limiter::default(),
1232 0,1281 0,
1233 );1282 );
@@ -1256,7 +1305,7 @@ mod tests {
1256 video 1 0 0 30 0 - - - fit 1000\n";1305 video 1 0 0 30 0 - - - fit 1000\n";
1257 let old = parse(v9, &dir).expect("v9 still loads");1306 let old = parse(v9, &dir).expect("v9 still loads");
1258 assert_eq!(old.subtitles, Vec::new());1307 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"));
1260 // ...and the line itself is not a v9 line: a dialect may not be mixed.1309 // ...and the line itself is not a v9 line: a dialect may not be mixed.
1261 let mixed = parse(b"edith 9\nsource 0 a.mp4\nsubtitle - subs.srt\n", &dir)1310 let mixed = parse(b"edith 9\nsource 0 a.mp4\nsubtitle - subs.srt\n", &dir)
1262 .unwrap_err()1311 .unwrap_err()
@@ -1293,6 +1342,7 @@ mod tests {
1293 crate::tonemap::Preset::default(),1342 crate::tonemap::Preset::default(),
1294 proxy,1343 proxy,
1295 true,1344 true,
1345+ crate::export::EncoderSeat::default(),
1296 Limiter::default(),1346 Limiter::default(),
1297 0,1347 0,
1298 )1348 )
@@ -1354,6 +1404,7 @@ mod tests {
1354 crate::tonemap::Preset::default(),1404 crate::tonemap::Preset::default(),
1355 proxy,1405 proxy,
1356 auto,1406 auto,
1407+ crate::export::EncoderSeat::default(),
1357 Limiter::default(),1408 Limiter::default(),
1358 0,1409 0,
1359 )1410 )
@@ -1395,6 +1446,78 @@ mod tests {
1395 }1446 }
1396 }1447 }
1397 1448
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+
1398 /// The v11 line: the HDR rendition, written by name, read back as the very1521 /// The v11 line: the HDR rendition, written by name, read back as the very
1399 /// preset -- and the dialect before it, which had no way to say one and1522 /// preset -- and the dialect before it, which had no way to say one and
1400 /// meant the published conversion.1523 /// meant the published conversion.
@@ -1416,6 +1539,7 @@ mod tests {
1416 preset,1539 preset,
1417 false,1540 false,
1418 true,1541 true,
1542+ crate::export::EncoderSeat::default(),
1419 Limiter::default(),1543 Limiter::default(),
1420 0,1544 0,
1421 );1545 );
@@ -1510,7 +1634,7 @@ mod tests {
1510 let bytes = flat(&dir, &sources, &lanes, 12);1634 let bytes = flat(&dir, &sources, &lanes, 12);
1511 assert_eq!(1635 assert_eq!(
1512 String::from_utf8_lossy(&bytes),1636 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\
1514 source 2 /elsewhere/b.mp4\n\1638 source 2 /elsewhere/b.mp4\n\
1515 video 1 0 0 30 0 0 - - fit 1000\nvideo 1 30 10 20 1 1 - - fit 1000\n\1639 video 1 0 0 30 0 0 - - fit 1000\nvideo 1 30 10 20 1 1 - - fit 1000\n\
1516 audio 1 0 0 30 0 0 - - fit 1000\n",1640 audio 1 0 0 30 0 0 - - fit 1000\n",
@@ -1547,7 +1671,7 @@ mod tests {
1547 let bytes = flat(&dir, &sources, &lanes, 7);1671 let bytes = flat(&dir, &sources, &lanes, 7);
1548 assert_eq!(1672 assert_eq!(
1549 String::from_utf8_lossy(&bytes),1673 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\
1551 video 1 0 0 30 0 4 - - fit 1000\naudio 1\n\1675 video 1 0 0 30 0 4 - - fit 1000\naudio 1\n\
1552 video 2 40 0 10 0 - - - fit 1000\naudio 2 0 0 30 0 4 - - fit 1000\n",1676 video 2 40 0 10 0 - - - fit 1000\naudio 2 0 0 30 0 4 - - fit 1000\n",
1553 "an empty lane is a line of its own; everything else is its clips"1677 "an empty lane is a line of its own; everything else is its clips"
@@ -1655,7 +1779,7 @@ mod tests {
1655 let bytes = emit(&dir, &sources, &lanes, &eq, &[], (1280, 720), 0);1779 let bytes = emit(&dir, &sources, &lanes, &eq, &[], (1280, 720), 0);
1656 assert_eq!(1780 assert_eq!(
1657 String::from_utf8_lossy(&bytes),1781 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\
1659 eq 80.0:-3.0:0.707:ls 1000.0:4.5:1.0:pk\n\1783 eq 80.0:-3.0:0.707:ls 1000.0:4.5:1.0:pk\n\
1660 eq 16777215.0:-0.1:3.918315e-39:hs\n\1784 eq 16777215.0:-0.1:3.918315e-39:hs\n\
1661 eq\n\1785 eq\n\
@@ -1759,7 +1883,7 @@ mod tests {
1759 let bytes = emit(&dir, &sources, &lanes, &[], &color, (1280, 720), 0);1883 let bytes = emit(&dir, &sources, &lanes, &[], &color, (1280, 720), 0);
1760 assert_eq!(1884 assert_eq!(
1761 String::from_utf8_lossy(&bytes),1885 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\
1763 color 0.1:1.2:0.9:-0.3\n\1887 color 0.1:1.2:0.9:-0.3\n\
1764 color -1e-7:16777215.0:3.918315e-39:-0.0\n\1888 color -1e-7:16777215.0:3.918315e-39:-0.0\n\
1765 color 0.0:1.0:1.0:0.0\n\1889 color 0.0:1.0:1.0:0.0\n\
@@ -1824,7 +1948,7 @@ mod tests {
1824 (1280, 720),1948 (1280, 720),
1825 old.playhead1949 old.playhead
1826 )),1950 )),
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\
1828 eq 80.0:-3.0:0.707:ls\n\1952 eq 80.0:-3.0:0.707:ls\n\
1829 video 1 0 0 30 0 0 0 - fit 1000\naudio 1 0 0 30 0 0 - - fit 1000\n"1953 video 1 0 0 30 0 0 0 - fit 1000\naudio 1 0 0 30 0 0 - - fit 1000\n"
1830 );1954 );
@@ -1862,7 +1986,7 @@ mod tests {
1862 let bytes = emit(&dir, &sources, &lanes, &[], &[], (1280, 720), 0);1986 let bytes = emit(&dir, &sources, &lanes, &[], &[], (1280, 720), 0);
1863 assert_eq!(1987 assert_eq!(
1864 String::from_utf8_lossy(&bytes),1988 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\
1866 video 1 0 0 30 0 - - - fit 2000\nvideo 1 15 30 40 0 - - - fit 250\n\1990 video 1 0 0 30 0 - - - fit 2000\nvideo 1 15 30 40 0 - - - fit 250\n\
1867 audio 1 0 0 30 0 - - - fit 2000\n",1991 audio 1 0 0 30 0 - - - fit 2000\n",
1868 "the rate is the clip line's last field, in thousandths"1992 "the rate is the clip line's last field, in thousandths"
@@ -1891,7 +2015,7 @@ mod tests {
1891 (1280, 720),2015 (1280, 720),
1892 old.playhead2016 old.playhead
1893 )),2017 )),
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\
1895 video 1 0 0 30 0 0 - - fit 1000\naudio 1 0 0 30 0 0 - - fit 1000\n"2019 video 1 0 0 30 0 0 - - fit 1000\naudio 1 0 0 30 0 0 - - fit 1000\n"
1896 );2020 );
1897 // A rate outside what the editor can set is a corrupt line, by name.2021 // A rate outside what the editor can set is a corrupt line, by name.
@@ -1934,12 +2058,13 @@ mod tests {
1934 crate::tonemap::Preset::default(),2058 crate::tonemap::Preset::default(),
1935 false,2059 false,
1936 true,2060 true,
2061+ crate::export::EncoderSeat::default(),
1937 limiter,2062 limiter,
1938 0,2063 0,
1939 );2064 );
1940 assert_eq!(2065 assert_eq!(
1941 String::from_utf8_lossy(&bytes),2066 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\
1943 limiter -1.5 on\nsource 0 a.mp4\n\2068 limiter -1.5 on\nsource 0 a.mp4\n\
1944 video 1 0 0 30 0 - - - fit 1000\naudio 1 0 0 30 0 - - - fit 1000\n\2069 video 1 0 0 30 0 - - - fit 1000\naudio 1 0 0 30 0 - - - fit 1000\n\
1945 audio 2 0 0 30 0 - - - fit 1000\n\2070 audio 2 0 0 30 0 - - - fit 1000\n\
@@ -1971,7 +2096,7 @@ mod tests {
1971 (1280, 720),2096 (1280, 720),
1972 old.playhead2097 old.playhead
1973 )),2098 )),
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\
1975 video 1 0 0 30 0 - - - fit 1000\naudio 1 0 0 30 0 - - - fit 1000\n"2100 video 1 0 0 30 0 - - - fit 1000\naudio 1 0 0 30 0 - - - fit 1000\n"
1976 );2101 );
1977 2102
@@ -2135,7 +2260,7 @@ mod tests {
2135 assert!(old.eq.is_empty(), "nothing before v5 equalizes anything");2260 assert!(old.eq.is_empty(), "nothing before v5 equalizes anything");
2136 assert_eq!(2261 assert_eq!(
2137 String::from_utf8_lossy(&flat(&dir, &old.sources, &old.lanes, old.playhead)),2262 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\
2139 source 2 /elsewhere/b.mp4\n\2264 source 2 /elsewhere/b.mp4\n\
2140 video 1 0 0 30 0 0 - - fit 1000\nvideo 1 30 10 20 1 1 - - fit 1000\n\2265 video 1 0 0 30 0 0 - - fit 1000\nvideo 1 30 10 20 1 1 - - fit 1000\n\
2141 audio 1 0 0 30 0 0 - - fit 1000\n"2266 audio 1 0 0 30 0 0 - - fit 1000\n"
@@ -2188,7 +2313,7 @@ mod tests {
2188 let v5 = flat(&dir, &back.sources, &back.lanes, back.playhead);2313 let v5 = flat(&dir, &back.sources, &back.lanes, back.playhead);
2189 assert_eq!(2314 assert_eq!(
2190 String::from_utf8_lossy(&v5),2315 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\
2192 source 0 /elsewhere/b.mp4\n\2317 source 0 /elsewhere/b.mp4\n\
2193 video 1 0 0 30 0 0 - - fit 1000\nvideo 1 30 10 20 1 1 - - fit 1000\n\2318 video 1 0 0 30 0 0 - - fit 1000\nvideo 1 30 10 20 1 1 - - fit 1000\n\
2194 audio 1 0 0 30 0 0 - - fit 1000\n",2319 audio 1 0 0 30 0 0 - - fit 1000\n",
@@ -2220,7 +2345,7 @@ mod tests {
2220 // Saved again it is the current version, which round-trips to the2345 // Saved again it is the current version, which round-trips to the
2221 // same document.2346 // same document.
2222 let v5 = flat(&dir, &back.sources, &back.lanes, back.playhead);2347 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"));
2224 let again = parse(&v5, &dir).expect("v5 parses");2349 let again = parse(&v5, &dir).expect("v5 parses");
2225 assert_eq!(again.lanes, back.lanes);2350 assert_eq!(again.lanes, back.lanes);
2226 // A dialect may not be mixed: lane lines under v1, `clip` under v2.2351 // A dialect may not be mixed: lane lines under v1, `clip` under v2.
@@ -2320,6 +2445,7 @@ mod tests {
2320 crate::tonemap::Preset::default(),2445 crate::tonemap::Preset::default(),
2321 false,2446 false,
2322 true,2447 true,
2448+ crate::export::EncoderSeat::default(),
2323 Limiter::default(),2449 Limiter::default(),
2324 0,2450 0,
2325 )2451 )
@@ -2327,7 +2453,7 @@ mod tests {
2327 let bytes = std::fs::read(&path).expect("read back");2453 let bytes = std::fs::read(&path).expect("read back");
2328 assert_eq!(2454 assert_eq!(
2329 String::from_utf8_lossy(&bytes),2455 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\
2331 video 1 0 0 30 0 - - - fit 1000\naudio 1 0 0 30 0 - - - fit 1000\n"2457 video 1 0 0 30 0 - - - fit 1000\naudio 1 0 0 30 0 - - - fit 1000\n"
2332 );2458 );
2333 // Loading rejoins the *given* directory, so the file is reached by the2459 // Loading rejoins the *given* directory, so the file is reached by the
@@ -2372,10 +2498,10 @@ mod tests {
2372 #[test]2498 #[test]
2373 fn a_wrong_first_line_is_refused_by_name() {2499 fn a_wrong_first_line_is_refused_by_name() {
2374 let dir = PathBuf::from("/proj");2500 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)
2376 .unwrap_err()2502 .unwrap_err()
2377 .to_string();2503 .to_string();
2378- assert_eq!(err, "line 1: unsupported version 14");2504+ assert_eq!(err, "line 1: unsupported version 15");
2379 for junk in [&b""[..], b"{}\n", b"source a.mp4\n"] {2505 for junk in [&b""[..], b"{}\n", b"source a.mp4\n"] {
2380 assert_eq!(2506 assert_eq!(
2381 parse(junk, &dir).unwrap_err().to_string(),2507 parse(junk, &dir).unwrap_err().to_string(),
crates/engine/src/export.rsmodified+112 -32
@@ -263,6 +263,48 @@ impl Format {
263 }263 }
264 }264 }
265 265
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+
266 /// What the caller gets to decide about the output. The codec is not among it:308 /// What the caller gets to decide about the output. The codec is not among it:
267 /// [`Format`] names a container *and* what goes in it, because every pair we309 /// [`Format`] names a container *and* what goes in it, because every pair we
268 /// can write is a pair we can also read back.310 /// can write is a pair we can also read back.
@@ -271,9 +313,11 @@ pub struct ExportSettings {
271 /// Bits per second, clamped to the same sane range the automatic value uses.313 /// Bits per second, clamped to the same sane range the automatic value uses.
272 /// `None` picks it from the picture size and frame rate. Video only.314 /// `None` picks it from the picture size and frame rate. Video only.
273 pub bitrate: Option<u64>,315 pub bitrate: Option<u64>,
274- /// Skip the hardware encoder even where it is available -- an escape hatch316+ /// Which encoder writes the picture ([`EncoderSeat`]). Was a `force_sw`
275- /// for a driver that encodes badly, matching the `VE_SW_ENC` env pin.317+ /// flag, which could say "not the GPU" and never "the GPU or say so".
276- pub force_sw: bool,318+ /// [`EncoderSeat::Software`] is what the `VE_SW_ENC` env pin still forces
319+ /// on every export of a run.
320+ pub seat: EncoderSeat,
277 /// The file to write. Defaults to [`Format::Mp4`], which is what every321 /// The file to write. Defaults to [`Format::Mp4`], which is what every
278 /// caller wrote before there was a choice.322 /// caller wrote before there was a choice.
279 pub format: Format,323 pub format: Format,
@@ -528,14 +572,35 @@ fn audio_kbps_of(settings: &ExportSettings) -> u32 {
528 }572 }
529 573
530 /// The hardware seat for these settings, opened exactly as the export opens it574 /// 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 may575+/// -- the same pins, the same dimensions a driver may refuse -- or `None` where
532-/// refuse -- or `None` where the software encoder takes the file. The single576+/// the software encoder takes the file. The single place that choice is made,
533-/// place that choice is made, which is what lets [`planned_video`] *measure* it577+/// which is what lets [`planned_video`] *measure* it instead of promising it.
534-/// instead of promising it.578+///
535-fn hw_seat(meta: &VideoMeta, settings: &ExportSettings) -> Option<HwEncoder> {579+/// `Err` is the one answer the software encoder does **not** take over from:
536- if settings.force_sw || forced("VE_SW_ENC") {580+/// [`EncoderSeat::Hardware`] asked for the GPU by name and this machine has no
537- return None;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());
538 }597 }
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> {
539 let (fps_num, fps_den) = crate::mux::frame_timing(meta.frame_rate).ok()?;604 let (fps_num, fps_den) = crate::mux::frame_timing(meta.frame_rate).ok()?;
540 let bitrate = bitrate_of(meta, settings);605 let bitrate = bitrate_of(meta, settings);
541 match settings.format {606 match settings.format {
@@ -561,9 +626,10 @@ fn hw_seat(meta: &VideoMeta, settings: &ExportSettings) -> Option<HwEncoder> {
561 bitrate,626 bitrate,
562 ColorDescription::output(meta.height),627 ColorDescription::output(meta.height),
563 ),628 ),
564- // Opt-in only, for the reason [`Enc::open_av1`] states in full. Both629+ // 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
565 // AV1 formats sit on it: the container is not the encoder's business.631 // 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,
567 format if format.is_av1() => {633 format if format.is_av1() => {
568 HwEncoder::open_av1(meta.width, meta.height, fps_num, fps_den, bitrate)634 HwEncoder::open_av1(meta.width, meta.height, fps_num, fps_den, bitrate)
569 }635 }
@@ -585,6 +651,15 @@ fn hw_seat(meta: &VideoMeta, settings: &ExportSettings) -> Option<HwEncoder> {
585 }651 }
586 }652 }
587 653
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+
588 /// How a front-end names a video seat: which of the two encoders has the file,663 /// How a front-end names a video seat: which of the two encoders has the file,
589 /// and which library that is. Not the codec -- a caller shows this beside the664 /// and which library that is. Not the codec -- a caller shows this beside the
590 /// format it picked, and `rav1e` names AV1 as `rusty_h264` names H.264. One665 /// 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> {
592 /// during one cannot drift apart.667 /// during one cannot drift apart.
593 fn video_label(format: Format, hw: bool) -> &'static str {668 fn video_label(format: Format, hw: bool) -> &'static str {
594 match (format, hw) {669 match (format, hw) {
595- (_, true) => "HW encode (VA-API)",670+ (_, true) => HW_LABEL,
596 (Format::Hevc | Format::HevcMp4, false) => "SW encode (oxideav-h265 intra)",671 (Format::Hevc | Format::HevcMp4, false) => "SW encode (oxideav-h265 intra)",
597 (Format::Av1 | Format::Av1Mp4, false) => "SW encode (rav1e)",672 (Format::Av1 | Format::Av1Mp4, false) => "SW encode (rav1e)",
598 (_, false) => "SW encode (rusty_h264)",673 (_, false) => "SW encode (rusty_h264)",
@@ -925,10 +1000,12 @@ pub fn planned_subtitles(
925 /// Costs that open (~100 ms here): ask it off a render thread and keep the1000 /// Costs that open (~100 ms here): ask it off a render thread and keep the
926 /// answer until the format, the resolution or the bitrate changes.1001 /// answer until the format, the resolution or the bitrate changes.
927 pub fn planned_video(meta: &VideoMeta, settings: &ExportSettings) -> Option<&'static str> {1002 pub fn planned_video(meta: &VideoMeta, settings: &ExportSettings) -> Option<&'static str> {
928- settings1003+ settings.format.has_video().then(|| match hw_seat(meta, settings) {
929- .format1004+ Ok(hw) => video_label(settings.format, hw.is_some()),
930- .has_video()1005+ // The seat the settings demand and this machine has not: the very
931- .then(|| video_label(settings.format, hw_seat(meta, settings).is_some()))1006+ // refusal [`start`] would settle with, said on the card instead.
1007+ Err(_) => NO_HW_SEAT,
1008+ })
932 }1009 }
933 1010
934 /// What [`start`] would open for *this* timeline: the picture's seat -- or the1011 /// What [`start`] would open for *this* timeline: the picture's seat -- or the
@@ -954,7 +1031,7 @@ pub fn planned_seats(
954 let video = settings.format.has_video().then(|| {1031 let video = settings.format.has_video().then(|| {
955 match CopyPlan::of(project, meta, settings).is_some() {1032 match CopyPlan::of(project, meta, settings).is_some() {
956 true => "copy (source packets)",1033 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),
958 }1035 }
959 });1036 });
960 // The half [`audio_label`] cannot know from the format: a copy is a *sample1037 // The half [`audio_label`] cannot know from the format: a copy is a *sample
@@ -3041,7 +3118,7 @@ impl Enc {
3041 // hand 24000/1001 over as a rounded 23.976, which is the same3118 // hand 24000/1001 over as a rounded 23.976, which is the same
3042 // truncation the container timing had.3119 // truncation the container timing had.
3043 crate::mux::frame_timing(meta.frame_rate)?;3120 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)? {
3045 eprintln!("export encoder: hardware (VA-API plugin)");3122 eprintln!("export encoder: hardware (VA-API plugin)");
3046 return Ok(Self::Hw(hw));3123 return Ok(Self::Hw(hw));
3047 }3124 }
@@ -3074,25 +3151,28 @@ impl Enc {
3074 /// simply has none and this falls through -- the same "no" a GPU without an3151 /// simply has none and this falls through -- the same "no" a GPU without an
3075 /// AV1 encode entrypoint gives, and the same silent fallback either way.3152 /// AV1 encode entrypoint gives, and the same silent fallback either way.
3076 ///3153 ///
3077- /// It is **opt-in**, which is the one place this pair does not mirror the3154+ /// It is **asked for by name**, which is the one place this pair does not
3078- /// H.264 one: the vendored cros-codecs AV1 encoder hung the GPU on this3155+ /// mirror the H.264 one: the vendored cros-codecs AV1 encoder hung the GPU
3079- /// project's own radeonsi box -- `engine_hw: operation failed`, then an3156+ /// on this project's own radeonsi box -- `engine_hw: operation failed`,
3080- /// amdgpu hard recovery and a lost context, measured 2026-08-10 exporting3157+ /// then an amdgpu hard recovery and a lost context, measured 2026-08-10
3081- /// the 720p fixture. A software encoder that takes half a minute is a worse3158+ /// exporting the 720p fixture. A software encoder that takes half a minute
3082- /// export than a hardware one; a driver reset is not an export at all. So3159+ /// is a worse export than a hardware one; a driver reset is not an export
3083- /// the plugin's AV1 seat is wired, kept and only entered when `VE_HW_AV1=1`3160+ /// at all. So [`EncoderSeat::Auto`] takes `rav1e` here and only
3084- /// asks for it by name.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.
3085 ///3165 ///
3086 /// corner-cut: the upgrade path is a driver this was reproduced against (or a3166 /// corner-cut: the upgrade path is a driver this was reproduced against (or a
3087 /// cros-codecs release that fixes it) plus a probe encode of one frame at3167 /// 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.
3089 fn open_av1(meta: &VideoMeta, settings: &ExportSettings) -> crate::Result<Self> {3169 fn open_av1(meta: &VideoMeta, settings: &ExportSettings) -> crate::Result<Self> {
3090 let bitrate = bitrate_of(meta, settings);3170 let bitrate = bitrate_of(meta, settings);
3091 let (fps_num, fps_den) = crate::mux::frame_timing(meta.frame_rate)?;3171 let (fps_num, fps_den) = crate::mux::frame_timing(meta.frame_rate)?;
3092 // Two seconds between keyframes, as the H.264 seat does: a seek may only3172 // Two seconds between keyframes, as the H.264 seat does: a seek may only
3093 // land on one, and this is what a cluster of the Matroska file is.3173 // land on one, and this is what a cluster of the Matroska file is.
3094 let gop = (meta.frame_rate * 2.0).round().max(1.0) as u64;3174 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)? {
3096 eprintln!("export encoder: hardware AV1 (VA-API plugin)");3176 eprintln!("export encoder: hardware AV1 (VA-API plugin)");
3097 return Ok(Self::Av1Hw(hw));3177 return Ok(Self::Av1Hw(hw));
3098 }3178 }
@@ -3179,7 +3259,7 @@ impl Enc {
3179 )3259 )
3180 .into());3260 .into());
3181 }3261 }
3182- if let Some(hw) = hw_seat(meta, settings) {3262+ if let Some(hw) = hw_seat(meta, settings)? {
3183 eprintln!("export encoder: hardware HEVC intra (VA-API plugin)");3263 eprintln!("export encoder: hardware HEVC intra (VA-API plugin)");
3184 return Ok(Self::HevcHw(hw));3264 return Ok(Self::HevcHw(hw));
3185 }3265 }
@@ -3295,8 +3375,8 @@ impl Enc {
3295 /// being read back -- `None` for every seat that reads bytes, which is both3375 /// being read back -- `None` for every seat that reads bytes, which is both
3296 /// software encoders and the intra HEVC one.3376 /// software encoders and the intra HEVC one.
3297 ///3377 ///
3298- /// The AV1 hardware seat is left out on purpose: it is opt-in behind3378+ /// The AV1 hardware seat is left out on purpose: it is entered only when a
3299- /// `VE_HW_AV1` because the vendored encoder reset this project's GPU3379+ /// person picks it by name because the vendored encoder reset this project's GPU
3300 /// ([`Enc::open_av1`]), and a path that cannot be measured is not one to3380 /// ([`Enc::open_av1`]), and a path that cannot be measured is not one to
3301 /// widen.3381 /// widen.
3302 fn dma_want(&self, meta: &VideoMeta) -> Option<crate::hw::DmaWant> {3382 fn dma_want(&self, meta: &VideoMeta) -> Option<crate::hw::DmaWant> {
crates/engine/src/hw.rsmodified+4 -3
@@ -556,9 +556,10 @@ impl HwEncoder {
556 /// really fires, and the caller's software AV1 encoder takes the export556 /// really fires, and the caller's software AV1 encoder takes the export
557 /// without saying anything about it.557 /// without saying anything about it.
558 ///558 ///
559- /// The caller only reaches this behind `VE_HW_AV1=1`: the vendored encoder559+ /// The caller only reaches this when a person picked
560- /// reset this project's own GPU, which [`crate::export::Enc::open_av1`]560+ /// [`crate::export::EncoderSeat::Hardware`] for an AV1 export: the vendored
561- /// states in full.561+ /// encoder reset this project's own GPU, which
562+ /// [`crate::export::Enc::open_av1`] states in full.
562 pub fn open_av1(563 pub fn open_av1(
563 width: u32,564 width: u32,
564 height: u32,565 height: u32,
crates/engine/src/playback.rsmodified+30 -0
@@ -394,6 +394,11 @@ pub struct PlaybackSession {
394 /// the project like the one above it, and read by the front end: the engine394 /// the project like the one above it, and read by the front end: the engine
395 /// starts no encode of its own.395 /// starts no encode of its own.
396 auto_proxies: bool,396 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,
397 }402 }
398 403
399 /// What an edit dirtied -- which half of the pipeline has to be rebuilt for the404 /// What an edit dirtied -- which half of the pipeline has to be rebuilt for the
@@ -512,6 +517,7 @@ impl PlaybackSession {
512 // A file just opened is a project nobody has picked stand-ins for.517 // A file just opened is a project nobody has picked stand-ins for.
513 proxies: false,518 proxies: false,
514 auto_proxies: true,519 auto_proxies: true,
520+ encoder_seat: crate::export::EncoderSeat::default(),
515 })521 })
516 }522 }
517 523
@@ -628,6 +634,7 @@ impl PlaybackSession {
628 // A file just opened is a project nobody has picked stand-ins for.634 // A file just opened is a project nobody has picked stand-ins for.
629 proxies: false,635 proxies: false,
630 auto_proxies: true,636 auto_proxies: true,
637+ encoder_seat: crate::export::EncoderSeat::default(),
631 })638 })
632 }639 }
633 640
@@ -708,6 +715,7 @@ impl PlaybackSession {
708 // A file just opened is a project nobody has picked stand-ins for.715 // A file just opened is a project nobody has picked stand-ins for.
709 proxies: false,716 proxies: false,
710 auto_proxies: true,717 auto_proxies: true,
718+ encoder_seat: crate::export::EncoderSeat::default(),
711 })719 })
712 }720 }
713 721
@@ -1008,6 +1016,9 @@ impl PlaybackSession {
1008 // ...and what it says about making them, which is "yes" for every1016 // ...and what it says about making them, which is "yes" for every
1009 // dialect before v13 and for one that leaves the line out.1017 // dialect before v13 and for one that leaves the line out.
1010 auto_proxies: doc.auto_proxy,1018 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,
1011 };1022 };
1012 // The scaffolding above opened source 0 from its first frame and the1023 // The scaffolding above opened source 0 from its first frame and the
1013 // whole of its audio; this puts both onto the clip the playhead is1024 // whole of its audio; this puts both onto the clip the playhead is
@@ -1271,6 +1282,10 @@ impl PlaybackSession {
1271 // question from whether it cuts on them and the only one an import1282 // question from whether it cuts on them and the only one an import
1272 // asks ([`Self::auto_proxies`]).1283 // asks ([`Self::auto_proxies`]).
1273 self.auto_proxies,1284 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,
1274 self.project.limiter(),1289 self.project.limiter(),
1275 playhead,1290 playhead,
1276 )1291 )
@@ -2087,6 +2102,21 @@ impl PlaybackSession {
2087 self.seek(now);2102 self.seek(now);
2088 }2103 }
2089 2104
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+
2090 /// Whether an imported film that wants a stand-in gets one made for it2120 /// Whether an imported film that wants a stand-in gets one made for it
2091 /// there and then ([`Self::set_auto_proxies`]).2121 /// there and then ([`Self::set_auto_proxies`]).
2092 pub fn auto_proxies(&self) -> bool {2122 pub fn auto_proxies(&self) -> bool {
crates/engine/tests/av1.rsmodified+2 -2
@@ -371,7 +371,7 @@ fn av1_settings() -> ExportSettings {
371 format: engine::export::Format::Av1,371 format: engine::export::Format::Av1,
372 // The software encoder, on every machine: the hardware twin below is372 // The software encoder, on every machine: the hardware twin below is
373 // where the plugin's AV1 seat is exercised.373 // where the plugin's AV1 seat is exercised.
374- force_sw: true,374+ seat: engine::export::EncoderSeat::Software,
375 ..Default::default()375 ..Default::default()
376 }376 }
377 }377 }
@@ -466,7 +466,7 @@ fn an_av1_export_carries_the_timelines_sound_in_either_container() {
466 let out = Scratch::file("ve_av1_sound", ext);466 let out = Scratch::file("ve_av1_sound", ext);
467 let settings = ExportSettings {467 let settings = ExportSettings {
468 format,468 format,
469- force_sw: true,469+ seat: engine::export::EncoderSeat::Software,
470 ..Default::default()470 ..Default::default()
471 };471 };
472 let handle = session.export_to_with(&out, &settings);472 let handle = session.export_to_with(&out, &settings);
crates/engine/tests/backends.rsmodified+58 -13
@@ -13,7 +13,7 @@ use std::time::{Duration, Instant};
13 13
14 use engine::Codec;14 use engine::Codec;
15 use engine::decode::{Backend, probe};15 use engine::decode::{Backend, probe};
16-use engine::export::{ExportSettings, Format};16+use engine::export::{EncoderSeat, ExportSettings, Format};
17 use engine::scratch::Scratch;17 use engine::scratch::Scratch;
18 use engine::{ExportHandle, PlaybackSession};18 use engine::{ExportHandle, PlaybackSession};
19 19
@@ -144,15 +144,18 @@ fn the_planned_encoders_are_the_ones_the_job_opens() {
144 144
145 /// The same pin, swept over the two things that *move* the seat under a user's145 /// The same pin, swept over the two things that *move* the seat under a user's
146 /// hand: the picture size (the plugin refuses HEVC below the driver's 384x384146 /// 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 on147+/// floor and the software intra encoder takes the file) and the seat picked on
148-/// the card. The export card reads [`engine::export::planned_video`] for every148+/// the card ([`engine::export::EncoderSeat`]). The export card reads
149-/// one of these combinations, so a size that flips the seat and a card that kept149+/// [`engine::export::planned_video`] for every one of these combinations, so a
150-/// the old line is the exact lie this sweep exists to catch.150+/// size that flips the seat and a card that kept the old line is the exact lie
151+/// this sweep exists to catch.
151 ///152 ///
152-/// Not swept: the hardware AV1 seat. It is `VE_HW_AV1=1` opt-in because opening153+/// Not swept: the hardware AV1 seat, which is what `Hardware` means for the two
153-/// it hung this box's GPU into a driver reset (2026-08-10), and a test suite is154+/// AV1 rows. Opening it hung this box's GPU into a driver reset (2026-08-10) and
154-/// not the place to find out whether that is fixed -- `av1.rs` keeps that one155+/// a test suite is not the place to find out whether that is fixed -- `av1.rs`
155-/// `#[ignore]`d and by name.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.
156 #[test]159 #[test]
157 fn the_planned_seat_follows_the_size_and_the_pin() {160 fn the_planned_seat_follows_the_size_and_the_pin() {
158 for (format, ext) in [161 for (format, ext) in [
@@ -163,10 +166,13 @@ fn the_planned_seat_follows_the_size_and_the_pin() {
163 (Format::HevcMp4, "mp4"),166 (Format::HevcMp4, "mp4"),
164 ] {167 ] {
165 for (width, height) in [(320, 180), (1280, 720), (1920, 1080)] {168 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+ }
167 let settings = ExportSettings {173 let settings = ExportSettings {
168 format,174 format,
169- force_sw,175+ seat,
170 ..ExportSettings::default()176 ..ExportSettings::default()
171 };177 };
172 let mut session =178 let mut session =
@@ -178,7 +184,7 @@ fn the_planned_seat_follows_the_size_and_the_pin() {
178 .expect("these formats carry picture");184 .expect("these formats carry picture");
179 // A pinned job is software by definition, whatever the machine185 // A pinned job is software by definition, whatever the machine
180 // has -- the one seat this file may assert outright.186 // has -- the one seat this file may assert outright.
181- if force_sw {187+ if seat == EncoderSeat::Software {
182 assert!(188 assert!(
183 planned.starts_with("SW encode"),189 planned.starts_with("SW encode"),
184 "{ext} {width}x{height}: a pinned job is software, got {planned}"190 "{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() {
186 }192 }
187 let out = out_path("seat", ext);193 let out = out_path("seat", ext);
188 let handle = session.export_to_with(&out, &settings);194 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+ }
189 let opened = published_encoders(&handle, &format!("{ext} {width}x{height}"));227 let opened = published_encoders(&handle, &format!("{ext} {width}x{height}"));
190 handle.cancel();228 handle.cancel();
191 wind_down(&handle);229 wind_down(&handle);
192 assert!(230 assert!(
193 opened.starts_with(planned),231 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}"
195 );233 );
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+ }
196 }241 }
197 }242 }
198 }243 }
crates/engine/tests/export.rsmodified+2 -2
@@ -481,7 +481,7 @@ fn a_higher_bitrate_writes_a_bigger_file() {
481 let out = out_path(&format!("bitrate_{bitrate}"));481 let out = out_path(&format!("bitrate_{bitrate}"));
482 let settings = ExportSettings {482 let settings = ExportSettings {
483 bitrate: Some(bitrate),483 bitrate: Some(bitrate),
484- force_sw: true,484+ seat: engine::export::EncoderSeat::Software,
485 ..Default::default()485 ..Default::default()
486 };486 };
487 let handle = session.export_to_with(&out, &settings);487 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() {
985 session.set_proxies(true);985 session.set_proxies(true);
986 session.save_project(&project).expect("save");986 session.save_project(&project).expect("save");
987 let text = std::fs::read_to_string(&project).expect("read the project back");987 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}");
989 assert!(text.contains("\nproxy on\n"), "{text}");989 assert!(text.contains("\nproxy on\n"), "{text}");
990 let reopened = PlaybackSession::open_project(&project).expect("load");990 let reopened = PlaybackSession::open_project(&project).expect("load");
991 assert!(reopened.proxies(), "the switch came back on");991 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() {
134 std::fs::remove_dir_all(&dir).expect("cleanup");134 std::fs::remove_dir_all(&dir).expect("cleanup");
135 }135 }
136 136
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+
137 /// Why a trim's tail stops where the file ends: a clip reaching past the last183 /// Why a trim's tail stops where the file ends: a clip reaching past the last
138 /// frame of its source is a project that will not open again (`open_project`184 /// frame of its source is a project that will not open again (`open_project`
139 /// refuses it by name). Pulled in on both ends and then dragged out as far as185 /// 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() {
245 let v2 = dir.join("new.edith");291 let v2 = dir.join("new.edith");
246 loaded.save_project(&v2).expect("save");292 loaded.save_project(&v2).expect("save");
247 let text = std::fs::read_to_string(&v2).expect("read back");293 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}");
249 assert!(295 assert!(
250 text.contains("\nresolution 1280 720\n"),296 text.contains("\nresolution 1280 720\n"),
251 "a project with no resolution of its own is saved at source 0's: {text}"297 "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() {
333 loaded.save_project(&again).expect("save");379 loaded.save_project(&again).expect("save");
334 assert_eq!(380 assert_eq!(
335 std::fs::read_to_string(&again).expect("read back"),381 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\
337 video 1 0 0 30 0 3 - - fit 1000\naudio 1\n\383 video 1 0 0 30 0 3 - - fit 1000\naudio 1\n\
338 video 2 40 0 20 0 - - - fit 1000\naudio 2 0 0 30 0 3 - - fit 1000\n",384 video 2 40 0 20 0 - - - fit 1000\naudio 2 0 0 30 0 3 - - fit 1000\n",
339 "a four-lane project is written as it was read, three versions on"385 "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() {
363 loaded.save_project(&again).expect("save");409 loaded.save_project(&again).expect("save");
364 assert_eq!(410 assert_eq!(
365 std::fs::read_to_string(&again).expect("read back"),411 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\
367 eq 80.0:-3.0:0.707:ls 1000.0:4.5:1.0:pk\n\413 eq 80.0:-3.0:0.707:ls 1000.0:4.5:1.0:pk\n\
368 eq 12000.0:6.25:0.5:hs\n\414 eq 12000.0:6.25:0.5:hs\n\
369 video 1 0 0 30 0 - 0 - fit 1000\nvideo 1 30 30 60 0 - 1 - fit 1000\n\415 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() {
398 loaded.save_project(&again).expect("save");444 loaded.save_project(&again).expect("save");
399 assert_eq!(445 assert_eq!(
400 std::fs::read_to_string(&again).expect("read back"),446 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\
402 eq 80.0:-3.0:0.707:ls\n\448 eq 80.0:-3.0:0.707:ls\n\
403 color 0.1:1.2:0.9:-0.3\n\449 color 0.1:1.2:0.9:-0.3\n\
404 color -0.25:1.0:0.0:0.5\n\450 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() {
448 loaded.save_project(&again).expect("save");494 loaded.save_project(&again).expect("save");
449 assert_eq!(495 assert_eq!(
450 std::fs::read_to_string(&again).expect("read back"),496 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\
452 video 1 0 0 30 0 - - - fill 1000\nvideo 1 30 30 60 0 - - - center 1000\n\498 video 1 0 0 30 0 - - - fill 1000\nvideo 1 30 30 60 0 - - - center 1000\n\
453 audio 1 0 0 60 0 - - - fit 1000\n",499 audio 1 0 0 60 0 - - - fit 1000\n",
454 "a v7 project is written back as the v8 it now is: the same clips, each \500 "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() {
706 752
707 for (text, want) in [753 for (text, want) in [
708 (754 (
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",
710 "line 1",756 "line 1",
711 ),757 ),
712 // An eq index the table does not hold, and a band shape there is none.758 // 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() {
378 p.tone(),378 p.tone(),
379 false,379 false,
380 true,380 true,
381+ engine::export::EncoderSeat::default(),
381 p.limiter(),382 p.limiter(),
382 0,383 0,
383 )384 )
crates/engine/tests/subtitles.rsmodified+1 -1
@@ -260,7 +260,7 @@ fn a_project_keeps_its_subtitles_across_a_save() {
260 let project = dir.join("cut.edith");260 let project = dir.join("cut.edith");
261 session.save_project(&project).expect("save");261 session.save_project(&project).expect("save");
262 let text = std::fs::read_to_string(&project).expect("read the project back");262 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}");
264 assert!(264 assert!(
265 text.contains("\nsubtitle - test_subs.srt\n"),265 text.contains("\nsubtitle - test_subs.srt\n"),
266 "the reference is written relative, and no cue is: {text}"266 "the reference is written relative, and no cue is: {text}"