From aaea288abfa4af1b8c0b7046c987366a82e1e6c1 Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Sat, 3 Feb 2024 09:13:51 +0100 Subject: [PATCH] Adapt to no longer re-exported traits Some of the traits were moved to prelude or translate and no longer in the main scope of the crate Part-of: --- examples/src/bin/subclass_vfuncs/iirfilter/mod.rs | 2 +- gstreamer-allocators/src/dma_buf_allocator.rs | 2 +- gstreamer-allocators/src/drm_dumb_allocator.rs | 2 +- gstreamer-allocators/src/fd_allocator.rs | 2 +- gstreamer-audio/src/audio_aggregator.rs | 6 +++--- gstreamer-audio/src/audio_aggregator_convert_pad.rs | 7 +++---- gstreamer-audio/src/audio_channel_position.rs | 2 +- gstreamer-audio/src/audio_format_info.rs | 2 +- gstreamer-audio/src/flag_serde.rs | 3 ++- gstreamer-editing-services/src/flag_serde.rs | 3 ++- gstreamer-gl/src/flag_serde.rs | 3 ++- gstreamer-pbutils/src/audio_visualizer.rs | 1 - gstreamer-pbutils/src/discoverer_audio_info.rs | 2 +- gstreamer-pbutils/src/discoverer_subtitle_info.rs | 2 +- gstreamer-pbutils/src/discoverer_video_info.rs | 2 +- gstreamer-pbutils/src/flag_serde.rs | 3 ++- gstreamer-play/src/play_signal_adapter.rs | 2 +- gstreamer-rtp/src/flag_serde.rs | 3 ++- gstreamer-rtsp-server/src/flag_serde.rs | 3 ++- gstreamer-rtsp-server/src/rtsp_context.rs | 2 +- gstreamer-rtsp/src/flag_serde.rs | 3 ++- gstreamer-sdp/src/sdp_message.rs | 2 +- gstreamer-video/src/caps.rs | 2 +- gstreamer-video/src/flag_serde.rs | 3 ++- gstreamer-video/src/video_aggregator.rs | 2 +- gstreamer-video/src/video_aggregator_convert_pad.rs | 7 +++---- gstreamer-video/src/video_event.rs | 2 +- gstreamer-video/src/video_message.rs | 2 +- gstreamer/src/allocator.rs | 2 +- gstreamer/src/caps.rs | 6 +----- gstreamer/src/caps_features.rs | 4 ++-- gstreamer/src/date_time_serde.rs | 2 +- gstreamer/src/enums.rs | 3 ++- gstreamer/src/error.rs | 2 +- gstreamer/src/flag_serde.rs | 3 ++- gstreamer/src/format/clock_time.rs | 9 +++++---- gstreamer/src/gtype.rs | 2 +- gstreamer/src/iterator.rs | 3 ++- gstreamer/src/log.rs | 10 +++++----- gstreamer/src/memory.rs | 4 ++-- gstreamer/src/memory_wrapped.rs | 2 +- gstreamer/src/message.rs | 5 ----- gstreamer/src/miniobject.rs | 11 ++++++----- gstreamer/src/param_spec.rs | 10 +++++----- gstreamer/src/rank.rs | 2 +- gstreamer/src/segment.rs | 2 +- gstreamer/src/static_caps.rs | 4 ++-- gstreamer/src/static_pad_template.rs | 2 +- gstreamer/src/structure.rs | 2 +- gstreamer/src/structure_serde.rs | 2 +- gstreamer/src/subclass/buffer_pool.rs | 2 +- gstreamer/src/subclass/error.rs | 6 +++--- gstreamer/src/tags.rs | 2 +- gstreamer/src/tags_serde.rs | 3 ++- gstreamer/src/utils.rs | 5 +++-- gstreamer/src/value.rs | 2 +- gstreamer/src/value_serde.rs | 2 +- 57 files changed, 97 insertions(+), 94 deletions(-) diff --git a/examples/src/bin/subclass_vfuncs/iirfilter/mod.rs b/examples/src/bin/subclass_vfuncs/iirfilter/mod.rs index e1dbf8c88..b7bc5c007 100644 --- a/examples/src/bin/subclass_vfuncs/iirfilter/mod.rs +++ b/examples/src/bin/subclass_vfuncs/iirfilter/mod.rs @@ -51,7 +51,7 @@ impl IirFilterImplExt for T {} /// Class struct for `IirFilter`. #[repr(C)] pub struct Class { - parent: <::ParentType as glib::ObjectType>::GlibClassType, + parent: <::ParentType as ObjectType>::GlibClassType, set_rate: fn(&IirFilter, rate: u32), } diff --git a/gstreamer-allocators/src/dma_buf_allocator.rs b/gstreamer-allocators/src/dma_buf_allocator.rs index 95b3b7786..2b6ecb213 100644 --- a/gstreamer-allocators/src/dma_buf_allocator.rs +++ b/gstreamer-allocators/src/dma_buf_allocator.rs @@ -3,7 +3,7 @@ use std::{ os::unix::prelude::{IntoRawFd, RawFd}, }; -use glib::{translate::*, Cast}; +use glib::{prelude::*, translate::*}; use gst::{Memory, MemoryRef}; #[cfg(feature = "v1_16")] diff --git a/gstreamer-allocators/src/drm_dumb_allocator.rs b/gstreamer-allocators/src/drm_dumb_allocator.rs index eaf30be5f..b98a1e12d 100644 --- a/gstreamer-allocators/src/drm_dumb_allocator.rs +++ b/gstreamer-allocators/src/drm_dumb_allocator.rs @@ -1,6 +1,6 @@ use std::{fmt, mem, os::unix::prelude::IntoRawFd}; -use glib::{translate::*, Cast}; +use glib::{prelude::*, translate::*}; use gst::{Memory, MemoryRef}; use crate::{DRMDumbAllocator, DmaBufMemory}; diff --git a/gstreamer-allocators/src/fd_allocator.rs b/gstreamer-allocators/src/fd_allocator.rs index 0169695e2..a29462687 100644 --- a/gstreamer-allocators/src/fd_allocator.rs +++ b/gstreamer-allocators/src/fd_allocator.rs @@ -1,6 +1,6 @@ use std::{fmt, os::unix::prelude::RawFd}; -use glib::{translate::*, Cast}; +use glib::{prelude::*, translate::*}; use gst::{Memory, MemoryRef}; use crate::{FdAllocator, FdMemoryFlags}; diff --git a/gstreamer-audio/src/audio_aggregator.rs b/gstreamer-audio/src/audio_aggregator.rs index e0b07b14f..473bd0fdc 100644 --- a/gstreamer-audio/src/audio_aggregator.rs +++ b/gstreamer-audio/src/audio_aggregator.rs @@ -5,7 +5,7 @@ use std::mem::transmute; use glib::object::Cast; #[cfg(feature = "v1_18")] use glib::signal::{connect_raw, SignalHandlerId}; -use glib::{object::IsA, translate::*}; +use glib::translate::*; use gst::prelude::*; use crate::auto::{AudioAggregator, AudioAggregatorPad}; @@ -31,14 +31,14 @@ pub trait AudioAggregatorExtManual: sealed::Sealed + IsA + 'sta #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))] #[doc(alias = "output-buffer-duration-fraction")] fn output_buffer_duration_fraction(&self) -> gst::Fraction { - glib::ObjectExt::property(self.as_ref(), "output-buffer-duration-fraction") + ObjectExt::property(self.as_ref(), "output-buffer-duration-fraction") } #[cfg(feature = "v1_18")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))] #[doc(alias = "output-buffer-duration-fraction")] fn set_output_buffer_duration_fraction(&self, output_buffer_duration_fraction: gst::Fraction) { - glib::ObjectExt::set_property( + ObjectExt::set_property( self.as_ref(), "output-buffer-duration-fraction", output_buffer_duration_fraction, diff --git a/gstreamer-audio/src/audio_aggregator_convert_pad.rs b/gstreamer-audio/src/audio_aggregator_convert_pad.rs index 463eeafd2..26c588d4e 100644 --- a/gstreamer-audio/src/audio_aggregator_convert_pad.rs +++ b/gstreamer-audio/src/audio_aggregator_convert_pad.rs @@ -1,10 +1,9 @@ use std::mem::transmute; use glib::{ - object::IsA, + prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, - Cast, }; use crate::auto::AudioAggregatorConvertPad; @@ -19,13 +18,13 @@ pub trait AudioAggregatorConvertPadExtManual: { #[doc(alias = "converter-config")] fn converter_config(&self) -> Option { - glib::ObjectExt::property::>(self.as_ref(), "converter-config") + ObjectExt::property::>(self.as_ref(), "converter-config") .map(|c| c.try_into().unwrap()) } #[doc(alias = "converter-config")] fn set_converter_config(&self, converter_config: Option<&crate::AudioConverterConfig>) { - glib::ObjectExt::set_property( + ObjectExt::set_property( self.as_ref(), "converter-config", converter_config.map(|s| s.as_ref()), diff --git a/gstreamer-audio/src/audio_channel_position.rs b/gstreamer-audio/src/audio_channel_position.rs index 8932ab41b..fe0eddccb 100644 --- a/gstreamer-audio/src/audio_channel_position.rs +++ b/gstreamer-audio/src/audio_channel_position.rs @@ -2,7 +2,7 @@ use std::{mem, slice}; -use glib::{translate::*, value::FromValue, StaticType, ToValue, Type}; +use glib::{prelude::*, translate::*, value::FromValue, Type}; #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] diff --git a/gstreamer-audio/src/audio_format_info.rs b/gstreamer-audio/src/audio_format_info.rs index 5af638e25..f22beabf7 100644 --- a/gstreamer-audio/src/audio_format_info.rs +++ b/gstreamer-audio/src/audio_format_info.rs @@ -3,8 +3,8 @@ use std::{cmp::Ordering, fmt, marker::PhantomData, str}; use glib::{ + prelude::*, translate::{from_glib, from_glib_none, FromGlib, IntoGlib, ToGlibPtr, ToGlibPtrMut}, - StaticType, }; #[derive(PartialEq, Eq, Copy, Clone, Debug, Hash)] diff --git a/gstreamer-audio/src/flag_serde.rs b/gstreamer-audio/src/flag_serde.rs index ef5603ee4..f9c44e6ce 100644 --- a/gstreamer-audio/src/flag_serde.rs +++ b/gstreamer-audio/src/flag_serde.rs @@ -1,8 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. use glib::{ + prelude::*, translate::{from_glib, ToGlibPtr}, - FlagsClass, StaticType, ToValue, + FlagsClass, }; use gst::bitflags_serde_impl; diff --git a/gstreamer-editing-services/src/flag_serde.rs b/gstreamer-editing-services/src/flag_serde.rs index 70ab8c765..ef972ce02 100644 --- a/gstreamer-editing-services/src/flag_serde.rs +++ b/gstreamer-editing-services/src/flag_serde.rs @@ -1,8 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. use glib::{ + prelude::*, translate::{from_glib, ToGlibPtr}, - FlagsClass, StaticType, ToValue, + FlagsClass, }; use gst::bitflags_serde_impl; diff --git a/gstreamer-gl/src/flag_serde.rs b/gstreamer-gl/src/flag_serde.rs index d8ff764b5..b805306d7 100644 --- a/gstreamer-gl/src/flag_serde.rs +++ b/gstreamer-gl/src/flag_serde.rs @@ -1,8 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. use glib::{ + prelude::*, translate::{from_glib, ToGlibPtr}, - FlagsClass, StaticType, ToValue, + FlagsClass, }; use gst::bitflags_serde_impl; diff --git a/gstreamer-pbutils/src/audio_visualizer.rs b/gstreamer-pbutils/src/audio_visualizer.rs index 30e4c7b6e..3e810ef5a 100644 --- a/gstreamer-pbutils/src/audio_visualizer.rs +++ b/gstreamer-pbutils/src/audio_visualizer.rs @@ -1,6 +1,5 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::object::IsA; use gst::prelude::*; use crate::{auto::AudioVisualizer, subclass::AudioVisualizerSetupToken}; diff --git a/gstreamer-pbutils/src/discoverer_audio_info.rs b/gstreamer-pbutils/src/discoverer_audio_info.rs index 1f1eb86bc..7ea238de3 100644 --- a/gstreamer-pbutils/src/discoverer_audio_info.rs +++ b/gstreamer-pbutils/src/discoverer_audio_info.rs @@ -2,7 +2,7 @@ use std::fmt; -use glib::Cast; +use glib::prelude::*; use crate::{DiscovererAudioInfo, DiscovererStreamInfo}; diff --git a/gstreamer-pbutils/src/discoverer_subtitle_info.rs b/gstreamer-pbutils/src/discoverer_subtitle_info.rs index b48fbd5af..7f6f1efca 100644 --- a/gstreamer-pbutils/src/discoverer_subtitle_info.rs +++ b/gstreamer-pbutils/src/discoverer_subtitle_info.rs @@ -2,7 +2,7 @@ use std::fmt; -use glib::Cast; +use glib::prelude::*; use crate::{DiscovererStreamInfo, DiscovererSubtitleInfo}; diff --git a/gstreamer-pbutils/src/discoverer_video_info.rs b/gstreamer-pbutils/src/discoverer_video_info.rs index 144a6ddec..222404b4f 100644 --- a/gstreamer-pbutils/src/discoverer_video_info.rs +++ b/gstreamer-pbutils/src/discoverer_video_info.rs @@ -2,7 +2,7 @@ use std::fmt; -use glib::{translate::*, Cast}; +use glib::{prelude::*, translate::*}; use crate::{DiscovererStreamInfo, DiscovererVideoInfo}; diff --git a/gstreamer-pbutils/src/flag_serde.rs b/gstreamer-pbutils/src/flag_serde.rs index d75d5a7e5..1583664b6 100644 --- a/gstreamer-pbutils/src/flag_serde.rs +++ b/gstreamer-pbutils/src/flag_serde.rs @@ -1,8 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. use glib::{ + prelude::*, translate::{from_glib, ToGlibPtr}, - FlagsClass, StaticType, ToValue, + FlagsClass, }; use gst::bitflags_serde_impl; diff --git a/gstreamer-play/src/play_signal_adapter.rs b/gstreamer-play/src/play_signal_adapter.rs index feac372e6..96160899e 100644 --- a/gstreamer-play/src/play_signal_adapter.rs +++ b/gstreamer-play/src/play_signal_adapter.rs @@ -3,9 +3,9 @@ use std::{boxed::Box as Box_, mem::transmute}; use glib::{ + prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, - ObjectType, }; use crate::PlaySignalAdapter; diff --git a/gstreamer-rtp/src/flag_serde.rs b/gstreamer-rtp/src/flag_serde.rs index b6ceb603a..153864305 100644 --- a/gstreamer-rtp/src/flag_serde.rs +++ b/gstreamer-rtp/src/flag_serde.rs @@ -1,8 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. use glib::{ + prelude::*, translate::{from_glib, ToGlibPtr}, - FlagsClass, StaticType, ToValue, + FlagsClass, }; use gst::{bitflags_deserialize_impl, bitflags_serde_impl, bitflags_serialize_impl}; diff --git a/gstreamer-rtsp-server/src/flag_serde.rs b/gstreamer-rtsp-server/src/flag_serde.rs index 95dced3a0..94be41b20 100644 --- a/gstreamer-rtsp-server/src/flag_serde.rs +++ b/gstreamer-rtsp-server/src/flag_serde.rs @@ -1,8 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. use glib::{ + prelude::*, translate::{from_glib, ToGlibPtr}, - FlagsClass, StaticType, ToValue, + FlagsClass, }; use gst::bitflags_serde_impl; diff --git a/gstreamer-rtsp-server/src/rtsp_context.rs b/gstreamer-rtsp-server/src/rtsp_context.rs index d51cd8a84..4b738d00b 100644 --- a/gstreamer-rtsp-server/src/rtsp_context.rs +++ b/gstreamer-rtsp-server/src/rtsp_context.rs @@ -5,7 +5,7 @@ use std::{ ptr::{self, addr_of}, }; -use glib::{translate::*, ObjectType}; +use glib::{prelude::*, translate::*}; use gst_rtsp::{rtsp_message::RTSPMessage, RTSPUrl}; use crate::{RTSPClient, RTSPSession, RTSPToken}; diff --git a/gstreamer-rtsp/src/flag_serde.rs b/gstreamer-rtsp/src/flag_serde.rs index b0725ef17..ad647c301 100644 --- a/gstreamer-rtsp/src/flag_serde.rs +++ b/gstreamer-rtsp/src/flag_serde.rs @@ -1,8 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. use glib::{ + prelude::*, translate::{from_glib, ToGlibPtr}, - FlagsClass, StaticType, ToValue, + FlagsClass, }; use gst::bitflags_serde_impl; diff --git a/gstreamer-sdp/src/sdp_message.rs b/gstreamer-sdp/src/sdp_message.rs index 0959e6931..af2137b8e 100644 --- a/gstreamer-sdp/src/sdp_message.rs +++ b/gstreamer-sdp/src/sdp_message.rs @@ -6,7 +6,7 @@ use std::{ fmt, mem, ops, ptr, }; -use glib::{translate::*, StaticType}; +use glib::{prelude::*, translate::*}; use crate::{ sdp_attribute::SDPAttribute, diff --git a/gstreamer-video/src/caps.rs b/gstreamer-video/src/caps.rs index ef3839f00..90494ff7d 100644 --- a/gstreamer-video/src/caps.rs +++ b/gstreamer-video/src/caps.rs @@ -1,6 +1,6 @@ use std::ops::{Bound::*, RangeBounds}; -use glib::IntoGStr; +use glib::translate::*; use gst::Caps; use crate::VideoFormat; diff --git a/gstreamer-video/src/flag_serde.rs b/gstreamer-video/src/flag_serde.rs index 46a676295..af421cc03 100644 --- a/gstreamer-video/src/flag_serde.rs +++ b/gstreamer-video/src/flag_serde.rs @@ -1,8 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. use glib::{ + prelude::*, translate::{from_glib, ToGlibPtr}, - FlagsClass, StaticType, ToValue, + FlagsClass, }; use gst::bitflags_serde_impl; diff --git a/gstreamer-video/src/video_aggregator.rs b/gstreamer-video/src/video_aggregator.rs index 306b49dab..2667fb201 100644 --- a/gstreamer-video/src/video_aggregator.rs +++ b/gstreamer-video/src/video_aggregator.rs @@ -1,4 +1,4 @@ -use glib::{object::IsA, translate::*}; +use glib::translate::*; use gst::prelude::*; use crate::auto::VideoAggregator; diff --git a/gstreamer-video/src/video_aggregator_convert_pad.rs b/gstreamer-video/src/video_aggregator_convert_pad.rs index 1b66c4819..1a0b396d7 100644 --- a/gstreamer-video/src/video_aggregator_convert_pad.rs +++ b/gstreamer-video/src/video_aggregator_convert_pad.rs @@ -1,10 +1,9 @@ use std::mem::transmute; use glib::{ - object::IsA, + prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, - Cast, }; use crate::auto::VideoAggregatorConvertPad; @@ -19,13 +18,13 @@ pub trait VideoAggregatorConvertPadExtManual: { #[doc(alias = "converter-config")] fn converter_config(&self) -> Option { - glib::ObjectExt::property::>(self.as_ref(), "converter-config") + ObjectExt::property::>(self.as_ref(), "converter-config") .map(|c| c.try_into().unwrap()) } #[doc(alias = "converter-config")] fn set_converter_config(&self, converter_config: Option<&crate::VideoConverterConfig>) { - glib::ObjectExt::set_property( + ObjectExt::set_property( self.as_ref(), "converter-config", converter_config.map(|s| s.as_ref()), diff --git a/gstreamer-video/src/video_event.rs b/gstreamer-video/src/video_event.rs index b31f3c79f..86401756f 100644 --- a/gstreamer-video/src/video_event.rs +++ b/gstreamer-video/src/video_event.rs @@ -1,7 +1,7 @@ // Take a look at the license at the top of the repository in the LICENSE file. use std::mem; -use glib::{translate::*, ToSendValue}; +use glib::{prelude::*, translate::*}; use gst::EventType; #[cfg(feature = "v1_22")] diff --git a/gstreamer-video/src/video_message.rs b/gstreamer-video/src/video_message.rs index 2704500bd..c19669b55 100644 --- a/gstreamer-video/src/video_message.rs +++ b/gstreamer-video/src/video_message.rs @@ -4,7 +4,7 @@ use std::ptr; use glib::{ translate::{from_glib, from_glib_full, IntoGlib, ToGlibPtr}, - ToSendValue, + value::ToSendValue, }; use gst::{ffi as gst_ffi, prelude::*, Message, Object, Seqnum}; diff --git a/gstreamer/src/allocator.rs b/gstreamer/src/allocator.rs index f8b9a126b..bd68997fe 100644 --- a/gstreamer/src/allocator.rs +++ b/gstreamer/src/allocator.rs @@ -1,6 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::{translate::*, Cast, IsA}; +use glib::{prelude::*, translate::*}; use crate::Allocator; diff --git a/gstreamer/src/caps.rs b/gstreamer/src/caps.rs index 03bbb06b8..b301c1b3a 100644 --- a/gstreamer/src/caps.rs +++ b/gstreamer/src/caps.rs @@ -2,11 +2,7 @@ use std::{fmt, marker::PhantomData, ptr, str}; -use glib::{ - translate::{from_glib, from_glib_full, FromGlibPtrFull, IntoGlib, IntoGlibPtr, ToGlibPtr}, - value::ToSendValue, - IntoGStr, StaticType, -}; +use glib::{prelude::*, translate::*, value::ToSendValue}; use crate::{caps_features::*, structure::*, CapsIntersectMode}; diff --git a/gstreamer/src/caps_features.rs b/gstreamer/src/caps_features.rs index 546a0f11b..773a17d27 100644 --- a/gstreamer/src/caps_features.rs +++ b/gstreamer/src/caps_features.rs @@ -9,7 +9,7 @@ use std::{ ptr, str, }; -use glib::{translate::*, IntoGStr, StaticType}; +use glib::{prelude::*, translate::*}; use once_cell::sync::Lazy; #[doc(alias = "GstCapsFeatures")] @@ -854,7 +854,7 @@ mod tests { #[test] fn test_from_value_optional() { - use glib::ToValue; + use glib::value::ToValue; crate::init().unwrap(); diff --git a/gstreamer/src/date_time_serde.rs b/gstreamer/src/date_time_serde.rs index 9e4af2f78..7d90d9d7f 100644 --- a/gstreamer/src/date_time_serde.rs +++ b/gstreamer/src/date_time_serde.rs @@ -4,8 +4,8 @@ use glib::{ translate::{FromGlib, IntoGlib}, + types::StaticType, value::{ToValue, ToValueOptional}, - StaticType, }; use serde::{ de::{Deserialize, Deserializer, Error}, diff --git a/gstreamer/src/enums.rs b/gstreamer/src/enums.rs index 88318e882..3fa438cab 100644 --- a/gstreamer/src/enums.rs +++ b/gstreamer/src/enums.rs @@ -3,9 +3,10 @@ use std::{cmp, ops}; use glib::{ + prelude::*, translate::*, value::{FromValue, ToValue, Value}, - StaticType, Type, + Type, }; use thiserror::Error; diff --git a/gstreamer/src/error.rs b/gstreamer/src/error.rs index 1b3f7d951..74d130455 100644 --- a/gstreamer/src/error.rs +++ b/gstreamer/src/error.rs @@ -1,6 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::{prelude::*, IntoGStr}; +use glib::{prelude::*, translate::*}; use thiserror::Error; #[macro_export] diff --git a/gstreamer/src/flag_serde.rs b/gstreamer/src/flag_serde.rs index 4fe2ca632..2bb351c8f 100644 --- a/gstreamer/src/flag_serde.rs +++ b/gstreamer/src/flag_serde.rs @@ -1,8 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. use glib::{ + prelude::*, translate::{from_glib, ToGlibPtr}, - FlagsClass, StaticType, ToValue, + FlagsClass, }; bitflags_serde_impl!(crate::BinFlags); diff --git a/gstreamer/src/format/clock_time.rs b/gstreamer/src/format/clock_time.rs index 7e984d46a..7e510db25 100644 --- a/gstreamer/src/format/clock_time.rs +++ b/gstreamer/src/format/clock_time.rs @@ -6,7 +6,8 @@ use std::{ time::Duration, }; -use glib::{translate::*, StaticType}; +use crate::prelude::*; +use glib::translate::*; use super::{ Format, FormattedValue, FormattedValueError, FormattedValueFullRange, FormattedValueIntrinsic, @@ -527,14 +528,14 @@ impl From for glib::Value { } #[doc(hidden)] -impl glib::StaticType for ClockTime { +impl StaticType for ClockTime { #[inline] fn static_type() -> glib::Type { - ::static_type() + ::static_type() } } -impl glib::HasParamSpec for ClockTime { +impl HasParamSpec for ClockTime { type ParamSpec = glib::ParamSpecUInt64; type SetValue = Self; type BuilderFn = fn(&str) -> glib::ParamSpecUInt64Builder; diff --git a/gstreamer/src/gtype.rs b/gstreamer/src/gtype.rs index 77ac1edc2..51100f679 100644 --- a/gstreamer/src/gtype.rs +++ b/gstreamer/src/gtype.rs @@ -64,7 +64,7 @@ impl PluginApiExt for glib::Type { #[cfg(test)] mod tests { - use glib::StaticType; + use glib::prelude::StaticType; use super::*; diff --git a/gstreamer/src/iterator.rs b/gstreamer/src/iterator.rs index 52c13e926..755bb5f81 100644 --- a/gstreamer/src/iterator.rs +++ b/gstreamer/src/iterator.rs @@ -4,9 +4,10 @@ use std::{any::Any, fmt, iter, marker::PhantomData, mem, ptr, sync::Arc}; use glib::{ ffi::{gconstpointer, gpointer}, + prelude::*, translate::*, value::{FromValue, ToValue}, - StaticType, Value, + Value, }; use thiserror::Error; diff --git a/gstreamer/src/log.rs b/gstreamer/src/log.rs index 7986158c7..8c90f5d8d 100644 --- a/gstreamer/src/log.rs +++ b/gstreamer/src/log.rs @@ -2,7 +2,7 @@ use std::{borrow::Cow, ffi::CStr, fmt, ptr}; -use glib::{ffi::gpointer, prelude::*, translate::*, IntoGStr, IntoOptionalGStr}; +use glib::{ffi::gpointer, prelude::*, translate::*}; use libc::c_char; use once_cell::sync::Lazy; @@ -746,7 +746,7 @@ macro_rules! log_with_level( #[allow(unused_unsafe)] #[allow(clippy::redundant_closure_call)] if cat.above_threshold($level) { - use $crate::glib::Cast; + use $crate::glib::prelude::Cast; // FIXME: Once there's a function_name! macro that returns a string literal we can // directly pass it as `&GStr` forward @@ -789,7 +789,7 @@ macro_rules! log_with_level( // formatted arguments are evaluated even if we end up not logging. #[allow(unused_unsafe)] if cat.above_threshold($level) { - use $crate::glib::Cast; + use $crate::glib::prelude::Cast; // FIXME: Once there's a function_name! macro that returns a string literal we can // directly pass it as `&GStr` forward @@ -814,7 +814,7 @@ macro_rules! log_with_level( #[allow(unused_unsafe)] #[allow(clippy::redundant_closure_call)] if cat.above_threshold($level) { - use $crate::glib::Cast; + use $crate::glib::prelude::Cast; // FIXME: Once there's a function_name! macro that returns a string literal we can // directly pass it as `&GStr` forward @@ -858,7 +858,7 @@ macro_rules! log_with_level( // formatted arguments are evaluated even if we end up not logging. #[allow(unused_unsafe)] if cat.above_threshold($level) { - use $crate::glib::Cast; + use $crate::glib::prelude::Cast; // FIXME: Once there's a function_name! macro that returns a string literal we can // directly pass it as `&GStr` forward diff --git a/gstreamer/src/memory.rs b/gstreamer/src/memory.rs index 74ec620e6..8c89546a0 100644 --- a/gstreamer/src/memory.rs +++ b/gstreamer/src/memory.rs @@ -595,7 +595,7 @@ pub struct MemoryTypeValueTypeChecker(PhantomData); unsafe impl glib::value::ValueTypeChecker for MemoryTypeValueTypeChecker where - M: MemoryType + glib::StaticType, + M: MemoryType + glib::prelude::StaticType, ::RefType: AsRef + AsMut, { type Error = glib::value::ValueTypeMismatchOrNoneError; @@ -875,7 +875,7 @@ macro_rules! memory_object_wrapper { } fn value_type(&self) -> glib::Type { - ::static_type() + ::static_type() } } diff --git a/gstreamer/src/memory_wrapped.rs b/gstreamer/src/memory_wrapped.rs index f99e80d1b..743ff231e 100644 --- a/gstreamer/src/memory_wrapped.rs +++ b/gstreamer/src/memory_wrapped.rs @@ -1,6 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::{translate::*, StaticType}; +use glib::{prelude::*, translate::*}; use std::{alloc, mem, ptr}; diff --git a/gstreamer/src/message.rs b/gstreamer/src/message.rs index 923168fee..d97224d4a 100644 --- a/gstreamer/src/message.rs +++ b/gstreamer/src/message.rs @@ -350,7 +350,6 @@ impl Error { pub fn builder_from_error<'a>(error: glib::Error) -> ErrorBuilder<'a> { assert_initialized_main_thread!(); - use glib::error::ErrorDomain; assert!([ crate::CoreError::domain(), crate::ResourceError::domain(), @@ -443,8 +442,6 @@ impl Warning { pub fn builder_from_error<'a>(error: glib::Error) -> WarningBuilder<'a> { assert_initialized_main_thread!(); - use glib::error::ErrorDomain; - assert!([ crate::CoreError::domain(), crate::ResourceError::domain(), @@ -537,8 +534,6 @@ impl Info { pub fn builder_from_error<'a>(error: glib::Error) -> InfoBuilder<'a> { assert_initialized_main_thread!(); - use glib::error::ErrorDomain; - assert!([ crate::CoreError::domain(), crate::ResourceError::domain(), diff --git a/gstreamer/src/miniobject.rs b/gstreamer/src/miniobject.rs index c776ab52c..4bc8e6481 100644 --- a/gstreamer/src/miniobject.rs +++ b/gstreamer/src/miniobject.rs @@ -2,6 +2,7 @@ use std::fmt; +use crate::prelude::*; use glib::translate::*; pub trait IsMiniObject: @@ -570,7 +571,7 @@ macro_rules! mini_object_wrapper ( #[inline] fn value_type(&self) -> $crate::glib::Type { - ::static_type() + ::static_type() } } @@ -617,7 +618,7 @@ macro_rules! mini_object_wrapper ( // Can't have SetValue/SetValueOptional impls as otherwise one could use it to get // immutable references from a mutable reference without borrowing via the value - impl $crate::glib::HasParamSpec for $name { + impl $crate::glib::prelude::HasParamSpec for $name { type ParamSpec = $crate::glib::ParamSpecBoxed; type SetValue = Self; type BuilderFn = fn(&str) -> $crate::glib::ParamSpecBoxedBuilder; @@ -639,7 +640,7 @@ mini_object_wrapper!(MiniObject, MiniObjectRef, ffi::GstMiniObject, || { impl MiniObject { #[inline] - pub fn downcast(self) -> Result { + pub fn downcast(self) -> Result { if self.type_().is_a(T::static_type()) { unsafe { Ok(from_glib_full(self.into_glib_ptr() as *mut T::FfiType)) } } else { @@ -670,7 +671,7 @@ impl MiniObjectRef { } #[inline] - pub fn downcast_ref(&self) -> Option<&T::RefType> { + pub fn downcast_ref(&self) -> Option<&T::RefType> { if self.type_().is_a(T::static_type()) { unsafe { Some(&*(self as *const Self as *const T::RefType)) } } else { @@ -679,7 +680,7 @@ impl MiniObjectRef { } #[inline] - pub fn downcast_mut(&mut self) -> Option<&mut T::RefType> { + pub fn downcast_mut(&mut self) -> Option<&mut T::RefType> { if self.type_().is_a(T::static_type()) { unsafe { Some(&mut *(self as *mut Self as *mut T::RefType)) } } else { diff --git a/gstreamer/src/param_spec.rs b/gstreamer/src/param_spec.rs index dc99bc7de..d7f87b379 100644 --- a/gstreamer/src/param_spec.rs +++ b/gstreamer/src/param_spec.rs @@ -1,6 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::{gobject_ffi, translate::*, ParamSpec}; +use glib::{gobject_ffi, prelude::*, translate::*, ParamSpec}; glib::wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] @@ -26,9 +26,9 @@ impl std::ops::Deref for ParamSpecFraction { } } -unsafe impl glib::ParamSpecType for ParamSpecFraction {} +unsafe impl ParamSpecType for ParamSpecFraction {} -impl glib::HasParamSpec for crate::Fraction { +impl HasParamSpec for crate::Fraction { type ParamSpec = ParamSpecFraction; type SetValue = crate::Fraction; @@ -222,9 +222,9 @@ impl std::ops::Deref for ParamSpecArray { } } -unsafe impl glib::ParamSpecType for ParamSpecArray {} +unsafe impl ParamSpecType for ParamSpecArray {} -impl glib::HasParamSpec for crate::Array { +impl HasParamSpec for crate::Array { type ParamSpec = ParamSpecArray; type SetValue = crate::Array; diff --git a/gstreamer/src/rank.rs b/gstreamer/src/rank.rs index ea596a305..6d8d508b1 100644 --- a/gstreamer/src/rank.rs +++ b/gstreamer/src/rank.rs @@ -44,7 +44,7 @@ impl StaticType for Rank { } } -impl glib::HasParamSpec for Rank { +impl HasParamSpec for Rank { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; diff --git a/gstreamer/src/segment.rs b/gstreamer/src/segment.rs index 4369dab65..15fca0826 100644 --- a/gstreamer/src/segment.rs +++ b/gstreamer/src/segment.rs @@ -2,7 +2,7 @@ use std::{fmt, marker::PhantomData, mem}; -use glib::{translate::*, StaticType}; +use glib::{prelude::*, translate::*}; use crate::{ format::{ diff --git a/gstreamer/src/static_caps.rs b/gstreamer/src/static_caps.rs index 6b8745626..e8c2dd4fa 100644 --- a/gstreamer/src/static_caps.rs +++ b/gstreamer/src/static_caps.rs @@ -2,7 +2,7 @@ use std::{fmt, marker::PhantomData, ptr}; -use glib::{translate::*, StaticType}; +use glib::{prelude::*, translate::*}; use crate::Caps; @@ -31,7 +31,7 @@ impl fmt::Debug for StaticCaps { } } -impl glib::types::StaticType for StaticCaps { +impl StaticType for StaticCaps { #[inline] fn static_type() -> glib::types::Type { unsafe { glib::translate::from_glib(ffi::gst_static_caps_get_type()) } diff --git a/gstreamer/src/static_pad_template.rs b/gstreamer/src/static_pad_template.rs index 561f3f831..d34d07c5b 100644 --- a/gstreamer/src/static_pad_template.rs +++ b/gstreamer/src/static_pad_template.rs @@ -2,7 +2,7 @@ use std::{ffi::CStr, fmt, marker::PhantomData, ptr}; -use glib::{translate::*, StaticType}; +use glib::{prelude::*, translate::*}; use crate::{Caps, PadTemplate}; diff --git a/gstreamer/src/structure.rs b/gstreamer/src/structure.rs index 7a3211913..b81c045b0 100644 --- a/gstreamer/src/structure.rs +++ b/gstreamer/src/structure.rs @@ -1205,7 +1205,7 @@ mod tests { #[test] fn test_from_value_optional() { - use glib::ToValue; + use glib::value::ToValue; crate::init().unwrap(); diff --git a/gstreamer/src/structure_serde.rs b/gstreamer/src/structure_serde.rs index 22deb50bd..2dba774a7 100644 --- a/gstreamer/src/structure_serde.rs +++ b/gstreamer/src/structure_serde.rs @@ -4,7 +4,7 @@ use std::fmt; -use glib::{Date, ToValue}; +use glib::{value::ToValue, Date}; use serde::{ de, de::{Deserialize, DeserializeSeed, Deserializer, SeqAccess, Visitor}, diff --git a/gstreamer/src/subclass/buffer_pool.rs b/gstreamer/src/subclass/buffer_pool.rs index 1d44b5dcf..95bba7b74 100644 --- a/gstreamer/src/subclass/buffer_pool.rs +++ b/gstreamer/src/subclass/buffer_pool.rs @@ -3,9 +3,9 @@ use std::ptr; use glib::{ + prelude::*, subclass::{prelude::*, InitializingObject}, translate::*, - Cast, StaticType, }; use libc::c_char; diff --git a/gstreamer/src/subclass/error.rs b/gstreamer/src/subclass/error.rs index 143baf3d1..79dc31da8 100644 --- a/gstreamer/src/subclass/error.rs +++ b/gstreamer/src/subclass/error.rs @@ -37,11 +37,11 @@ macro_rules! panic_to_error( { let panicked = $imp.panicked(); let element = $crate::glib::subclass::types::ObjectSubclassExt::obj($imp); - let element = unsafe { $crate::glib::Cast::unsafe_cast_ref::<$crate::Element>(element.as_ref()) }; + let element = unsafe { $crate::glib::prelude::Cast::unsafe_cast_ref::<$crate::Element>(element.as_ref()) }; if panicked.load(std::sync::atomic::Ordering::Relaxed) { $crate::subclass::post_panic_error_message( element, - $crate::glib::Cast::upcast_ref::<$crate::Object>(element), + $crate::glib::prelude::Cast::upcast_ref::<$crate::Object>(element), None, ); $ret @@ -54,7 +54,7 @@ macro_rules! panic_to_error( panicked.store(true, std::sync::atomic::Ordering::Relaxed); $crate::subclass::post_panic_error_message( element, - $crate::glib::Cast::upcast_ref::<$crate::Object>(element), + $crate::glib::prelude::Cast::upcast_ref::<$crate::Object>(element), Some(err), ); $ret diff --git a/gstreamer/src/tags.rs b/gstreamer/src/tags.rs index 269a9e81d..b7be1b070 100644 --- a/gstreamer/src/tags.rs +++ b/gstreamer/src/tags.rs @@ -3,9 +3,9 @@ use std::{fmt, marker::PhantomData, mem}; use glib::{ + prelude::*, translate::*, value::{FromValue, SendValue, ToSendValue, Value}, - IntoGStr, StaticType, }; use crate::{Sample, TagError, TagMergeMode, TagScope}; diff --git a/gstreamer/src/tags_serde.rs b/gstreamer/src/tags_serde.rs index 7a36a71b1..49d53466d 100644 --- a/gstreamer/src/tags_serde.rs +++ b/gstreamer/src/tags_serde.rs @@ -6,7 +6,8 @@ use std::{cell::RefCell, cmp, fmt, rc::Rc}; use glib::{ translate::{from_glib, ToGlibPtr}, - Date, SendValue, ToValue, + value::{SendValue, ToValue}, + Date, }; use serde::{ de, diff --git a/gstreamer/src/utils.rs b/gstreamer/src/utils.rs index 99d84186d..bd77358b1 100644 --- a/gstreamer/src/utils.rs +++ b/gstreamer/src/utils.rs @@ -1,5 +1,7 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use glib::prelude::*; + // rustdoc-stripper-ignore-next /// Trait that allows accessing `Display` implementation on types external to this crate. pub trait Displayable { @@ -16,13 +18,12 @@ pub struct ObjectLockGuard<'a, T: ?Sized> { impl<'a, T> ObjectLockGuard<'a, T> where - T: glib::IsA + ?Sized, + T: IsA + ?Sized, { #[inline] pub fn acquire(obj: &'a T) -> ObjectLockGuard<'a, T> { skip_assert_initialized!(); unsafe { - use glib::ObjectType; let mutex = &mut (*obj.as_ref().as_ptr()).lock; glib::ffi::g_mutex_lock(mutex); Self { obj, mutex } diff --git a/gstreamer/src/value.rs b/gstreamer/src/value.rs index a226e5a2c..18ead030a 100644 --- a/gstreamer/src/value.rs +++ b/gstreamer/src/value.rs @@ -2,7 +2,7 @@ use std::{cmp, fmt, ops, slice}; -use glib::{translate::*, StaticType}; +use glib::{prelude::*, translate::*}; use num_rational::Rational32; #[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)] diff --git a/gstreamer/src/value_serde.rs b/gstreamer/src/value_serde.rs index ce186924c..60e2c8ec4 100644 --- a/gstreamer/src/value_serde.rs +++ b/gstreamer/src/value_serde.rs @@ -4,7 +4,7 @@ use std::{fmt, mem}; -use glib::{Date, StaticType, ToValue}; +use glib::{prelude::*, Date}; use num_rational::Rational32; use once_cell::sync::Lazy; use serde::{