diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2021-03-07 19:22:24 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2021-03-07 19:27:00 +0300 |
commit | dc0c5f7611d5896f9fcfa9e141fabe02dea16ea6 (patch) | |
tree | 74d3f6c20a64a3e5fa9c1f4fcff6efb8a1d694d4 /utils | |
parent | 5dd0a23986352fa363b002c8495951e6a3593673 (diff) |
Update for new #[glib::object_subclass] attribute macro
Diffstat (limited to 'utils')
5 files changed, 8 insertions, 43 deletions
diff --git a/utils/fallbackswitch/src/fallbacksrc/custom_source/imp.rs b/utils/fallbackswitch/src/fallbacksrc/custom_source/imp.rs index fa5a5c073..ce7059e3d 100644 --- a/utils/fallbackswitch/src/fallbacksrc/custom_source/imp.rs +++ b/utils/fallbackswitch/src/fallbacksrc/custom_source/imp.rs @@ -16,7 +16,6 @@ // Boston, MA 02110-1335, USA. use glib::prelude::*; -use glib::subclass; use glib::subclass::prelude::*; use gst::prelude::*; use gst::subclass::prelude::*; @@ -42,37 +41,25 @@ struct Stream { stream: gst::Stream, } +#[derive(Default)] struct State { pads: Vec<Stream>, num_audio: usize, num_video: usize, } +#[derive(Default)] pub struct CustomSource { source: OnceCell<gst::Element>, state: Mutex<State>, } +#[glib::object_subclass] impl ObjectSubclass for CustomSource { const NAME: &'static str = "FallbackSrcCustomSource"; type Type = super::CustomSource; type ParentType = gst::Bin; - type Interfaces = (); type Instance = gst::subclass::ElementInstanceStruct<Self>; - type Class = subclass::simple::ClassStruct<Self>; - - glib::object_subclass!(); - - fn new() -> Self { - Self { - source: OnceCell::default(), - state: Mutex::new(State { - pads: vec![], - num_audio: 0, - num_video: 0, - }), - } - } } impl ObjectImpl for CustomSource { diff --git a/utils/fallbackswitch/src/fallbacksrc/imp.rs b/utils/fallbackswitch/src/fallbacksrc/imp.rs index 2280016ec..7c2e4f316 100644 --- a/utils/fallbackswitch/src/fallbacksrc/imp.rs +++ b/utils/fallbackswitch/src/fallbacksrc/imp.rs @@ -16,7 +16,6 @@ // Boston, MA 02110-1335, USA. use glib::prelude::*; -use glib::subclass; use glib::subclass::prelude::*; use gst::prelude::*; use gst::subclass::prelude::*; @@ -172,27 +171,18 @@ struct State { stats: Stats, } +#[derive(Default)] pub struct FallbackSrc { settings: Mutex<Settings>, state: Mutex<Option<State>>, } +#[glib::object_subclass] impl ObjectSubclass for FallbackSrc { const NAME: &'static str = "FallbackSrc"; type Type = super::FallbackSrc; type ParentType = gst::Bin; - type Interfaces = (); type Instance = gst::subclass::ElementInstanceStruct<Self>; - type Class = subclass::simple::ClassStruct<Self>; - - glib::object_subclass!(); - - fn new() -> Self { - Self { - settings: Mutex::new(Settings::default()), - state: Mutex::new(None), - } - } } impl ObjectImpl for FallbackSrc { diff --git a/utils/fallbackswitch/src/fallbacksrc/video_fallback/imp.rs b/utils/fallbackswitch/src/fallbacksrc/video_fallback/imp.rs index 6fe8dd716..fed4ebd35 100644 --- a/utils/fallbackswitch/src/fallbacksrc/video_fallback/imp.rs +++ b/utils/fallbackswitch/src/fallbacksrc/video_fallback/imp.rs @@ -17,7 +17,6 @@ // Boston, MA 02110-1335, USA. use glib::prelude::*; -use glib::subclass; use glib::subclass::prelude::*; use gst::prelude::*; use gst::subclass::prelude::*; @@ -62,15 +61,12 @@ pub struct VideoFallbackSource { settings: Mutex<Settings>, } +#[glib::object_subclass] impl ObjectSubclass for VideoFallbackSource { const NAME: &'static str = "FallbackSrcVideoFallbackSource"; type Type = super::VideoFallbackSource; type ParentType = gst::Bin; - type Interfaces = (); type Instance = gst::subclass::ElementInstanceStruct<Self>; - type Class = subclass::simple::ClassStruct<Self>; - - glib::object_subclass!(); fn with_class(klass: &Self::Class) -> Self { let templ = klass.get_pad_template("src").unwrap(); diff --git a/utils/fallbackswitch/src/fallbackswitch/imp.rs b/utils/fallbackswitch/src/fallbackswitch/imp.rs index b114b68fb..e498d0b9e 100644 --- a/utils/fallbackswitch/src/fallbackswitch/imp.rs +++ b/utils/fallbackswitch/src/fallbackswitch/imp.rs @@ -27,7 +27,6 @@ use gst_base::prelude::*; #[cfg(feature = "v1_18")] use gst_base::subclass::prelude::*; -use glib::subclass; #[cfg(not(feature = "v1_18"))] use glib::subclass::prelude::*; #[cfg(not(feature = "v1_18"))] @@ -643,15 +642,12 @@ impl FallbackSwitch { } } +#[glib::object_subclass] impl ObjectSubclass for FallbackSwitch { const NAME: &'static str = "FallbackSwitch"; type Type = super::FallbackSwitch; type ParentType = gst_base::Aggregator; - type Interfaces = (); type Instance = gst::subclass::ElementInstanceStruct<Self>; - type Class = subclass::simple::ClassStruct<Self>; - - glib::object_subclass!(); fn with_class(klass: &Self::Class) -> Self { let templ = klass.get_pad_template("sink").unwrap(); diff --git a/utils/togglerecord/src/togglerecord/imp.rs b/utils/togglerecord/src/togglerecord/imp.rs index cb28e408b..3e3d212d1 100644 --- a/utils/togglerecord/src/togglerecord/imp.rs +++ b/utils/togglerecord/src/togglerecord/imp.rs @@ -16,7 +16,6 @@ // Boston, MA 02110-1335, USA. use glib::prelude::*; -use glib::subclass; use glib::subclass::prelude::*; use gst::prelude::*; use gst::subclass::prelude::*; @@ -1617,15 +1616,12 @@ impl ToggleRecord { } } +#[glib::object_subclass] impl ObjectSubclass for ToggleRecord { const NAME: &'static str = "RsToggleRecord"; type Type = super::ToggleRecord; type ParentType = gst::Element; - type Interfaces = (); type Instance = gst::subclass::ElementInstanceStruct<Self>; - type Class = subclass::simple::ClassStruct<Self>; - - glib::object_subclass!(); fn with_class(klass: &Self::Class) -> Self { let templ = klass.get_pad_template("sink").unwrap(); |