Update for glib subclass API cleanup

This commit is contained in:
Sebastian Dröge 2021-03-08 12:06:56 +02:00
parent b8c20c07ce
commit 0803dd411e
32 changed files with 79 additions and 94 deletions

View file

@ -534,8 +534,8 @@ unsafe impl<T: AudioDecoderImpl> IsSubclassable<T> for AudioDecoder
where
<T as ObjectSubclass>::Instance: PanicPoison,
{
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<gst::Element as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<gst::Element as IsSubclassable<T>>::class_init(klass);
let klass = klass.as_mut();
klass.open = Some(audio_decoder_open::<T>);
klass.close = Some(audio_decoder_close::<T>);

View file

@ -480,8 +480,8 @@ unsafe impl<T: AudioEncoderImpl> IsSubclassable<T> for AudioEncoder
where
<T as ObjectSubclass>::Instance: PanicPoison,
{
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<gst::Element as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<gst::Element as IsSubclassable<T>>::class_init(klass);
let klass = klass.as_mut();
klass.open = Some(audio_encoder_open::<T>);
klass.close = Some(audio_encoder_close::<T>);

View file

@ -188,8 +188,8 @@ unsafe impl<T: AudioSinkImpl> IsSubclassable<T> for AudioSink
where
<T as ObjectSubclass>::Instance: PanicPoison,
{
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<gst_base::BaseSink as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<gst_base::BaseSink as IsSubclassable<T>>::class_init(klass);
let klass = klass.as_mut();
klass.close = Some(audiosink_close::<T>);
klass.delay = Some(audiosink_delay::<T>);

View file

@ -204,8 +204,8 @@ unsafe impl<T: AudioSrcImpl> IsSubclassable<T> for AudioSrc
where
<T as ObjectSubclass>::Instance: PanicPoison,
{
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<gst_base::BaseSrc as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<gst_base::BaseSrc as IsSubclassable<T>>::class_init(klass);
let klass = klass.as_mut();
klass.close = Some(audiosrc_close::<T>);
klass.delay = Some(audiosrc_delay::<T>);

View file

@ -707,8 +707,8 @@ unsafe impl<T: AggregatorImpl> IsSubclassable<T> for Aggregator
where
<T as ObjectSubclass>::Instance: PanicPoison,
{
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<gst::Element as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<gst::Element as IsSubclassable<T>>::class_init(klass);
let klass = klass.as_mut();
klass.flush = Some(aggregator_flush::<T>);
klass.clip = Some(aggregator_clip::<T>);

View file

@ -94,8 +94,8 @@ impl<T: AggregatorPadImpl> AggregatorPadImplExt for T {
}
}
unsafe impl<T: AggregatorPadImpl> IsSubclassable<T> for AggregatorPad {
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<gst::Pad as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<gst::Pad as IsSubclassable<T>>::class_init(klass);
let klass = klass.as_mut();
klass.flush = Some(aggregator_pad_flush::<T>);
klass.skip_buffer = Some(aggregator_pad_skip_buffer::<T>);

View file

@ -207,8 +207,8 @@ unsafe impl<T: BaseParseImpl> IsSubclassable<T> for BaseParse
where
<T as ObjectSubclass>::Instance: PanicPoison,
{
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<gst::Element as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<gst::Element as IsSubclassable<T>>::class_init(klass);
let klass = klass.as_mut();
klass.start = Some(base_parse_start::<T>);
klass.stop = Some(base_parse_stop::<T>);

View file

@ -404,8 +404,8 @@ unsafe impl<T: BaseSinkImpl> IsSubclassable<T> for BaseSink
where
<T as ObjectSubclass>::Instance: PanicPoison,
{
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<gst::Element as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<gst::Element as IsSubclassable<T>>::class_init(klass);
let klass = klass.as_mut();
klass.start = Some(base_sink_start::<T>);
klass.stop = Some(base_sink_stop::<T>);

View file

@ -584,8 +584,8 @@ unsafe impl<T: BaseSrcImpl> IsSubclassable<T> for BaseSrc
where
<T as ObjectSubclass>::Instance: PanicPoison,
{
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<gst::Element as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<gst::Element as IsSubclassable<T>>::class_init(klass);
let klass = klass.as_mut();
klass.start = Some(base_src_start::<T>);
klass.stop = Some(base_src_stop::<T>);

View file

@ -838,8 +838,8 @@ unsafe impl<T: BaseTransformImpl> IsSubclassable<T> for BaseTransform
where
<T as ObjectSubclass>::Instance: PanicPoison,
{
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<gst::Element as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<gst::Element as IsSubclassable<T>>::class_init(klass);
let klass = klass.as_mut();
klass.start = Some(base_transform_start::<T>);
klass.stop = Some(base_transform_stop::<T>);

View file

@ -114,8 +114,8 @@ unsafe impl<T: PushSrcImpl> IsSubclassable<T> for PushSrc
where
<T as ObjectSubclass>::Instance: PanicPoison,
{
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<crate::BaseSrc as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<crate::BaseSrc as IsSubclassable<T>>::class_init(klass);
let klass = klass.as_mut();
klass.fill = Some(push_src_fill::<T>);
klass.alloc = Some(push_src_alloc::<T>);

View file

@ -11,13 +11,10 @@ pub trait PlayerVideoRendererImpl: ObjectImpl {
}
unsafe impl<T: PlayerVideoRendererImpl> IsImplementable<T> for PlayerVideoRenderer {
unsafe extern "C" fn interface_init(
iface: glib::ffi::gpointer,
_iface_data: glib::ffi::gpointer,
) {
let video_renderer_iface = &mut *(iface as *mut ffi::GstPlayerVideoRendererInterface);
fn interface_init(iface: &mut glib::Class<Self>) {
let iface = iface.as_mut();
video_renderer_iface.create_video_sink = Some(video_renderer_create_video_sink::<T>);
iface.create_video_sink = Some(video_renderer_create_video_sink::<T>);
}
}

View file

@ -854,8 +854,8 @@ impl<T: RTSPClientImpl> RTSPClientImplExt for T {
}
}
unsafe impl<T: RTSPClientImpl> IsSubclassable<T> for RTSPClient {
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<glib::Object as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<glib::Object as IsSubclassable<T>>::class_init(klass);
let klass = klass.as_mut();
klass.create_sdp = Some(client_create_sdp::<T>);
klass.configure_client_media = Some(client_configure_client_media::<T>);

View file

@ -451,8 +451,8 @@ impl<T: RTSPMediaImpl> RTSPMediaImplExt for T {
}
}
unsafe impl<T: RTSPMediaImpl> IsSubclassable<T> for RTSPMedia {
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<glib::Object as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<glib::Object as IsSubclassable<T>>::class_init(klass);
let klass = klass.as_mut();
klass.handle_message = Some(media_handle_message::<T>);
klass.prepare = Some(media_prepare::<T>);

View file

@ -232,8 +232,8 @@ impl<T: RTSPMediaFactoryImpl> RTSPMediaFactoryImplExt for T {
}
}
unsafe impl<T: RTSPMediaFactoryImpl> IsSubclassable<T> for RTSPMediaFactory {
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<glib::Object as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<glib::Object as IsSubclassable<T>>::class_init(klass);
let klass = klass.as_mut();
klass.gen_key = Some(factory_gen_key::<T>);
klass.create_element = Some(factory_create_element::<T>);

View file

@ -48,8 +48,8 @@ impl<T: RTSPServerImpl> RTSPServerImplExt for T {
}
}
unsafe impl<T: RTSPServerImpl> IsSubclassable<T> for RTSPServer {
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<glib::Object as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<glib::Object as IsSubclassable<T>>::class_init(klass);
let klass = klass.as_mut();
klass.create_client = Some(server_create_client::<T>);
klass.client_connected = Some(server_client_connected::<T>);

View file

@ -536,8 +536,8 @@ unsafe impl<T: VideoDecoderImpl> IsSubclassable<T> for VideoDecoder
where
<T as ObjectSubclass>::Instance: PanicPoison,
{
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<gst::Element as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<gst::Element as IsSubclassable<T>>::class_init(klass);
let klass = klass.as_mut();
klass.open = Some(video_decoder_open::<T>);
klass.close = Some(video_decoder_close::<T>);

View file

@ -470,8 +470,8 @@ unsafe impl<T: VideoEncoderImpl> IsSubclassable<T> for VideoEncoder
where
<T as ObjectSubclass>::Instance: PanicPoison,
{
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<gst::Element as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<gst::Element as IsSubclassable<T>>::class_init(klass);
let klass = klass.as_mut();
klass.open = Some(video_encoder_open::<T>);
klass.close = Some(video_encoder_close::<T>);

View file

@ -54,8 +54,8 @@ unsafe impl<T: VideoSinkImpl> IsSubclassable<T> for VideoSink
where
<T as ObjectSubclass>::Instance: PanicPoison,
{
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<gst_base::BaseSink as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<gst_base::BaseSink as IsSubclassable<T>>::class_init(klass);
let klass = klass.as_mut();
klass.show_frame = Some(video_sink_show_frame::<T>);
}

View file

@ -102,8 +102,8 @@ unsafe impl<T: BinImpl> IsSubclassable<T> for Bin
where
<T as ObjectSubclass>::Instance: PanicPoison,
{
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<crate::Element as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<crate::Element as IsSubclassable<T>>::class_init(klass);
let klass = klass.as_mut();
klass.add_element = Some(bin_add_element::<T>);
klass.remove_element = Some(bin_remove_element::<T>);

View file

@ -33,17 +33,14 @@ pub trait ChildProxyImpl: ObjectImpl + Send + Sync {
}
unsafe impl<T: ChildProxyImpl> IsImplementable<T> for ChildProxy {
unsafe extern "C" fn interface_init(
iface: glib::ffi::gpointer,
_iface_data: glib::ffi::gpointer,
) {
let child_proxy_iface = &mut *(iface as *mut ffi::GstChildProxyInterface);
fn interface_init(iface: &mut glib::Class<Self>) {
let iface = iface.as_mut();
child_proxy_iface.get_child_by_name = Some(child_proxy_get_child_by_name::<T>);
child_proxy_iface.get_child_by_index = Some(child_proxy_get_child_by_index::<T>);
child_proxy_iface.get_children_count = Some(child_proxy_get_children_count::<T>);
child_proxy_iface.child_added = Some(child_proxy_child_added::<T>);
child_proxy_iface.child_removed = Some(child_proxy_child_removed::<T>);
iface.get_child_by_name = Some(child_proxy_get_child_by_name::<T>);
iface.get_child_by_index = Some(child_proxy_get_child_by_index::<T>);
iface.get_children_count = Some(child_proxy_get_children_count::<T>);
iface.child_added = Some(child_proxy_child_added::<T>);
iface.child_removed = Some(child_proxy_child_removed::<T>);
}
}

View file

@ -231,8 +231,8 @@ impl<T: ClockImpl> ClockImplExt for T {
}
unsafe impl<T: ClockImpl> IsSubclassable<T> for Clock {
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<glib::Object as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<glib::Object as IsSubclassable<T>>::class_init(klass);
let klass = klass.as_mut();
klass.change_resolution = Some(clock_change_resolution::<T>);
klass.get_resolution = Some(clock_get_resolution::<T>);

View file

@ -100,8 +100,8 @@ impl<T: DeviceImpl> DeviceImplExt for T {
}
unsafe impl<T: DeviceImpl> IsSubclassable<T> for Device {
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<glib::Object as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<glib::Object as IsSubclassable<T>>::class_init(klass);
let klass = klass.as_mut();
klass.create_element = Some(device_create_element::<T>);
klass.reconfigure_element = Some(device_reconfigure_element::<T>);

View file

@ -92,8 +92,8 @@ impl<T: DeviceProviderImpl> DeviceProviderImplExt for T {
}
unsafe impl<T: DeviceProviderImpl> IsSubclassable<T> for DeviceProvider {
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<glib::Object as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<glib::Object as IsSubclassable<T>>::class_init(klass);
let klass = klass.as_mut();
klass.probe = Some(device_provider_probe::<T>);
klass.start = Some(device_provider_start::<T>);

View file

@ -355,8 +355,8 @@ unsafe impl<T: ElementImpl> IsSubclassable<T> for Element
where
<T as ObjectSubclass>::Instance: PanicPoison,
{
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<glib::Object as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<glib::Object as IsSubclassable<T>>::class_init(klass);
let klass = klass.as_mut();
klass.change_state = Some(element_change_state::<T>);

View file

@ -8,8 +8,8 @@ use crate::GhostPad;
pub trait GhostPadImpl: PadImpl {}
unsafe impl<T: GhostPadImpl> IsSubclassable<T> for GhostPad {
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<crate::Pad as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<crate::Pad as IsSubclassable<T>>::class_init(klass);
let _klass = klass.as_mut();
// Nothing to do here
}

View file

@ -59,8 +59,8 @@ impl<T: PadImpl> PadImplExt for T {
}
unsafe impl<T: PadImpl> IsSubclassable<T> for Pad {
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<glib::Object as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<glib::Object as IsSubclassable<T>>::class_init(klass);
let klass = klass.as_mut();
klass.linked = Some(pad_linked::<T>);
klass.unlinked = Some(pad_unlinked::<T>);

View file

@ -11,8 +11,8 @@ unsafe impl<T: PipelineImpl> IsSubclassable<T> for Pipeline
where
<T as ObjectSubclass>::Instance: PanicPoison,
{
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<crate::Bin as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<crate::Bin as IsSubclassable<T>>::class_init(klass);
let _klass = klass.as_mut();
// Nothing to do here
}

View file

@ -7,9 +7,5 @@ use crate::Preset;
pub trait PresetImpl: super::element::ElementImpl {}
unsafe impl<T: PresetImpl> IsImplementable<T> for Preset {
unsafe extern "C" fn interface_init(
_iface: glib::ffi::gpointer,
_iface_data: glib::ffi::gpointer,
) {
}
fn interface_init(_iface: &mut glib::Class<Self>) {}
}

View file

@ -8,8 +8,8 @@ use crate::SystemClock;
pub trait SystemClockImpl: ClockImpl {}
unsafe impl<T: SystemClockImpl> IsSubclassable<T> for SystemClock {
fn override_vfuncs(klass: &mut glib::Class<Self>) {
<crate::Clock as IsSubclassable<T>>::override_vfuncs(klass);
fn class_init(klass: &mut glib::Class<Self>) {
<crate::Clock as IsSubclassable<T>>::class_init(klass);
let _klass = klass.as_mut();
// Nothing to do here
}

View file

@ -7,9 +7,5 @@ use crate::TagSetter;
pub trait TagSetterImpl: super::element::ElementImpl {}
unsafe impl<T: TagSetterImpl> IsImplementable<T> for TagSetter {
unsafe extern "C" fn interface_init(
_iface: glib::ffi::gpointer,
_iface_data: glib::ffi::gpointer,
) {
}
fn interface_init(_iface: &mut glib::Class<Self>) {}
}

View file

@ -21,24 +21,23 @@ unsafe impl Send for CStrV {}
unsafe impl Sync for CStrV {}
unsafe impl<T: URIHandlerImpl> IsImplementable<T> for URIHandler {
unsafe extern "C" fn interface_init(
iface: glib::ffi::gpointer,
_iface_data: glib::ffi::gpointer,
) {
let uri_handler_iface = &mut *(iface as *mut ffi::GstURIHandlerInterface);
fn interface_init(iface: &mut glib::Class<Self>) {
let iface = iface.as_mut();
// Store the protocols in the interface data for later use
let mut data = T::type_data();
let protocols = T::get_protocols();
let protocols = protocols.to_glib_full();
let data = data.as_mut();
unsafe {
let mut data = T::type_data();
let protocols = T::get_protocols();
let protocols = protocols.to_glib_full();
let data = data.as_mut();
data.set_class_data(URIHandler::static_type(), CStrV(protocols));
data.set_class_data(URIHandler::static_type(), CStrV(protocols));
}
uri_handler_iface.get_type = Some(uri_handler_get_type::<T>);
uri_handler_iface.get_protocols = Some(uri_handler_get_protocols::<T>);
uri_handler_iface.get_uri = Some(uri_handler_get_uri::<T>);
uri_handler_iface.set_uri = Some(uri_handler_set_uri::<T>);
iface.get_type = Some(uri_handler_get_type::<T>);
iface.get_protocols = Some(uri_handler_get_protocols::<T>);
iface.get_uri = Some(uri_handler_get_uri::<T>);
iface.set_uri = Some(uri_handler_set_uri::<T>);
}
}