From f81d7b61b5923eea4247548c1778d1c71d94ed92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 22 Nov 2020 19:21:45 +0200 Subject: [PATCH] video: Update to 2018 edition --- video/cdg/Cargo.toml | 12 ++++---- video/cdg/src/cdgdec/imp.rs | 11 ++++---- video/cdg/src/cdgdec/mod.rs | 2 +- video/cdg/src/cdgparse/imp.rs | 14 ++++++---- video/cdg/src/cdgparse/mod.rs | 2 +- video/cdg/src/lib.rs | 11 +------- video/cdg/tests/cdgdec.rs | 3 -- video/closedcaption/Cargo.toml | 3 +- video/closedcaption/src/ccdetect/imp.rs | 13 +++++---- video/closedcaption/src/ccdetect/mod.rs | 2 +- video/closedcaption/src/cea608overlay/imp.rs | 23 ++++++++-------- video/closedcaption/src/cea608overlay/mod.rs | 2 +- video/closedcaption/src/cea608tott/imp.rs | 13 +++++---- video/closedcaption/src/cea608tott/mod.rs | 2 +- video/closedcaption/src/lib.rs | 13 +-------- video/closedcaption/src/mcc_enc/imp.rs | 13 +++++---- video/closedcaption/src/mcc_enc/mod.rs | 2 +- video/closedcaption/src/mcc_parse/imp.rs | 24 +++++++++------- video/closedcaption/src/mcc_parse/mod.rs | 2 +- video/closedcaption/src/scc_enc/imp.rs | 21 +++++++------- video/closedcaption/src/scc_enc/mod.rs | 2 +- video/closedcaption/src/scc_parse/imp.rs | 21 +++++++------- video/closedcaption/src/scc_parse/mod.rs | 2 +- video/closedcaption/src/tttocea608/imp.rs | 16 +++++++---- video/closedcaption/src/tttocea608/mod.rs | 5 ++-- video/closedcaption/tests/ccdetect.rs | 5 ++-- video/closedcaption/tests/cea608tott.rs | 5 ++-- video/closedcaption/tests/mcc_enc.rs | 5 ++-- video/closedcaption/tests/mcc_parse.rs | 4 +-- video/closedcaption/tests/scc_enc.rs | 3 +- video/closedcaption/tests/scc_parse.rs | 4 +-- video/closedcaption/tests/tttocea608.rs | 3 +- video/dav1d/Cargo.toml | 8 +++--- video/dav1d/src/dav1ddec/imp.rs | 13 +++++---- video/dav1d/src/dav1ddec/mod.rs | 2 +- video/dav1d/src/lib.rs | 12 +------- video/flavors/Cargo.toml | 6 ++-- video/flavors/src/flvdemux/imp.rs | 29 +++++++++++--------- video/flavors/src/flvdemux/mod.rs | 2 +- video/flavors/src/lib.rs | 11 +------- video/gif/Cargo.toml | 8 ++++-- video/gif/examples/testvideosrc2gif.rs | 1 - video/gif/src/gifenc/imp.rs | 3 +- video/gif/src/gifenc/mod.rs | 2 +- video/gif/src/lib.rs | 8 +----- video/gif/tests/gifenc.rs | 7 ----- video/rav1e/Cargo.toml | 10 ++++--- video/rav1e/src/lib.rs | 10 +------ video/rav1e/src/rav1enc/imp.rs | 12 ++++---- video/rav1e/src/rav1enc/mod.rs | 2 +- video/rav1e/tests/rav1enc.rs | 6 ---- video/rspng/Cargo.toml | 4 ++- 52 files changed, 189 insertions(+), 230 deletions(-) diff --git a/video/cdg/Cargo.toml b/video/cdg/Cargo.toml index 604a5b03..e5c73207 100644 --- a/video/cdg/Cargo.toml +++ b/video/cdg/Cargo.toml @@ -9,15 +9,17 @@ edition = "2018" [dependencies] glib = { git = "https://github.com/gtk-rs/gtk-rs" } -gstreamer = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] } -gstreamer-base = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] } -gstreamer-video = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] } -gstreamer-app = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } +gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] } +gst-base = { package = "gstreamer-base", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] } +gst-video = { package = "gstreamer-video", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] } cdg = "0.1" cdg_renderer = "0.6" image = { version = "0.23", default-features = false } muldiv = "1.0" -lazy_static = "1.0" +once_cell = "1.0" + +[dev-dependencies] +gst-app = { package = "gstreamer-app", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } [lib] name = "gstcdg" diff --git a/video/cdg/src/cdgdec/imp.rs b/video/cdg/src/cdgdec/imp.rs index 2a2365d1..da43e502 100644 --- a/video/cdg/src/cdgdec/imp.rs +++ b/video/cdg/src/cdgdec/imp.rs @@ -9,18 +9,19 @@ use glib::subclass; use glib::subclass::prelude::*; use gst::subclass::prelude::*; +use gst::{gst_debug, gst_element_error}; use gst_video::prelude::VideoDecoderExtManual; use gst_video::prelude::*; use gst_video::subclass::prelude::*; use image::GenericImageView; +use once_cell::sync::Lazy; use std::sync::Mutex; use crate::constants::{CDG_HEIGHT, CDG_WIDTH}; -lazy_static! { - static ref CAT: gst::DebugCategory = - gst::DebugCategory::new("cdgdec", gst::DebugColorFlags::empty(), Some("CDG decoder"),); -} +static CAT: Lazy = Lazy::new(|| { + gst::DebugCategory::new("cdgdec", gst::DebugColorFlags::empty(), Some("CDG decoder")) +}); pub struct CdgDec { cdg_inter: Mutex>, @@ -34,7 +35,7 @@ impl ObjectSubclass for CdgDec { type Instance = gst::subclass::ElementInstanceStruct; type Class = subclass::simple::ClassStruct; - glib_object_subclass!(); + glib::glib_object_subclass!(); fn new() -> Self { Self { diff --git a/video/cdg/src/cdgdec/mod.rs b/video/cdg/src/cdgdec/mod.rs index daf17cb4..54ad3ed7 100644 --- a/video/cdg/src/cdgdec/mod.rs +++ b/video/cdg/src/cdgdec/mod.rs @@ -10,7 +10,7 @@ use glib::prelude::*; mod imp; -glib_wrapper! { +glib::glib_wrapper! { pub struct CdgDec(ObjectSubclass) @extends gst_video::VideoDecoder, gst::Element, gst::Object; } diff --git a/video/cdg/src/cdgparse/imp.rs b/video/cdg/src/cdgparse/imp.rs index 7b564a5a..f4928638 100644 --- a/video/cdg/src/cdgparse/imp.rs +++ b/video/cdg/src/cdgparse/imp.rs @@ -8,11 +8,13 @@ use glib::subclass; use glib::subclass::prelude::*; +use gst::format::Bytes; use gst::subclass::prelude::*; use gst::SECOND_VAL; +use gst::{gst_debug, gst_element_error}; use gst_base::prelude::*; use gst_base::subclass::prelude::*; -use gstreamer::format::Bytes; +use once_cell::sync::Lazy; use std::convert::TryInto; use crate::constants::{ @@ -25,13 +27,13 @@ const CDG_CMD_MEMORY_LOAD_COLOR_TABLE_2: u8 = 31; pub struct CdgParse; -lazy_static! { - static ref CAT: gst::DebugCategory = gst::DebugCategory::new( +static CAT: Lazy = Lazy::new(|| { + gst::DebugCategory::new( "cdgparse", gst::DebugColorFlags::empty(), Some("CDG parser"), - ); -} + ) +}); impl ObjectSubclass for CdgParse { const NAME: &'static str = "CdgParse"; @@ -40,7 +42,7 @@ impl ObjectSubclass for CdgParse { type Instance = gst::subclass::ElementInstanceStruct; type Class = subclass::simple::ClassStruct; - glib_object_subclass!(); + glib::glib_object_subclass!(); fn new() -> Self { Self diff --git a/video/cdg/src/cdgparse/mod.rs b/video/cdg/src/cdgparse/mod.rs index 10cac351..b5e594d9 100644 --- a/video/cdg/src/cdgparse/mod.rs +++ b/video/cdg/src/cdgparse/mod.rs @@ -10,7 +10,7 @@ use glib::prelude::*; mod imp; -glib_wrapper! { +glib::glib_wrapper! { pub struct CdgParse(ObjectSubclass) @extends gst_base::BaseParse, gst::Element, gst::Object; } diff --git a/video/cdg/src/lib.rs b/video/cdg/src/lib.rs index c5e5bb51..59b2a510 100644 --- a/video/cdg/src/lib.rs +++ b/video/cdg/src/lib.rs @@ -6,15 +6,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[macro_use] -extern crate glib; -#[macro_use] -extern crate gstreamer as gst; -extern crate gstreamer_base as gst_base; -extern crate gstreamer_video as gst_video; -#[macro_use] -extern crate lazy_static; - mod cdgdec; mod cdgparse; mod constants; @@ -27,7 +18,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { Ok(()) } -gst_plugin_define!( +gst::gst_plugin_define!( cdg, env!("CARGO_PKG_DESCRIPTION"), plugin_init, diff --git a/video/cdg/tests/cdgdec.rs b/video/cdg/tests/cdgdec.rs index c43ffa4f..9dd8b1a2 100644 --- a/video/cdg/tests/cdgdec.rs +++ b/video/cdg/tests/cdgdec.rs @@ -6,9 +6,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern crate gstreamer as gst; -extern crate gstreamer_app as gst_app; - use gst::prelude::*; use std::path::PathBuf; diff --git a/video/closedcaption/Cargo.toml b/video/closedcaption/Cargo.toml index 20ca30a1..edd3dad1 100644 --- a/video/closedcaption/Cargo.toml +++ b/video/closedcaption/Cargo.toml @@ -13,10 +13,9 @@ nom = "6.0" either = "1" uuid = { version = "0.8", features = ["v4"] } chrono = "0.4" -lazy_static = "1.2" +once_cell = "1.0" atomic_refcell = "0.1" cairo-rs = { git = "https://github.com/gtk-rs/gtk-rs", features=["use_glib"] } -cairo-sys-rs = { git = "https://github.com/gtk-rs/gtk-rs" } pango = { git = "https://github.com/gtk-rs/gtk-rs" } pangocairo = { git = "https://github.com/gtk-rs/gtk-rs" } byteorder = "1" diff --git a/video/closedcaption/src/ccdetect/imp.rs b/video/closedcaption/src/ccdetect/imp.rs index 3f38998c..5ac43309 100644 --- a/video/closedcaption/src/ccdetect/imp.rs +++ b/video/closedcaption/src/ccdetect/imp.rs @@ -19,21 +19,24 @@ use glib::subclass; use glib::subclass::prelude::*; use gst::prelude::*; use gst::subclass::prelude::*; +use gst::{gst_element_error, gst_element_warning, gst_loggable_error, gst_trace, gst_warning}; use gst_base::subclass::prelude::*; use byteorder::{BigEndian, ByteOrder}; +use once_cell::sync::Lazy; + use std::fmt; use std::sync::Mutex; use std::u64; -lazy_static! { - static ref CAT: gst::DebugCategory = gst::DebugCategory::new( +static CAT: Lazy = Lazy::new(|| { + gst::DebugCategory::new( "ccdetect", gst::DebugColorFlags::empty(), Some("Closed Caption Detection"), - ); -} + ) +}); const DEFAULT_WINDOW: u64 = 10 * gst::SECOND_VAL; const DEFAULT_CC608: bool = false; @@ -387,7 +390,7 @@ impl ObjectSubclass for CCDetect { type Instance = gst::subclass::ElementInstanceStruct; type Class = subclass::simple::ClassStruct; - glib_object_subclass!(); + glib::glib_object_subclass!(); fn new() -> Self { Self { diff --git a/video/closedcaption/src/ccdetect/mod.rs b/video/closedcaption/src/ccdetect/mod.rs index 11a82b86..681ec6ff 100644 --- a/video/closedcaption/src/ccdetect/mod.rs +++ b/video/closedcaption/src/ccdetect/mod.rs @@ -19,7 +19,7 @@ use glib::prelude::*; mod imp; -glib_wrapper! { +glib::glib_wrapper! { pub struct CCDetect(ObjectSubclass) @extends gst_base::BaseTransform, gst::Element, gst::Object; } diff --git a/video/closedcaption/src/cea608overlay/imp.rs b/video/closedcaption/src/cea608overlay/imp.rs index e55c16c8..61f6a989 100644 --- a/video/closedcaption/src/cea608overlay/imp.rs +++ b/video/closedcaption/src/cea608overlay/imp.rs @@ -19,23 +19,24 @@ use glib::subclass; use glib::subclass::prelude::*; use gst::prelude::*; use gst::subclass::prelude::*; +use gst::{gst_element_error, gst_error, gst_log, gst_trace}; use gst_video::prelude::*; +use once_cell::sync::Lazy; + use std::sync::Mutex; use pango::prelude::*; use crate::caption_frame::{CaptionFrame, Status}; -lazy_static! { - static ref CAT: gst::DebugCategory = { - gst::DebugCategory::new( - "cea608overlay", - gst::DebugColorFlags::empty(), - Some("CEA 608 overlay element"), - ) - }; -} +static CAT: Lazy = Lazy::new(|| { + gst::DebugCategory::new( + "cea608overlay", + gst::DebugColorFlags::empty(), + Some("CEA 608 overlay element"), + ) +}); struct State { video_info: Option, @@ -209,7 +210,7 @@ impl Cea608Overlay { // anymore mutably. unsafe { assert_eq!( - cairo_sys::cairo_surface_get_reference_count(surface.to_raw_none()), + cairo::ffi::cairo_surface_get_reference_count(surface.to_raw_none()), 1 ); let buffer = glib::translate::from_glib_none(buffer_ptr); @@ -391,7 +392,7 @@ impl ObjectSubclass for Cea608Overlay { type Instance = gst::subclass::ElementInstanceStruct; type Class = subclass::simple::ClassStruct; - glib_object_subclass!(); + glib::glib_object_subclass!(); fn with_class(klass: &Self::Class) -> Self { let templ = klass.get_pad_template("sink").unwrap(); diff --git a/video/closedcaption/src/cea608overlay/mod.rs b/video/closedcaption/src/cea608overlay/mod.rs index 54669bf3..ca84bdd4 100644 --- a/video/closedcaption/src/cea608overlay/mod.rs +++ b/video/closedcaption/src/cea608overlay/mod.rs @@ -25,7 +25,7 @@ use glib::prelude::*; mod imp; -glib_wrapper! { +glib::glib_wrapper! { pub struct Cea608Overlay(ObjectSubclass) @extends gst::Element, gst::Object; } diff --git a/video/closedcaption/src/cea608tott/imp.rs b/video/closedcaption/src/cea608tott/imp.rs index 6dbc36ac..68aee6c0 100644 --- a/video/closedcaption/src/cea608tott/imp.rs +++ b/video/closedcaption/src/cea608tott/imp.rs @@ -10,10 +10,13 @@ use glib::subclass; use glib::subclass::prelude::*; use gst::prelude::*; use gst::subclass::prelude::*; +use gst::{gst_debug, gst_error, gst_log, gst_trace}; use crate::caption_frame::{CaptionFrame, Status}; use atomic_refcell::AtomicRefCell; +use once_cell::sync::Lazy; + #[derive(Copy, Clone, Debug)] enum Format { Srt, @@ -48,13 +51,13 @@ pub struct Cea608ToTt { state: AtomicRefCell, } -lazy_static! { - static ref CAT: gst::DebugCategory = gst::DebugCategory::new( +static CAT: Lazy = Lazy::new(|| { + gst::DebugCategory::new( "cea608tott", gst::DebugColorFlags::empty(), Some("CEA-608 to TT Element"), - ); -} + ) +}); impl Cea608ToTt { fn sink_chain( @@ -375,7 +378,7 @@ impl ObjectSubclass for Cea608ToTt { type Instance = gst::subclass::ElementInstanceStruct; type Class = subclass::simple::ClassStruct; - glib_object_subclass!(); + glib::glib_object_subclass!(); fn with_class(klass: &Self::Class) -> Self { let templ = klass.get_pad_template("sink").unwrap(); diff --git a/video/closedcaption/src/cea608tott/mod.rs b/video/closedcaption/src/cea608tott/mod.rs index 51b23dc8..8690033f 100644 --- a/video/closedcaption/src/cea608tott/mod.rs +++ b/video/closedcaption/src/cea608tott/mod.rs @@ -10,7 +10,7 @@ use glib::prelude::*; mod imp; -glib_wrapper! { +glib::glib_wrapper! { pub struct Cea608ToTt(ObjectSubclass) @extends gst::Element, gst::Object; } diff --git a/video/closedcaption/src/lib.rs b/video/closedcaption/src/lib.rs index e372d659..3c6f971c 100644 --- a/video/closedcaption/src/lib.rs +++ b/video/closedcaption/src/lib.rs @@ -17,17 +17,6 @@ #![recursion_limit = "128"] -#[macro_use] -extern crate glib; -#[macro_use] -extern crate gst; -#[macro_use] -extern crate lazy_static; - -#[cfg(test)] -#[macro_use] -extern crate pretty_assertions; - #[allow(non_camel_case_types, non_upper_case_globals, unused)] #[allow(clippy::redundant_static_lifetimes, clippy::unreadable_literal)] #[allow(clippy::useless_transmute, clippy::trivially_copy_pass_by_ref)] @@ -57,7 +46,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { Ok(()) } -gst_plugin_define!( +gst::gst_plugin_define!( rsclosedcaption, env!("CARGO_PKG_DESCRIPTION"), plugin_init, diff --git a/video/closedcaption/src/mcc_enc/imp.rs b/video/closedcaption/src/mcc_enc/imp.rs index 243a0796..786d52c0 100644 --- a/video/closedcaption/src/mcc_enc/imp.rs +++ b/video/closedcaption/src/mcc_enc/imp.rs @@ -21,10 +21,13 @@ use glib::subclass::prelude::*; use gst::prelude::*; use gst::structure; use gst::subclass::prelude::*; +use gst::{gst_element_error, gst_error, gst_log, gst_trace}; use chrono::prelude::*; use uuid::Uuid; +use once_cell::sync::Lazy; + use std::io::Write; use std::sync::Mutex; @@ -94,13 +97,13 @@ pub struct MccEnc { settings: Mutex, } -lazy_static! { - static ref CAT: gst::DebugCategory = gst::DebugCategory::new( +static CAT: Lazy = Lazy::new(|| { + gst::DebugCategory::new( "mccenc", gst::DebugColorFlags::empty(), Some("Mcc Encoder Element"), - ); -} + ) +}); impl MccEnc { #[allow(clippy::write_with_newline)] @@ -470,7 +473,7 @@ impl ObjectSubclass for MccEnc { type Instance = gst::subclass::ElementInstanceStruct; type Class = subclass::simple::ClassStruct; - glib_object_subclass!(); + glib::glib_object_subclass!(); fn with_class(klass: &Self::Class) -> Self { let templ = klass.get_pad_template("sink").unwrap(); diff --git a/video/closedcaption/src/mcc_enc/mod.rs b/video/closedcaption/src/mcc_enc/mod.rs index f3c1f0d3..6bb606ea 100644 --- a/video/closedcaption/src/mcc_enc/mod.rs +++ b/video/closedcaption/src/mcc_enc/mod.rs @@ -20,7 +20,7 @@ use glib::prelude::*; mod headers; mod imp; -glib_wrapper! { +glib::glib_wrapper! { pub struct MccEnc(ObjectSubclass) @extends gst::Element, gst::Object; } diff --git a/video/closedcaption/src/mcc_parse/imp.rs b/video/closedcaption/src/mcc_parse/imp.rs index 953b70f3..945461e8 100644 --- a/video/closedcaption/src/mcc_parse/imp.rs +++ b/video/closedcaption/src/mcc_parse/imp.rs @@ -20,25 +20,29 @@ use glib::subclass; use glib::subclass::prelude::*; use gst::prelude::*; use gst::subclass::prelude::*; +use gst::{ + gst_debug, gst_element_error, gst_error, gst_fixme, gst_info, gst_log, gst_loggable_error, + gst_trace, gst_warning, +}; use gst_video::ValidVideoTimeCode; use std::cmp; use std::convert::TryInto; use std::sync::{Mutex, MutexGuard}; +use once_cell::sync::Lazy; + use super::parser::{MccLine, MccParser}; use crate::line_reader::LineReader; use crate::parser_utils::TimeCode; -lazy_static! { - static ref CAT: gst::DebugCategory = { - gst::DebugCategory::new( - "mccparse", - gst::DebugColorFlags::empty(), - Some("Mcc Parser Element"), - ) - }; -} +static CAT: Lazy = Lazy::new(|| { + gst::DebugCategory::new( + "mccparse", + gst::DebugColorFlags::empty(), + Some("Mcc Parser Element"), + ) +}); #[derive(Clone, Copy, Debug, PartialEq, Eq)] enum Format { @@ -1133,7 +1137,7 @@ impl ObjectSubclass for MccParse { type Instance = gst::subclass::ElementInstanceStruct; type Class = subclass::simple::ClassStruct; - glib_object_subclass!(); + glib::glib_object_subclass!(); fn with_class(klass: &Self::Class) -> Self { let templ = klass.get_pad_template("sink").unwrap(); diff --git a/video/closedcaption/src/mcc_parse/mod.rs b/video/closedcaption/src/mcc_parse/mod.rs index d3ee283e..7bf4d45b 100644 --- a/video/closedcaption/src/mcc_parse/mod.rs +++ b/video/closedcaption/src/mcc_parse/mod.rs @@ -20,7 +20,7 @@ use glib::prelude::*; mod imp; mod parser; -glib_wrapper! { +glib::glib_wrapper! { pub struct MccParse(ObjectSubclass) @extends gst::Element, gst::Object; } diff --git a/video/closedcaption/src/scc_enc/imp.rs b/video/closedcaption/src/scc_enc/imp.rs index c9c47393..20c86c9b 100644 --- a/video/closedcaption/src/scc_enc/imp.rs +++ b/video/closedcaption/src/scc_enc/imp.rs @@ -21,20 +21,21 @@ use glib::subclass::prelude::*; use gst::prelude::*; use gst::structure; use gst::subclass::prelude::*; +use gst::{gst_element_error, gst_error, gst_log, gst_trace}; use gst_video::{self, ValidVideoTimeCode}; +use once_cell::sync::Lazy; + use std::io::Write; use std::sync::Mutex; -lazy_static! { - static ref CAT: gst::DebugCategory = { - gst::DebugCategory::new( - "sccenc", - gst::DebugColorFlags::empty(), - Some("Scc Encoder Element"), - ) - }; -} +static CAT: Lazy = Lazy::new(|| { + gst::DebugCategory::new( + "sccenc", + gst::DebugColorFlags::empty(), + Some("Scc Encoder Element"), + ) +}); #[derive(Debug)] struct State { @@ -339,7 +340,7 @@ impl ObjectSubclass for SccEnc { type Instance = gst::subclass::ElementInstanceStruct; type Class = subclass::simple::ClassStruct; - glib_object_subclass!(); + glib::glib_object_subclass!(); fn with_class(klass: &Self::Class) -> Self { let templ = klass.get_pad_template("sink").unwrap(); diff --git a/video/closedcaption/src/scc_enc/mod.rs b/video/closedcaption/src/scc_enc/mod.rs index 46998d75..ac215456 100644 --- a/video/closedcaption/src/scc_enc/mod.rs +++ b/video/closedcaption/src/scc_enc/mod.rs @@ -20,7 +20,7 @@ use glib::prelude::*; mod imp; -glib_wrapper! { +glib::glib_wrapper! { pub struct SccEnc(ObjectSubclass) @extends gst::Element, gst::Object; } diff --git a/video/closedcaption/src/scc_parse/imp.rs b/video/closedcaption/src/scc_parse/imp.rs index 22a2b477..a7835dd7 100644 --- a/video/closedcaption/src/scc_parse/imp.rs +++ b/video/closedcaption/src/scc_parse/imp.rs @@ -20,22 +20,23 @@ use glib::subclass; use glib::subclass::prelude::*; use gst::prelude::*; use gst::subclass::prelude::*; +use gst::{gst_debug, gst_element_error, gst_error, gst_fixme, gst_log, gst_trace, gst_warning}; use std::sync::{Mutex, MutexGuard}; +use once_cell::sync::Lazy; + use super::parser::{SccLine, SccParser}; use crate::line_reader::LineReader; use crate::parser_utils::TimeCode; -lazy_static! { - static ref CAT: gst::DebugCategory = { - gst::DebugCategory::new( - "sccparse", - gst::DebugColorFlags::empty(), - Some("Scc Parser Element"), - ) - }; -} +static CAT: Lazy = Lazy::new(|| { + gst::DebugCategory::new( + "sccparse", + gst::DebugColorFlags::empty(), + Some("Scc Parser Element"), + ) +}); #[derive(Debug)] struct State { @@ -430,7 +431,7 @@ impl ObjectSubclass for SccParse { type Instance = gst::subclass::ElementInstanceStruct; type Class = subclass::simple::ClassStruct; - glib_object_subclass!(); + glib::glib_object_subclass!(); fn with_class(klass: &Self::Class) -> Self { let templ = klass.get_pad_template("sink").unwrap(); diff --git a/video/closedcaption/src/scc_parse/mod.rs b/video/closedcaption/src/scc_parse/mod.rs index 19cf93f8..05067d6e 100644 --- a/video/closedcaption/src/scc_parse/mod.rs +++ b/video/closedcaption/src/scc_parse/mod.rs @@ -21,7 +21,7 @@ use glib::prelude::*; mod imp; mod parser; -glib_wrapper! { +glib::glib_wrapper! { pub struct SccParse(ObjectSubclass) @extends gst::Element, gst::Object; } diff --git a/video/closedcaption/src/tttocea608/imp.rs b/video/closedcaption/src/tttocea608/imp.rs index 8b2bbc14..e99e2c0e 100644 --- a/video/closedcaption/src/tttocea608/imp.rs +++ b/video/closedcaption/src/tttocea608/imp.rs @@ -20,6 +20,9 @@ use glib::subclass; use glib::subclass::prelude::*; use gst::prelude::*; use gst::subclass::prelude::*; +use gst::{gst_debug, gst_element_error, gst_error, gst_log, gst_trace, gst_warning}; + +use once_cell::sync::Lazy; use crate::ffi; use std::sync::Mutex; @@ -263,14 +266,15 @@ pub struct TtToCea608 { settings: Mutex, } -lazy_static! { - static ref CAT: gst::DebugCategory = gst::DebugCategory::new( +static CAT: Lazy = Lazy::new(|| { + gst::DebugCategory::new( "tttocea608", gst::DebugColorFlags::empty(), Some("TT CEA 608 Element"), - ); - static ref SPACE: u16 = eia608_from_utf8_1(&[0x20, 0, 0, 0, 0]); -} + ) +}); + +static SPACE: Lazy = Lazy::new(|| eia608_from_utf8_1(&[0x20, 0, 0, 0, 0])); impl TtToCea608 { fn push_gap(&self, last_frame_no: u64, new_frame_no: u64) { @@ -786,7 +790,7 @@ impl ObjectSubclass for TtToCea608 { type Instance = gst::subclass::ElementInstanceStruct; type Class = subclass::simple::ClassStruct; - glib_object_subclass!(); + glib::glib_object_subclass!(); fn with_class(klass: &Self::Class) -> Self { let templ = klass.get_pad_template("sink").unwrap(); diff --git a/video/closedcaption/src/tttocea608/mod.rs b/video/closedcaption/src/tttocea608/mod.rs index 790e7151..e9004fea 100644 --- a/video/closedcaption/src/tttocea608/mod.rs +++ b/video/closedcaption/src/tttocea608/mod.rs @@ -16,11 +16,10 @@ // Boston, MA 02110-1335, USA. use glib::prelude::*; -use glib::GEnum; mod imp; -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, GEnum)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, glib::GEnum)] #[repr(u32)] #[genum(type_name = "GstTtToCea608Mode")] enum Mode { @@ -30,7 +29,7 @@ enum Mode { RollUp4, } -glib_wrapper! { +glib::glib_wrapper! { pub struct TtToCea608(ObjectSubclass) @extends gst::Element, gst::Object; } diff --git a/video/closedcaption/tests/ccdetect.rs b/video/closedcaption/tests/ccdetect.rs index 0123a4dd..97c215c4 100644 --- a/video/closedcaption/tests/ccdetect.rs +++ b/video/closedcaption/tests/ccdetect.rs @@ -15,13 +15,12 @@ // Free Software Foundation, Inc., 51 Franklin Street, Suite 500, // Boston, MA 02110-1335, USA. -#[macro_use] -extern crate pretty_assertions; - use gst::prelude::*; use std::sync::{Arc, Mutex}; +use pretty_assertions::assert_eq; + fn init() { use std::sync::Once; static INIT: Once = Once::new(); diff --git a/video/closedcaption/tests/cea608tott.rs b/video/closedcaption/tests/cea608tott.rs index 4489d6ac..dc891666 100644 --- a/video/closedcaption/tests/cea608tott.rs +++ b/video/closedcaption/tests/cea608tott.rs @@ -15,11 +15,10 @@ // Free Software Foundation, Inc., 51 Franklin Street, Suite 500, // Boston, MA 02110-1335, USA. -#[macro_use] -extern crate pretty_assertions; - use gst::prelude::*; +use pretty_assertions::assert_eq; + fn init() { use std::sync::Once; static INIT: Once = Once::new(); diff --git a/video/closedcaption/tests/mcc_enc.rs b/video/closedcaption/tests/mcc_enc.rs index 1fbfe89f..e0e4d407 100644 --- a/video/closedcaption/tests/mcc_enc.rs +++ b/video/closedcaption/tests/mcc_enc.rs @@ -15,11 +15,10 @@ // Free Software Foundation, Inc., 51 Franklin Street, Suite 500, // Boston, MA 02110-1335, USA. -#[macro_use] -extern crate pretty_assertions; - use glib::prelude::*; +use pretty_assertions::assert_eq; + fn init() { use std::sync::Once; static INIT: Once = Once::new(); diff --git a/video/closedcaption/tests/mcc_parse.rs b/video/closedcaption/tests/mcc_parse.rs index 0ad06ee9..81cad922 100644 --- a/video/closedcaption/tests/mcc_parse.rs +++ b/video/closedcaption/tests/mcc_parse.rs @@ -15,11 +15,9 @@ // Free Software Foundation, Inc., 51 Franklin Street, Suite 500, // Boston, MA 02110-1335, USA. -#[macro_use] -extern crate pretty_assertions; - use gst::prelude::*; use gst::EventView; +use pretty_assertions::assert_eq; use rand::{Rng, SeedableRng}; use std::path::PathBuf; diff --git a/video/closedcaption/tests/scc_enc.rs b/video/closedcaption/tests/scc_enc.rs index 2115156c..e5d00c90 100644 --- a/video/closedcaption/tests/scc_enc.rs +++ b/video/closedcaption/tests/scc_enc.rs @@ -16,8 +16,7 @@ // Free Software Foundation, Inc., 51 Franklin Street, Suite 500, // Boston, MA 02110-1335, USA. -#[macro_use] -extern crate pretty_assertions; +use pretty_assertions::assert_eq; fn init() { use std::sync::Once; diff --git a/video/closedcaption/tests/scc_parse.rs b/video/closedcaption/tests/scc_parse.rs index cbabccdb..3e0a449f 100644 --- a/video/closedcaption/tests/scc_parse.rs +++ b/video/closedcaption/tests/scc_parse.rs @@ -16,11 +16,9 @@ // Free Software Foundation, Inc., 51 Franklin Street, Suite 500, // Boston, MA 02110-1335, USA. -#[macro_use] -extern crate pretty_assertions; - use gst::prelude::*; use gst_video::{ValidVideoTimeCode, VideoTimeCode}; +use pretty_assertions::assert_eq; use rand::{Rng, SeedableRng}; use std::collections::VecDeque; diff --git a/video/closedcaption/tests/tttocea608.rs b/video/closedcaption/tests/tttocea608.rs index 8153a246..24d91e96 100644 --- a/video/closedcaption/tests/tttocea608.rs +++ b/video/closedcaption/tests/tttocea608.rs @@ -15,9 +15,8 @@ // Free Software Foundation, Inc., 51 Franklin Street, Suite 500, // Boston, MA 02110-1335, USA. -#[macro_use] -extern crate pretty_assertions; use gst::EventView; +use pretty_assertions::assert_eq; fn init() { use std::sync::Once; diff --git a/video/dav1d/Cargo.toml b/video/dav1d/Cargo.toml index df6582ab..476fab14 100644 --- a/video/dav1d/Cargo.toml +++ b/video/dav1d/Cargo.toml @@ -10,10 +10,10 @@ description = "Dav1d Plugin" [dependencies] dav1d = "0.5" glib = { git = "https://github.com/gtk-rs/gtk-rs" } -gstreamer = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } -gstreamer-base = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } -gstreamer-video = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] } -lazy_static = "1.0" +gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } +gst-base = { package = "gstreamer-base", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } +gst-video = { package = "gstreamer-video", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] } +once_cell = "1.0" [lib] name = "gstrsdav1d" diff --git a/video/dav1d/src/dav1ddec/imp.rs b/video/dav1d/src/dav1ddec/imp.rs index 3e4983be..0e43ab2f 100644 --- a/video/dav1d/src/dav1ddec/imp.rs +++ b/video/dav1d/src/dav1ddec/imp.rs @@ -10,9 +10,12 @@ use glib::subclass; use glib::subclass::prelude::*; use gst::prelude::*; use gst::subclass::prelude::*; +use gst::{gst_debug, gst_error, gst_info, gst_trace, gst_warning}; use gst_video::prelude::*; use gst_video::subclass::prelude::*; +use once_cell::sync::Lazy; + use std::convert::TryInto; use std::i32; use std::str::FromStr; @@ -30,13 +33,13 @@ pub struct Dav1dDec { negotiation_infos: Mutex, } -lazy_static! { - static ref CAT: gst::DebugCategory = gst::DebugCategory::new( +static CAT: Lazy = Lazy::new(|| { + gst::DebugCategory::new( "dav1ddec", gst::DebugColorFlags::empty(), Some("Dav1d AV1 decoder"), - ); -} + ) +}); impl Dav1dDec { pub fn gst_video_format_from_dav1d_picture( @@ -349,7 +352,7 @@ impl ObjectSubclass for Dav1dDec { type Instance = gst::subclass::ElementInstanceStruct; type Class = subclass::simple::ClassStruct; - glib_object_subclass!(); + glib::glib_object_subclass!(); fn new() -> Self { Self { diff --git a/video/dav1d/src/dav1ddec/mod.rs b/video/dav1d/src/dav1ddec/mod.rs index 276fd089..2576c237 100644 --- a/video/dav1d/src/dav1ddec/mod.rs +++ b/video/dav1d/src/dav1ddec/mod.rs @@ -10,7 +10,7 @@ use glib::prelude::*; mod imp; -glib_wrapper! { +glib::glib_wrapper! { pub struct Dav1dDec(ObjectSubclass) @extends gst_video::VideoDecoder, gst::Element, gst::Object; } diff --git a/video/dav1d/src/lib.rs b/video/dav1d/src/lib.rs index 2567134b..3f7b9c89 100644 --- a/video/dav1d/src/lib.rs +++ b/video/dav1d/src/lib.rs @@ -6,16 +6,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[macro_use] -extern crate glib; -#[macro_use] -extern crate gstreamer as gst; -extern crate dav1d; -extern crate gstreamer_base as gst_base; -extern crate gstreamer_video as gst_video; -#[macro_use] -extern crate lazy_static; - mod dav1ddec; fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { @@ -23,7 +13,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { Ok(()) } -gst_plugin_define!( +gst::gst_plugin_define!( rsdav1d, env!("CARGO_PKG_DESCRIPTION"), plugin_init, diff --git a/video/flavors/Cargo.toml b/video/flavors/Cargo.toml index bb5573ce..aa2c6ddb 100644 --- a/video/flavors/Cargo.toml +++ b/video/flavors/Cargo.toml @@ -9,14 +9,14 @@ description = "Rust FLV Plugin" [dependencies] glib = { git = "https://github.com/gtk-rs/gtk-rs" } -gstreamer = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } -gstreamer-base = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } +gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } +gst-base = { package = "gstreamer-base", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } num-rational = { version = "0.3", default-features = false, features = [] } nom = "6" flavors = { git = "https://github.com/rust-av/flavors" } muldiv = "1.0" byteorder = "1.0" -lazy_static = "1.0" +once_cell = "1.0" smallvec = "1.0" [lib] diff --git a/video/flavors/src/flvdemux/imp.rs b/video/flavors/src/flvdemux/imp.rs index a4e54117..a907440f 100644 --- a/video/flavors/src/flvdemux/imp.rs +++ b/video/flavors/src/flvdemux/imp.rs @@ -16,20 +16,23 @@ use ::flavors::parser as flavors; use glib::subclass; use gst::prelude::*; use gst::subclass::prelude::*; +use gst::{ + gst_debug, gst_error, gst_error_msg, gst_log, gst_loggable_error, gst_trace, gst_warning, +}; use num_rational::Rational32; +use once_cell::sync::Lazy; + use smallvec::SmallVec; -lazy_static! { - static ref CAT: gst::DebugCategory = { - gst::DebugCategory::new( - "rsflvdemux", - gst::DebugColorFlags::empty(), - Some("Rust FLV demuxer"), - ) - }; -} +static CAT: Lazy = Lazy::new(|| { + gst::DebugCategory::new( + "rsflvdemux", + gst::DebugColorFlags::empty(), + Some("Rust FLV demuxer"), + ) +}); pub struct FlvDemux { sinkpad: gst::Pad, @@ -126,7 +129,7 @@ impl ObjectSubclass for FlvDemux { type Instance = gst::subclass::ElementInstanceStruct; type Class = subclass::simple::ClassStruct; - glib_object_subclass!(); + glib::glib_object_subclass!(); fn with_class(klass: &Self::Class) -> Self { let templ = klass.get_pad_template("sink").unwrap(); @@ -374,7 +377,7 @@ impl FlvDemux { } fn sink_event(&self, pad: &gst::Pad, element: &super::FlvDemux, event: gst::Event) -> bool { - use crate::gst::EventView; + use gst::EventView; gst_log!(CAT, obj: pad, "Handling event {:?}", event); match event.view() { @@ -404,7 +407,7 @@ impl FlvDemux { element: &super::FlvDemux, query: &mut gst::QueryRef, ) -> bool { - use crate::gst::QueryView; + use gst::QueryView; match query.view_mut() { QueryView::Position(ref mut q) => { @@ -452,7 +455,7 @@ impl FlvDemux { } fn src_event(&self, pad: &gst::Pad, element: &super::FlvDemux, event: gst::Event) -> bool { - use crate::gst::EventView; + use gst::EventView; match event.view() { EventView::Seek(..) => { diff --git a/video/flavors/src/flvdemux/mod.rs b/video/flavors/src/flvdemux/mod.rs index aca2b41a..dc1e341d 100644 --- a/video/flavors/src/flvdemux/mod.rs +++ b/video/flavors/src/flvdemux/mod.rs @@ -10,7 +10,7 @@ use glib::prelude::*; mod imp; -glib_wrapper! { +glib::glib_wrapper! { pub struct FlvDemux(ObjectSubclass) @extends gst::Element, gst::Object; } diff --git a/video/flavors/src/lib.rs b/video/flavors/src/lib.rs index 479716ed..af01fcee 100644 --- a/video/flavors/src/lib.rs +++ b/video/flavors/src/lib.rs @@ -6,15 +6,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[macro_use] -extern crate glib; -#[macro_use] -extern crate gstreamer as gst; -extern crate gstreamer_base as gst_base; - -#[macro_use] -extern crate lazy_static; - mod bytes; mod flvdemux; @@ -22,7 +13,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { flvdemux::register(plugin) } -gst_plugin_define!( +gst::gst_plugin_define!( rsflv, env!("CARGO_PKG_DESCRIPTION"), plugin_init, diff --git a/video/gif/Cargo.toml b/video/gif/Cargo.toml index 07995281..f25283fe 100644 --- a/video/gif/Cargo.toml +++ b/video/gif/Cargo.toml @@ -9,13 +9,15 @@ description = "GStreamer GIF plugin" [dependencies] glib = { git = "https://github.com/gtk-rs/gtk-rs" } -gstreamer = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } -gstreamer-video = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } -gstreamer-check = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } +gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } +gst-video = { package = "gstreamer-video", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } gif = "0.11" atomic_refcell = "0.1" once_cell = "1" +[dev-dependencies] +gst-check = { package = "gstreamer-check", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } + [lib] name = "gstgif" crate-type = ["cdylib", "rlib", "staticlib"] diff --git a/video/gif/examples/testvideosrc2gif.rs b/video/gif/examples/testvideosrc2gif.rs index 51083144..7f4ef530 100644 --- a/video/gif/examples/testvideosrc2gif.rs +++ b/video/gif/examples/testvideosrc2gif.rs @@ -15,7 +15,6 @@ // Free Software Foundation, Inc., 51 Franklin Street, Suite 500, // Boston, MA 02110-1335, USA. -extern crate gstreamer as gst; use gst::prelude::*; const ENCODE_PIPELINE: &str = "videotestsrc is-live=false num-buffers=100 ! videoconvert ! gifenc ! filesink location=test.gif"; diff --git a/video/gif/src/gifenc/imp.rs b/video/gif/src/gifenc/imp.rs index 962d1156..e6b4598e 100644 --- a/video/gif/src/gifenc/imp.rs +++ b/video/gif/src/gifenc/imp.rs @@ -10,6 +10,7 @@ use atomic_refcell::AtomicRefCell; use glib::subclass; use glib::subclass::prelude::*; use gst::subclass::prelude::*; +use gst::{gst_debug, gst_element_error, gst_loggable_error}; use gst_video::prelude::*; use gst_video::subclass::prelude::*; use once_cell::sync::Lazy; @@ -148,7 +149,7 @@ impl ObjectSubclass for GifEnc { type Instance = gst::subclass::ElementInstanceStruct; type Class = subclass::simple::ClassStruct; - glib_object_subclass!(); + glib::glib_object_subclass!(); fn new() -> Self { Self { diff --git a/video/gif/src/gifenc/mod.rs b/video/gif/src/gifenc/mod.rs index 40543d41..e53d2b1c 100644 --- a/video/gif/src/gifenc/mod.rs +++ b/video/gif/src/gifenc/mod.rs @@ -10,7 +10,7 @@ use glib::prelude::*; mod imp; -glib_wrapper! { +glib::glib_wrapper! { pub struct GifEnc(ObjectSubclass) @extends gst_video::VideoEncoder, gst::Element, gst::Object; } diff --git a/video/gif/src/lib.rs b/video/gif/src/lib.rs index 7b14fbd0..7e090338 100644 --- a/video/gif/src/lib.rs +++ b/video/gif/src/lib.rs @@ -6,19 +6,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[macro_use] -extern crate glib; -#[macro_use] -extern crate gstreamer as gst; -extern crate gstreamer_video as gst_video; - mod gifenc; fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gifenc::register(plugin) } -gst_plugin_define!( +gst::gst_plugin_define!( gifenc, env!("CARGO_PKG_DESCRIPTION"), plugin_init, diff --git a/video/gif/tests/gifenc.rs b/video/gif/tests/gifenc.rs index 11a6975d..65d4d170 100644 --- a/video/gif/tests/gifenc.rs +++ b/video/gif/tests/gifenc.rs @@ -6,13 +6,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern crate glib; -extern crate gstreamer as gst; -extern crate gstreamer_check as gst_check; -extern crate gstreamer_video as gst_video; - -extern crate gstgif; - fn init() { use std::sync::Once; static INIT: Once = Once::new(); diff --git a/video/rav1e/Cargo.toml b/video/rav1e/Cargo.toml index 5ed1db60..8e0d2f30 100644 --- a/video/rav1e/Cargo.toml +++ b/video/rav1e/Cargo.toml @@ -9,12 +9,14 @@ edition = "2018" [dependencies] glib = { git = "https://github.com/gtk-rs/gtk-rs" } -gstreamer = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } -gstreamer-video = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] } -gstreamer-check = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } +gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } +gst-video = { package = "gstreamer-video", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] } rav1e = { version = "0.3", default-features = false } atomic_refcell = "0.1" -lazy_static = "1.0" +once_cell = "1.0" + +[dev-dependencies] +gst-check = { package = "gstreamer-check", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } [lib] name = "gstrav1e" diff --git a/video/rav1e/src/lib.rs b/video/rav1e/src/lib.rs index 452ee2f2..0dcb12f3 100644 --- a/video/rav1e/src/lib.rs +++ b/video/rav1e/src/lib.rs @@ -6,21 +6,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[macro_use] -extern crate glib; -#[macro_use] -extern crate gstreamer as gst; -extern crate gstreamer_video as gst_video; -#[macro_use] -extern crate lazy_static; - mod rav1enc; fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { rav1enc::register(plugin) } -gst_plugin_define!( +gst::gst_plugin_define!( rav1e, env!("CARGO_PKG_DESCRIPTION"), plugin_init, diff --git a/video/rav1e/src/rav1enc/imp.rs b/video/rav1e/src/rav1enc/imp.rs index 0a46eacb..f28bd99e 100644 --- a/video/rav1e/src/rav1enc/imp.rs +++ b/video/rav1e/src/rav1enc/imp.rs @@ -10,8 +10,10 @@ use atomic_refcell::AtomicRefCell; use glib::subclass; use glib::subclass::prelude::*; use gst::subclass::prelude::*; +use gst::{gst_debug, gst_element_error, gst_loggable_error}; use gst_video::prelude::*; use gst_video::subclass::prelude::*; +use once_cell::sync::Lazy; use rav1e::color; use rav1e::config; use rav1e::data; @@ -286,13 +288,13 @@ pub struct Rav1Enc { settings: Mutex, } -lazy_static! { - static ref CAT: gst::DebugCategory = gst::DebugCategory::new( +static CAT: Lazy = Lazy::new(|| { + gst::DebugCategory::new( "rav1enc", gst::DebugColorFlags::empty(), Some("rav1e AV1 encoder"), - ); -} + ) +}); impl ObjectSubclass for Rav1Enc { const NAME: &'static str = "Rav1Enc"; @@ -301,7 +303,7 @@ impl ObjectSubclass for Rav1Enc { type Instance = gst::subclass::ElementInstanceStruct; type Class = subclass::simple::ClassStruct; - glib_object_subclass!(); + glib::glib_object_subclass!(); fn new() -> Self { Self { diff --git a/video/rav1e/src/rav1enc/mod.rs b/video/rav1e/src/rav1enc/mod.rs index b953bf9f..a4cc4089 100644 --- a/video/rav1e/src/rav1enc/mod.rs +++ b/video/rav1e/src/rav1enc/mod.rs @@ -10,7 +10,7 @@ use glib::prelude::*; mod imp; -glib_wrapper! { +glib::glib_wrapper! { pub struct Rav1Enc(ObjectSubclass) @extends gst_video::VideoEncoder, gst::Element, gst::Object; } diff --git a/video/rav1e/tests/rav1enc.rs b/video/rav1e/tests/rav1enc.rs index ec259143..40e456ad 100644 --- a/video/rav1e/tests/rav1enc.rs +++ b/video/rav1e/tests/rav1enc.rs @@ -6,13 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern crate glib; use glib::prelude::*; -extern crate gstreamer as gst; -extern crate gstreamer_check as gst_check; -extern crate gstreamer_video as gst_video; - -extern crate gstrav1e; fn init() { use std::sync::Once; diff --git a/video/rspng/Cargo.toml b/video/rspng/Cargo.toml index b7d52446..87a7c405 100644 --- a/video/rspng/Cargo.toml +++ b/video/rspng/Cargo.toml @@ -11,12 +11,14 @@ description = "An PNG encoder/decoder written in pure Rust" glib = { git = "https://github.com/gtk-rs/gtk-rs" } gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } gst_video = { package = "gstreamer-video", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } -gst_check = { package = "gstreamer-check", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } png = "0.16.3" once_cell = "1" parking_lot = "0.11" atomic_refcell = "0.1" +[dev-dependencies] +gst_check = { package = "gstreamer-check", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } + [lib] name = "gstrspng" crate-type = ["cdylib", "rlib", "staticlib"]