diff options
Diffstat (limited to 'video/closedcaption/src')
-rw-r--r-- | video/closedcaption/src/ccdetect/imp.rs | 13 | ||||
-rw-r--r-- | video/closedcaption/src/ccdetect/mod.rs | 2 | ||||
-rw-r--r-- | video/closedcaption/src/cea608overlay/imp.rs | 23 | ||||
-rw-r--r-- | video/closedcaption/src/cea608overlay/mod.rs | 2 | ||||
-rw-r--r-- | video/closedcaption/src/cea608tott/imp.rs | 13 | ||||
-rw-r--r-- | video/closedcaption/src/cea608tott/mod.rs | 2 | ||||
-rw-r--r-- | video/closedcaption/src/lib.rs | 13 | ||||
-rw-r--r-- | video/closedcaption/src/mcc_enc/imp.rs | 13 | ||||
-rw-r--r-- | video/closedcaption/src/mcc_enc/mod.rs | 2 | ||||
-rw-r--r-- | video/closedcaption/src/mcc_parse/imp.rs | 24 | ||||
-rw-r--r-- | video/closedcaption/src/mcc_parse/mod.rs | 2 | ||||
-rw-r--r-- | video/closedcaption/src/scc_enc/imp.rs | 21 | ||||
-rw-r--r-- | video/closedcaption/src/scc_enc/mod.rs | 2 | ||||
-rw-r--r-- | video/closedcaption/src/scc_parse/imp.rs | 21 | ||||
-rw-r--r-- | video/closedcaption/src/scc_parse/mod.rs | 2 | ||||
-rw-r--r-- | video/closedcaption/src/tttocea608/imp.rs | 16 | ||||
-rw-r--r-- | video/closedcaption/src/tttocea608/mod.rs | 5 |
17 files changed, 92 insertions, 84 deletions
diff --git a/video/closedcaption/src/ccdetect/imp.rs b/video/closedcaption/src/ccdetect/imp.rs index 3f38998cf..5ac43309d 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<gst::DebugCategory> = 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<Self>; type Class = subclass::simple::ClassStruct<Self>; - 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 11a82b86b..681ec6ff5 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<imp::CCDetect>) @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 e55c16c8c..61f6a9899 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<gst::DebugCategory> = Lazy::new(|| { + gst::DebugCategory::new( + "cea608overlay", + gst::DebugColorFlags::empty(), + Some("CEA 608 overlay element"), + ) +}); struct State { video_info: Option<gst_video::VideoInfo>, @@ -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<Self>; type Class = subclass::simple::ClassStruct<Self>; - 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 54669bf3e..ca84bdd44 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<imp::Cea608Overlay>) @extends gst::Element, gst::Object; } diff --git a/video/closedcaption/src/cea608tott/imp.rs b/video/closedcaption/src/cea608tott/imp.rs index 6dbc36ace..68aee6c0b 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<State>, } -lazy_static! { - static ref CAT: gst::DebugCategory = gst::DebugCategory::new( +static CAT: Lazy<gst::DebugCategory> = 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<Self>; type Class = subclass::simple::ClassStruct<Self>; - 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 51b23dc8a..8690033fa 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<imp::Cea608ToTt>) @extends gst::Element, gst::Object; } diff --git a/video/closedcaption/src/lib.rs b/video/closedcaption/src/lib.rs index e372d6591..3c6f971c3 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 243a0796e..786d52c02 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<Settings>, } -lazy_static! { - static ref CAT: gst::DebugCategory = gst::DebugCategory::new( +static CAT: Lazy<gst::DebugCategory> = 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<Self>; type Class = subclass::simple::ClassStruct<Self>; - 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 f3c1f0d30..6bb606eab 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<imp::MccEnc>) @extends gst::Element, gst::Object; } diff --git a/video/closedcaption/src/mcc_parse/imp.rs b/video/closedcaption/src/mcc_parse/imp.rs index 953b70f3c..945461e89 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<gst::DebugCategory> = 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<Self>; type Class = subclass::simple::ClassStruct<Self>; - 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 d3ee283e0..7bf4d45b9 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<imp::MccParse>) @extends gst::Element, gst::Object; } diff --git a/video/closedcaption/src/scc_enc/imp.rs b/video/closedcaption/src/scc_enc/imp.rs index c9c473931..20c86c9b4 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<gst::DebugCategory> = 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<Self>; type Class = subclass::simple::ClassStruct<Self>; - 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 46998d753..ac2154567 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<imp::SccEnc>) @extends gst::Element, gst::Object; } diff --git a/video/closedcaption/src/scc_parse/imp.rs b/video/closedcaption/src/scc_parse/imp.rs index 22a2b4770..a7835dd78 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<gst::DebugCategory> = 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<Self>; type Class = subclass::simple::ClassStruct<Self>; - 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 19cf93f87..05067d6e9 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<imp::SccParse>) @extends gst::Element, gst::Object; } diff --git a/video/closedcaption/src/tttocea608/imp.rs b/video/closedcaption/src/tttocea608/imp.rs index 8b2bbc148..e99e2c0e7 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<Settings>, } -lazy_static! { - static ref CAT: gst::DebugCategory = gst::DebugCategory::new( +static CAT: Lazy<gst::DebugCategory> = 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<u16> = 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<Self>; type Class = subclass::simple::ClassStruct<Self>; - 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 790e71511..e9004fea1 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<imp::TtToCea608>) @extends gst::Element, gst::Object; } |