fallbackswitch: Switch from lazy_static to once_cell

This commit is contained in:
Sebastian Dröge 2020-04-07 23:47:15 +03:00
parent cb7741919d
commit f6120fcf98
4 changed files with 13 additions and 14 deletions

View file

@ -19,12 +19,11 @@ gstreamer-audio = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs
gstreamer-video = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_14"] }
gtk = { git = "https://github.com/gtk-rs/gtk", optional = true }
gio = { git = "https://github.com/gtk-rs/gio", optional = true }
lazy_static = "1.0"
once_cell = "1.0"
[dev-dependencies]
gstreamer-check = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_14"]}
gstreamer-app = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_14"]}
lazy_static = "1.2"
[lib]
name = "gstfallbackswitch"

View file

@ -31,6 +31,8 @@ use gst_base::prelude::*;
use gst_base::subclass::prelude::*;
use gst_video;
use once_cell::sync::Lazy;
use std::sync::{Mutex, RwLock};
struct FallbackSwitch {
@ -42,13 +44,13 @@ struct FallbackSwitch {
settings: Mutex<Settings>,
}
lazy_static! {
static ref CAT: gst::DebugCategory = gst::DebugCategory::new(
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
gst::DebugCategory::new(
"fallbackswitch",
gst::DebugColorFlags::empty(),
Some("Fallback switch Element"),
);
}
)
});
#[derive(Debug)]
struct OutputState {

View file

@ -39,8 +39,7 @@ mod gst_base {
pub use super::base::*;
}
#[macro_use]
extern crate lazy_static;
extern crate once_cell;
mod fallbackswitch;

View file

@ -26,16 +26,15 @@ extern crate gstreamer_check as gst_check;
extern crate gstfallbackswitch;
#[macro_use]
extern crate lazy_static;
use once_cell::sync::Lazy;
lazy_static! {
static ref TEST_CAT: gst::DebugCategory = gst::DebugCategory::new(
static TEST_CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
gst::DebugCategory::new(
"fallbackswitch-test",
gst::DebugColorFlags::empty(),
Some("fallbackswitch test"),
);
}
)
});
fn init() {
use std::sync::Once;