From f6cf6c88637c90890bbf1ab8092a0962c744b386 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 16 Oct 2021 14:12:50 +0300 Subject: [PATCH] Improve subclass decide_allocation() / propose_allocation() API The queries passed in are always allocation queries, so don't require implementors to match on that first. --- gstreamer-audio/src/subclass/audio_decoder.rs | 22 ++++++++----- gstreamer-audio/src/subclass/audio_encoder.rs | 22 ++++++++----- gstreamer-base/src/subclass/aggregator.rs | 33 ++++++++++++------- gstreamer-base/src/subclass/base_sink.rs | 11 ++++--- gstreamer-base/src/subclass/base_src.rs | 11 ++++--- gstreamer-base/src/subclass/base_transform.rs | 33 ++++++++++++------- gstreamer-video/src/subclass/video_decoder.rs | 22 ++++++++----- gstreamer-video/src/subclass/video_encoder.rs | 22 ++++++++----- 8 files changed, 112 insertions(+), 64 deletions(-) diff --git a/gstreamer-audio/src/subclass/audio_decoder.rs b/gstreamer-audio/src/subclass/audio_decoder.rs index 9ecb59d2f..940ea2ed5 100644 --- a/gstreamer-audio/src/subclass/audio_decoder.rs +++ b/gstreamer-audio/src/subclass/audio_decoder.rs @@ -87,7 +87,7 @@ pub trait AudioDecoderImpl: AudioDecoderImplExt + ElementImpl { fn propose_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { self.parent_propose_allocation(element, query) } @@ -95,7 +95,7 @@ pub trait AudioDecoderImpl: AudioDecoderImplExt + ElementImpl { fn decide_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { self.parent_decide_allocation(element, query) } @@ -151,13 +151,13 @@ pub trait AudioDecoderImplExt: ObjectSubclass { fn parent_propose_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage>; fn parent_decide_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage>; } @@ -468,7 +468,7 @@ impl AudioDecoderImplExt for T { fn parent_propose_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { unsafe { let data = Self::type_data(); @@ -495,7 +495,7 @@ impl AudioDecoderImplExt for T { fn parent_decide_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { unsafe { let data = Self::type_data(); @@ -830,7 +830,10 @@ unsafe extern "C" fn audio_decoder_propose_allocation( let instance = &*(ptr as *mut T::Instance); let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - let query = gst::QueryRef::from_mut_ptr(query); + let query = match gst::QueryRef::from_mut_ptr(query).view_mut() { + gst::QueryView::Allocation(allocation) => allocation, + _ => unreachable!(), + }; gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.propose_allocation(wrap.unsafe_cast_ref(), query) { @@ -851,7 +854,10 @@ unsafe extern "C" fn audio_decoder_decide_allocation( let instance = &*(ptr as *mut T::Instance); let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - let query = gst::QueryRef::from_mut_ptr(query); + let query = match gst::QueryRef::from_mut_ptr(query).view_mut() { + gst::QueryView::Allocation(allocation) => allocation, + _ => unreachable!(), + }; gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.decide_allocation(wrap.unsafe_cast_ref(), query) { diff --git a/gstreamer-audio/src/subclass/audio_encoder.rs b/gstreamer-audio/src/subclass/audio_encoder.rs index 6471cc0e2..44d800b59 100644 --- a/gstreamer-audio/src/subclass/audio_encoder.rs +++ b/gstreamer-audio/src/subclass/audio_encoder.rs @@ -79,7 +79,7 @@ pub trait AudioEncoderImpl: AudioEncoderImplExt + ElementImpl { fn propose_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { self.parent_propose_allocation(element, query) } @@ -87,7 +87,7 @@ pub trait AudioEncoderImpl: AudioEncoderImplExt + ElementImpl { fn decide_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { self.parent_decide_allocation(element, query) } @@ -137,13 +137,13 @@ pub trait AudioEncoderImplExt: ObjectSubclass { fn parent_propose_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage>; fn parent_decide_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage>; } @@ -418,7 +418,7 @@ impl AudioEncoderImplExt for T { fn parent_propose_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { unsafe { let data = Self::type_data(); @@ -445,7 +445,7 @@ impl AudioEncoderImplExt for T { fn parent_decide_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { unsafe { let data = Self::type_data(); @@ -750,7 +750,10 @@ unsafe extern "C" fn audio_encoder_propose_allocation( let instance = &*(ptr as *mut T::Instance); let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - let query = gst::QueryRef::from_mut_ptr(query); + let query = match gst::QueryRef::from_mut_ptr(query).view_mut() { + gst::QueryView::Allocation(allocation) => allocation, + _ => unreachable!(), + }; gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.propose_allocation(wrap.unsafe_cast_ref(), query) { @@ -771,7 +774,10 @@ unsafe extern "C" fn audio_encoder_decide_allocation( let instance = &*(ptr as *mut T::Instance); let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - let query = gst::QueryRef::from_mut_ptr(query); + let query = match gst::QueryRef::from_mut_ptr(query).view_mut() { + gst::QueryView::Allocation(allocation) => allocation, + _ => unreachable!(), + }; gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.decide_allocation(wrap.unsafe_cast_ref(), query) { diff --git a/gstreamer-base/src/subclass/aggregator.rs b/gstreamer-base/src/subclass/aggregator.rs index 091262972..bb3302a54 100644 --- a/gstreamer-base/src/subclass/aggregator.rs +++ b/gstreamer-base/src/subclass/aggregator.rs @@ -153,8 +153,8 @@ pub trait AggregatorImpl: AggregatorImplExt + ElementImpl { &self, element: &Self::Type, pad: &AggregatorPad, - decide_query: &gst::QueryRef, - query: &mut gst::QueryRef, + decide_query: gst::query::Allocation<&gst::QueryRef>, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { self.parent_propose_allocation(element, pad, decide_query, query) } @@ -162,7 +162,7 @@ pub trait AggregatorImpl: AggregatorImplExt + ElementImpl { fn decide_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { self.parent_decide_allocation(element, query) } @@ -289,14 +289,14 @@ pub trait AggregatorImplExt: ObjectSubclass { &self, element: &Self::Type, pad: &AggregatorPad, - decide_query: &gst::QueryRef, - query: &mut gst::QueryRef, + decide_query: gst::query::Allocation<&gst::QueryRef>, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage>; fn parent_decide_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage>; #[cfg(any(feature = "v1_18", feature = "dox"))] @@ -692,8 +692,8 @@ impl AggregatorImplExt for T { &self, element: &Self::Type, pad: &AggregatorPad, - decide_query: &gst::QueryRef, - query: &mut gst::QueryRef, + decide_query: gst::query::Allocation<&gst::QueryRef>, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { unsafe { let data = Self::type_data(); @@ -722,7 +722,7 @@ impl AggregatorImplExt for T { fn parent_decide_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { unsafe { let data = Self::type_data(); @@ -1176,8 +1176,14 @@ unsafe extern "C" fn aggregator_propose_allocation( let instance = &*(ptr as *mut T::Instance); let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - let decide_query = gst::QueryRef::from_ptr(decide_query); - let query = gst::QueryRef::from_mut_ptr(query); + let decide_query = match gst::QueryRef::from_ptr(decide_query).view() { + gst::QueryView::Allocation(allocation) => allocation, + _ => unreachable!(), + }; + let query = match gst::QueryRef::from_mut_ptr(query).view_mut() { + gst::QueryView::Allocation(allocation) => allocation, + _ => unreachable!(), + }; gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.propose_allocation( @@ -1203,7 +1209,10 @@ unsafe extern "C" fn aggregator_decide_allocation( let instance = &*(ptr as *mut T::Instance); let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - let query = gst::QueryRef::from_mut_ptr(query); + let query = match gst::QueryRef::from_mut_ptr(query).view_mut() { + gst::QueryView::Allocation(allocation) => allocation, + _ => unreachable!(), + }; gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.decide_allocation(wrap.unsafe_cast_ref(), query) { diff --git a/gstreamer-base/src/subclass/base_sink.rs b/gstreamer-base/src/subclass/base_sink.rs index 54065e86c..78a9f5b03 100644 --- a/gstreamer-base/src/subclass/base_sink.rs +++ b/gstreamer-base/src/subclass/base_sink.rs @@ -81,7 +81,7 @@ pub trait BaseSinkImpl: BaseSinkImplExt + ElementImpl { fn propose_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { self.parent_propose_allocation(element, query) } @@ -137,7 +137,7 @@ pub trait BaseSinkImplExt: ObjectSubclass { fn parent_propose_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage>; } @@ -403,7 +403,7 @@ impl BaseSinkImplExt for T { fn parent_propose_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { unsafe { let data = Self::type_data(); @@ -677,7 +677,10 @@ unsafe extern "C" fn base_sink_propose_allocation( let instance = &*(ptr as *mut T::Instance); let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - let query = gst::QueryRef::from_mut_ptr(query); + let query = match gst::QueryRef::from_mut_ptr(query).view_mut() { + gst::QueryView::Allocation(allocation) => allocation, + _ => unreachable!(), + }; gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.propose_allocation(wrap.unsafe_cast_ref(), query) { diff --git a/gstreamer-base/src/subclass/base_src.rs b/gstreamer-base/src/subclass/base_src.rs index 310a97e86..74a0c313c 100644 --- a/gstreamer-base/src/subclass/base_src.rs +++ b/gstreamer-base/src/subclass/base_src.rs @@ -111,7 +111,7 @@ pub trait BaseSrcImpl: BaseSrcImplExt + ElementImpl { fn decide_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { self.parent_decide_allocation(element, query) } @@ -180,7 +180,7 @@ pub trait BaseSrcImplExt: ObjectSubclass { fn parent_decide_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage>; } @@ -587,7 +587,7 @@ impl BaseSrcImplExt for T { fn parent_decide_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { unsafe { let data = Self::type_data(); @@ -1025,7 +1025,10 @@ unsafe extern "C" fn base_src_decide_allocation( let instance = &*(ptr as *mut T::Instance); let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - let query = gst::QueryRef::from_mut_ptr(query); + let query = match gst::QueryRef::from_mut_ptr(query).view_mut() { + gst::QueryView::Allocation(allocation) => allocation, + _ => unreachable!(), + }; gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.decide_allocation(wrap.unsafe_cast_ref(), query) { diff --git a/gstreamer-base/src/subclass/base_transform.rs b/gstreamer-base/src/subclass/base_transform.rs index 8b092bc50..0679c9f97 100644 --- a/gstreamer-base/src/subclass/base_transform.rs +++ b/gstreamer-base/src/subclass/base_transform.rs @@ -138,8 +138,8 @@ pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl { fn propose_allocation( &self, element: &Self::Type, - decide_query: &gst::QueryRef, - query: &mut gst::QueryRef, + decide_query: gst::query::Allocation<&gst::QueryRef>, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { self.parent_propose_allocation(element, decide_query, query) } @@ -147,7 +147,7 @@ pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl { fn decide_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { self.parent_decide_allocation(element, query) } @@ -277,14 +277,14 @@ pub trait BaseTransformImplExt: ObjectSubclass { fn parent_propose_allocation( &self, element: &Self::Type, - decide_query: &gst::QueryRef, - query: &mut gst::QueryRef, + decide_query: gst::query::Allocation<&gst::QueryRef>, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage>; fn parent_decide_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage>; fn parent_copy_metadata( @@ -717,8 +717,8 @@ impl BaseTransformImplExt for T { fn parent_propose_allocation( &self, element: &Self::Type, - decide_query: &gst::QueryRef, - query: &mut gst::QueryRef, + decide_query: gst::query::Allocation<&gst::QueryRef>, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { unsafe { let data = Self::type_data(); @@ -746,7 +746,7 @@ impl BaseTransformImplExt for T { fn parent_decide_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { unsafe { let data = Self::type_data(); @@ -1327,8 +1327,14 @@ unsafe extern "C" fn base_transform_propose_allocation( let instance = &*(ptr as *mut T::Instance); let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - let decide_query = gst::QueryRef::from_ptr(decide_query); - let query = gst::QueryRef::from_mut_ptr(query); + let decide_query = match gst::QueryRef::from_ptr(decide_query).view() { + gst::QueryView::Allocation(allocation) => allocation, + _ => unreachable!(), + }; + let query = match gst::QueryRef::from_mut_ptr(query).view_mut() { + gst::QueryView::Allocation(allocation) => allocation, + _ => unreachable!(), + }; gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.propose_allocation(wrap.unsafe_cast_ref(), decide_query, query) { @@ -1349,7 +1355,10 @@ unsafe extern "C" fn base_transform_decide_allocation( let instance = &*(ptr as *mut T::Instance); let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - let query = gst::QueryRef::from_mut_ptr(query); + let query = match gst::QueryRef::from_mut_ptr(query).view_mut() { + gst::QueryView::Allocation(allocation) => allocation, + _ => unreachable!(), + }; gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.decide_allocation(wrap.unsafe_cast_ref(), query) { diff --git a/gstreamer-video/src/subclass/video_decoder.rs b/gstreamer-video/src/subclass/video_decoder.rs index f82d7a854..8263e2a09 100644 --- a/gstreamer-video/src/subclass/video_decoder.rs +++ b/gstreamer-video/src/subclass/video_decoder.rs @@ -91,7 +91,7 @@ pub trait VideoDecoderImpl: VideoDecoderImplExt + ElementImpl { fn propose_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { self.parent_propose_allocation(element, query) } @@ -99,7 +99,7 @@ pub trait VideoDecoderImpl: VideoDecoderImplExt + ElementImpl { fn decide_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { self.parent_decide_allocation(element, query) } @@ -166,13 +166,13 @@ pub trait VideoDecoderImplExt: ObjectSubclass { fn parent_propose_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage>; fn parent_decide_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage>; #[cfg(any(feature = "v1_20", feature = "dox"))] @@ -494,7 +494,7 @@ impl VideoDecoderImplExt for T { fn parent_propose_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { unsafe { let data = Self::type_data(); @@ -521,7 +521,7 @@ impl VideoDecoderImplExt for T { fn parent_decide_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { unsafe { let data = Self::type_data(); @@ -878,7 +878,10 @@ unsafe extern "C" fn video_decoder_propose_allocation( let instance = &*(ptr as *mut T::Instance); let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - let query = gst::QueryRef::from_mut_ptr(query); + let query = match gst::QueryRef::from_mut_ptr(query).view_mut() { + gst::QueryView::Allocation(allocation) => allocation, + _ => unreachable!(), + }; gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.propose_allocation(wrap.unsafe_cast_ref(), query) { @@ -899,7 +902,10 @@ unsafe extern "C" fn video_decoder_decide_allocation( let instance = &*(ptr as *mut T::Instance); let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - let query = gst::QueryRef::from_mut_ptr(query); + let query = match gst::QueryRef::from_mut_ptr(query).view_mut() { + gst::QueryView::Allocation(allocation) => allocation, + _ => unreachable!(), + }; gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.decide_allocation(wrap.unsafe_cast_ref(), query) { diff --git a/gstreamer-video/src/subclass/video_encoder.rs b/gstreamer-video/src/subclass/video_encoder.rs index e919fc46f..93f769082 100644 --- a/gstreamer-video/src/subclass/video_encoder.rs +++ b/gstreamer-video/src/subclass/video_encoder.rs @@ -77,7 +77,7 @@ pub trait VideoEncoderImpl: VideoEncoderImplExt + ElementImpl { fn propose_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { self.parent_propose_allocation(element, query) } @@ -85,7 +85,7 @@ pub trait VideoEncoderImpl: VideoEncoderImplExt + ElementImpl { fn decide_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { self.parent_decide_allocation(element, query) } @@ -131,13 +131,13 @@ pub trait VideoEncoderImplExt: ObjectSubclass { fn parent_propose_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage>; fn parent_decide_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage>; } @@ -410,7 +410,7 @@ impl VideoEncoderImplExt for T { fn parent_propose_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { unsafe { let data = Self::type_data(); @@ -437,7 +437,7 @@ impl VideoEncoderImplExt for T { fn parent_decide_allocation( &self, element: &Self::Type, - query: &mut gst::QueryRef, + query: gst::query::Allocation<&mut gst::QueryRef>, ) -> Result<(), gst::ErrorMessage> { unsafe { let data = Self::type_data(); @@ -730,7 +730,10 @@ unsafe extern "C" fn video_encoder_propose_allocation( let instance = &*(ptr as *mut T::Instance); let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - let query = gst::QueryRef::from_mut_ptr(query); + let query = match gst::QueryRef::from_mut_ptr(query).view_mut() { + gst::QueryView::Allocation(allocation) => allocation, + _ => unreachable!(), + }; gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.propose_allocation(wrap.unsafe_cast_ref(), query) { @@ -751,7 +754,10 @@ unsafe extern "C" fn video_encoder_decide_allocation( let instance = &*(ptr as *mut T::Instance); let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - let query = gst::QueryRef::from_mut_ptr(query); + let query = match gst::QueryRef::from_mut_ptr(query).view_mut() { + gst::QueryView::Allocation(allocation) => allocation, + _ => unreachable!(), + }; gst::panic_to_error!(&wrap, imp.panicked(), false, { match imp.decide_allocation(wrap.unsafe_cast_ref(), query) {