The seat that writes the picture is picked on the card, not by an env pin
Browse files at this commit50af5b50923fbaa9412e9ef6af51549b6385b91dParent: 0dac66e- feat
- the seat that writes the picture is picked on the card, not by an env pin
21 changed files +628 -112
- crates/app/src/export_ui.rs +52 -5
- crates/app/src/keymap.rs +7 -1
- crates/app/src/main.rs +1 -1
- crates/app/src/menus.rs +5 -0
- crates/app/src/player/cards.rs +5 -0
- crates/app/src/player/export.rs +52 -2
- crates/app/src/render.rs +5 -0
- crates/app/src/tests/cards.rs +39 -10
- crates/app/src/tests/mod.rs +3 -2
- crates/app/src/ui/cards.rs +40 -1
- crates/engine/examples/bench.rs +8 -8
- crates/engine/src/edith.rs +149 -23
- crates/engine/src/export.rs +112 -32
- crates/engine/src/hw.rs +4 -3
- crates/engine/src/playback.rs +30 -0
- crates/engine/tests/av1.rs +2 -2
- crates/engine/tests/backends.rs +58 -13
- crates/engine/tests/export.rs +2 -2
- crates/engine/tests/saveload.rs +52 -6
- crates/engine/tests/silence.rs +1 -0
- crates/engine/tests/subtitles.rs +1 -1
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 | .bitrate | 75 | .bitrate |
| 76 | .unwrap_or_default() | 76 | .unwrap_or_default() |
| 77 | / 1_000_000 | 77 | / 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, the | 508 | /// 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 encodes | 687 | + // 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 only | 691 | // 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 the | 692 | // 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 the | 425 | // 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, and | 426 | // 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 the | 61 | /// 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 click | 70 | /// 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, and | 87 | /// 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 through | 101 | // 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 is | 103 | // 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 about | 427 | /// 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 no | 428 | /// 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 the | 571 | // 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 also | 573 | // 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 of | 246 | // 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 a | 255 | // 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 | None | 819 | 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 | format | 844 | 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 a | 849 | // 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: the | 1230 | // 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 it | 1231 | // 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 targets | 1232 | // 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 many | 322 | // 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 one | 323 | // 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 on | 324 | // 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.session | 476 | 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: dropping | 50 | // `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 run | 617 | /// 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 measured | 624 | // `hevc` keeps meaning the software intra seat, so a row measured |
| 625 | // against an older baseline still compares with the one beside it; the | 625 | // 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 never | 631 | // 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 | //! ```text | 3 | //! ```text |
| 4 | -//! edith 13 | 4 | +//! edith 14 |
| 5 | //! playhead 90 | 5 | //! playhead 90 |
| 6 | //! resolution 1920 1080 | 6 | //! resolution 1920 1080 |
| 7 | //! fps 30.0 | 7 | //! fps 30.0 |
| 8 | //! tonemap vivid | 8 | //! tonemap vivid |
| 9 | //! proxy on | 9 | //! proxy on |
| 10 | //! autoproxy off | 10 | //! autoproxy off |
| 11 | +//! encoder hardware | ||
| 11 | //! limiter -1.0 on | 12 | //! limiter -1.0 on |
| 12 | //! source 0 test_av.mp4 | 13 | //! source 0 test_av.mp4 |
| 13 | //! source 1 /elsewhere/test_av2.mp4 | 14 | //! 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 a | 62 | //! 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 mix | 74 | //! 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 lane | 127 | //! 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 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 | ||
| 121 | //! stand-in for every film that wants one the moment it arrives, which is all | 134 | //! 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 on | 136 | //! **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 grades | 158 | //! 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 one | 159 | //! 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 shown | 160 | //! 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 |
| 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 is | 164 | //! 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 module | 195 | /// 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 only | 262 | /// 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 limited | 389 | // 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() { |
| @@ -488,8 +515,10 @@ fn parse(data: &[u8], dir: &Path) -> crate::Result<Document> { | |||
| 488 | // The dialects that wrote a source line without its stream field. Reading | 515 | // The dialects that wrote a source line without its stream field. Reading |
| 489 | // one is the whole of what "an old project still opens" means here. | 516 | // one is the whole of what "an old project still opens" means here. |
| 490 | let streamless = v1 || first == MAGIC_V2; | 517 | let streamless = v1 || first == MAGIC_V2; |
| 491 | - // The one that says whether the stand-ins are made by themselves... | 518 | + // The one that says which encoder an export takes... |
| 492 | - let v13 = first == MAGIC; | 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; | ||
| 493 | // ...the ones that say whether it is cut on stand-ins... | 522 | // ...the ones that say whether it is cut on stand-ins... |
| 494 | let v12 = v13 || first == MAGIC_V12; | 523 | let v12 = v13 || first == MAGIC_V12; |
| 495 | // ...the ones that carry an HDR rendition... | 524 | // ...the ones that carry an HDR rendition... |
| @@ -545,6 +574,10 @@ fn parse(data: &[u8], dir: &Path) -> crate::Result<Document> { | |||
| 545 | // that wanted a stand-in got one, which is what leaving the line out | 574 | // that wanted a stand-in got one, which is what leaving the line out |
| 546 | // still means. | 575 | // still means. |
| 547 | auto_proxy: true, | 576 | 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(), | ||
| 548 | fps: None, | 581 | fps: None, |
| 549 | playhead: 0, | 582 | playhead: 0, |
| 550 | }; | 583 | }; |
| @@ -653,6 +686,20 @@ fn parse(data: &[u8], dir: &Path) -> crate::Result<Document> { | |||
| 653 | } | 686 | } |
| 654 | }; | 687 | }; |
| 655 | } | 688 | } |
| 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 | + } | ||
| 656 | b"limiter" if v9 => { | 703 | b"limiter" if v9 => { |
| 657 | if !doc.sources.is_empty() { | 704 | if !doc.sources.is_empty() { |
| 658 | return Err( | 705 | return Err( |
| @@ -1174,6 +1221,7 @@ mod tests { | |||
| 1174 | crate::tonemap::Preset::default(), | 1221 | crate::tonemap::Preset::default(), |
| 1175 | false, | 1222 | false, |
| 1176 | true, | 1223 | true, |
| 1224 | + crate::export::EncoderSeat::default(), | ||
| 1177 | Limiter::default(), | 1225 | Limiter::default(), |
| 1178 | playhead, | 1226 | playhead, |
| 1179 | ) | 1227 | ) |
| @@ -1219,6 +1267,7 @@ mod tests { | |||
| 1219 | crate::tonemap::Preset::default(), | 1267 | crate::tonemap::Preset::default(), |
| 1220 | false, | 1268 | false, |
| 1221 | true, | 1269 | true, |
| 1270 | + crate::export::EncoderSeat::default(), | ||
| 1222 | Limiter::default(), | 1271 | Limiter::default(), |
| 1223 | 0, | 1272 | 0, |
| 1224 | ); | 1273 | ); |
| @@ -1247,7 +1296,7 @@ mod tests { | |||
| 1247 | video 1 0 0 30 0 - - - fit 1000\n"; | 1296 | video 1 0 0 30 0 - - - fit 1000\n"; |
| 1248 | let old = parse(v9, &dir).expect("v9 still loads"); | 1297 | let old = parse(v9, &dir).expect("v9 still loads"); |
| 1249 | assert_eq!(old.subtitles, Vec::new()); | 1298 | 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")); |
| 1251 | // ...and the line itself is not a v9 line: a dialect may not be mixed. | 1300 | // ...and the line itself is not a v9 line: a dialect may not be mixed. |
| 1252 | let mixed = parse(b"edith 9\nsource 0 a.mp4\nsubtitle - subs.srt\n", &dir) | 1301 | let mixed = parse(b"edith 9\nsource 0 a.mp4\nsubtitle - subs.srt\n", &dir) |
| 1253 | .unwrap_err() | 1302 | .unwrap_err() |
| @@ -1284,6 +1333,7 @@ mod tests { | |||
| 1284 | crate::tonemap::Preset::default(), | 1333 | crate::tonemap::Preset::default(), |
| 1285 | proxy, | 1334 | proxy, |
| 1286 | true, | 1335 | true, |
| 1336 | + crate::export::EncoderSeat::default(), | ||
| 1287 | Limiter::default(), | 1337 | Limiter::default(), |
| 1288 | 0, | 1338 | 0, |
| 1289 | ) | 1339 | ) |
| @@ -1345,6 +1395,7 @@ mod tests { | |||
| 1345 | crate::tonemap::Preset::default(), | 1395 | crate::tonemap::Preset::default(), |
| 1346 | proxy, | 1396 | proxy, |
| 1347 | auto, | 1397 | auto, |
| 1398 | + crate::export::EncoderSeat::default(), | ||
| 1348 | Limiter::default(), | 1399 | Limiter::default(), |
| 1349 | 0, | 1400 | 0, |
| 1350 | ) | 1401 | ) |
| @@ -1386,6 +1437,78 @@ mod tests { | |||
| 1386 | } | 1437 | } |
| 1387 | } | 1438 | } |
| 1388 | 1439 | ||
| 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 | + | ||
| 1389 | /// The v11 line: the HDR rendition, written by name, read back as the very | 1512 | /// The v11 line: the HDR rendition, written by name, read back as the very |
| 1390 | /// preset -- and the dialect before it, which had no way to say one and | 1513 | /// preset -- and the dialect before it, which had no way to say one and |
| 1391 | /// meant the published conversion. | 1514 | /// meant the published conversion. |
| @@ -1407,6 +1530,7 @@ mod tests { | |||
| 1407 | preset, | 1530 | preset, |
| 1408 | false, | 1531 | false, |
| 1409 | true, | 1532 | true, |
| 1533 | + crate::export::EncoderSeat::default(), | ||
| 1410 | Limiter::default(), | 1534 | Limiter::default(), |
| 1411 | 0, | 1535 | 0, |
| 1412 | ); | 1536 | ); |
| @@ -1501,7 +1625,7 @@ mod tests { | |||
| 1501 | let bytes = flat(&dir, &sources, &lanes, 12); | 1625 | let bytes = flat(&dir, &sources, &lanes, 12); |
| 1502 | assert_eq!( | 1626 | assert_eq!( |
| 1503 | String::from_utf8_lossy(&bytes), | 1627 | 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\ |
| 1505 | source 2 /elsewhere/b.mp4\n\ | 1629 | source 2 /elsewhere/b.mp4\n\ |
| 1506 | video 1 0 0 30 0 0 - - fit 1000\nvideo 1 30 10 20 1 1 - - fit 1000\n\ | 1630 | video 1 0 0 30 0 0 - - fit 1000\nvideo 1 30 10 20 1 1 - - fit 1000\n\ |
| 1507 | audio 1 0 0 30 0 0 - - fit 1000\n", | 1631 | audio 1 0 0 30 0 0 - - fit 1000\n", |
| @@ -1538,7 +1662,7 @@ mod tests { | |||
| 1538 | let bytes = flat(&dir, &sources, &lanes, 7); | 1662 | let bytes = flat(&dir, &sources, &lanes, 7); |
| 1539 | assert_eq!( | 1663 | assert_eq!( |
| 1540 | String::from_utf8_lossy(&bytes), | 1664 | 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\ |
| 1542 | video 1 0 0 30 0 4 - - fit 1000\naudio 1\n\ | 1666 | video 1 0 0 30 0 4 - - fit 1000\naudio 1\n\ |
| 1543 | video 2 40 0 10 0 - - - fit 1000\naudio 2 0 0 30 0 4 - - fit 1000\n", | 1667 | video 2 40 0 10 0 - - - fit 1000\naudio 2 0 0 30 0 4 - - fit 1000\n", |
| 1544 | "an empty lane is a line of its own; everything else is its clips" | 1668 | "an empty lane is a line of its own; everything else is its clips" |
| @@ -1646,7 +1770,7 @@ mod tests { | |||
| 1646 | let bytes = emit(&dir, &sources, &lanes, &eq, &[], (1280, 720), 0); | 1770 | let bytes = emit(&dir, &sources, &lanes, &eq, &[], (1280, 720), 0); |
| 1647 | assert_eq!( | 1771 | assert_eq!( |
| 1648 | String::from_utf8_lossy(&bytes), | 1772 | 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\ |
| 1650 | eq 80.0:-3.0:0.707:ls 1000.0:4.5:1.0:pk\n\ | 1774 | eq 80.0:-3.0:0.707:ls 1000.0:4.5:1.0:pk\n\ |
| 1651 | eq 16777215.0:-0.1:3.918315e-39:hs\n\ | 1775 | eq 16777215.0:-0.1:3.918315e-39:hs\n\ |
| 1652 | eq\n\ | 1776 | eq\n\ |
| @@ -1750,7 +1874,7 @@ mod tests { | |||
| 1750 | let bytes = emit(&dir, &sources, &lanes, &[], &color, (1280, 720), 0); | 1874 | let bytes = emit(&dir, &sources, &lanes, &[], &color, (1280, 720), 0); |
| 1751 | assert_eq!( | 1875 | assert_eq!( |
| 1752 | String::from_utf8_lossy(&bytes), | 1876 | 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\ |
| 1754 | color 0.1:1.2:0.9:-0.3\n\ | 1878 | color 0.1:1.2:0.9:-0.3\n\ |
| 1755 | color -1e-7:16777215.0:3.918315e-39:-0.0\n\ | 1879 | color -1e-7:16777215.0:3.918315e-39:-0.0\n\ |
| 1756 | color 0.0:1.0:1.0:0.0\n\ | 1880 | color 0.0:1.0:1.0:0.0\n\ |
| @@ -1815,7 +1939,7 @@ mod tests { | |||
| 1815 | (1280, 720), | 1939 | (1280, 720), |
| 1816 | old.playhead | 1940 | old.playhead |
| 1817 | )), | 1941 | )), |
| 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\ |
| 1819 | eq 80.0:-3.0:0.707:ls\n\ | 1943 | eq 80.0:-3.0:0.707:ls\n\ |
| 1820 | video 1 0 0 30 0 0 0 - fit 1000\naudio 1 0 0 30 0 0 - - fit 1000\n" | 1944 | video 1 0 0 30 0 0 0 - fit 1000\naudio 1 0 0 30 0 0 - - fit 1000\n" |
| 1821 | ); | 1945 | ); |
| @@ -1853,7 +1977,7 @@ mod tests { | |||
| 1853 | let bytes = emit(&dir, &sources, &lanes, &[], &[], (1280, 720), 0); | 1977 | let bytes = emit(&dir, &sources, &lanes, &[], &[], (1280, 720), 0); |
| 1854 | assert_eq!( | 1978 | assert_eq!( |
| 1855 | String::from_utf8_lossy(&bytes), | 1979 | 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\ |
| 1857 | video 1 0 0 30 0 - - - fit 2000\nvideo 1 15 30 40 0 - - - fit 250\n\ | 1981 | video 1 0 0 30 0 - - - fit 2000\nvideo 1 15 30 40 0 - - - fit 250\n\ |
| 1858 | audio 1 0 0 30 0 - - - fit 2000\n", | 1982 | audio 1 0 0 30 0 - - - fit 2000\n", |
| 1859 | "the rate is the clip line's last field, in thousandths" | 1983 | "the rate is the clip line's last field, in thousandths" |
| @@ -1882,7 +2006,7 @@ mod tests { | |||
| 1882 | (1280, 720), | 2006 | (1280, 720), |
| 1883 | old.playhead | 2007 | old.playhead |
| 1884 | )), | 2008 | )), |
| 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\ |
| 1886 | video 1 0 0 30 0 0 - - fit 1000\naudio 1 0 0 30 0 0 - - fit 1000\n" | 2010 | video 1 0 0 30 0 0 - - fit 1000\naudio 1 0 0 30 0 0 - - fit 1000\n" |
| 1887 | ); | 2011 | ); |
| 1888 | // A rate outside what the editor can set is a corrupt line, by name. | 2012 | // A rate outside what the editor can set is a corrupt line, by name. |
| @@ -1925,12 +2049,13 @@ mod tests { | |||
| 1925 | crate::tonemap::Preset::default(), | 2049 | crate::tonemap::Preset::default(), |
| 1926 | false, | 2050 | false, |
| 1927 | true, | 2051 | true, |
| 2052 | + crate::export::EncoderSeat::default(), | ||
| 1928 | limiter, | 2053 | limiter, |
| 1929 | 0, | 2054 | 0, |
| 1930 | ); | 2055 | ); |
| 1931 | assert_eq!( | 2056 | assert_eq!( |
| 1932 | String::from_utf8_lossy(&bytes), | 2057 | 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\ |
| 1934 | limiter -1.5 on\nsource 0 a.mp4\n\ | 2059 | limiter -1.5 on\nsource 0 a.mp4\n\ |
| 1935 | video 1 0 0 30 0 - - - fit 1000\naudio 1 0 0 30 0 - - - fit 1000\n\ | 2060 | video 1 0 0 30 0 - - - fit 1000\naudio 1 0 0 30 0 - - - fit 1000\n\ |
| 1936 | audio 2 0 0 30 0 - - - fit 1000\n\ | 2061 | audio 2 0 0 30 0 - - - fit 1000\n\ |
| @@ -1962,7 +2087,7 @@ mod tests { | |||
| 1962 | (1280, 720), | 2087 | (1280, 720), |
| 1963 | old.playhead | 2088 | old.playhead |
| 1964 | )), | 2089 | )), |
| 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\ |
| 1966 | video 1 0 0 30 0 - - - fit 1000\naudio 1 0 0 30 0 - - - fit 1000\n" | 2091 | video 1 0 0 30 0 - - - fit 1000\naudio 1 0 0 30 0 - - - fit 1000\n" |
| 1967 | ); | 2092 | ); |
| 1968 | 2093 | ||
| @@ -2126,7 +2251,7 @@ mod tests { | |||
| 2126 | assert!(old.eq.is_empty(), "nothing before v5 equalizes anything"); | 2251 | assert!(old.eq.is_empty(), "nothing before v5 equalizes anything"); |
| 2127 | assert_eq!( | 2252 | assert_eq!( |
| 2128 | String::from_utf8_lossy(&flat(&dir, &old.sources, &old.lanes, old.playhead)), | 2253 | 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\ |
| 2130 | source 2 /elsewhere/b.mp4\n\ | 2255 | source 2 /elsewhere/b.mp4\n\ |
| 2131 | video 1 0 0 30 0 0 - - fit 1000\nvideo 1 30 10 20 1 1 - - fit 1000\n\ | 2256 | video 1 0 0 30 0 0 - - fit 1000\nvideo 1 30 10 20 1 1 - - fit 1000\n\ |
| 2132 | audio 1 0 0 30 0 0 - - fit 1000\n" | 2257 | audio 1 0 0 30 0 0 - - fit 1000\n" |
| @@ -2179,7 +2304,7 @@ mod tests { | |||
| 2179 | let v5 = flat(&dir, &back.sources, &back.lanes, back.playhead); | 2304 | let v5 = flat(&dir, &back.sources, &back.lanes, back.playhead); |
| 2180 | assert_eq!( | 2305 | assert_eq!( |
| 2181 | String::from_utf8_lossy(&v5), | 2306 | 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\ |
| 2183 | source 0 /elsewhere/b.mp4\n\ | 2308 | source 0 /elsewhere/b.mp4\n\ |
| 2184 | video 1 0 0 30 0 0 - - fit 1000\nvideo 1 30 10 20 1 1 - - fit 1000\n\ | 2309 | video 1 0 0 30 0 0 - - fit 1000\nvideo 1 30 10 20 1 1 - - fit 1000\n\ |
| 2185 | audio 1 0 0 30 0 0 - - fit 1000\n", | 2310 | audio 1 0 0 30 0 0 - - fit 1000\n", |
| @@ -2211,7 +2336,7 @@ mod tests { | |||
| 2211 | // Saved again it is the current version, which round-trips to the | 2336 | // Saved again it is the current version, which round-trips to the |
| 2212 | // same document. | 2337 | // same document. |
| 2213 | let v5 = flat(&dir, &back.sources, &back.lanes, back.playhead); | 2338 | 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")); |
| 2215 | let again = parse(&v5, &dir).expect("v5 parses"); | 2340 | let again = parse(&v5, &dir).expect("v5 parses"); |
| 2216 | assert_eq!(again.lanes, back.lanes); | 2341 | assert_eq!(again.lanes, back.lanes); |
| 2217 | // A dialect may not be mixed: lane lines under v1, `clip` under v2. | 2342 | // A dialect may not be mixed: lane lines under v1, `clip` under v2. |
| @@ -2311,6 +2436,7 @@ mod tests { | |||
| 2311 | crate::tonemap::Preset::default(), | 2436 | crate::tonemap::Preset::default(), |
| 2312 | false, | 2437 | false, |
| 2313 | true, | 2438 | true, |
| 2439 | + crate::export::EncoderSeat::default(), | ||
| 2314 | Limiter::default(), | 2440 | Limiter::default(), |
| 2315 | 0, | 2441 | 0, |
| 2316 | ) | 2442 | ) |
| @@ -2318,7 +2444,7 @@ mod tests { | |||
| 2318 | let bytes = std::fs::read(&path).expect("read back"); | 2444 | let bytes = std::fs::read(&path).expect("read back"); |
| 2319 | assert_eq!( | 2445 | assert_eq!( |
| 2320 | String::from_utf8_lossy(&bytes), | 2446 | 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\ |
| 2322 | video 1 0 0 30 0 - - - fit 1000\naudio 1 0 0 30 0 - - - fit 1000\n" | 2448 | video 1 0 0 30 0 - - - fit 1000\naudio 1 0 0 30 0 - - - fit 1000\n" |
| 2323 | ); | 2449 | ); |
| 2324 | // Loading rejoins the *given* directory, so the file is reached by the | 2450 | // Loading rejoins the *given* directory, so the file is reached by the |
| @@ -2363,10 +2489,10 @@ mod tests { | |||
| 2363 | #[test] | 2489 | #[test] |
| 2364 | fn a_wrong_first_line_is_refused_by_name() { | 2490 | fn a_wrong_first_line_is_refused_by_name() { |
| 2365 | let dir = PathBuf::from("/proj"); | 2491 | 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) |
| 2367 | .unwrap_err() | 2493 | .unwrap_err() |
| 2368 | .to_string(); | 2494 | .to_string(); |
| 2369 | - assert_eq!(err, "line 1: unsupported version 14"); | 2495 | + assert_eq!(err, "line 1: unsupported version 15"); |
| 2370 | for junk in [&b""[..], b"{}\n", b"source a.mp4\n"] { | 2496 | for junk in [&b""[..], b"{}\n", b"source a.mp4\n"] { |
| 2371 | assert_eq!( | 2497 | assert_eq!( |
| 2372 | parse(junk, &dir).unwrap_err().to_string(), | 2498 | 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 we | 309 | /// [`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 hatch | 316 | + /// 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 every | 321 | /// 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 it | 574 | /// 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 | 575 | +/// -- 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 single | 576 | +/// 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* it | 577 | +/// 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. 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 | ||
| 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 the | 664 | /// 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. One | 665 | /// 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 the | 1000 | /// 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 | - settings | 1003 | + settings.format.has_video().then(|| match hw_seat(meta, settings) { |
| 929 | - .format | 1004 | + 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 the | 1011 | /// 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 *sample | 1037 | // 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 same | 3118 | // 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 an | 3151 | /// 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 the | 3154 | + /// 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 this | 3155 | + /// 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 an | 3156 | + /// on this project's own radeonsi box -- `engine_hw: operation failed`, |
| 3080 | - /// amdgpu hard recovery and a lost context, measured 2026-08-10 exporting | 3157 | + /// 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 worse | 3158 | + /// 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. So | 3159 | + /// 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 a | 3166 | /// 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 at | 3167 | /// 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 only | 3172 | // 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 both | 3375 | /// 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 behind | 3378 | + /// 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 GPU | 3379 | + /// 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 to | 3380 | /// ([`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 export | 556 | /// 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 encoder | 559 | + /// 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 engine | 394 | /// 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 the | 404 | /// 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 every | 1016 | // ...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 the | 1023 | // 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 is | 1024 | // whole of its audio; this puts both onto the clip the playhead is |
| @@ -1267,6 +1278,10 @@ impl PlaybackSession { | |||
| 1267 | // question from whether it cuts on them and the only one an import | 1278 | // question from whether it cuts on them and the only one an import |
| 1268 | // asks ([`Self::auto_proxies`]). | 1279 | // asks ([`Self::auto_proxies`]). |
| 1269 | self.auto_proxies, | 1280 | 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, | ||
| 1270 | self.project.limiter(), | 1285 | self.project.limiter(), |
| 1271 | playhead, | 1286 | playhead, |
| 1272 | ) | 1287 | ) |
| @@ -2014,6 +2029,21 @@ impl PlaybackSession { | |||
| 2014 | self.seek(now); | 2029 | self.seek(now); |
| 2015 | } | 2030 | } |
| 2016 | 2031 | ||
| 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 | + | ||
| 2017 | /// Whether an imported film that wants a stand-in gets one made for it | 2047 | /// Whether an imported film that wants a stand-in gets one made for it |
| 2018 | /// there and then ([`Self::set_auto_proxies`]). | 2048 | /// there and then ([`Self::set_auto_proxies`]). |
| 2019 | pub fn auto_proxies(&self) -> bool { | 2049 | 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 is | 372 | // 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's | 145 | /// 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 384x384 | 146 | /// 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 | 147 | +/// 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 every | 148 | +/// 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 kept | 149 | +/// [`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 opening | 153 | +/// 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 is | 154 | +/// 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 one | 155 | +/// 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 machine | 185 | // 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 last | 183 | /// 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 as | 185 | /// 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
| @@ -259,7 +259,7 @@ fn a_project_keeps_its_subtitles_across_a_save() { | |||
| 259 | let project = dir.join("cut.edith"); | 259 | let project = dir.join("cut.edith"); |
| 260 | session.save_project(&project).expect("save"); | 260 | session.save_project(&project).expect("save"); |
| 261 | let text = std::fs::read_to_string(&project).expect("read the project back"); | 261 | 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}"); |
| 263 | assert!( | 263 | assert!( |
| 264 | text.contains("\nsubtitle - test_subs.srt\n"), | 264 | text.contains("\nsubtitle - test_subs.srt\n"), |
| 265 | "the reference is written relative, and no cue is: {text}" | 265 | "the reference is written relative, and no cue is: {text}" |