diff options
Diffstat (limited to 'tutorial/src')
-rw-r--r-- | tutorial/src/identity/imp.rs | 7 | ||||
-rw-r--r-- | tutorial/src/progressbin/imp.rs | 7 | ||||
-rw-r--r-- | tutorial/src/rgb2gray/imp.rs | 17 | ||||
-rw-r--r-- | tutorial/src/sinesrc/imp.rs | 30 |
4 files changed, 15 insertions, 46 deletions
diff --git a/tutorial/src/identity/imp.rs b/tutorial/src/identity/imp.rs index 7a256e60c..cddb491a1 100644 --- a/tutorial/src/identity/imp.rs +++ b/tutorial/src/identity/imp.rs @@ -6,7 +6,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use glib::subclass; use glib::subclass::prelude::*; use gst::prelude::*; use gst::subclass::prelude::*; @@ -114,16 +113,12 @@ impl Identity { // This trait registers our type with the GObject object system and // provides the entry points for creating a new instance and setting // up the class data +#[glib::object_subclass] impl ObjectSubclass for Identity { const NAME: &'static str = "RsIdentity"; type Type = super::Identity; type ParentType = gst::Element; - type Interfaces = (); type Instance = gst::subclass::ElementInstanceStruct<Self>; - type Class = subclass::simple::ClassStruct<Self>; - - // This macro provides some boilerplate. - glib::object_subclass!(); // Called when a new instance is to be created. We need to return an instance // of our struct here and also get the class struct passed in case it's needed diff --git a/tutorial/src/progressbin/imp.rs b/tutorial/src/progressbin/imp.rs index e00d6c0a3..9499147bc 100644 --- a/tutorial/src/progressbin/imp.rs +++ b/tutorial/src/progressbin/imp.rs @@ -7,7 +7,6 @@ // except according to those terms. use glib::prelude::*; -use glib::subclass; use glib::subclass::prelude::*; use gst::gst_info; use gst::prelude::*; @@ -44,16 +43,12 @@ pub struct ProgressBin { // This trait registers our type with the GObject object system and // provides the entry points for creating a new instance and setting // up the class data +#[glib::object_subclass] impl ObjectSubclass for ProgressBin { const NAME: &'static str = "RsProgressBin"; type Type = super::ProgressBin; type ParentType = gst::Bin; - type Interfaces = (); type Instance = gst::subclass::ElementInstanceStruct<Self>; - type Class = subclass::simple::ClassStruct<Self>; - - // This macro provides some boilerplate. - glib::object_subclass!(); // Called when a new instance is to be created. We need to return an instance // of our struct here and also get the class struct passed in case it's needed diff --git a/tutorial/src/rgb2gray/imp.rs b/tutorial/src/rgb2gray/imp.rs index 4db88fd8b..db4ac16dd 100644 --- a/tutorial/src/rgb2gray/imp.rs +++ b/tutorial/src/rgb2gray/imp.rs @@ -6,7 +6,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use glib::subclass; use glib::subclass::prelude::*; use gst::prelude::*; use gst::subclass::prelude::*; @@ -55,6 +54,7 @@ struct State { } // Struct containing all the element data +#[derive(Default)] pub struct Rgb2Gray { settings: Mutex<Settings>, state: Mutex<Option<State>>, @@ -90,25 +90,12 @@ impl Rgb2Gray { // This trait registers our type with the GObject object system and // provides the entry points for creating a new instance and setting // up the class data +#[glib::object_subclass] impl ObjectSubclass for Rgb2Gray { const NAME: &'static str = "RsRgb2Gray"; type Type = super::Rgb2Gray; type ParentType = gst_base::BaseTransform; - type Interfaces = (); type Instance = gst::subclass::ElementInstanceStruct<Self>; - type Class = subclass::simple::ClassStruct<Self>; - - // This macro provides some boilerplate - glib::object_subclass!(); - - // Called when a new instance is to be created. We need to return an instance - // of our struct here. - fn new() -> Self { - Self { - settings: Mutex::new(Default::default()), - state: Mutex::new(None), - } - } } // Implementation of glib::Object virtual methods diff --git a/tutorial/src/sinesrc/imp.rs b/tutorial/src/sinesrc/imp.rs index e18c5a023..90bb1812c 100644 --- a/tutorial/src/sinesrc/imp.rs +++ b/tutorial/src/sinesrc/imp.rs @@ -6,7 +6,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use glib::subclass; use glib::subclass::prelude::*; use gst::prelude::*; use gst::subclass::prelude::*; @@ -89,7 +88,17 @@ struct ClockWait { flushing: bool, } +impl Default for ClockWait { + fn default() -> ClockWait { + ClockWait { + clock_id: None, + flushing: true, + } + } +} + // Struct containing all the element data +#[derive(Default)] pub struct SineSrc { settings: Mutex<Settings>, state: Mutex<State>, @@ -144,29 +153,12 @@ impl SineSrc { // This trait registers our type with the GObject object system and // provides the entry points for creating a new instance and setting // up the class data +#[glib::object_subclass] impl ObjectSubclass for SineSrc { const NAME: &'static str = "RsSineSrc"; type Type = super::SineSrc; type ParentType = gst_base::PushSrc; - type Interfaces = (); type Instance = gst::subclass::ElementInstanceStruct<Self>; - type Class = subclass::simple::ClassStruct<Self>; - - // This macro provides some boilerplate. - glib::object_subclass!(); - - // Called when a new instance is to be created. We need to return an instance - // of our struct here. - fn new() -> Self { - Self { - settings: Mutex::new(Default::default()), - state: Mutex::new(Default::default()), - clock_wait: Mutex::new(ClockWait { - clock_id: None, - flushing: true, - }), - } - } } // Implementation of glib::Object virtual methods |