Revert https://github.com/alexheretic/ab-av1/commit/57d090e70ae0 until lang/rust >= 1.80 update --- Cargo.lock.orig 2024-07-28 18:16:35 UTC +++ Cargo.lock @@ -48,9 +48,9 @@ name = "anstream" [[package]] name = "anstream" -version = "0.6.15" +version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" dependencies = [ "anstyle", "anstyle-parse", @@ -63,33 +63,33 @@ name = "anstyle" [[package]] name = "anstyle" -version = "1.0.8" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" [[package]] name = "anstyle-parse" -version = "0.2.5" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" +checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" dependencies = [ "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.4" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" dependencies = [ "anstyle", "windows-sys 0.52.0", @@ -207,9 +207,9 @@ name = "clap" [[package]] name = "clap" -version = "4.5.11" +version = "4.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35723e6a11662c2afb578bcf0b88bf6ea8e21282a953428f240574fcc3a2b5b3" +checksum = "8f6b81fb3c84f5563d509c59b5a48d935f689e993afa90fe39047f05adef9142" dependencies = [ "clap_builder", "clap_derive", @@ -217,9 +217,9 @@ name = "clap_builder" [[package]] name = "clap_builder" -version = "4.5.11" +version = "4.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49eb96cbfa7cfa35017b7cd548c75b14c3118c98b423041d70562665e07fb0fa" +checksum = "5ca6706fd5224857d9ac5eb9355f6683563cc0541c7cd9d014043b57cbec78ac" dependencies = [ "anstream", "anstyle", @@ -230,18 +230,18 @@ name = "clap_complete" [[package]] name = "clap_complete" -version = "4.5.11" +version = "4.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6ae69fbb0833c6fcd5a8d4b8609f108c7ad95fc11e248d853ff2c42a90df26a" +checksum = "faa2032320fd6f50d22af510d204b2994eef49600dfbd0e771a166213844e4cd" dependencies = [ "clap", ] [[package]] name = "clap_derive" -version = "4.5.11" +version = "4.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d029b67f89d30bbb547c89fd5161293c0aec155fc691d7924b64550662db93e" +checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085" dependencies = [ "heck", "proc-macro2", @@ -251,15 +251,15 @@ name = "clap_lex" [[package]] name = "clap_lex" -version = "0.7.2" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" +checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" [[package]] name = "colorchoice" -version = "1.0.2" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" [[package]] name = "console" @@ -342,18 +342,18 @@ name = "env_filter" [[package]] name = "env_filter" -version = "0.1.2" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab" +checksum = "c6dc8c8ff84895b051f07a0e65f975cf225131742531338752abfb324e4449ff" dependencies = [ "log", ] [[package]] name = "env_logger" -version = "0.11.5" +version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d" +checksum = "06676b12debf7bba6903559720abca942d3a66b8acb88815fd2c7c6537e9ade1" dependencies = [ "anstream", "anstyle", @@ -561,9 +561,9 @@ name = "is_terminal_polyfill" [[package]] name = "is_terminal_polyfill" -version = "1.70.1" +version = "1.70.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" [[package]] name = "itoa" @@ -656,9 +656,9 @@ name = "object" [[package]] name = "object" -version = "0.36.2" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f203fa8daa7bb185f760ae12bd8e097f63d17041dcdcaf675ac54cdf863170e" +checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce" dependencies = [ "memchr", ] --- src/ffmpeg.rs.orig 2024-07-28 18:16:35 UTC +++ src/ffmpeg.rs @@ -12,7 +12,7 @@ use std::{ hash::{Hash, Hasher}, path::{Path, PathBuf}, process::Stdio, - sync::{Arc, LazyLock}, + sync::{Arc, OnceLock}, }; use tokio::process::Command; use tokio_stream::Stream; @@ -33,17 +33,18 @@ impl FfmpegEncodeArgs<'_> { impl FfmpegEncodeArgs<'_> { pub fn sample_encode_hash(&self, state: &mut impl Hasher) { - static SVT_AV1_V: LazyLock> = LazyLock::new(|| { - std::process::Command::new("SvtAv1EncApp") - .arg("--version") - .output() - .map(|o| o.stdout) - .unwrap_or_default() - }); + static SVT_AV1_V: OnceLock> = OnceLock::new(); // hashing svt-av1 version means new encoder releases will avoid old cache data if &*self.vcodec == "libsvtav1" { - SVT_AV1_V.hash(state); + let svtav1_version = SVT_AV1_V.get_or_init(|| { + use std::process::Command; + match Command::new("SvtAv1EncApp").arg("--version").output() { + Ok(out) => out.stdout, + _ => <_>::default(), + } + }); + svtav1_version.hash(state); } // input not relevant to sample encoding --- src/temporary.rs.orig 2024-07-28 18:16:35 UTC +++ src/temporary.rs @@ -3,11 +3,9 @@ use std::{ collections::HashMap, env, iter, path::{Path, PathBuf}, - sync::{LazyLock, Mutex}, + sync::{Mutex, OnceLock}, }; -static TEMPS: LazyLock>> = LazyLock::new(<_>::default); - #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum TempKind { /// Should always be deleted at the end of the program. @@ -18,15 +16,20 @@ pub fn add(file: impl Into, kind: TempKind) { /// Add a file as temporary so it can be deleted later. pub fn add(file: impl Into, kind: TempKind) { - TEMPS.lock().unwrap().insert(file.into(), kind); + temp_files().lock().unwrap().insert(file.into(), kind); } /// Remove a previously added file so that it won't be deleted later, /// if it hasn't already. pub fn unadd(file: &Path) -> bool { - TEMPS.lock().unwrap().remove(file).is_some() + temp_files().lock().unwrap().remove(file).is_some() } +fn temp_files() -> &'static Mutex> { + static TEMPS: OnceLock>> = OnceLock::new(); + TEMPS.get_or_init(<_>::default) +} + /// Delete all added temporary files. /// If `keep_keepables` true don't delete [`TempKind::Keepable`] temporary files. pub async fn clean(keep_keepables: bool) { @@ -38,7 +41,7 @@ pub async fn clean_all() { /// Delete all added temporary files. pub async fn clean_all() { - let mut files: Vec<_> = std::mem::take(&mut *TEMPS.lock().unwrap()) + let mut files: Vec<_> = std::mem::take(&mut *temp_files().lock().unwrap()) .into_keys() .collect(); files.sort_by_key(|f| f.is_dir()); // rm dir at the end @@ -52,7 +55,7 @@ async fn clean_non_keepables() { } async fn clean_non_keepables() { - let mut matching: Vec<_> = TEMPS + let mut matching: Vec<_> = temp_files() .lock() .unwrap() .iter() @@ -66,7 +69,7 @@ async fn clean_non_keepables() { true => _ = tokio::fs::remove_dir(&file).await, false => _ = tokio::fs::remove_file(&file).await, } - TEMPS.lock().unwrap().remove(&file); + temp_files().lock().unwrap().remove(&file); } } @@ -74,7 +77,8 @@ pub fn process_dir(conf_parent: Option) -> Pa /// /// Configured --temp-dir is used as a parent or, if not set, the current working dir. pub fn process_dir(conf_parent: Option) -> PathBuf { - static SUBDIR: LazyLock = LazyLock::new(|| { + static SUBDIR: OnceLock = OnceLock::new(); + let subdir = SUBDIR.get_or_init(|| { let mut subdir = String::from(".ab-av1-"); subdir.extend(iter::repeat_with(fastrand::alphanumeric).take(12)); subdir @@ -82,7 +86,7 @@ pub fn process_dir(conf_parent: Option) -> Pa let mut temp_dir = conf_parent.unwrap_or_else(|| env::current_dir().expect("current working directory")); - temp_dir.push(&*SUBDIR); + temp_dir.push(subdir); if !temp_dir.exists() { add(&temp_dir, TempKind::Keepable);