Use re-exported once_cell

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1293>
This commit is contained in:
Bilal Elmoussaoui 2023-07-06 15:38:29 +02:00 committed by Sebastian Dröge
parent b156ba2c59
commit f9fa7f55fc
37 changed files with 25 additions and 39 deletions

View file

@ -36,7 +36,6 @@ cairo-rs = { git = "https://github.com/gtk-rs/gtk-rs-core", features=["use_glib"
pango = { git = "https://github.com/gtk-rs/gtk-rs-core", optional = true }
pangocairo = { git = "https://github.com/gtk-rs/gtk-rs-core", optional = true }
glutin = { version = "0.29", optional = true }
once_cell = "1.0"
image = { version = "0.24", optional = true, default-features = false, features = ["png", "jpeg"] }
memmap2 = { version = "0.7", optional = true }
memfd = { version = "0.6", optional = true }

View file

@ -10,9 +10,9 @@ mod examples_common;
// Our custom compositor element is defined in this module.
mod cairo_compositor {
use glib::once_cell::sync::Lazy;
use gst_base::subclass::prelude::*;
use gst_video::{prelude::*, subclass::prelude::*};
use once_cell::sync::Lazy;
// In the imp submodule we include the actual implementation of the compositor.
mod imp {

View file

@ -71,8 +71,8 @@ mod custom_meta {
mod imp {
use std::{mem, ptr};
use glib::once_cell::sync::Lazy;
use glib::translate::*;
use once_cell::sync::Lazy;
pub(super) struct CustomMetaParams {
pub label: String,

View file

@ -361,11 +361,11 @@ mod video_filter {
use std::{mem::ManuallyDrop, os::unix::prelude::FromRawFd};
use anyhow::Error;
use glib::once_cell::sync::Lazy;
use gst::{subclass::prelude::*, PadDirection, PadPresence, PadTemplate};
use gst_app::gst_base::subclass::BaseTransformMode;
use gst_video::{subclass::prelude::*, VideoFrameRef};
use memmap2::MmapMut;
use once_cell::sync::Lazy;
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
gst::DebugCategory::new(

View file

@ -30,13 +30,13 @@ void main () {
mod mirror {
use std::sync::Mutex;
use glib::once_cell::sync::Lazy;
use gst_base::subclass::BaseTransformMode;
use gst_gl::{
prelude::*,
subclass::{prelude::*, GLFilterMode},
*,
};
use once_cell::sync::Lazy;
use super::{gl, FRAGMENT_SHADER};

View file

@ -17,8 +17,8 @@ mod examples_common;
// Our custom FIR filter element is defined in this module
mod fir_filter {
use byte_slice_cast::*;
use glib::once_cell::sync::Lazy;
use gst_base::subclass::prelude::*;
use once_cell::sync::Lazy;
// The debug category we use below for our filter
pub static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {

View file

@ -18,7 +18,6 @@ libc = "0.2"
ffi = { package = "gstreamer-allocators-sys", path = "sys" }
glib = { git = "https://github.com/gtk-rs/gtk-rs-core" }
gst = { package = "gstreamer", path = "../gstreamer" }
once_cell = "1.0"
[dev-dependencies]
gir-format-check = "0.1"

View file

@ -1,7 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file.
use glib::once_cell::sync::Lazy;
use gst::CapsFeatures;
use once_cell::sync::Lazy;
pub static CAPS_FEATURES_MEMORY_DMABUF: Lazy<CapsFeatures> =
Lazy::new(|| CapsFeatures::new([crate::CAPS_FEATURE_MEMORY_DMABUF]));

View file

@ -21,7 +21,6 @@ ffi = { package = "gstreamer-app-sys", path = "sys" }
glib = { git = "https://github.com/gtk-rs/gtk-rs-core" }
gst = { package = "gstreamer", path = "../gstreamer" }
gst-base = { package = "gstreamer-base", path = "../gstreamer-base" }
once_cell = "1.0"
[dev-dependencies]
futures-util = { version = "0.3", features = ["sink"] }

View file

@ -351,7 +351,7 @@ impl AppSink {
#[doc(alias = "gst_app_sink_set_callbacks")]
pub fn set_callbacks(&self, callbacks: AppSinkCallbacks) {
#[cfg(not(feature = "v1_18"))]
use once_cell::sync::Lazy;
use glib::once_cell::sync::Lazy;
#[cfg(not(feature = "v1_18"))]
static SET_ONCE_QUARK: Lazy<glib::Quark> =
Lazy::new(|| glib::Quark::from_str("gstreamer-rs-app-sink-callbacks"));

View file

@ -224,7 +224,7 @@ impl AppSrc {
#[doc(alias = "gst_app_src_set_callbacks")]
pub fn set_callbacks(&self, callbacks: AppSrcCallbacks) {
#[cfg(not(feature = "v1_18"))]
use once_cell::sync::Lazy;
use glib::once_cell::sync::Lazy;
#[cfg(not(feature = "v1_18"))]
static SET_ONCE_QUARK: Lazy<glib::Quark> =
Lazy::new(|| glib::Quark::from_str("gstreamer-rs-app-src-callbacks"));

View file

@ -20,7 +20,6 @@ ffi = { package = "gstreamer-audio-sys", path = "sys" }
glib = { git = "https://github.com/gtk-rs/gtk-rs-core" }
gst = { package = "gstreamer", path = "../gstreamer" }
gst-base = { package = "gstreamer-base", path = "../gstreamer-base" }
once_cell = "1.0"
serde = { version = "1.0", optional = true }
[dev-dependencies]

View file

@ -2,8 +2,8 @@
use std::str;
use glib::once_cell::sync::Lazy;
use glib::translate::{from_glib, IntoGlib};
use once_cell::sync::Lazy;
#[cfg(feature = "v1_18")]
pub static AUDIO_FORMATS_ALL: Lazy<Box<[crate::AudioFormat]>> = Lazy::new(|| unsafe {

View file

@ -20,7 +20,6 @@ ffi = { package = "gstreamer-base-sys", path = "sys" }
glib = { git = "https://github.com/gtk-rs/gtk-rs-core" }
gst = { package = "gstreamer", path = "../gstreamer" }
atomic_refcell = "0.1"
once_cell = "1"
[dev-dependencies]
gir-format-check = "0.1"

View file

@ -1310,7 +1310,7 @@ mod tests {
impl ElementImpl for TestTransform {
fn metadata() -> Option<&'static gst::subclass::ElementMetadata> {
use once_cell::sync::Lazy;
use glib::once_cell::sync::Lazy;
static ELEMENT_METADATA: Lazy<gst::subclass::ElementMetadata> = Lazy::new(|| {
gst::subclass::ElementMetadata::new(
"Test Transform",
@ -1324,7 +1324,7 @@ mod tests {
}
fn pad_templates() -> &'static [gst::PadTemplate] {
use once_cell::sync::Lazy;
use glib::once_cell::sync::Lazy;
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
let caps = gst::Caps::new_any();
vec![

View file

@ -14,7 +14,6 @@ edition = "2021"
rust-version = "1.66"
[dependencies]
once_cell = "1.0"
ffi = { package = "gstreamer-controller-sys", path = "sys" }
glib = { git = "https://github.com/gtk-rs/gtk-rs-core" }
gst = { package = "gstreamer", path = "../gstreamer" }

View file

@ -18,7 +18,6 @@ rust-version = "1.66"
[dependencies]
libc = "0.2"
once_cell = "1.0"
ffi = { package = "gstreamer-gl-sys", path = "sys" }
glib = { git = "https://github.com/gtk-rs/gtk-rs-core" }
gst = { package = "gstreamer", path = "../gstreamer" }

View file

@ -1,7 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file.
use glib::once_cell::sync::Lazy;
use gst::CapsFeatures;
use once_cell::sync::Lazy;
pub static CAPS_FEATURES_MEMORY_GL_MEMORY: Lazy<CapsFeatures> =
Lazy::new(|| CapsFeatures::new([crate::CAPS_FEATURE_MEMORY_GL_MEMORY]));

View file

@ -19,7 +19,6 @@ ffi = { package = "gstreamer-play-sys", path = "sys" }
glib = { git = "https://github.com/gtk-rs/gtk-rs-core" }
gst = { package = "gstreamer", path = "../gstreamer", features = ["v1_20"] }
gst-video = { package = "gstreamer-video", path = "../gstreamer-video", features = ["v1_20"] }
once_cell = "1.0"
[dev-dependencies]
gir-format-check = "0.1"

View file

@ -49,7 +49,7 @@ unsafe extern "C" fn video_renderer_create_video_sink<T: PlayVideoRendererImpl>(
video_renderer: *mut ffi::GstPlayVideoRenderer,
play: *mut ffi::GstPlay,
) -> *mut gst::ffi::GstElement {
use once_cell::sync::Lazy;
use glib::once_cell::sync::Lazy;
static VIDEO_SINK_QUARK: Lazy<glib::Quark> =
Lazy::new(|| glib::Quark::from_str("gstreamer-rs-play-video-sink"));

View file

@ -19,7 +19,6 @@ ffi = { package = "gstreamer-player-sys", path = "sys" }
glib = { git = "https://github.com/gtk-rs/gtk-rs-core" }
gst = { package = "gstreamer", path = "../gstreamer" }
gst-video = { package = "gstreamer-video", path = "../gstreamer-video" }
once_cell = "1.0"
[dev-dependencies]
gir-format-check = "0.1"

View file

@ -49,7 +49,7 @@ unsafe extern "C" fn video_renderer_create_video_sink<T: PlayerVideoRendererImpl
video_renderer: *mut ffi::GstPlayerVideoRenderer,
player: *mut ffi::GstPlayer,
) -> *mut gst::ffi::GstElement {
use once_cell::sync::Lazy;
use glib::once_cell::sync::Lazy;
static VIDEO_SINK_QUARK: Lazy<glib::Quark> =
Lazy::new(|| glib::Quark::from_str("gstreamer-rs-player-video-sink"));

View file

@ -14,7 +14,6 @@ edition = "2021"
rust-version = "1.66"
[dependencies]
once_cell = "1.0"
libc = "0.2"
ffi = { package = "gstreamer-rtp-sys", path = "sys" }
glib = { git = "https://github.com/gtk-rs/gtk-rs-core" }

View file

@ -15,7 +15,6 @@ rust-version = "1.66"
[dependencies]
libc = "0.2"
once_cell = "1.0"
ffi = { package = "gstreamer-rtsp-server-sys", path = "sys" }
glib = { git = "https://github.com/gtk-rs/gtk-rs-core" }
gio = { git = "https://github.com/gtk-rs/gtk-rs-core" }

View file

@ -224,7 +224,7 @@ unsafe extern "C" fn factory_create_pipeline<T: RTSPMediaFactoryImpl>(
ptr: *mut ffi::GstRTSPMediaFactory,
media: *mut ffi::GstRTSPMedia,
) -> *mut gst::ffi::GstElement {
use once_cell::sync::Lazy;
use glib::once_cell::sync::Lazy;
static PIPELINE_QUARK: Lazy<glib::Quark> =
Lazy::new(|| glib::Quark::from_str("gstreamer-rs-rtsp-media-pipeline"));

View file

@ -19,7 +19,6 @@ rust-version = "1.66"
gst = { package = "gstreamer", path = "../gstreamer", features = ["v1_20"] }
gst_app = { package = "gstreamer-app", path = "../gstreamer-app", features = ["v1_20"] }
gst_video = { package = "gstreamer-video", path = "../gstreamer-video", features = ["v1_20"] }
once_cell = "1"
thiserror = "1"
[dev-dependencies]

View file

@ -4,8 +4,8 @@ use std::{
sync::{atomic, Arc, Mutex},
};
use glib::once_cell::sync::Lazy;
use gst::{glib, prelude::*};
use once_cell::sync::Lazy;
use thiserror::Error;
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {

View file

@ -20,7 +20,6 @@ ffi = { package = "gstreamer-video-sys", path = "sys" }
glib = { git = "https://github.com/gtk-rs/gtk-rs-core" }
gst = { package = "gstreamer", path = "../gstreamer" }
gst-base = { package = "gstreamer-base", path = "../gstreamer-base" }
once_cell = "1.0"
futures-channel = "0.3"
serde = { version = "1.0", optional = true, features = ["derive"] }

View file

@ -1,7 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file.
use glib::once_cell::sync::Lazy;
use gst::CapsFeatures;
use once_cell::sync::Lazy;
#[cfg(feature = "v1_16")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]

View file

@ -2,8 +2,8 @@
use std::str;
use glib::once_cell::sync::Lazy;
use glib::translate::{from_glib, FromGlib, IntoGlib};
use once_cell::sync::Lazy;
#[cfg(feature = "v1_18")]
pub static VIDEO_FORMATS_ALL: Lazy<Box<[crate::VideoFormat]>> = Lazy::new(|| unsafe {

View file

@ -20,7 +20,6 @@ ffi = { package = "gstreamer-sys", path = "sys" }
glib = { git = "https://github.com/gtk-rs/gtk-rs-core" }
num-integer = { version = "0.1", default-features = false, features = [] }
num-rational = { version = "0.4", default-features = false, features = [] }
once_cell = "1.0"
futures-core = "0.3"
futures-channel = "0.3"
futures-util = { version = "0.3", default-features = false }

View file

@ -192,7 +192,7 @@ impl Bus {
F: Fn(&Bus, &Message) -> BusSyncReply + Send + Sync + 'static,
{
#[cfg(not(feature = "v1_18"))]
use once_cell::sync::Lazy;
use glib::once_cell::sync::Lazy;
#[cfg(not(feature = "v1_18"))]
static SET_ONCE_QUARK: Lazy<glib::Quark> =
Lazy::new(|| glib::Quark::from_str("gstreamer-rs-sync-handler"));

View file

@ -9,8 +9,8 @@ use std::{
ptr, str,
};
use glib::once_cell::sync::Lazy;
use glib::{translate::*, IntoGStr, StaticType};
use once_cell::sync::Lazy;
#[doc(alias = "GstCapsFeatures")]
#[repr(transparent)]

View file

@ -2,9 +2,9 @@
use std::{borrow::Cow, ffi::CStr, fmt, ptr};
use glib::once_cell::sync::Lazy;
use glib::{ffi::gpointer, prelude::*, translate::*, IntoGStr, IntoOptionalGStr};
use libc::c_char;
use once_cell::sync::Lazy;
use crate::DebugLevel;

View file

@ -43,7 +43,7 @@ macro_rules! bitflags_serialize_impl {
where
S: serde::Serializer,
{
use once_cell::sync::Lazy;
use glib::once_cell::sync::Lazy;
let mut handled = Self::empty();
let mut res = String::new();

View file

@ -616,7 +616,7 @@ mod tests {
impl ElementImpl for TestElement {
fn metadata() -> Option<&'static ElementMetadata> {
use once_cell::sync::Lazy;
use glib::once_cell::sync::Lazy;
static ELEMENT_METADATA: Lazy<ElementMetadata> = Lazy::new(|| {
ElementMetadata::new(
"Test Element",
@ -630,7 +630,7 @@ mod tests {
}
fn pad_templates() -> &'static [PadTemplate] {
use once_cell::sync::Lazy;
use glib::once_cell::sync::Lazy;
static PAD_TEMPLATES: Lazy<Vec<PadTemplate>> = Lazy::new(|| {
let caps = crate::Caps::new_any();
vec![

View file

@ -4,9 +4,9 @@
use std::{fmt, mem};
use glib::once_cell::sync::Lazy;
use glib::{Date, StaticType, ToValue};
use num_rational::Rational32;
use once_cell::sync::Lazy;
use serde::{
de,
de::{Deserialize, Deserializer, SeqAccess, Visitor},