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 /net | |
parent | 5dd0a23986352fa363b002c8495951e6a3593673 (diff) |
Update for new #[glib::object_subclass] attribute macro
Diffstat (limited to 'net')
-rw-r--r-- | net/reqwest/src/reqwesthttpsrc/imp.rs | 17 | ||||
-rw-r--r-- | net/rusoto/src/aws_transcriber/imp.rs | 6 | ||||
-rw-r--r-- | net/rusoto/src/s3sink/imp.rs | 15 | ||||
-rw-r--r-- | net/rusoto/src/s3src/imp.rs | 20 |
4 files changed, 13 insertions, 45 deletions
diff --git a/net/reqwest/src/reqwesthttpsrc/imp.rs b/net/reqwest/src/reqwesthttpsrc/imp.rs index 453b6dd39..5767538d4 100644 --- a/net/reqwest/src/reqwesthttpsrc/imp.rs +++ b/net/reqwest/src/reqwesthttpsrc/imp.rs @@ -17,7 +17,6 @@ use url::Url; use once_cell::sync::Lazy; -use glib::subclass; use glib::subclass::prelude::*; use gst::prelude::*; use gst::subclass::prelude::*; @@ -103,7 +102,7 @@ impl Default for State { } } -#[derive(Debug)] +#[derive(Debug, Default)] pub struct ReqwestHttpSrc { client: Mutex<Option<ClientContext>>, external_client: Mutex<Option<ClientContext>>, @@ -1112,23 +1111,11 @@ impl URIHandlerImpl for ReqwestHttpSrc { } } +#[glib::object_subclass] impl ObjectSubclass for ReqwestHttpSrc { const NAME: &'static str = "ReqwestHttpSrc"; type Type = super::ReqwestHttpSrc; type ParentType = gst_base::PushSrc; type Interfaces = (gst::URIHandler,); type Instance = gst::subclass::ElementInstanceStruct<Self>; - type Class = subclass::simple::ClassStruct<Self>; - - glib::object_subclass!(); - - fn new() -> Self { - Self { - client: Mutex::new(None), - external_client: Mutex::new(None), - settings: Mutex::new(Default::default()), - state: Mutex::new(Default::default()), - canceller: Mutex::new(None), - } - } } diff --git a/net/rusoto/src/aws_transcriber/imp.rs b/net/rusoto/src/aws_transcriber/imp.rs index 4cb213fe1..017151463 100644 --- a/net/rusoto/src/aws_transcriber/imp.rs +++ b/net/rusoto/src/aws_transcriber/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::*; @@ -965,15 +964,12 @@ impl Transcriber { } } +#[glib::object_subclass] impl ObjectSubclass for Transcriber { const NAME: &'static str = "RsAwsTranscriber"; type Type = super::Transcriber; 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(); diff --git a/net/rusoto/src/s3sink/imp.rs b/net/rusoto/src/s3sink/imp.rs index dd9ec4696..3a30bdd63 100644 --- a/net/rusoto/src/s3sink/imp.rs +++ b/net/rusoto/src/s3sink/imp.rs @@ -7,7 +7,6 @@ // except according to those terms. use glib::prelude::*; -use glib::subclass; use glib::subclass::prelude::*; use gst::prelude::*; @@ -90,6 +89,7 @@ struct Settings { buffer_size: u64, } +#[derive(Default)] pub struct S3Sink { settings: Mutex<Settings>, state: Mutex<State>, @@ -341,23 +341,12 @@ impl S3Sink { } } +#[glib::object_subclass] impl ObjectSubclass for S3Sink { const NAME: &'static str = "RusotoS3Sink"; type Type = super::S3Sink; type ParentType = gst_base::BaseSink; - type Interfaces = (); type Instance = gst::subclass::ElementInstanceStruct<Self>; - type Class = subclass::simple::ClassStruct<Self>; - - glib::object_subclass!(); - - fn new() -> Self { - Self { - settings: Mutex::new(Default::default()), - state: Mutex::new(Default::default()), - canceller: Mutex::new(None), - } - } } impl ObjectImpl for S3Sink { diff --git a/net/rusoto/src/s3src/imp.rs b/net/rusoto/src/s3src/imp.rs index 736f1a13a..156e6b6d8 100644 --- a/net/rusoto/src/s3src/imp.rs +++ b/net/rusoto/src/s3src/imp.rs @@ -14,7 +14,6 @@ use once_cell::sync::Lazy; use rusoto_s3::*; use glib::prelude::*; -use glib::subclass; use glib::subclass::prelude::*; use gst::subclass::prelude::*; @@ -37,6 +36,13 @@ enum StreamingState { }, } +impl Default for StreamingState { + fn default() -> StreamingState { + StreamingState::Stopped + } +} + +#[derive(Default)] pub struct S3Src { url: Mutex<Option<GstS3Url>>, state: Mutex<StreamingState>, @@ -196,23 +202,13 @@ impl S3Src { } } +#[glib::object_subclass] impl ObjectSubclass for S3Src { const NAME: &'static str = "RusotoS3Src"; type Type = super::S3Src; type ParentType = gst_base::BaseSrc; type Interfaces = (gst::URIHandler,); type Instance = gst::subclass::ElementInstanceStruct<Self>; - type Class = subclass::simple::ClassStruct<Self>; - - glib::object_subclass!(); - - fn new() -> Self { - Self { - url: Mutex::new(None), - state: Mutex::new(StreamingState::Stopped), - canceller: Mutex::new(None), - } - } } impl ObjectImpl for S3Src { |