From 8e2c621a9ff26c6ee2496c59c7a8c51c28e5399c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laignel?= Date: Sun, 9 Oct 2022 18:37:45 +0200 Subject: [PATCH] gst/lib: cleanup format re-exports --- gstreamer-audio/src/audio_info.rs | 6 +++--- gstreamer-audio/src/audio_meta.rs | 2 +- gstreamer-base/src/aggregator.rs | 12 +++++++++--- gstreamer-base/src/base_parse.rs | 17 +++++++++-------- gstreamer-base/src/subclass/base_parse.rs | 7 +++---- gstreamer-video/src/video_info.rs | 6 +++--- gstreamer/src/buffer_pool.rs | 2 +- gstreamer/src/element.rs | 9 +++++---- gstreamer/src/event.rs | 8 +++++--- gstreamer/src/format/clock_time.rs | 2 +- gstreamer/src/format/compatible.rs | 2 +- gstreamer/src/format/macros.rs | 4 ++-- gstreamer/src/format/mod.rs | 2 +- gstreamer/src/lib.rs | 11 ++--------- gstreamer/src/message.rs | 1 + gstreamer/src/pad.rs | 8 ++++---- gstreamer/src/query.rs | 2 +- gstreamer/src/sample.rs | 2 +- gstreamer/src/segment.rs | 8 ++++---- gstreamer/src/segment_serde.rs | 10 ++-------- 20 files changed, 59 insertions(+), 62 deletions(-) diff --git a/gstreamer-audio/src/audio_info.rs b/gstreamer-audio/src/audio_info.rs index 6d00a1345..a31b7362f 100644 --- a/gstreamer-audio/src/audio_info.rs +++ b/gstreamer-audio/src/audio_info.rs @@ -176,9 +176,9 @@ impl AudioInfo { } #[doc(alias = "gst_audio_info_convert")] - pub fn convert( + pub fn convert( &self, - src_val: impl gst::FormattedValue, + src_val: impl gst::format::FormattedValue, ) -> Option { assert_initialized_main_thread!(); unsafe { @@ -199,7 +199,7 @@ impl AudioInfo { pub fn convert_generic( &self, - src_val: impl gst::FormattedValue, + src_val: impl gst::format::FormattedValue, dest_fmt: gst::Format, ) -> Option { assert_initialized_main_thread!(); diff --git a/gstreamer-audio/src/audio_meta.rs b/gstreamer-audio/src/audio_meta.rs index d58b2106c..58188b53b 100644 --- a/gstreamer-audio/src/audio_meta.rs +++ b/gstreamer-audio/src/audio_meta.rs @@ -23,7 +23,7 @@ unsafe impl Sync for AudioClippingMeta {} impl AudioClippingMeta { #[doc(alias = "gst_buffer_add_audio_clipping_meta")] - pub fn add( + pub fn add( buffer: &mut gst::BufferRef, start: V, end: V, diff --git a/gstreamer-base/src/aggregator.rs b/gstreamer-base/src/aggregator.rs index da9bcd2dd..a5d7fd022 100644 --- a/gstreamer-base/src/aggregator.rs +++ b/gstreamer-base/src/aggregator.rs @@ -6,7 +6,7 @@ use glib::prelude::*; #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] use glib::signal::{connect_raw, SignalHandlerId}; use glib::translate::*; -use gst::FormattedValue; +use gst::format::FormattedValue; #[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] use std::boxed::Box as Box_; @@ -53,7 +53,10 @@ pub trait AggregatorExtManual: 'static { #[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] #[doc(alias = "gst_aggregator_update_segment")] - fn update_segment(&self, segment: &gst::FormattedSegment); + fn update_segment( + &self, + segment: &gst::FormattedSegment, + ); fn set_position(&self, position: impl FormattedValue); @@ -158,7 +161,10 @@ impl> AggregatorExtManual for O { } #[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] - fn update_segment(&self, segment: &gst::FormattedSegment) { + fn update_segment( + &self, + segment: &gst::FormattedSegment, + ) { unsafe { ffi::gst_aggregator_update_segment( self.as_ref().to_glib_none().0, diff --git a/gstreamer-base/src/base_parse.rs b/gstreamer-base/src/base_parse.rs index 5a1719a6e..c76c67e7e 100644 --- a/gstreamer-base/src/base_parse.rs +++ b/gstreamer-base/src/base_parse.rs @@ -4,6 +4,7 @@ use crate::BaseParse; use crate::BaseParseFrame; use glib::prelude::*; use glib::translate::*; +use gst::format::{FormattedValue, SpecificFormattedValueFullRange}; use std::mem; pub trait BaseParseExtManual: 'static { @@ -13,18 +14,18 @@ pub trait BaseParseExtManual: 'static { fn src_pad(&self) -> &gst::Pad; #[doc(alias = "gst_base_parse_set_duration")] - fn set_duration(&self, duration: impl gst::FormattedValue, interval: u32); + fn set_duration(&self, duration: impl FormattedValue, interval: u32); #[doc(alias = "gst_base_parse_set_frame_rate")] fn set_frame_rate(&self, fps: gst::Fraction, lead_in: u32, lead_out: u32); #[doc(alias = "gst_base_parse_convert_default")] - fn convert_default( + fn convert_default( &self, - src_val: impl gst::FormattedValue, + src_val: impl FormattedValue, ) -> Option; fn convert_default_generic( &self, - src_val: impl gst::FormattedValue, + src_val: impl FormattedValue, dest_format: gst::Format, ) -> Option; @@ -51,7 +52,7 @@ impl> BaseParseExtManual for O { } } - fn set_duration(&self, duration: impl gst::FormattedValue, interval: u32) { + fn set_duration(&self, duration: impl FormattedValue, interval: u32) { unsafe { ffi::gst_base_parse_set_duration( self.as_ref().to_glib_none().0, @@ -75,9 +76,9 @@ impl> BaseParseExtManual for O { } } - fn convert_default( + fn convert_default( &self, - src_val: impl gst::FormattedValue, + src_val: impl FormattedValue, ) -> Option { unsafe { let mut dest_val = mem::MaybeUninit::uninit(); @@ -98,7 +99,7 @@ impl> BaseParseExtManual for O { fn convert_default_generic( &self, - src_val: impl gst::FormattedValue, + src_val: impl FormattedValue, dest_format: gst::Format, ) -> Option { unsafe { diff --git a/gstreamer-base/src/subclass/base_parse.rs b/gstreamer-base/src/subclass/base_parse.rs index 169fa87a4..4bc37a5bc 100644 --- a/gstreamer-base/src/subclass/base_parse.rs +++ b/gstreamer-base/src/subclass/base_parse.rs @@ -5,7 +5,6 @@ use std::mem; use crate::prelude::*; use glib::translate::*; - use gst::subclass::prelude::*; use crate::BaseParse; @@ -33,7 +32,7 @@ pub trait BaseParseImpl: BaseParseImplExt + ElementImpl { fn convert( &self, - src_val: impl gst::FormattedValue, + src_val: impl gst::format::FormattedValue, dest_format: gst::Format, ) -> Option { self.parent_convert(src_val, dest_format) @@ -54,7 +53,7 @@ pub trait BaseParseImplExt: ObjectSubclass { fn parent_convert( &self, - src_val: impl gst::FormattedValue, + src_val: impl gst::format::FormattedValue, dest_format: gst::Format, ) -> Option; } @@ -160,7 +159,7 @@ impl BaseParseImplExt for T { fn parent_convert( &self, - src_val: impl gst::FormattedValue, + src_val: impl gst::format::FormattedValue, dest_format: gst::Format, ) -> Option { unsafe { diff --git a/gstreamer-video/src/video_info.rs b/gstreamer-video/src/video_info.rs index 2658bbf3e..fd2eb7988 100644 --- a/gstreamer-video/src/video_info.rs +++ b/gstreamer-video/src/video_info.rs @@ -744,9 +744,9 @@ impl VideoInfo { } #[doc(alias = "gst_video_info_convert")] - pub fn convert( + pub fn convert( &self, - src_val: impl gst::FormattedValue, + src_val: impl gst::format::FormattedValue, ) -> Option { skip_assert_initialized!(); unsafe { @@ -767,7 +767,7 @@ impl VideoInfo { pub fn convert_generic( &self, - src_val: impl gst::FormattedValue, + src_val: impl gst::format::FormattedValue, dest_fmt: gst::Format, ) -> Option { skip_assert_initialized!(); diff --git a/gstreamer/src/buffer_pool.rs b/gstreamer/src/buffer_pool.rs index f1a916e83..92b0aa1ad 100644 --- a/gstreamer/src/buffer_pool.rs +++ b/gstreamer/src/buffer_pool.rs @@ -260,7 +260,7 @@ impl BufferPoolAcquireParams { }) } - pub fn with_start_stop( + pub fn with_start_stop( start: T, stop: T, flags: crate::BufferPoolAcquireFlags, diff --git a/gstreamer/src/element.rs b/gstreamer/src/element.rs index 5135d6f71..f309a9134 100644 --- a/gstreamer/src/element.rs +++ b/gstreamer/src/element.rs @@ -4,6 +4,10 @@ use crate::Element; use once_cell::sync::Lazy; +use crate::format::{ + CompatibleFormattedValue, FormattedValue, SpecificFormattedValueFullRange, + SpecificFormattedValueIntrinsic, +}; use crate::prelude::*; use crate::ClockTime; use crate::ElementFlags; @@ -14,10 +18,7 @@ use crate::Plugin; use crate::QueryRef; use crate::Rank; use crate::State; -use crate::{ - CompatibleFormattedValue, Format, FormattedValue, GenericFormattedValue, - SpecificFormattedValueFullRange, -}; +use crate::{Format, GenericFormattedValue}; use glib::translate::*; diff --git a/gstreamer/src/event.rs b/gstreamer/src/event.rs index de8789ce7..1cf531c58 100644 --- a/gstreamer/src/event.rs +++ b/gstreamer/src/event.rs @@ -1,8 +1,10 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use crate::format::{ + CompatibleFormattedValue, FormattedValue, FormattedValueIntrinsic, GenericFormattedValue, +}; use crate::structure::*; use crate::ClockTime; -use crate::{CompatibleFormattedValue, FormattedValue, GenericFormattedValue}; use std::borrow::Borrow; use std::cmp; @@ -550,12 +552,12 @@ declare_concrete_event!(@sticky Segment, T); impl Segment { #[doc(alias = "gst_event_new_segment")] #[allow(clippy::new_ret_no_self)] - pub fn new(segment: &crate::FormattedSegment) -> Event { + pub fn new(segment: &crate::FormattedSegment) -> Event { skip_assert_initialized!(); Self::builder(segment).build() } - pub fn builder( + pub fn builder( segment: &crate::FormattedSegment, ) -> SegmentBuilder { assert_initialized_main_thread!(); diff --git a/gstreamer/src/format/clock_time.rs b/gstreamer/src/format/clock_time.rs index 4e26f9037..5c6b07b59 100644 --- a/gstreamer/src/format/clock_time.rs +++ b/gstreamer/src/format/clock_time.rs @@ -517,7 +517,7 @@ impl std::iter::Sum for ClockTime { #[cfg(test)] mod tests { use super::*; - use crate::{Signed, UnsignedIntoSigned}; + use crate::format::{Signed, UnsignedIntoSigned}; use opt_ops::prelude::*; const CT_1: ClockTime = ClockTime::from_nseconds(1); diff --git a/gstreamer/src/format/compatible.rs b/gstreamer/src/format/compatible.rs index 9cbe7cda3..661a52d6e 100644 --- a/gstreamer/src/format/compatible.rs +++ b/gstreamer/src/format/compatible.rs @@ -14,7 +14,7 @@ use super::{FormattedValue, SpecificFormattedValue}; /// Consider the following function: /// /// ```rust -/// # use gstreamer::{ClockTime, CompatibleFormattedValue, FormattedValue, GenericFormattedValue}; +/// # use gstreamer::format::{ClockTime, CompatibleFormattedValue, FormattedValue, GenericFormattedValue}; /// fn with_compatible_formats( /// arg1: V, /// arg2: impl CompatibleFormattedValue, diff --git a/gstreamer/src/format/macros.rs b/gstreamer/src/format/macros.rs index 103077331..ea3378538 100644 --- a/gstreamer/src/format/macros.rs +++ b/gstreamer/src/format/macros.rs @@ -185,7 +185,7 @@ macro_rules! impl_unsigned_int_into_signed( ($typ:ty) => { impl crate::format::SignedIntrinsic for $typ {} - impl crate::UnsignedIntoSigned for $typ { + impl crate::format::UnsignedIntoSigned for $typ { type Signed = crate::Signed<$typ>; fn into_positive(self) -> Self::Signed { @@ -197,7 +197,7 @@ macro_rules! impl_unsigned_int_into_signed( } } - impl crate::UnsignedIntoSigned for Option<$typ> { + impl crate::format::UnsignedIntoSigned for Option<$typ> { type Signed = Option>; fn into_positive(self) -> Self::Signed { diff --git a/gstreamer/src/format/mod.rs b/gstreamer/src/format/mod.rs index def950989..cf92c9f9f 100644 --- a/gstreamer/src/format/mod.rs +++ b/gstreamer/src/format/mod.rs @@ -49,7 +49,7 @@ //! //! ``` //! # use gstreamer as gst; -//! # use gst::FormattedValue; +//! # use gst::format::FormattedValue; //! # gst::init(); //! # let segment = gst::FormattedSegment::::new().upcast(); //! // Downcasting the generic `segment` for `gst::ClockTime` use. diff --git a/gstreamer/src/lib.rs b/gstreamer/src/lib.rs index 6aaf06310..40f67a48f 100644 --- a/gstreamer/src/lib.rs +++ b/gstreamer/src/lib.rs @@ -218,12 +218,7 @@ pub use crate::typefind::*; mod typefind_factory; pub mod format; -pub use crate::format::{ - ClockTime, CompatibleFormattedValue, FormattedValue, FormattedValueFullRange, - FormattedValueIntrinsic, FormattedValueNoneBuilder, GenericFormattedValue, NoneSignedBuilder, - Signed, SpecificFormattedValue, SpecificFormattedValueFullRange, - SpecificFormattedValueIntrinsic, UnsignedIntoSigned, -}; +pub use crate::format::{ClockTime, GenericFormattedValue, GenericSignedFormattedValue, Signed}; mod segment; pub use crate::segment::*; @@ -344,9 +339,7 @@ pub mod prelude { pub use muldiv::MulDiv; pub use crate::format::{ - CompatibleFormattedValue, FormattedValue, FormattedValueFullRange, FormattedValueIntrinsic, - FormattedValueNoneBuilder, NoneSignedBuilder, SpecificFormattedValue, - SpecificFormattedValueFullRange, SpecificFormattedValueIntrinsic, UnsignedIntoSigned, + FormattedValue, FormattedValueNoneBuilder, NoneSignedBuilder, UnsignedIntoSigned, }; pub use crate::utils::Displayable; diff --git a/gstreamer/src/message.rs b/gstreamer/src/message.rs index 806919eb3..006920ef4 100644 --- a/gstreamer/src/message.rs +++ b/gstreamer/src/message.rs @@ -1,5 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use crate::format::{CompatibleFormattedValue, FormattedValue}; use crate::prelude::*; use crate::structure::*; use crate::GenericFormattedValue; diff --git a/gstreamer/src/pad.rs b/gstreamer/src/pad.rs index 7bc93e705..3b260fd0a 100644 --- a/gstreamer/src/pad.rs +++ b/gstreamer/src/pad.rs @@ -1,5 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use crate::format::{ + FormattedValue, SpecificFormattedValueFullRange, SpecificFormattedValueIntrinsic, +}; use crate::Buffer; use crate::BufferList; use crate::Event; @@ -14,10 +17,7 @@ use crate::PadProbeType; use crate::Query; use crate::QueryRef; use crate::StaticPadTemplate; -use crate::{ - Format, FormattedValue, GenericFormattedValue, SpecificFormattedValueFullRange, - SpecificFormattedValueIntrinsic, -}; +use crate::{Format, GenericFormattedValue}; use std::mem; use std::num::NonZeroU64; diff --git a/gstreamer/src/query.rs b/gstreamer/src/query.rs index 9a77b8f90..0f554eeb2 100644 --- a/gstreamer/src/query.rs +++ b/gstreamer/src/query.rs @@ -1,7 +1,7 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use crate::format::{CompatibleFormattedValue, FormattedValue, GenericFormattedValue}; use crate::structure::*; -use crate::{CompatibleFormattedValue, FormattedValue, GenericFormattedValue}; use std::borrow::{Borrow, BorrowMut}; use std::ffi::CStr; diff --git a/gstreamer/src/sample.rs b/gstreamer/src/sample.rs index bd02d2dbc..fd28519e0 100644 --- a/gstreamer/src/sample.rs +++ b/gstreamer/src/sample.rs @@ -5,6 +5,7 @@ use std::ptr; use glib::translate::{from_glib_full, from_glib_none, mut_override, IntoGlibPtr, ToGlibPtr}; +use crate::format::FormattedValueIntrinsic; use crate::Buffer; use crate::BufferList; use crate::BufferListRef; @@ -12,7 +13,6 @@ use crate::BufferRef; use crate::Caps; use crate::CapsRef; use crate::FormattedSegment; -use crate::FormattedValueIntrinsic; use crate::Segment; use crate::Structure; use crate::StructureRef; diff --git a/gstreamer/src/segment.rs b/gstreamer/src/segment.rs index eb27df0c7..f0a8c0f76 100644 --- a/gstreamer/src/segment.rs +++ b/gstreamer/src/segment.rs @@ -1,13 +1,13 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use crate::format::{ + CompatibleFormattedValue, FormattedValue, FormattedValueFullRange, FormattedValueIntrinsic, + FormattedValueNoneBuilder, NoneSignedBuilder, UnsignedIntoSigned, +}; use crate::Format; use crate::GenericFormattedValue; use crate::SeekFlags; use crate::SeekType; -use crate::{ - CompatibleFormattedValue, FormattedValue, FormattedValueFullRange, FormattedValueIntrinsic, - FormattedValueNoneBuilder, NoneSignedBuilder, UnsignedIntoSigned, -}; use glib::translate::*; use glib::StaticType; use std::fmt; diff --git a/gstreamer/src/segment_serde.rs b/gstreamer/src/segment_serde.rs index 65a25836b..de25d1508 100644 --- a/gstreamer/src/segment_serde.rs +++ b/gstreamer/src/segment_serde.rs @@ -4,14 +4,8 @@ use serde::de; use serde::de::{Deserialize, Deserializer}; use serde::ser::{Serialize, Serializer}; -use crate::Format; -use crate::FormattedSegment; -use crate::FormattedValue; -use crate::FormattedValueIntrinsic; -use crate::GenericFormattedValue; -use crate::Segment; -use crate::SegmentFlags; -use crate::SpecificFormattedValueIntrinsic; +use crate::format::{FormattedValue, FormattedValueIntrinsic, SpecificFormattedValueIntrinsic}; +use crate::{Format, FormattedSegment, GenericFormattedValue, Segment, SegmentFlags}; #[derive(serde::Serialize, serde::Deserialize)] struct FormattedSegmentSerde {