diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2020-11-22 20:21:45 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2020-11-23 11:28:35 +0300 |
commit | f81d7b61b5923eea4247548c1778d1c71d94ed92 (patch) | |
tree | 16ba3459d302dff6435db34f5effbafe94568d20 /video/cdg | |
parent | 767ed3afaeab3a88255e6718c4ed008539438c41 (diff) |
video: Update to 2018 edition
Diffstat (limited to 'video/cdg')
-rw-r--r-- | video/cdg/Cargo.toml | 12 | ||||
-rw-r--r-- | video/cdg/src/cdgdec/imp.rs | 11 | ||||
-rw-r--r-- | video/cdg/src/cdgdec/mod.rs | 2 | ||||
-rw-r--r-- | video/cdg/src/cdgparse/imp.rs | 14 | ||||
-rw-r--r-- | video/cdg/src/cdgparse/mod.rs | 2 | ||||
-rw-r--r-- | video/cdg/src/lib.rs | 11 | ||||
-rw-r--r-- | video/cdg/tests/cdgdec.rs | 3 |
7 files changed, 24 insertions, 31 deletions
diff --git a/video/cdg/Cargo.toml b/video/cdg/Cargo.toml index 604a5b03f..e5c73207c 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 2a2365d1c..da43e502a 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<gst::DebugCategory> = Lazy::new(|| { + gst::DebugCategory::new("cdgdec", gst::DebugColorFlags::empty(), Some("CDG decoder")) +}); pub struct CdgDec { cdg_inter: Mutex<Box<cdg_renderer::CdgInterpreter>>, @@ -34,7 +35,7 @@ impl ObjectSubclass for CdgDec { type Instance = gst::subclass::ElementInstanceStruct<Self>; type Class = subclass::simple::ClassStruct<Self>; - 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 daf17cb42..54ad3ed72 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<imp::CdgDec>) @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 7b564a5a1..f49286384 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<gst::DebugCategory> = 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<Self>; type Class = subclass::simple::ClassStruct<Self>; - 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 10cac351f..b5e594d97 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<imp::CdgParse>) @extends gst_base::BaseParse, gst::Element, gst::Object; } diff --git a/video/cdg/src/lib.rs b/video/cdg/src/lib.rs index c5e5bb513..59b2a5106 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 c43ffa4fd..9dd8b1a2e 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; |