From e8a00d4639eb4b0ecd86421423c45907c846fac6 Mon Sep 17 00:00:00 2001 From: Scott Lamb Date: Sat, 28 Dec 2019 08:03:05 -0600 Subject: [PATCH] use parking_lot::Once in ffmpeg I'm getting deprecation warnings for std::sync::ONCE_INIT, and I'm not sure when std::sync::Once::new() became a const fn. Just as easy to switch to parking_lot. --- Cargo.lock | 1 + ffmpeg/Cargo.toml | 1 + ffmpeg/lib.rs | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f375035..c812363 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1100,6 +1100,7 @@ dependencies = [ "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/ffmpeg/Cargo.toml b/ffmpeg/Cargo.toml index c94248a..16df0e6 100644 --- a/ffmpeg/Cargo.toml +++ b/ffmpeg/Cargo.toml @@ -12,6 +12,7 @@ path = "lib.rs" [dependencies] libc = "0.2" log = { version = "0.4", features = ["release_max_level_info"] } +parking_lot = { version = "0.9", features = [] } [build-dependencies] cc = "1.0" diff --git a/ffmpeg/lib.rs b/ffmpeg/lib.rs index 734e99a..a1fc936 100644 --- a/ffmpeg/lib.rs +++ b/ffmpeg/lib.rs @@ -29,13 +29,13 @@ // along with this program. If not, see . use log::info; +use parking_lot::Once; use std::cell::{Ref, RefCell}; use std::ffi::CStr; use std::fmt::{self, Write}; use std::ptr; -use std::sync; -static START: sync::Once = sync::ONCE_INIT; +static START: Once = Once::new(); //#[link(name = "avcodec")] extern "C" {