Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2021-03-09 16:51:37 +0300
committerSebastian Dröge <sebastian@centricular.com>2021-03-09 18:07:13 +0300
commit2cada57efc92cb4201d999fd214ad9665313c188 (patch)
tree3b3db433d57732dd23dac095438270aef73411d9 /utils
parentaa354058f58ab33ac838ff90e6c8b852b97fd320 (diff)
Update for the subclassing glib/gstreamer bindings API changes
Diffstat (limited to 'utils')
-rw-r--r--utils/fallbackswitch/src/base/subclass/aggregator.rs142
-rw-r--r--utils/fallbackswitch/src/base/subclass/aggregator_pad.rs4
-rw-r--r--utils/fallbackswitch/src/fallbacksrc/custom_source/imp.rs1
-rw-r--r--utils/fallbackswitch/src/fallbacksrc/imp.rs1
-rw-r--r--utils/fallbackswitch/src/fallbacksrc/video_fallback/imp.rs1
-rw-r--r--utils/fallbackswitch/src/fallbackswitch/imp.rs1
-rw-r--r--utils/togglerecord/src/togglerecord/imp.rs1
7 files changed, 47 insertions, 104 deletions
diff --git a/utils/fallbackswitch/src/base/subclass/aggregator.rs b/utils/fallbackswitch/src/base/subclass/aggregator.rs
index 4fb401cb0..25623d115 100644
--- a/utils/fallbackswitch/src/base/subclass/aggregator.rs
+++ b/utils/fallbackswitch/src/base/subclass/aggregator.rs
@@ -614,10 +614,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
}
}
-unsafe impl<T: AggregatorImpl> IsSubclassable<T> for Aggregator
-where
- <T as ObjectSubclass>::Instance: PanicPoison,
-{
+unsafe impl<T: AggregatorImpl> IsSubclassable<T> for Aggregator {
fn class_init(klass: &mut glib::Class<Self>) {
<gst::Element as IsSubclassable<T>>::class_init(klass);
let klass = klass.as_mut();
@@ -643,19 +640,20 @@ where
klass.negotiate = Some(aggregator_negotiate::<T>);
}
}
+
+ fn instance_init(instance: &mut glib::subclass::InitializingObject<T>) {
+ <gst::Element as IsSubclassable<T>>::instance_init(instance);
+ }
}
unsafe extern "C" fn aggregator_flush<T: AggregatorImpl>(
ptr: *mut ffi::GstAggregator,
-) -> gst::ffi::GstFlowReturn
-where
- T::Instance: PanicPoison,
-{
+) -> gst::ffi::GstFlowReturn {
let instance = &*(ptr as *mut T::Instance);
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
- gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
+ gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
imp.flush(wrap.unsafe_cast_ref()).into()
})
.to_glib()
@@ -665,15 +663,12 @@ unsafe extern "C" fn aggregator_clip<T: AggregatorImpl>(
ptr: *mut ffi::GstAggregator,
aggregator_pad: *mut ffi::GstAggregatorPad,
buffer: *mut gst::ffi::GstBuffer,
-) -> *mut gst::ffi::GstBuffer
-where
- T::Instance: PanicPoison,
-{
+) -> *mut gst::ffi::GstBuffer {
let instance = &*(ptr as *mut T::Instance);
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
- let ret = gst::panic_to_error!(&wrap, &instance.panicked(), None, {
+ let ret = gst::panic_to_error!(&wrap, &imp.panicked(), None, {
imp.clip(
wrap.unsafe_cast_ref(),
&from_glib_borrow(aggregator_pad),
@@ -687,15 +682,12 @@ where
unsafe extern "C" fn aggregator_finish_buffer<T: AggregatorImpl>(
ptr: *mut ffi::GstAggregator,
buffer: *mut gst::ffi::GstBuffer,
-) -> gst::ffi::GstFlowReturn
-where
- T::Instance: PanicPoison,
-{
+) -> gst::ffi::GstFlowReturn {
let instance = &*(ptr as *mut T::Instance);
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
- gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
+ gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
imp.finish_buffer(wrap.unsafe_cast_ref(), from_glib_full(buffer))
.into()
})
@@ -706,15 +698,12 @@ unsafe extern "C" fn aggregator_sink_event<T: AggregatorImpl>(
ptr: *mut ffi::GstAggregator,
aggregator_pad: *mut ffi::GstAggregatorPad,
event: *mut gst::ffi::GstEvent,
-) -> glib::ffi::gboolean
-where
- T::Instance: PanicPoison,
-{
+) -> glib::ffi::gboolean {
let instance = &*(ptr as *mut T::Instance);
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
- gst::panic_to_error!(wrap, &instance.panicked(), false, {
+ gst::panic_to_error!(wrap, &imp.panicked(), false, {
imp.sink_event(
wrap.unsafe_cast_ref(),
&from_glib_borrow(aggregator_pad),
@@ -728,15 +717,12 @@ unsafe extern "C" fn aggregator_sink_event_pre_queue<T: AggregatorImpl>(
ptr: *mut ffi::GstAggregator,
aggregator_pad: *mut ffi::GstAggregatorPad,
event: *mut gst::ffi::GstEvent,
-) -> gst::ffi::GstFlowReturn
-where
- T::Instance: PanicPoison,
-{
+) -> gst::ffi::GstFlowReturn {
let instance = &*(ptr as *mut T::Instance);
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
- gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
+ gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
imp.sink_event_pre_queue(
wrap.unsafe_cast_ref(),
&from_glib_borrow(aggregator_pad),
@@ -751,15 +737,12 @@ unsafe extern "C" fn aggregator_sink_query<T: AggregatorImpl>(
ptr: *mut ffi::GstAggregator,
aggregator_pad: *mut ffi::GstAggregatorPad,
query: *mut gst::ffi::GstQuery,
-) -> glib::ffi::gboolean
-where
- T::Instance: PanicPoison,
-{
+) -> glib::ffi::gboolean {
let instance = &*(ptr as *mut T::Instance);
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
- gst::panic_to_error!(&wrap, &instance.panicked(), false, {
+ gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.sink_query(
wrap.unsafe_cast_ref(),
&from_glib_borrow(aggregator_pad),
@@ -773,15 +756,12 @@ unsafe extern "C" fn aggregator_sink_query_pre_queue<T: AggregatorImpl>(
ptr: *mut ffi::GstAggregator,
aggregator_pad: *mut ffi::GstAggregatorPad,
query: *mut gst::ffi::GstQuery,
-) -> glib::ffi::gboolean
-where
- T::Instance: PanicPoison,
-{
+) -> glib::ffi::gboolean {
let instance = &*(ptr as *mut T::Instance);
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
- gst::panic_to_error!(&wrap, &instance.panicked(), false, {
+ gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.sink_query_pre_queue(
wrap.unsafe_cast_ref(),
&from_glib_borrow(aggregator_pad),
@@ -794,15 +774,12 @@ where
unsafe extern "C" fn aggregator_src_event<T: AggregatorImpl>(
ptr: *mut ffi::GstAggregator,
event: *mut gst::ffi::GstEvent,
-) -> glib::ffi::gboolean
-where
- T::Instance: PanicPoison,
-{
+) -> glib::ffi::gboolean {
let instance = &*(ptr as *mut T::Instance);
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
- gst::panic_to_error!(&wrap, &instance.panicked(), false, {
+ gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event))
})
.to_glib()
@@ -811,15 +788,12 @@ where
unsafe extern "C" fn aggregator_src_query<T: AggregatorImpl>(
ptr: *mut ffi::GstAggregator,
query: *mut gst::ffi::GstQuery,
-) -> glib::ffi::gboolean
-where
- T::Instance: PanicPoison,
-{
+) -> glib::ffi::gboolean {
let instance = &*(ptr as *mut T::Instance);
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
- gst::panic_to_error!(&wrap, &instance.panicked(), false, {
+ gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
})
.to_glib()
@@ -829,15 +803,12 @@ unsafe extern "C" fn aggregator_src_activate<T: AggregatorImpl>(
ptr: *mut ffi::GstAggregator,
mode: gst::ffi::GstPadMode,
active: glib::ffi::gboolean,
-) -> glib::ffi::gboolean
-where
- T::Instance: PanicPoison,
-{
+) -> glib::ffi::gboolean {
let instance = &*(ptr as *mut T::Instance);
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
- gst::panic_to_error!(&wrap, &instance.panicked(), false, {
+ gst::panic_to_error!(&wrap, &imp.panicked(), false, {
match imp.src_activate(wrap.unsafe_cast_ref(), from_glib(mode), from_glib(active)) {
Ok(()) => true,
Err(err) => {
@@ -852,15 +823,12 @@ where
unsafe extern "C" fn aggregator_aggregate<T: AggregatorImpl>(
ptr: *mut ffi::GstAggregator,
timeout: glib::ffi::gboolean,
-) -> gst::ffi::GstFlowReturn
-where
- T::Instance: PanicPoison,
-{
+) -> gst::ffi::GstFlowReturn {
let instance = &*(ptr as *mut T::Instance);
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
- gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
+ gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
imp.aggregate(wrap.unsafe_cast_ref(), from_glib(timeout))
.into()
})
@@ -869,15 +837,12 @@ where
unsafe extern "C" fn aggregator_start<T: AggregatorImpl>(
ptr: *mut ffi::GstAggregator,
-) -> glib::ffi::gboolean
-where
- T::Instance: PanicPoison,
-{
+) -> glib::ffi::gboolean {
let instance = &*(ptr as *mut T::Instance);
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
- gst::panic_to_error!(&wrap, &instance.panicked(), false, {
+ gst::panic_to_error!(&wrap, &imp.panicked(), false, {
match imp.start(wrap.unsafe_cast_ref()) {
Ok(()) => true,
Err(err) => {
@@ -891,15 +856,12 @@ where
unsafe extern "C" fn aggregator_stop<T: AggregatorImpl>(
ptr: *mut ffi::GstAggregator,
-) -> glib::ffi::gboolean
-where
- T::Instance: PanicPoison,
-{
+) -> glib::ffi::gboolean {
let instance = &*(ptr as *mut T::Instance);
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
- gst::panic_to_error!(&wrap, &instance.panicked(), false, {
+ gst::panic_to_error!(&wrap, &imp.panicked(), false, {
match imp.stop(wrap.unsafe_cast_ref()) {
Ok(()) => true,
Err(err) => {
@@ -913,15 +875,12 @@ where
unsafe extern "C" fn aggregator_get_next_time<T: AggregatorImpl>(
ptr: *mut ffi::GstAggregator,
-) -> gst::ffi::GstClockTime
-where
- T::Instance: PanicPoison,
-{
+) -> gst::ffi::GstClockTime {
let instance = &*(ptr as *mut T::Instance);
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
- gst::panic_to_error!(&wrap, &instance.panicked(), gst::CLOCK_TIME_NONE, {
+ gst::panic_to_error!(&wrap, &imp.panicked(), gst::CLOCK_TIME_NONE, {
imp.get_next_time(wrap.unsafe_cast_ref())
})
.to_glib()
@@ -932,15 +891,12 @@ unsafe extern "C" fn aggregator_create_new_pad<T: AggregatorImpl>(
templ: *mut gst::ffi::GstPadTemplate,
req_name: *const libc::c_char,
caps: *const gst::ffi::GstCaps,
-) -> *mut ffi::GstAggregatorPad
-where
- T::Instance: PanicPoison,
-{
+) -> *mut ffi::GstAggregatorPad {
let instance = &*(ptr as *mut T::Instance);
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
- gst::panic_to_error!(&wrap, &instance.panicked(), None, {
+ gst::panic_to_error!(&wrap, &imp.panicked(), None, {
let req_name: Borrowed<Option<glib::GString>> = from_glib_borrow(req_name);
imp.create_new_pad(
@@ -959,17 +915,14 @@ unsafe extern "C" fn aggregator_update_src_caps<T: AggregatorImpl>(
ptr: *mut ffi::GstAggregator,
caps: *mut gst::ffi::GstCaps,
res: *mut *mut gst::ffi::GstCaps,
-) -> gst::ffi::GstFlowReturn
-where
- T::Instance: PanicPoison,
-{
+) -> gst::ffi::GstFlowReturn {
let instance = &*(ptr as *mut T::Instance);
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
*res = ptr::null_mut();
- gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
+ gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
match imp.update_src_caps(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) {
Ok(res_caps) => {
*res = res_caps.into_ptr();
@@ -984,15 +937,12 @@ where
unsafe extern "C" fn aggregator_fixate_src_caps<T: AggregatorImpl>(
ptr: *mut ffi::GstAggregator,
caps: *mut gst::ffi::GstCaps,
-) -> *mut gst::ffi::GstCaps
-where
- T::Instance: PanicPoison,
-{
+) -> *mut gst::ffi::GstCaps {
let instance = &*(ptr as *mut T::Instance);
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
- gst::panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
+ gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), {
imp.fixate_src_caps(wrap.unsafe_cast_ref(), from_glib_full(caps))
})
.into_ptr()
@@ -1001,15 +951,12 @@ where
unsafe extern "C" fn aggregator_negotiated_src_caps<T: AggregatorImpl>(
ptr: *mut ffi::GstAggregator,
caps: *mut gst::ffi::GstCaps,
-) -> glib::ffi::gboolean
-where
- T::Instance: PanicPoison,
-{
+) -> glib::ffi::gboolean {
let instance = &*(ptr as *mut T::Instance);
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
- gst::panic_to_error!(&wrap, &instance.panicked(), false, {
+ gst::panic_to_error!(&wrap, &imp.panicked(), false, {
match imp.negotiated_src_caps(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) {
Ok(()) => true,
Err(err) => {
@@ -1023,15 +970,12 @@ where
unsafe extern "C" fn aggregator_negotiate<T: AggregatorImpl>(
ptr: *mut ffi::GstAggregator,
-) -> glib::ffi::gboolean
-where
- T::Instance: PanicPoison,
-{
+) -> glib::ffi::gboolean {
let instance = &*(ptr as *mut T::Instance);
let imp = instance.get_impl();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
- gst::panic_to_error!(&wrap, &instance.panicked(), false, {
+ gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.negotiate(wrap.unsafe_cast_ref())
})
.to_glib()
diff --git a/utils/fallbackswitch/src/base/subclass/aggregator_pad.rs b/utils/fallbackswitch/src/base/subclass/aggregator_pad.rs
index 2317df70d..68a706f4b 100644
--- a/utils/fallbackswitch/src/base/subclass/aggregator_pad.rs
+++ b/utils/fallbackswitch/src/base/subclass/aggregator_pad.rs
@@ -108,6 +108,10 @@ unsafe impl<T: AggregatorPadImpl> IsSubclassable<T> for AggregatorPad {
klass.flush = Some(aggregator_pad_flush::<T>);
klass.skip_buffer = Some(aggregator_pad_skip_buffer::<T>);
}
+
+ fn instance_init(instance: &mut glib::subclass::InitializingObject<T>) {
+ <gst::Pad as IsSubclassable<T>>::instance_init(instance);
+ }
}
unsafe extern "C" fn aggregator_pad_flush<T: AggregatorPadImpl>(
diff --git a/utils/fallbackswitch/src/fallbacksrc/custom_source/imp.rs b/utils/fallbackswitch/src/fallbacksrc/custom_source/imp.rs
index ce7059e3d..f634553fb 100644
--- a/utils/fallbackswitch/src/fallbacksrc/custom_source/imp.rs
+++ b/utils/fallbackswitch/src/fallbacksrc/custom_source/imp.rs
@@ -59,7 +59,6 @@ impl ObjectSubclass for CustomSource {
const NAME: &'static str = "FallbackSrcCustomSource";
type Type = super::CustomSource;
type ParentType = gst::Bin;
- type Instance = gst::subclass::ElementInstanceStruct<Self>;
}
impl ObjectImpl for CustomSource {
diff --git a/utils/fallbackswitch/src/fallbacksrc/imp.rs b/utils/fallbackswitch/src/fallbacksrc/imp.rs
index 7c2e4f316..d85cef12b 100644
--- a/utils/fallbackswitch/src/fallbacksrc/imp.rs
+++ b/utils/fallbackswitch/src/fallbacksrc/imp.rs
@@ -182,7 +182,6 @@ impl ObjectSubclass for FallbackSrc {
const NAME: &'static str = "FallbackSrc";
type Type = super::FallbackSrc;
type ParentType = gst::Bin;
- type Instance = gst::subclass::ElementInstanceStruct<Self>;
}
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 fed4ebd35..800018507 100644
--- a/utils/fallbackswitch/src/fallbacksrc/video_fallback/imp.rs
+++ b/utils/fallbackswitch/src/fallbacksrc/video_fallback/imp.rs
@@ -66,7 +66,6 @@ impl ObjectSubclass for VideoFallbackSource {
const NAME: &'static str = "FallbackSrcVideoFallbackSource";
type Type = super::VideoFallbackSource;
type ParentType = gst::Bin;
- type Instance = gst::subclass::ElementInstanceStruct<Self>;
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 e498d0b9e..0b191a257 100644
--- a/utils/fallbackswitch/src/fallbackswitch/imp.rs
+++ b/utils/fallbackswitch/src/fallbackswitch/imp.rs
@@ -647,7 +647,6 @@ impl ObjectSubclass for FallbackSwitch {
const NAME: &'static str = "FallbackSwitch";
type Type = super::FallbackSwitch;
type ParentType = gst_base::Aggregator;
- type Instance = gst::subclass::ElementInstanceStruct<Self>;
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 3e3d212d1..58b24cf06 100644
--- a/utils/togglerecord/src/togglerecord/imp.rs
+++ b/utils/togglerecord/src/togglerecord/imp.rs
@@ -1621,7 +1621,6 @@ impl ObjectSubclass for ToggleRecord {
const NAME: &'static str = "RsToggleRecord";
type Type = super::ToggleRecord;
type ParentType = gst::Element;
- type Instance = gst::subclass::ElementInstanceStruct<Self>;
fn with_class(klass: &Self::Class) -> Self {
let templ = klass.get_pad_template("sink").unwrap();