Commit 0eb777cf authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

Update for removal of ObjectImpl::get_type_data()

parent 1730de6c
Pipeline #182271 passed with stages
in 26 minutes and 21 seconds
......@@ -194,8 +194,6 @@ impl ObjectSubclass for AudioEcho {
}
impl ObjectImpl for AudioEcho {
glib_object_impl!();
fn set_property(&self, _obj: &glib::Object, id: usize, value: &glib::Value) {
let prop = &PROPERTIES[id];
......
......@@ -1824,8 +1824,6 @@ impl ObjectSubclass for AudioLoudNorm {
}
impl ObjectImpl for AudioLoudNorm {
glib_object_impl!();
fn constructed(&self, obj: &glib::Object) {
self.parent_constructed(obj);
......
......@@ -93,9 +93,7 @@ impl ObjectSubclass for ClaxonDec {
}
}
impl ObjectImpl for ClaxonDec {
glib_object_impl!();
}
impl ObjectImpl for ClaxonDec {}
impl ElementImpl for ClaxonDec {}
......
......@@ -15,9 +15,9 @@
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
// Boston, MA 02110-1335, USA.
use glib::glib_object_subclass;
use glib::subclass;
use glib::subclass::prelude::*;
use glib::{glib_object_impl, glib_object_subclass};
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{
......@@ -431,8 +431,6 @@ impl ObjectSubclass for CsoundFilter {
}
impl ObjectImpl for CsoundFilter {
glib_object_impl!();
fn set_property(&self, _obj: &glib::Object, id: usize, value: &glib::Value) {
let prop = &PROPERTIES[id];
match *prop {
......
......@@ -92,9 +92,7 @@ impl ObjectSubclass for LewtonDec {
}
}
impl ObjectImpl for LewtonDec {
glib_object_impl!();
}
impl ObjectImpl for LewtonDec {}
impl ElementImpl for LewtonDec {}
......
......@@ -159,8 +159,6 @@ impl ObjectSubclass for FileSink {
}
impl ObjectImpl for FileSink {
glib_object_impl!();
fn set_property(&self, obj: &glib::Object, id: usize, value: &glib::Value) {
let prop = &PROPERTIES[id];
match *prop {
......
......@@ -173,8 +173,6 @@ impl ObjectSubclass for FileSrc {
}
impl ObjectImpl for FileSrc {
glib_object_impl!();
fn set_property(&self, obj: &glib::Object, id: usize, value: &glib::Value) {
let prop = &PROPERTIES[id];
match *prop {
......
......@@ -639,8 +639,6 @@ impl ObjectSubclass for Decrypter {
}
impl ObjectImpl for Decrypter {
glib_object_impl!();
fn constructed(&self, obj: &glib::Object) {
self.parent_constructed(obj);
......
......@@ -470,8 +470,6 @@ impl ObjectSubclass for Encrypter {
}
impl ObjectImpl for Encrypter {
glib_object_impl!();
fn constructed(&self, obj: &glib::Object) {
self.parent_constructed(obj);
......
......@@ -21,10 +21,10 @@ use futures::future::BoxFuture;
use futures::lock::Mutex as FutMutex;
use futures::prelude::*;
use glib::glib_object_subclass;
use glib::prelude::*;
use glib::subclass;
use glib::subclass::prelude::*;
use glib::{glib_object_impl, glib_object_subclass};
use gst::prelude::*;
use gst::subclass::prelude::*;
......@@ -639,8 +639,6 @@ impl ObjectSubclass for AppSrc {
}
impl ObjectImpl for AppSrc {
glib_object_impl!();
fn set_property(&self, _obj: &glib::Object, id: usize, value: &glib::Value) {
let prop = &PROPERTIES[id];
......
......@@ -19,10 +19,10 @@ use futures::future::BoxFuture;
use futures::future::{abortable, AbortHandle};
use futures::prelude::*;
use glib::glib_object_subclass;
use glib::prelude::*;
use glib::subclass;
use glib::subclass::prelude::*;
use glib::{glib_object_impl, glib_object_subclass};
use gst::prelude::*;
use gst::subclass::prelude::*;
......@@ -481,8 +481,6 @@ impl ObjectSubclass for InputSelector {
}
impl ObjectImpl for InputSelector {
glib_object_impl!();
fn set_property(&self, _obj: &glib::Object, id: usize, value: &glib::Value) {
let prop = &PROPERTIES[id];
......
......@@ -19,10 +19,10 @@ use futures::future::BoxFuture;
use futures::future::{abortable, AbortHandle, Aborted};
use futures::prelude::*;
use glib::glib_object_subclass;
use glib::prelude::*;
use glib::subclass;
use glib::subclass::prelude::*;
use glib::{glib_object_impl, glib_object_subclass};
use gst::prelude::*;
use gst::subclass::prelude::*;
......@@ -1494,8 +1494,6 @@ impl ObjectSubclass for JitterBuffer {
}
impl ObjectImpl for JitterBuffer {
glib_object_impl!();
fn set_property(&self, obj: &glib::Object, id: usize, value: &glib::Value) {
let prop = &PROPERTIES[id];
......
......@@ -19,10 +19,10 @@ use futures::channel::oneshot;
use futures::future::BoxFuture;
use futures::prelude::*;
use glib::glib_object_subclass;
use glib::prelude::*;
use glib::subclass;
use glib::subclass::prelude::*;
use glib::{glib_object_impl, glib_object_subclass};
use gst::prelude::*;
use gst::subclass::prelude::*;
......@@ -693,8 +693,6 @@ impl ObjectSubclass for ProxySink {
}
impl ObjectImpl for ProxySink {
glib_object_impl!();
fn set_property(&self, _obj: &glib::Object, id: usize, value: &glib::Value) {
let prop = &PROPERTIES_SINK[id];
......@@ -1216,8 +1214,6 @@ impl ObjectSubclass for ProxySrc {
}
impl ObjectImpl for ProxySrc {
glib_object_impl!();
fn set_property(&self, _obj: &glib::Object, id: usize, value: &glib::Value) {
let prop = &PROPERTIES_SRC[id];
......
......@@ -19,10 +19,10 @@ use futures::channel::oneshot;
use futures::future::BoxFuture;
use futures::prelude::*;
use glib::glib_object_subclass;
use glib::prelude::*;
use glib::subclass;
use glib::subclass::prelude::*;
use glib::{glib_object_impl, glib_object_subclass};
use gst::prelude::*;
use gst::subclass::prelude::*;
......@@ -808,8 +808,6 @@ impl ObjectSubclass for Queue {
}
impl ObjectImpl for Queue {
glib_object_impl!();
fn set_property(&self, _obj: &glib::Object, id: usize, value: &glib::Value) {
let prop = &PROPERTIES[id];
......
......@@ -20,10 +20,10 @@ use futures::future::BoxFuture;
use futures::lock::Mutex as FutMutex;
use futures::prelude::*;
use glib::glib_object_subclass;
use glib::prelude::*;
use glib::subclass;
use glib::subclass::prelude::*;
use glib::{glib_object_impl, glib_object_subclass};
use gst::prelude::*;
use gst::subclass::prelude::*;
......@@ -654,8 +654,6 @@ impl ObjectSubclass for TcpClientSrc {
}
impl ObjectImpl for TcpClientSrc {
glib_object_impl!();
fn set_property(&self, _obj: &glib::Object, id: usize, value: &glib::Value) {
let prop = &PROPERTIES[id];
......
......@@ -20,10 +20,10 @@ use futures::future::BoxFuture;
use futures::lock::Mutex;
use futures::prelude::*;
use glib::glib_object_subclass;
use glib::prelude::*;
use glib::subclass;
use glib::subclass::prelude::*;
use glib::{glib_object_impl, glib_object_subclass};
use gst::prelude::*;
use gst::subclass::prelude::*;
......@@ -1305,8 +1305,6 @@ impl ObjectSubclass for UdpSink {
}
impl ObjectImpl for UdpSink {
glib_object_impl!();
fn set_property(&self, obj: &glib::Object, id: usize, value: &glib::Value) {
let prop = &PROPERTIES[id];
let element = obj.downcast_ref::<gst::Element>().unwrap();
......
......@@ -19,10 +19,10 @@ use futures::future::BoxFuture;
use futures::lock::Mutex as FutMutex;
use futures::prelude::*;
use glib::glib_object_subclass;
use glib::prelude::*;
use glib::subclass;
use glib::subclass::prelude::*;
use glib::{glib_object_impl, glib_object_subclass};
use gst::prelude::*;
use gst::subclass::prelude::*;
......@@ -832,8 +832,6 @@ impl ObjectSubclass for UdpSrc {
}
impl ObjectImpl for UdpSrc {
glib_object_impl!();
fn set_property(&self, _obj: &glib::Object, id: usize, value: &glib::Value) {
let prop = &PROPERTIES[id];
......
......@@ -21,8 +21,8 @@ use futures::future::BoxFuture;
use futures::lock::Mutex as FutMutex;
use futures::prelude::*;
use glib::glib_object_subclass;
use glib::GBoxed;
use glib::{glib_object_impl, glib_object_subclass};
use gst::prelude::*;
use gst::subclass::prelude::*;
......@@ -336,8 +336,6 @@ impl ObjectSubclass for ElementSrcTest {
}
impl ObjectImpl for ElementSrcTest {
glib_object_impl!();
fn set_property(&self, _obj: &glib::Object, id: usize, value: &glib::Value) {
let prop = &SRC_PROPERTIES[id];
......@@ -649,8 +647,6 @@ impl ObjectSubclass for ElementSinkTest {
}
impl ObjectImpl for ElementSinkTest {
glib_object_impl!();
fn set_property(&self, _obj: &glib::Object, id: usize, value: &glib::Value) {
let prop = &SINK_PROPERTIES[id];
......
......@@ -670,8 +670,6 @@ impl ReqwestHttpSrc {
}
impl ObjectImpl for ReqwestHttpSrc {
glib_object_impl!();
fn set_property(&self, obj: &glib::Object, id: usize, value: &glib::Value) {
let prop = &PROPERTIES[id];
match *prop {
......
......@@ -1085,8 +1085,6 @@ impl ObjectSubclass for Transcriber {
}
impl ObjectImpl for Transcriber {
glib_object_impl!();
fn constructed(&self, obj: &glib::Object) {
self.parent_constructed(obj);
......
......@@ -418,8 +418,6 @@ impl ObjectSubclass for S3Sink {
}
impl ObjectImpl for S3Sink {
glib_object_impl!();
fn set_property(&self, _obj: &glib::Object, id: usize, value: &glib::Value) {
let prop = &PROPERTIES[id as usize];
let mut settings = self.settings.lock().unwrap();
......
......@@ -251,8 +251,6 @@ impl ObjectSubclass for S3Src {
}
impl ObjectImpl for S3Src {
glib_object_impl!();
fn set_property(&self, obj: &glib::Object, id: usize, value: &glib::Value) {
let prop = &PROPERTIES[id as usize];
let basesrc = obj.downcast_ref::<gst_base::BaseSrc>().unwrap();
......
......@@ -330,8 +330,6 @@ impl ObjectSubclass for TextWrap {
}
impl ObjectImpl for TextWrap {
glib_object_impl!();
fn constructed(&self, obj: &glib::Object) {
self.parent_constructed(obj);
......
......@@ -230,9 +230,6 @@ impl ObjectSubclass for Identity {
// Implementation of glib::Object virtual methods
impl ObjectImpl for Identity {
// This macro provides some boilerplate
glib_object_impl!();
// Called right after construction of a new instance
fn constructed(&self, obj: &glib::Object) {
// Call the parent class' ::constructed() implementation first
......
......@@ -156,9 +156,6 @@ impl ObjectSubclass for ProgressBin {
// Implementation of glib::Object virtual methods
impl ObjectImpl for ProgressBin {
// This macro provides some boilerplate
glib_object_impl!();
// Called whenever a value of a property is changed. It can be called
// at any time from any thread.
fn set_property(&self, obj: &glib::Object, id: usize, value: &glib::Value) {
......
......@@ -237,9 +237,6 @@ impl ObjectSubclass for Rgb2Gray {
// Implementation of glib::Object virtual methods
impl ObjectImpl for Rgb2Gray {
// This macro provides some boilerplate.
glib_object_impl!();
// Called whenever a value of a property is changed. It can be called
// at any time from any thread.
fn set_property(&self, obj: &glib::Object, id: usize, value: &glib::Value) {
......
......@@ -280,9 +280,6 @@ impl ObjectSubclass for SineSrc {
// Implementation of glib::Object virtual methods
impl ObjectImpl for SineSrc {
// This macro provides some boilerplate.
glib_object_impl!();
// Called right after construction of a new instance
fn constructed(&self, obj: &glib::Object) {
// Call the parent class' ::constructed() implementation first
......
......@@ -257,12 +257,10 @@ In the `new` function we return our empty struct.
In the `class_init` function we, again, set up some metadata for our new element. In this case these are a description, a classification of our element, a longer description and the author. The metadata can later be retrieved and made use of via the [`Registry`](https://slomo.pages.freedesktop.org/rustdocs/gstreamer/gstreamer/struct.Registry.html) and [`PluginFeature`](https://slomo.pages.freedesktop.org/rustdocs/gstreamer/gstreamer/struct.PluginFeature.html)/[`ElementFactory`](https://slomo.pages.freedesktop.org/rustdocs/gstreamer/gstreamer/struct.ElementFactory.html) API. We also configure the `BaseTransform` class and define that we will never operate in-place (producing our output in the input buffer), and that we don’t want to work in passthrough mode if the input/output formats are the same.
Additionally we need to implement various traits on the Rgb2Gray struct, which will later be used to override virtual methods of the various parent classes of our element. For now we can keep the trait implementations empty, except for `ObjectImpl` trait which should simply call the `glib_object_impl!()` macro for some boilerplate code. There is one trait implementation required per parent class.
Additionally we need to implement various traits on the Rgb2Gray struct, which will later be used to override virtual methods of the various parent classes of our element. For now we can keep the trait implementations empty. There is one trait implementation required per parent class.
```rust
impl ObjectImpl for Rgb2Gray {
glib_object_impl!();
}
impl ObjectImpl for Rgb2Gray {}
impl ElementImpl for Rgb2Gray {}
impl BaseTransformImpl for Rgb2Gray {}
```
......@@ -287,9 +285,7 @@ impl ObjectSubclass for Rgb2Gray {
glib_object_subclass!();
}
impl ObjectImpl for Rgb2Gray {
glib_object_impl!();
}
impl ObjectImpl for Rgb2Gray {}
impl ElementImpl for Rgb2Gray {}
......
......@@ -230,9 +230,6 @@ impl ObjectSubclass for SineSrc {
}
impl ObjectImpl for SineSrc {
// This macro provides some boilerplate.
glib_object_impl!();
// Called right after construction of a new instance
fn constructed(&self, obj: &glib::Object) {
// Call the parent class' ::constructed() implementation first
......
......@@ -19,7 +19,7 @@ use super::super::Aggregator;
use super::super::AggregatorClass;
use super::super::AggregatorPad;
pub trait AggregatorImpl: AggregatorImplExt + ElementImpl + Send + Sync + 'static {
pub trait AggregatorImpl: AggregatorImplExt + ElementImpl {
fn flush(&self, aggregator: &Aggregator) -> Result<gst::FlowSuccess, gst::FlowError> {
self.parent_flush(aggregator)
}
......@@ -98,7 +98,9 @@ pub trait AggregatorImpl: AggregatorImplExt + ElementImpl + Send + Sync + 'stati
&self,
aggregator: &Aggregator,
timeout: bool,
) -> Result<gst::FlowSuccess, gst::FlowError>;
) -> Result<gst::FlowSuccess, gst::FlowError> {
self.parent_aggregate(aggregator, timeout)
}
fn start(&self, aggregator: &Aggregator) -> Result<(), gst::ErrorMessage> {
self.parent_start(aggregator)
......@@ -239,10 +241,10 @@ pub trait AggregatorImplExt {
fn parent_negotiate(&self, aggregator: &Aggregator) -> bool;
}
impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
impl<T: AggregatorImpl> AggregatorImplExt for T {
fn parent_flush(&self, aggregator: &Aggregator) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe {
let data = self.get_type_data();
let data = T::type_data();
let parent_class =
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
(*parent_class)
......@@ -260,7 +262,7 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
buffer: gst::Buffer,
) -> Option<gst::Buffer> {
unsafe {
let data = self.get_type_data();
let data = T::type_data();
let parent_class =
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
match (*parent_class).clip {
......@@ -280,7 +282,7 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
buffer: gst::Buffer,
) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe {
let data = self.get_type_data();
let data = T::type_data();
let parent_class =
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
let f = (*parent_class)
......@@ -298,7 +300,7 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
event: gst::Event,
) -> bool {
unsafe {
let data = self.get_type_data();
let data = T::type_data();
let parent_class =
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
let f = (*parent_class)
......@@ -319,7 +321,7 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
event: gst::Event,
) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe {
let data = self.get_type_data();
let data = T::type_data();
let parent_class =
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
let f = (*parent_class)
......@@ -341,7 +343,7 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
query: &mut gst::QueryRef,
) -> bool {
unsafe {
let data = self.get_type_data();
let data = T::type_data();
let parent_class =
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
let f = (*parent_class)
......@@ -362,7 +364,7 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
query: &mut gst::QueryRef,
) -> bool {
unsafe {
let data = self.get_type_data();
let data = T::type_data();
let parent_class =
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
let f = (*parent_class)
......@@ -378,7 +380,7 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
fn parent_src_event(&self, aggregator: &Aggregator, event: gst::Event) -> bool {
unsafe {
let data = self.get_type_data();
let data = T::type_data();
let parent_class =
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
let f = (*parent_class)
......@@ -390,7 +392,7 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
fn parent_src_query(&self, aggregator: &Aggregator, query: &mut gst::QueryRef) -> bool {
unsafe {
let data = self.get_type_data();
let data = T::type_data();
let parent_class =
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
let f = (*parent_class)
......@@ -407,7 +409,7 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
active: bool,
) -> Result<(), gst::LoggableError> {
unsafe {
let data = self.get_type_data();
let data = T::type_data();
let parent_class =
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
match (*parent_class).src_activate {
......@@ -431,7 +433,7 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
timeout: bool,
) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe {
let data = self.get_type_data();
let data = T::type_data();
let parent_class =
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
let f = (*parent_class)
......@@ -444,7 +446,7 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
fn parent_start(&self, aggregator: &Aggregator) -> Result<(), gst::ErrorMessage> {
unsafe {
let data = self.get_type_data();
let data = T::type_data();
let parent_class =
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
(*parent_class)
......@@ -465,7 +467,7 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
fn parent_stop(&self, aggregator: &Aggregator) -> Result<(), gst::ErrorMessage> {
unsafe {
let data = self.get_type_data();
let data = T::type_data();
let parent_class =
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
(*parent_class)
......@@ -486,7 +488,7 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
fn parent_get_next_time(&self, aggregator: &Aggregator) -> gst::ClockTime {
unsafe {
let data = self.get_type_data();
let data = T::type_data();
let parent_class =
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
(*parent_class)
......@@ -504,7 +506,7 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
caps: Option<&gst::Caps>,
) -> Option<AggregatorPad> {
unsafe {
let data = self.get_type_data();
let data = T::type_data();
let parent_class =
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
let f = (*parent_class)
......@@ -525,7 +527,7 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
caps: &gst::Caps,
) -> Result<gst::Caps, gst::FlowError> {
unsafe {
let data = self.get_type_data();
let data = T::type_data();
let parent_class =
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
let f = (*parent_class)
......@@ -544,7 +546,7 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
fn parent_fixate_src_caps(&self, aggregator: &Aggregator, caps: gst::Caps) -> gst::Caps {
unsafe {
let data = self.get_type_data();
let data = T::type_data();
let parent_class =
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
......@@ -561,7 +563,7 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
caps: &gst::Caps,
) -> Result<(), gst::LoggableError> {
unsafe {
let data = self.get_type_data();
let data = T::type_data();
let parent_class =
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
(*parent_class)
......@@ -579,7 +581,7 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {