subclass: remove get prefix where applicable

This commit is contained in:
François Laignel 2021-04-14 22:30:38 +02:00
parent f7472c82e3
commit b8b944b72b
20 changed files with 105 additions and 123 deletions

View file

@ -65,8 +65,8 @@ pub trait AudioDecoderImpl: AudioDecoderImplExt + ElementImpl {
self.parent_negotiate(element) self.parent_negotiate(element)
} }
fn get_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps { fn caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps {
self.parent_get_caps(element, filter) self.parent_caps(element, filter)
} }
fn sink_event(&self, element: &Self::Type, event: gst::Event) -> bool { fn sink_event(&self, element: &Self::Type, event: gst::Event) -> bool {
@ -139,7 +139,7 @@ pub trait AudioDecoderImplExt: ObjectSubclass {
fn parent_negotiate(&self, element: &Self::Type) -> Result<(), gst::LoggableError>; fn parent_negotiate(&self, element: &Self::Type) -> Result<(), gst::LoggableError>;
fn parent_get_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps; fn parent_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps;
fn parent_sink_event(&self, element: &Self::Type, event: gst::Event) -> bool; fn parent_sink_event(&self, element: &Self::Type, event: gst::Event) -> bool;
@ -399,7 +399,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
} }
} }
fn parent_get_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps { fn parent_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioDecoderClass; let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioDecoderClass;

View file

@ -57,8 +57,8 @@ pub trait AudioEncoderImpl: AudioEncoderImplExt + ElementImpl {
self.parent_negotiate(element) self.parent_negotiate(element)
} }
fn get_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps { fn caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps {
self.parent_get_caps(element, filter) self.parent_caps(element, filter)
} }
fn sink_event(&self, element: &Self::Type, event: gst::Event) -> bool { fn sink_event(&self, element: &Self::Type, event: gst::Event) -> bool {
@ -125,7 +125,7 @@ pub trait AudioEncoderImplExt: ObjectSubclass {
fn parent_negotiate(&self, element: &Self::Type) -> Result<(), gst::LoggableError>; fn parent_negotiate(&self, element: &Self::Type) -> Result<(), gst::LoggableError>;
fn parent_get_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps; fn parent_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps;
fn parent_sink_event(&self, element: &Self::Type, event: gst::Event) -> bool; fn parent_sink_event(&self, element: &Self::Type, event: gst::Event) -> bool;
@ -345,7 +345,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
} }
} }
fn parent_get_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps { fn parent_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioEncoderClass; let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioEncoderClass;

View file

@ -35,11 +35,11 @@ pub trait AggregatorExtManual: 'static {
#[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg(any(feature = "v1_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
fn property_min_upstream_latency(&self) -> gst::ClockTime; fn min_upstream_latency(&self) -> gst::ClockTime;
#[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg(any(feature = "v1_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
fn set_property_min_upstream_latency(&self, min_upstream_latency: gst::ClockTime); fn set_min_upstream_latency(&self, min_upstream_latency: gst::ClockTime);
#[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg(any(feature = "v1_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
@ -124,7 +124,7 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
#[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg(any(feature = "v1_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
fn property_min_upstream_latency(&self) -> gst::ClockTime { fn min_upstream_latency(&self) -> gst::ClockTime {
unsafe { unsafe {
let mut value = Value::from_type(<gst::ClockTime as StaticType>::static_type()); let mut value = Value::from_type(<gst::ClockTime as StaticType>::static_type());
glib::gobject_ffi::g_object_get_property( glib::gobject_ffi::g_object_get_property(
@ -134,14 +134,14 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
); );
value value
.get() .get()
.expect("AggregatorExtManual::get_property_min_upstream_latency") .expect("AggregatorExtManual::min_upstream_latency")
.unwrap() .unwrap()
} }
} }
#[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg(any(feature = "v1_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
fn set_property_min_upstream_latency(&self, min_upstream_latency: gst::ClockTime) { fn set_min_upstream_latency(&self, min_upstream_latency: gst::ClockTime) {
unsafe { unsafe {
glib::gobject_ffi::g_object_set_property( glib::gobject_ffi::g_object_set_property(
self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,

View file

@ -26,7 +26,7 @@ glib::wrapper! {
} }
} }
}, },
get_type => || ffi::gst_flow_combiner_get_type(), type_ => || ffi::gst_flow_combiner_get_type(),
} }
} }

View file

@ -116,8 +116,8 @@ pub trait AggregatorImpl: AggregatorImplExt + ElementImpl {
self.parent_stop(aggregator) self.parent_stop(aggregator)
} }
fn get_next_time(&self, aggregator: &Self::Type) -> gst::ClockTime { fn next_time(&self, aggregator: &Self::Type) -> gst::ClockTime {
self.parent_get_next_time(aggregator) self.parent_next_time(aggregator)
} }
fn create_new_pad( fn create_new_pad(
@ -244,7 +244,7 @@ pub trait AggregatorImplExt: ObjectSubclass {
fn parent_stop(&self, aggregator: &Self::Type) -> Result<(), gst::ErrorMessage>; fn parent_stop(&self, aggregator: &Self::Type) -> Result<(), gst::ErrorMessage>;
fn parent_get_next_time(&self, aggregator: &Self::Type) -> gst::ClockTime; fn parent_next_time(&self, aggregator: &Self::Type) -> gst::ClockTime;
fn parent_create_new_pad( fn parent_create_new_pad(
&self, &self,
@ -563,7 +563,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
} }
} }
fn parent_get_next_time(&self, aggregator: &Self::Type) -> gst::ClockTime { fn parent_next_time(&self, aggregator: &Self::Type) -> gst::ClockTime {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass; let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass;
@ -994,7 +994,7 @@ unsafe extern "C" fn aggregator_get_next_time<T: AggregatorImpl>(
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::CLOCK_TIME_NONE, { gst::panic_to_error!(&wrap, &imp.panicked(), gst::CLOCK_TIME_NONE, {
imp.get_next_time(wrap.unsafe_cast_ref()) imp.next_time(wrap.unsafe_cast_ref())
}) })
.to_glib() .to_glib()
} }

View file

@ -59,8 +59,8 @@ pub trait BaseSinkImpl: BaseSinkImplExt + ElementImpl {
self.parent_event(element, event) self.parent_event(element, event)
} }
fn get_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> Option<gst::Caps> { fn caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> Option<gst::Caps> {
self.parent_get_caps(element, filter) self.parent_caps(element, filter)
} }
fn set_caps(&self, element: &Self::Type, caps: &gst::Caps) -> Result<(), gst::LoggableError> { fn set_caps(&self, element: &Self::Type, caps: &gst::Caps) -> Result<(), gst::LoggableError> {
@ -113,11 +113,7 @@ pub trait BaseSinkImplExt: ObjectSubclass {
fn parent_event(&self, element: &Self::Type, event: gst::Event) -> bool; fn parent_event(&self, element: &Self::Type, event: gst::Event) -> bool;
fn parent_get_caps( fn parent_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> Option<gst::Caps>;
&self,
element: &Self::Type,
filter: Option<&gst::Caps>,
) -> Option<gst::Caps>;
fn parent_set_caps( fn parent_set_caps(
&self, &self,
@ -299,11 +295,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
} }
} }
fn parent_get_caps( fn parent_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> Option<gst::Caps> {
&self,
element: &Self::Type,
filter: Option<&gst::Caps>,
) -> Option<gst::Caps> {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSinkClass; let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSinkClass;

View file

@ -31,8 +31,8 @@ pub trait BaseSrcImpl: BaseSrcImplExt + ElementImpl {
self.parent_is_seekable(element) self.parent_is_seekable(element)
} }
fn get_size(&self, element: &Self::Type) -> Option<u64> { fn size(&self, element: &Self::Type) -> Option<u64> {
self.parent_get_size(element) self.parent_size(element)
} }
fn get_times( fn get_times(
@ -40,7 +40,7 @@ pub trait BaseSrcImpl: BaseSrcImplExt + ElementImpl {
element: &Self::Type, element: &Self::Type,
buffer: &gst::BufferRef, buffer: &gst::BufferRef,
) -> (gst::ClockTime, gst::ClockTime) { ) -> (gst::ClockTime, gst::ClockTime) {
self.parent_get_times(element, buffer) self.parent_times(element, buffer)
} }
fn fill( fn fill(
@ -84,8 +84,8 @@ pub trait BaseSrcImpl: BaseSrcImplExt + ElementImpl {
self.parent_event(element, event) self.parent_event(element, event)
} }
fn get_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> Option<gst::Caps> { fn caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> Option<gst::Caps> {
self.parent_get_caps(element, filter) self.parent_caps(element, filter)
} }
fn negotiate(&self, element: &Self::Type) -> Result<(), gst::LoggableError> { fn negotiate(&self, element: &Self::Type) -> Result<(), gst::LoggableError> {
@ -116,9 +116,9 @@ pub trait BaseSrcImplExt: ObjectSubclass {
fn parent_is_seekable(&self, element: &Self::Type) -> bool; fn parent_is_seekable(&self, element: &Self::Type) -> bool;
fn parent_get_size(&self, element: &Self::Type) -> Option<u64>; fn parent_size(&self, element: &Self::Type) -> Option<u64>;
fn parent_get_times( fn parent_times(
&self, &self,
element: &Self::Type, element: &Self::Type,
buffer: &gst::BufferRef, buffer: &gst::BufferRef,
@ -153,11 +153,7 @@ pub trait BaseSrcImplExt: ObjectSubclass {
fn parent_event(&self, element: &Self::Type, event: &gst::Event) -> bool; fn parent_event(&self, element: &Self::Type, event: &gst::Event) -> bool;
fn parent_get_caps( fn parent_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> Option<gst::Caps>;
&self,
element: &Self::Type,
filter: Option<&gst::Caps>,
) -> Option<gst::Caps>;
fn parent_negotiate(&self, element: &Self::Type) -> Result<(), gst::LoggableError>; fn parent_negotiate(&self, element: &Self::Type) -> Result<(), gst::LoggableError>;
@ -226,7 +222,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
} }
} }
fn parent_get_size(&self, element: &Self::Type) -> Option<u64> { fn parent_size(&self, element: &Self::Type) -> Option<u64> {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSrcClass; let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSrcClass;
@ -247,7 +243,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
} }
} }
fn parent_get_times( fn parent_times(
&self, &self,
element: &Self::Type, element: &Self::Type,
buffer: &gst::BufferRef, buffer: &gst::BufferRef,
@ -462,11 +458,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
} }
} }
fn parent_get_caps( fn parent_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> Option<gst::Caps> {
&self,
element: &Self::Type,
filter: Option<&gst::Caps>,
) -> Option<gst::Caps> {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSrcClass; let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSrcClass;
@ -668,7 +660,7 @@ unsafe extern "C" fn base_src_get_size<T: BaseSrcImpl>(
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
match imp.get_size(wrap.unsafe_cast_ref()) { match imp.size(wrap.unsafe_cast_ref()) {
Some(s) => { Some(s) => {
*size = s; *size = s;
true true

View file

@ -91,8 +91,8 @@ pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl {
self.parent_transform_size(element, direction, caps, size, othercaps) self.parent_transform_size(element, direction, caps, size, othercaps)
} }
fn get_unit_size(&self, element: &Self::Type, caps: &gst::Caps) -> Option<usize> { fn unit_size(&self, element: &Self::Type, caps: &gst::Caps) -> Option<usize> {
self.parent_get_unit_size(element, caps) self.parent_unit_size(element, caps)
} }
fn sink_event(&self, element: &Self::Type, event: gst::Event) -> bool { fn sink_event(&self, element: &Self::Type, event: gst::Event) -> bool {
@ -227,7 +227,7 @@ pub trait BaseTransformImplExt: ObjectSubclass {
othercaps: &gst::Caps, othercaps: &gst::Caps,
) -> Option<usize>; ) -> Option<usize>;
fn parent_get_unit_size(&self, element: &Self::Type, caps: &gst::Caps) -> Option<usize>; fn parent_unit_size(&self, element: &Self::Type, caps: &gst::Caps) -> Option<usize>;
fn parent_sink_event(&self, element: &Self::Type, event: gst::Event) -> bool; fn parent_sink_event(&self, element: &Self::Type, event: gst::Event) -> bool;
@ -496,7 +496,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
} }
} }
fn parent_get_unit_size(&self, element: &Self::Type, caps: &gst::Caps) -> Option<usize> { fn parent_unit_size(&self, element: &Self::Type, caps: &gst::Caps) -> Option<usize> {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass; let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass;

View file

@ -9,7 +9,7 @@ glib::wrapper! {
match fn { match fn {
copy => |ptr| ffi::gst_control_point_copy(mut_override(ptr)), copy => |ptr| ffi::gst_control_point_copy(mut_override(ptr)),
free => |ptr| ffi::gst_control_point_free(ptr), free => |ptr| ffi::gst_control_point_free(ptr),
get_type => || ffi::gst_control_point_get_type(), type_ => || ffi::gst_control_point_get_type(),
} }
} }

View file

@ -36,9 +36,7 @@ impl<T: PlayerVideoRendererImpl> PlayerVideoRendererImplExt for T {
) -> gst::Element { ) -> gst::Element {
unsafe { unsafe {
let type_data = Self::type_data(); let type_data = Self::type_data();
let parent_iface = type_data let parent_iface = type_data.as_ref().parent_interface::<PlayerVideoRenderer>()
.as_ref()
.get_parent_interface::<PlayerVideoRenderer>()
as *const ffi::GstPlayerVideoRendererInterface; as *const ffi::GstPlayerVideoRendererInterface;
let func = (*parent_iface) let func = (*parent_iface)

View file

@ -81,8 +81,8 @@ pub trait RTSPClientImpl: RTSPClientImplExt + ObjectImpl + Send + Sync {
self.parent_set_parameter_request(client, ctx); self.parent_set_parameter_request(client, ctx);
} }
fn get_parameter_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { fn parameter_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) {
self.parent_get_parameter_request(client, ctx); self.parent_parameter_request(client, ctx);
} }
fn announce_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { fn announce_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) {
@ -253,7 +253,7 @@ pub trait RTSPClientImplExt: ObjectSubclass {
fn parent_set_parameter_request(&self, client: &Self::Type, ctx: &crate::RTSPContext); fn parent_set_parameter_request(&self, client: &Self::Type, ctx: &crate::RTSPContext);
fn parent_get_parameter_request(&self, client: &Self::Type, ctx: &crate::RTSPContext); fn parent_parameter_request(&self, client: &Self::Type, ctx: &crate::RTSPContext);
fn parent_announce_request(&self, client: &Self::Type, ctx: &crate::RTSPContext); fn parent_announce_request(&self, client: &Self::Type, ctx: &crate::RTSPContext);
@ -560,7 +560,7 @@ impl<T: RTSPClientImpl> RTSPClientImplExt for T {
} }
} }
fn parent_get_parameter_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { fn parent_parameter_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass;

View file

@ -30,7 +30,7 @@ glib::wrapper! {
copy copy
}, },
free => |ptr| assert_eq!(ffi::gst_sdp_message_free(ptr), ffi::GST_SDP_OK), free => |ptr| assert_eq!(ffi::gst_sdp_message_free(ptr), ffi::GST_SDP_OK),
get_type => || ffi::gst_sdp_message_get_type(), type_ => || ffi::gst_sdp_message_get_type(),
} }
} }

View file

@ -70,8 +70,8 @@ pub trait VideoDecoderImpl: VideoDecoderImplExt + ElementImpl {
self.parent_negotiate(element) self.parent_negotiate(element)
} }
fn get_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps { fn caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps {
self.parent_get_caps(element, filter) self.parent_caps(element, filter)
} }
fn sink_event(&self, element: &Self::Type, event: gst::Event) -> bool { fn sink_event(&self, element: &Self::Type, event: gst::Event) -> bool {
@ -144,7 +144,7 @@ pub trait VideoDecoderImplExt: ObjectSubclass {
fn parent_negotiate(&self, element: &Self::Type) -> Result<(), gst::LoggableError>; fn parent_negotiate(&self, element: &Self::Type) -> Result<(), gst::LoggableError>;
fn parent_get_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps; fn parent_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps;
fn parent_sink_event(&self, element: &Self::Type, event: gst::Event) -> bool; fn parent_sink_event(&self, element: &Self::Type, event: gst::Event) -> bool;
@ -401,7 +401,7 @@ impl<T: VideoDecoderImpl> VideoDecoderImplExt for T {
} }
} }
fn parent_get_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps { fn parent_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoDecoderClass; let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoDecoderClass;

View file

@ -56,8 +56,8 @@ pub trait VideoEncoderImpl: VideoEncoderImplExt + ElementImpl {
self.parent_negotiate(element) self.parent_negotiate(element)
} }
fn get_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps { fn caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps {
self.parent_get_caps(element, filter) self.parent_caps(element, filter)
} }
fn sink_event(&self, element: &Self::Type, event: gst::Event) -> bool { fn sink_event(&self, element: &Self::Type, event: gst::Event) -> bool {
@ -120,7 +120,7 @@ pub trait VideoEncoderImplExt: ObjectSubclass {
fn parent_negotiate(&self, element: &Self::Type) -> Result<(), gst::LoggableError>; fn parent_negotiate(&self, element: &Self::Type) -> Result<(), gst::LoggableError>;
fn parent_get_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps; fn parent_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps;
fn parent_sink_event(&self, element: &Self::Type, event: gst::Event) -> bool; fn parent_sink_event(&self, element: &Self::Type, event: gst::Event) -> bool;
@ -335,7 +335,7 @@ impl<T: VideoEncoderImpl> VideoEncoderImplExt for T {
} }
} }
fn parent_get_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps { fn parent_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoEncoderClass; let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoEncoderClass;

View file

@ -17,7 +17,7 @@ glib::wrapper! {
} }
}, },
free => |ptr| ffi::gst_parse_context_free(ptr), free => |ptr| ffi::gst_parse_context_free(ptr),
get_type => || ffi::gst_parse_context_get_type(), type_ => || ffi::gst_parse_context_get_type(),
} }
} }

View file

@ -17,7 +17,7 @@ glib::wrapper! {
match fn { match fn {
ref => |ptr| ffi::gst_mini_object_ref(ptr as *mut _), ref => |ptr| ffi::gst_mini_object_ref(ptr as *mut _),
unref => |ptr| ffi::gst_mini_object_unref(ptr as *mut _), unref => |ptr| ffi::gst_mini_object_unref(ptr as *mut _),
get_type => || ffi::gst_promise_get_type(), type_ => || ffi::gst_promise_get_type(),
} }
} }

View file

@ -7,12 +7,12 @@ use glib::translate::*;
use crate::ChildProxy; use crate::ChildProxy;
pub trait ChildProxyImpl: ObjectImpl + Send + Sync { pub trait ChildProxyImpl: ObjectImpl + Send + Sync {
fn get_child_by_name(&self, object: &Self::Type, name: &str) -> Option<glib::Object> { fn child_by_name(&self, object: &Self::Type, name: &str) -> Option<glib::Object> {
self.parent_get_child_by_name(object, name) self.parent_child_by_name(object, name)
} }
fn get_child_by_index(&self, object: &Self::Type, index: u32) -> Option<glib::Object>; fn child_by_index(&self, object: &Self::Type, index: u32) -> Option<glib::Object>;
fn get_children_count(&self, object: &Self::Type) -> u32; fn children_count(&self, object: &Self::Type) -> u32;
fn child_added(&self, object: &Self::Type, child: &glib::Object, name: &str) { fn child_added(&self, object: &Self::Type, child: &glib::Object, name: &str) {
self.parent_child_added(object, child, name); self.parent_child_added(object, child, name);
@ -23,25 +23,25 @@ pub trait ChildProxyImpl: ObjectImpl + Send + Sync {
} }
pub trait ChildProxyImplExt: ObjectSubclass { pub trait ChildProxyImplExt: ObjectSubclass {
fn parent_get_child_by_name(&self, object: &Self::Type, name: &str) -> Option<glib::Object>; fn parent_child_by_name(&self, object: &Self::Type, name: &str) -> Option<glib::Object>;
fn parent_get_child_by_index(&self, object: &Self::Type, index: u32) -> Option<glib::Object>; fn parent_child_by_index(&self, object: &Self::Type, index: u32) -> Option<glib::Object>;
fn parent_get_children_count(&self, object: &Self::Type) -> u32; fn parent_children_count(&self, object: &Self::Type) -> u32;
fn parent_child_added(&self, _object: &Self::Type, _child: &glib::Object, _name: &str); fn parent_child_added(&self, _object: &Self::Type, _child: &glib::Object, _name: &str);
fn parent_child_removed(&self, _object: &Self::Type, _child: &glib::Object, _name: &str); fn parent_child_removed(&self, _object: &Self::Type, _child: &glib::Object, _name: &str);
} }
impl<T: ChildProxyImpl> ChildProxyImplExt for T { impl<T: ChildProxyImpl> ChildProxyImplExt for T {
fn parent_get_child_by_name(&self, object: &Self::Type, name: &str) -> Option<glib::Object> { fn parent_child_by_name(&self, object: &Self::Type, name: &str) -> Option<glib::Object> {
unsafe { unsafe {
let type_data = Self::type_data(); let type_data = Self::type_data();
let parent_iface = type_data.as_ref().get_parent_interface::<ChildProxy>() let parent_iface = type_data.as_ref().parent_interface::<ChildProxy>()
as *const ffi::GstChildProxyInterface; as *const ffi::GstChildProxyInterface;
let func = (*parent_iface) let func = (*parent_iface)
.get_child_by_name .get_child_by_name
.expect("no parent \"get_child_by_name\" implementation"); .expect("no parent \"child_by_name\" implementation");
let ret = func( let ret = func(
object.unsafe_cast_ref::<ChildProxy>().to_glib_none().0, object.unsafe_cast_ref::<ChildProxy>().to_glib_none().0,
name.to_glib_none().0, name.to_glib_none().0,
@ -50,15 +50,15 @@ impl<T: ChildProxyImpl> ChildProxyImplExt for T {
} }
} }
fn parent_get_child_by_index(&self, object: &Self::Type, index: u32) -> Option<glib::Object> { fn parent_child_by_index(&self, object: &Self::Type, index: u32) -> Option<glib::Object> {
unsafe { unsafe {
let type_data = Self::type_data(); let type_data = Self::type_data();
let parent_iface = type_data.as_ref().get_parent_interface::<ChildProxy>() let parent_iface = type_data.as_ref().parent_interface::<ChildProxy>()
as *const ffi::GstChildProxyInterface; as *const ffi::GstChildProxyInterface;
let func = (*parent_iface) let func = (*parent_iface)
.get_child_by_index .get_child_by_index
.expect("no parent \"get_child_by_index\" implementation"); .expect("no parent \"child_by_index\" implementation");
let ret = func( let ret = func(
object.unsafe_cast_ref::<ChildProxy>().to_glib_none().0, object.unsafe_cast_ref::<ChildProxy>().to_glib_none().0,
index, index,
@ -67,15 +67,15 @@ impl<T: ChildProxyImpl> ChildProxyImplExt for T {
} }
} }
fn parent_get_children_count(&self, object: &Self::Type) -> u32 { fn parent_children_count(&self, object: &Self::Type) -> u32 {
unsafe { unsafe {
let type_data = Self::type_data(); let type_data = Self::type_data();
let parent_iface = type_data.as_ref().get_parent_interface::<ChildProxy>() let parent_iface = type_data.as_ref().parent_interface::<ChildProxy>()
as *const ffi::GstChildProxyInterface; as *const ffi::GstChildProxyInterface;
let func = (*parent_iface) let func = (*parent_iface)
.get_children_count .get_children_count
.expect("no parent \"get_children_count\" implementation"); .expect("no parent \"children_count\" implementation");
func(object.unsafe_cast_ref::<ChildProxy>().to_glib_none().0) func(object.unsafe_cast_ref::<ChildProxy>().to_glib_none().0)
} }
} }
@ -83,7 +83,7 @@ impl<T: ChildProxyImpl> ChildProxyImplExt for T {
fn parent_child_added(&self, object: &Self::Type, child: &glib::Object, name: &str) { fn parent_child_added(&self, object: &Self::Type, child: &glib::Object, name: &str) {
unsafe { unsafe {
let type_data = Self::type_data(); let type_data = Self::type_data();
let parent_iface = type_data.as_ref().get_parent_interface::<ChildProxy>() let parent_iface = type_data.as_ref().parent_interface::<ChildProxy>()
as *const ffi::GstChildProxyInterface; as *const ffi::GstChildProxyInterface;
if let Some(func) = (*parent_iface).child_added { if let Some(func) = (*parent_iface).child_added {
@ -99,7 +99,7 @@ impl<T: ChildProxyImpl> ChildProxyImplExt for T {
fn parent_child_removed(&self, object: &Self::Type, child: &glib::Object, name: &str) { fn parent_child_removed(&self, object: &Self::Type, child: &glib::Object, name: &str) {
unsafe { unsafe {
let type_data = Self::type_data(); let type_data = Self::type_data();
let parent_iface = type_data.as_ref().get_parent_interface::<ChildProxy>() let parent_iface = type_data.as_ref().parent_interface::<ChildProxy>()
as *const ffi::GstChildProxyInterface; as *const ffi::GstChildProxyInterface;
if let Some(func) = (*parent_iface).child_removed { if let Some(func) = (*parent_iface).child_removed {
@ -134,7 +134,7 @@ unsafe extern "C" fn child_proxy_get_child_by_name<T: ChildProxyImpl>(
let instance = &*(child_proxy as *mut T::Instance); let instance = &*(child_proxy as *mut T::Instance);
let imp = instance.impl_(); let imp = instance.impl_();
imp.get_child_by_name( imp.child_by_name(
&from_glib_borrow::<_, ChildProxy>(child_proxy).unsafe_cast_ref(), &from_glib_borrow::<_, ChildProxy>(child_proxy).unsafe_cast_ref(),
&glib::GString::from_glib_borrow(name), &glib::GString::from_glib_borrow(name),
) )
@ -148,7 +148,7 @@ unsafe extern "C" fn child_proxy_get_child_by_index<T: ChildProxyImpl>(
let instance = &*(child_proxy as *mut T::Instance); let instance = &*(child_proxy as *mut T::Instance);
let imp = instance.impl_(); let imp = instance.impl_();
imp.get_child_by_index( imp.child_by_index(
&from_glib_borrow::<_, ChildProxy>(child_proxy).unsafe_cast_ref(), &from_glib_borrow::<_, ChildProxy>(child_proxy).unsafe_cast_ref(),
index, index,
) )
@ -161,7 +161,7 @@ unsafe extern "C" fn child_proxy_get_children_count<T: ChildProxyImpl>(
let instance = &*(child_proxy as *mut T::Instance); let instance = &*(child_proxy as *mut T::Instance);
let imp = instance.impl_(); let imp = instance.impl_();
imp.get_children_count(&from_glib_borrow::<_, ChildProxy>(child_proxy).unsafe_cast_ref()) imp.children_count(&from_glib_borrow::<_, ChildProxy>(child_proxy).unsafe_cast_ref())
} }
unsafe extern "C" fn child_proxy_child_added<T: ChildProxyImpl>( unsafe extern "C" fn child_proxy_child_added<T: ChildProxyImpl>(

View file

@ -22,12 +22,12 @@ pub trait ClockImpl: ClockImplExt + ObjectImpl + Send + Sync {
self.parent_change_resolution(clock, old_resolution, new_resolution) self.parent_change_resolution(clock, old_resolution, new_resolution)
} }
fn get_resolution(&self, clock: &Self::Type) -> ClockTime { fn resolution(&self, clock: &Self::Type) -> ClockTime {
self.parent_get_resolution(clock) self.parent_resolution(clock)
} }
fn get_internal_time(&self, clock: &Self::Type) -> ClockTime { fn internal_time(&self, clock: &Self::Type) -> ClockTime {
self.parent_get_internal_time(clock) self.parent_internal_time(clock)
} }
fn wait( fn wait(
@ -55,9 +55,9 @@ pub trait ClockImplExt: ObjectSubclass {
new_resolution: ClockTime, new_resolution: ClockTime,
) -> ClockTime; ) -> ClockTime;
fn parent_get_resolution(&self, clock: &Self::Type) -> ClockTime; fn parent_resolution(&self, clock: &Self::Type) -> ClockTime;
fn parent_get_internal_time(&self, clock: &Self::Type) -> ClockTime; fn parent_internal_time(&self, clock: &Self::Type) -> ClockTime;
fn parent_wait( fn parent_wait(
&self, &self,
@ -97,12 +97,12 @@ impl<T: ClockImpl> ClockImplExt for T {
new_resolution.to_glib(), new_resolution.to_glib(),
)) ))
} else { } else {
self.get_resolution(clock) self.resolution(clock)
} }
} }
} }
fn parent_get_resolution(&self, clock: &Self::Type) -> ClockTime { fn parent_resolution(&self, clock: &Self::Type) -> ClockTime {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = data.as_ref().parent_class() as *mut ffi::GstClockClass; let parent_class = data.as_ref().parent_class() as *mut ffi::GstClockClass;
@ -116,7 +116,7 @@ impl<T: ClockImpl> ClockImplExt for T {
} }
} }
fn parent_get_internal_time(&self, clock: &Self::Type) -> ClockTime { fn parent_internal_time(&self, clock: &Self::Type) -> ClockTime {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = data.as_ref().parent_class() as *mut ffi::GstClockClass; let parent_class = data.as_ref().parent_class() as *mut ffi::GstClockClass;
@ -271,7 +271,7 @@ unsafe extern "C" fn clock_get_resolution<T: ClockImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Clock> = from_glib_borrow(ptr); let wrap: Borrowed<Clock> = from_glib_borrow(ptr);
imp.get_resolution(wrap.unsafe_cast_ref()).to_glib() imp.resolution(wrap.unsafe_cast_ref()).to_glib()
} }
unsafe extern "C" fn clock_get_internal_time<T: ClockImpl>( unsafe extern "C" fn clock_get_internal_time<T: ClockImpl>(
@ -281,7 +281,7 @@ unsafe extern "C" fn clock_get_internal_time<T: ClockImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Clock> = from_glib_borrow(ptr); let wrap: Borrowed<Clock> = from_glib_borrow(ptr);
imp.get_internal_time(wrap.unsafe_cast_ref()).to_glib() imp.internal_time(wrap.unsafe_cast_ref()).to_glib()
} }
unsafe extern "C" fn clock_wait<T: ClockImpl>( unsafe extern "C" fn clock_wait<T: ClockImpl>(

View file

@ -317,7 +317,7 @@ impl<T: ElementImpl> ElementImplExt for T {
} }
fn panicked(&self) -> &atomic::AtomicBool { fn panicked(&self) -> &atomic::AtomicBool {
self.get_instance_data::<atomic::AtomicBool>(crate::Element::static_type()) self.instance_data::<atomic::AtomicBool>(crate::Element::static_type())
.expect("instance not initialized correctly") .expect("instance not initialized correctly")
} }
@ -328,7 +328,7 @@ impl<T: ElementImpl> ElementImplExt for T {
f: F, f: F,
) -> R { ) -> R {
unsafe { unsafe {
assert!(element.type_().is_a(T::get_type())); assert!(element.type_().is_a(T::type_()));
let ptr: *mut ffi::GstElement = element.as_ptr() as *mut _; let ptr: *mut ffi::GstElement = element.as_ptr() as *mut _;
let instance = &*(ptr as *mut T::Instance); let instance = &*(ptr as *mut T::Instance);
let imp = instance.impl_(); let imp = instance.impl_();
@ -344,7 +344,7 @@ impl<T: ElementImpl> ElementImplExt for T {
) -> R { ) -> R {
unsafe { unsafe {
let wrap = parent.as_ref().unwrap().downcast_ref::<Element>().unwrap(); let wrap = parent.as_ref().unwrap().downcast_ref::<Element>().unwrap();
assert!(wrap.type_().is_a(T::get_type())); assert!(wrap.type_().is_a(T::type_()));
let ptr: *mut ffi::GstElement = wrap.to_glib_none().0; let ptr: *mut ffi::GstElement = wrap.to_glib_none().0;
let instance = &*(ptr as *mut T::Instance); let instance = &*(ptr as *mut T::Instance);
let imp = instance.impl_(); let imp = instance.impl_();

View file

@ -12,41 +12,41 @@ use std::ptr;
pub trait URIHandlerImpl: super::element::ElementImpl { pub trait URIHandlerImpl: super::element::ElementImpl {
const URI_TYPE: URIType; const URI_TYPE: URIType;
fn get_protocols() -> &'static [&'static str]; fn protocols() -> &'static [&'static str];
fn get_uri(&self, element: &Self::Type) -> Option<String>; fn uri(&self, element: &Self::Type) -> Option<String>;
fn set_uri(&self, element: &Self::Type, uri: &str) -> Result<(), glib::Error>; fn set_uri(&self, element: &Self::Type, uri: &str) -> Result<(), glib::Error>;
} }
pub trait URIHandlerImplExt: ObjectSubclass { pub trait URIHandlerImplExt: ObjectSubclass {
fn parent_get_protocols() -> Vec<String>; fn parent_protocols() -> Vec<String>;
fn parent_get_uri(&self, element: &Self::Type) -> Option<String>; fn parent_uri(&self, element: &Self::Type) -> Option<String>;
fn parent_set_uri(&self, element: &Self::Type, uri: &str) -> Result<(), glib::Error>; fn parent_set_uri(&self, element: &Self::Type, uri: &str) -> Result<(), glib::Error>;
} }
impl<T: URIHandlerImpl> URIHandlerImplExt for T { impl<T: URIHandlerImpl> URIHandlerImplExt for T {
fn parent_get_protocols() -> Vec<String> { fn parent_protocols() -> Vec<String> {
unsafe { unsafe {
let type_data = Self::type_data(); let type_data = Self::type_data();
let parent_iface = type_data.as_ref().get_parent_interface::<URIHandler>() let parent_iface = type_data.as_ref().parent_interface::<URIHandler>()
as *const ffi::GstURIHandlerInterface; as *const ffi::GstURIHandlerInterface;
let func = (*parent_iface) let func = (*parent_iface)
.get_protocols .get_protocols
.expect("no parent \"get_protocols\" implementation"); .expect("no parent \"protocols\" implementation");
let ret = func(Self::ParentType::static_type().to_glib()); let ret = func(Self::ParentType::static_type().to_glib());
FromGlibPtrContainer::from_glib_none(ret) FromGlibPtrContainer::from_glib_none(ret)
} }
} }
fn parent_get_uri(&self, element: &Self::Type) -> Option<String> { fn parent_uri(&self, element: &Self::Type) -> Option<String> {
unsafe { unsafe {
let type_data = Self::type_data(); let type_data = Self::type_data();
let parent_iface = type_data.as_ref().get_parent_interface::<URIHandler>() let parent_iface = type_data.as_ref().parent_interface::<URIHandler>()
as *const ffi::GstURIHandlerInterface; as *const ffi::GstURIHandlerInterface;
let func = (*parent_iface) let func = (*parent_iface)
.get_uri .get_uri
.expect("no parent \"get_uri\" implementation"); .expect("no parent \"uri\" implementation");
let ret = func(element.unsafe_cast_ref::<URIHandler>().to_glib_none().0); let ret = func(element.unsafe_cast_ref::<URIHandler>().to_glib_none().0);
from_glib_full(ret) from_glib_full(ret)
} }
@ -55,7 +55,7 @@ impl<T: URIHandlerImpl> URIHandlerImplExt for T {
fn parent_set_uri(&self, element: &Self::Type, uri: &str) -> Result<(), glib::Error> { fn parent_set_uri(&self, element: &Self::Type, uri: &str) -> Result<(), glib::Error> {
unsafe { unsafe {
let type_data = Self::type_data(); let type_data = Self::type_data();
let parent_iface = type_data.as_ref().get_parent_interface::<URIHandler>() let parent_iface = type_data.as_ref().parent_interface::<URIHandler>()
as *const ffi::GstURIHandlerInterface; as *const ffi::GstURIHandlerInterface;
let func = (*parent_iface) let func = (*parent_iface)
@ -90,7 +90,7 @@ unsafe impl<T: URIHandlerImpl> IsImplementable<T> for URIHandler {
// Store the protocols in the interface data for later use // Store the protocols in the interface data for later use
unsafe { unsafe {
let mut data = T::type_data(); let mut data = T::type_data();
let protocols = T::get_protocols(); let protocols = T::protocols();
let protocols = protocols.to_glib_full(); let protocols = protocols.to_glib_full();
let data = data.as_mut(); let data = data.as_mut();
@ -117,7 +117,7 @@ unsafe extern "C" fn uri_handler_get_protocols<T: URIHandlerImpl>(
) -> *const *const libc::c_char { ) -> *const *const libc::c_char {
let data = <T as ObjectSubclassType>::type_data(); let data = <T as ObjectSubclassType>::type_data();
data.as_ref() data.as_ref()
.get_class_data::<CStrV>(URIHandler::static_type()) .class_data::<CStrV>(URIHandler::static_type())
.unwrap_or(&CStrV(std::ptr::null())) .unwrap_or(&CStrV(std::ptr::null()))
.0 .0
} }
@ -128,7 +128,7 @@ unsafe extern "C" fn uri_handler_get_uri<T: URIHandlerImpl>(
let instance = &*(uri_handler as *mut T::Instance); let instance = &*(uri_handler as *mut T::Instance);
let imp = instance.impl_(); let imp = instance.impl_();
imp.get_uri(&from_glib_borrow::<_, URIHandler>(uri_handler).unsafe_cast_ref()) imp.uri(&from_glib_borrow::<_, URIHandler>(uri_handler).unsafe_cast_ref())
.to_glib_full() .to_glib_full()
} }