diff --git a/gstreamer-video/src/video_buffer_pool.rs b/gstreamer-video/src/video_buffer_pool.rs index 6655b82ac..b03f35d6f 100644 --- a/gstreamer-video/src/video_buffer_pool.rs +++ b/gstreamer-video/src/video_buffer_pool.rs @@ -67,12 +67,12 @@ impl VideoAlignment { stride_align: *stride_align, }; - VideoAlignment(videoalignment) + Self(videoalignment) } } impl PartialEq for VideoAlignment { - fn eq(&self, other: &VideoAlignment) -> bool { + fn eq(&self, other: &Self) -> bool { self.padding_top() == other.padding_top() && self.padding_bottom() == other.padding_bottom() && self.padding_left() == other.padding_left() diff --git a/gstreamer-video/src/video_converter.rs b/gstreamer-video/src/video_converter.rs index ca27eb249..1b95d231e 100644 --- a/gstreamer-video/src/video_converter.rs +++ b/gstreamer-video/src/video_converter.rs @@ -44,7 +44,7 @@ impl VideoConverter { if ptr.is_null() { Err(glib::bool_error!("Failed to create video converter")) } else { - Ok(VideoConverter(ptr::NonNull::new_unchecked(ptr))) + Ok(Self(ptr::NonNull::new_unchecked(ptr))) } } } @@ -118,17 +118,17 @@ impl AsMut for VideoConverterConfig { impl Default for VideoConverterConfig { fn default() -> Self { - VideoConverterConfig::new() + Self::new() } } impl convert::TryFrom for VideoConverterConfig { type Error = glib::BoolError; - fn try_from(v: gst::Structure) -> Result { + fn try_from(v: gst::Structure) -> Result { skip_assert_initialized!(); if v.name() == "GstVideoConverter" { - Ok(VideoConverterConfig(v)) + Ok(Self(v)) } else { Err(glib::bool_error!("Structure is no VideoConverterConfig")) } @@ -138,14 +138,14 @@ impl convert::TryFrom for VideoConverterConfig { impl<'a> convert::TryFrom<&'a gst::StructureRef> for VideoConverterConfig { type Error = glib::BoolError; - fn try_from(v: &'a gst::StructureRef) -> Result { + fn try_from(v: &'a gst::StructureRef) -> Result { skip_assert_initialized!(); - VideoConverterConfig::try_from(v.to_owned()) + Self::try_from(v.to_owned()) } } impl From for gst::Structure { - fn from(v: VideoConverterConfig) -> gst::Structure { + fn from(v: VideoConverterConfig) -> Self { skip_assert_initialized!(); v.0 } @@ -153,7 +153,7 @@ impl From for gst::Structure { impl VideoConverterConfig { pub fn new() -> Self { - VideoConverterConfig(gst::Structure::new_empty("GstVideoConverter")) + Self(gst::Structure::new_empty("GstVideoConverter")) } pub fn set_resampler_method(&mut self, v: crate::VideoResamplerMethod) { diff --git a/gstreamer-video/src/video_event.rs b/gstreamer-video/src/video_event.rs index 461dcd161..6447e5f00 100644 --- a/gstreamer-video/src/video_event.rs +++ b/gstreamer-video/src/video_event.rs @@ -144,9 +144,7 @@ impl DownstreamForceKeyUnitEvent { DownstreamForceKeyUnitEventBuilder::new() } - pub fn parse( - event: &gst::EventRef, - ) -> Result { + pub fn parse(event: &gst::EventRef) -> Result { skip_assert_initialized!(); unsafe { let mut timestamp = mem::MaybeUninit::uninit(); @@ -164,7 +162,7 @@ impl DownstreamForceKeyUnitEvent { count.as_mut_ptr(), )); if res { - Ok(DownstreamForceKeyUnitEvent { + Ok(Self { timestamp: from_glib(timestamp.assume_init()), stream_time: from_glib(stream_time.assume_init()), running_time: from_glib(running_time.assume_init()), @@ -239,9 +237,7 @@ impl UpstreamForceKeyUnitEvent { UpstreamForceKeyUnitEventBuilder::new() } - pub fn parse( - event: &gst::EventRef, - ) -> Result { + pub fn parse(event: &gst::EventRef) -> Result { skip_assert_initialized!(); unsafe { let mut running_time = mem::MaybeUninit::uninit(); @@ -255,7 +251,7 @@ impl UpstreamForceKeyUnitEvent { count.as_mut_ptr(), )); if res { - Ok(UpstreamForceKeyUnitEvent { + Ok(Self { running_time: from_glib(running_time.assume_init()), all_headers: from_glib(all_headers.assume_init()), count: count.assume_init(), @@ -279,12 +275,12 @@ impl ForceKeyUnitEvent { unsafe { from_glib(ffi::gst_video_event_is_force_key_unit(event.as_mut_ptr())) } } - pub fn parse(event: &gst::EventRef) -> Result { + pub fn parse(event: &gst::EventRef) -> Result { skip_assert_initialized!(); if event.is_upstream() { - UpstreamForceKeyUnitEvent::parse(event).map(ForceKeyUnitEvent::Upstream) + UpstreamForceKeyUnitEvent::parse(event).map(Self::Upstream) } else { - DownstreamForceKeyUnitEvent::parse(event).map(ForceKeyUnitEvent::Downstream) + DownstreamForceKeyUnitEvent::parse(event).map(Self::Downstream) } } } @@ -323,7 +319,7 @@ impl StillFrameEvent { StillFrameEventBuilder::new(in_still) } - pub fn parse(event: &gst::EventRef) -> Result { + pub fn parse(event: &gst::EventRef) -> Result { skip_assert_initialized!(); unsafe { let mut in_still = mem::MaybeUninit::uninit(); @@ -333,7 +329,7 @@ impl StillFrameEvent { in_still.as_mut_ptr(), )); if res { - Ok(StillFrameEvent { + Ok(Self { in_still: from_glib(in_still.assume_init()), }) } else { diff --git a/gstreamer-video/src/video_format.rs b/gstreamer-video/src/video_format.rs index a60f3ea17..0382dec7c 100644 --- a/gstreamer-video/src/video_format.rs +++ b/gstreamer-video/src/video_format.rs @@ -262,9 +262,9 @@ impl FromGlib for VideoEndianness { skip_assert_initialized!(); match value { - 1234 => VideoEndianness::LittleEndian, - 4321 => VideoEndianness::BigEndian, - _ => VideoEndianness::Unknown, + 1234 => Self::LittleEndian, + 4321 => Self::BigEndian, + _ => Self::Unknown, } } } @@ -274,8 +274,8 @@ impl IntoGlib for VideoEndianness { fn into_glib(self) -> i32 { match self { - VideoEndianness::LittleEndian => 1234, - VideoEndianness::BigEndian => 4321, + Self::LittleEndian => 1234, + Self::BigEndian => 4321, _ => 0, } } @@ -290,7 +290,7 @@ impl crate::VideoFormat { blue_mask: u32, green_mask: u32, alpha_mask: u32, - ) -> crate::VideoFormat { + ) -> Self { assert_initialized_main_thread!(); unsafe { @@ -344,14 +344,14 @@ impl str::FromStr for crate::VideoFormat { } impl PartialOrd for crate::VideoFormat { - fn partial_cmp(&self, other: &crate::VideoFormat) -> Option { + fn partial_cmp(&self, other: &Self) -> Option { crate::VideoFormatInfo::from_format(*self) .partial_cmp(&crate::VideoFormatInfo::from_format(*other)) } } impl Ord for crate::VideoFormat { - fn cmp(&self, other: &crate::VideoFormat) -> std::cmp::Ordering { + fn cmp(&self, other: &Self) -> std::cmp::Ordering { crate::VideoFormatInfo::from_format(*self).cmp(&crate::VideoFormatInfo::from_format(*other)) } } diff --git a/gstreamer-video/src/video_format_info.rs b/gstreamer-video/src/video_format_info.rs index 6fe4d49c9..d3d02a52d 100644 --- a/gstreamer-video/src/video_format_info.rs +++ b/gstreamer-video/src/video_format_info.rs @@ -10,14 +10,14 @@ use glib::translate::{from_glib, IntoGlib}; pub struct VideoFormatInfo(&'static ffi::GstVideoFormatInfo); impl VideoFormatInfo { - pub fn from_format(format: crate::VideoFormat) -> VideoFormatInfo { + pub fn from_format(format: crate::VideoFormat) -> Self { assert_initialized_main_thread!(); unsafe { let info = ffi::gst_video_format_get_info(format.into_glib()); assert!(!info.is_null()); - VideoFormatInfo(&*info) + Self(&*info) } } @@ -302,14 +302,14 @@ impl PartialEq for VideoFormatInfo { impl Eq for VideoFormatInfo {} impl PartialOrd for VideoFormatInfo { - fn partial_cmp(&self, other: &VideoFormatInfo) -> Option { + fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) } } impl Ord for VideoFormatInfo { // See GST_VIDEO_FORMATS_ALL for the sorting algorithm - fn cmp(&self, other: &VideoFormatInfo) -> Ordering { + fn cmp(&self, other: &Self) -> Ordering { self.n_components() .cmp(&other.n_components()) .then_with(|| self.depth().cmp(&other.depth())) @@ -446,7 +446,7 @@ impl glib::translate::GlibPtrDefault for VideoFormatInfo { #[doc(hidden)] impl<'a> glib::translate::ToGlibPtr<'a, *const ffi::GstVideoFormatInfo> for VideoFormatInfo { - type Storage = &'a VideoFormatInfo; + type Storage = &'a Self; fn to_glib_none(&'a self) -> glib::translate::Stash<'a, *const ffi::GstVideoFormatInfo, Self> { glib::translate::Stash(self.0, self) @@ -461,7 +461,7 @@ impl<'a> glib::translate::ToGlibPtr<'a, *const ffi::GstVideoFormatInfo> for Vide impl glib::translate::FromGlibPtrNone<*mut ffi::GstVideoFormatInfo> for VideoFormatInfo { #[inline] unsafe fn from_glib_none(ptr: *mut ffi::GstVideoFormatInfo) -> Self { - VideoFormatInfo(&*ptr) + Self(&*ptr) } } @@ -469,7 +469,7 @@ impl glib::translate::FromGlibPtrNone<*mut ffi::GstVideoFormatInfo> for VideoFor impl glib::translate::FromGlibPtrNone<*const ffi::GstVideoFormatInfo> for VideoFormatInfo { #[inline] unsafe fn from_glib_none(ptr: *const ffi::GstVideoFormatInfo) -> Self { - VideoFormatInfo(&*ptr) + Self(&*ptr) } } diff --git a/gstreamer-video/src/video_frame.rs b/gstreamer-video/src/video_frame.rs index 50f04fda6..26f66e618 100644 --- a/gstreamer-video/src/video_frame.rs +++ b/gstreamer-video/src/video_frame.rs @@ -173,7 +173,7 @@ impl VideoFrame { pub unsafe fn from_glib_full(frame: ffi::GstVideoFrame) -> Self { let info = crate::VideoInfo(ptr::read(&frame.info)); let buffer = gst::Buffer::from_glib_none(frame.buffer); - VideoFrame { + Self { frame, buffer: Some(buffer), info, @@ -209,7 +209,7 @@ impl VideoFrame { pub fn from_buffer_readable( buffer: gst::Buffer, info: &crate::VideoInfo, - ) -> Result, gst::Buffer> { + ) -> Result { skip_assert_initialized!(); assert!(info.is_valid()); @@ -228,7 +228,7 @@ impl VideoFrame { } else { let frame = frame.assume_init(); let info = crate::VideoInfo(ptr::read(&frame.info)); - Ok(VideoFrame { + Ok(Self { frame, buffer: Some(buffer), info, @@ -242,7 +242,7 @@ impl VideoFrame { buffer: gst::Buffer, id: i32, info: &crate::VideoInfo, - ) -> Result, gst::Buffer> { + ) -> Result { skip_assert_initialized!(); assert!(info.is_valid()); @@ -262,7 +262,7 @@ impl VideoFrame { } else { let frame = frame.assume_init(); let info = crate::VideoInfo(ptr::read(&frame.info)); - Ok(VideoFrame { + Ok(Self { frame, buffer: Some(buffer), info, @@ -281,7 +281,7 @@ impl VideoFrame { pub fn from_buffer_writable( buffer: gst::Buffer, info: &crate::VideoInfo, - ) -> Result, gst::Buffer> { + ) -> Result { skip_assert_initialized!(); assert!(info.is_valid()); @@ -302,7 +302,7 @@ impl VideoFrame { } else { let frame = frame.assume_init(); let info = crate::VideoInfo(ptr::read(&frame.info)); - Ok(VideoFrame { + Ok(Self { frame, buffer: Some(buffer), info, @@ -316,7 +316,7 @@ impl VideoFrame { buffer: gst::Buffer, id: i32, info: &crate::VideoInfo, - ) -> Result, gst::Buffer> { + ) -> Result { skip_assert_initialized!(); assert!(info.is_valid()); @@ -338,7 +338,7 @@ impl VideoFrame { } else { let frame = frame.assume_init(); let info = crate::VideoInfo(ptr::read(&frame.info)); - Ok(VideoFrame { + Ok(Self { frame, buffer: Some(buffer), info, @@ -552,7 +552,7 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> { let frame = ptr::read(frame); let info = crate::VideoInfo(ptr::read(&frame.info)); let buffer = gst::BufferRef::from_ptr(frame.buffer); - Borrowed::new(VideoFrameRef { + Borrowed::new(Self { frame, buffer: Some(buffer), info, @@ -563,7 +563,7 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> { pub unsafe fn from_glib_full(frame: ffi::GstVideoFrame) -> Self { let info = crate::VideoInfo(ptr::read(&frame.info)); let buffer = gst::BufferRef::from_ptr(frame.buffer); - VideoFrameRef { + Self { frame, buffer: Some(buffer), info, @@ -574,7 +574,7 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> { pub fn from_buffer_ref_readable<'b>( buffer: &'a gst::BufferRef, info: &'b crate::VideoInfo, - ) -> Result, glib::BoolError> { + ) -> Result { skip_assert_initialized!(); assert!(info.is_valid()); @@ -593,7 +593,7 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> { } else { let frame = frame.assume_init(); let info = crate::VideoInfo(ptr::read(&frame.info)); - Ok(VideoFrameRef { + Ok(Self { frame, buffer: Some(buffer), info, @@ -607,7 +607,7 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> { buffer: &'a gst::BufferRef, id: i32, info: &'b crate::VideoInfo, - ) -> Result, glib::BoolError> { + ) -> Result { skip_assert_initialized!(); assert!(info.is_valid()); @@ -627,7 +627,7 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> { } else { let frame = frame.assume_init(); let info = crate::VideoInfo(ptr::read(&frame.info)); - Ok(VideoFrameRef { + Ok(Self { frame, buffer: Some(buffer), info, @@ -649,7 +649,7 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> { let frame = ptr::read(frame); let info = crate::VideoInfo(ptr::read(&frame.info)); let buffer = gst::BufferRef::from_mut_ptr(frame.buffer); - Borrowed::new(VideoFrameRef { + Borrowed::new(Self { frame, buffer: Some(buffer), info, @@ -660,7 +660,7 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> { pub unsafe fn from_glib_full_mut(frame: ffi::GstVideoFrame) -> Self { let info = crate::VideoInfo(ptr::read(&frame.info)); let buffer = gst::BufferRef::from_mut_ptr(frame.buffer); - VideoFrameRef { + Self { frame, buffer: Some(buffer), info, @@ -671,7 +671,7 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> { pub fn from_buffer_ref_writable<'b>( buffer: &'a mut gst::BufferRef, info: &'b crate::VideoInfo, - ) -> Result, glib::BoolError> { + ) -> Result { skip_assert_initialized!(); assert!(info.is_valid()); @@ -692,7 +692,7 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> { } else { let frame = frame.assume_init(); let info = crate::VideoInfo(ptr::read(&frame.info)); - Ok(VideoFrameRef { + Ok(Self { frame, buffer: Some(buffer), info, @@ -706,7 +706,7 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> { buffer: &'a mut gst::BufferRef, id: i32, info: &'b crate::VideoInfo, - ) -> Result, glib::BoolError> { + ) -> Result { skip_assert_initialized!(); assert!(info.is_valid()); @@ -728,7 +728,7 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> { } else { let frame = frame.assume_init(); let info = crate::VideoInfo(ptr::read(&frame.info)); - Ok(VideoFrameRef { + Ok(Self { frame, buffer: Some(buffer), info, @@ -783,10 +783,7 @@ impl<'a> ops::Deref for VideoFrameRef<&'a mut gst::BufferRef> { type Target = VideoFrameRef<&'a gst::BufferRef>; fn deref(&self) -> &Self::Target { - unsafe { - &*(self as *const VideoFrameRef<&'a mut gst::BufferRef> - as *const VideoFrameRef<&'a gst::BufferRef>) - } + unsafe { &*(self as *const Self as *const Self::Target) } } } diff --git a/gstreamer-video/src/video_info.rs b/gstreamer-video/src/video_info.rs index a0344da7d..313dc35b1 100644 --- a/gstreamer-video/src/video_info.rs +++ b/gstreamer-video/src/video_info.rs @@ -28,10 +28,10 @@ impl IntoGlib for VideoColorRange { fn into_glib(self) -> ffi::GstVideoColorRange { match self { - VideoColorRange::Unknown => ffi::GST_VIDEO_COLOR_RANGE_UNKNOWN, - VideoColorRange::Range0255 => ffi::GST_VIDEO_COLOR_RANGE_0_255, - VideoColorRange::Range16235 => ffi::GST_VIDEO_COLOR_RANGE_16_235, - VideoColorRange::__Unknown(value) => value, + Self::Unknown => ffi::GST_VIDEO_COLOR_RANGE_UNKNOWN, + Self::Range0255 => ffi::GST_VIDEO_COLOR_RANGE_0_255, + Self::Range16235 => ffi::GST_VIDEO_COLOR_RANGE_16_235, + Self::__Unknown(value) => value, } } } @@ -41,10 +41,10 @@ impl FromGlib for VideoColorRange { unsafe fn from_glib(value: ffi::GstVideoColorRange) -> Self { skip_assert_initialized!(); match value as i32 { - 0 => VideoColorRange::Unknown, - 1 => VideoColorRange::Range0255, - 2 => VideoColorRange::Range16235, - value => VideoColorRange::__Unknown(value), + 0 => Self::Unknown, + 1 => Self::Range0255, + 2 => Self::Range16235, + value => Self::__Unknown(value), } } } @@ -98,7 +98,7 @@ impl VideoColorimetry { primaries: primaries.into_glib(), }; - VideoColorimetry(colorimetry) + Self(colorimetry) } pub fn range(&self) -> crate::VideoColorRange { @@ -120,7 +120,7 @@ impl VideoColorimetry { impl Clone for VideoColorimetry { fn clone(&self) -> Self { - unsafe { VideoColorimetry(ptr::read(&self.0)) } + unsafe { Self(ptr::read(&self.0)) } } } @@ -228,14 +228,12 @@ impl From for crate::VideoMultiviewMode { impl std::convert::TryFrom for crate::VideoMultiviewFramePacking { type Error = glib::BoolError; - fn try_from( - v: crate::VideoMultiviewMode, - ) -> Result { + fn try_from(v: crate::VideoMultiviewMode) -> Result { skip_assert_initialized!(); let v2 = unsafe { from_glib(v.into_glib()) }; - if let crate::VideoMultiviewFramePacking::__Unknown(_) = v2 { + if let Self::__Unknown(_) = v2 { Err(glib::bool_error!("Invalid frame packing mode")) } else { Ok(v2) @@ -607,7 +605,7 @@ impl VideoInfo { info.as_mut_ptr(), caps.as_ptr(), )) { - Ok(VideoInfo(info.assume_init())) + Ok(Self(info.assume_init())) } else { Err(glib::bool_error!("Failed to create VideoInfo from caps")) } @@ -844,7 +842,7 @@ impl VideoInfo { impl Clone for VideoInfo { fn clone(&self) -> Self { - unsafe { VideoInfo(ptr::read(&self.0)) } + unsafe { Self(ptr::read(&self.0)) } } } @@ -928,7 +926,7 @@ impl glib::translate::GlibPtrDefault for VideoInfo { #[doc(hidden)] impl<'a> glib::translate::ToGlibPtr<'a, *const ffi::GstVideoInfo> for VideoInfo { - type Storage = &'a VideoInfo; + type Storage = &'a Self; fn to_glib_none(&'a self) -> glib::translate::Stash<'a, *const ffi::GstVideoInfo, Self> { glib::translate::Stash(&self.0, self) @@ -943,7 +941,7 @@ impl<'a> glib::translate::ToGlibPtr<'a, *const ffi::GstVideoInfo> for VideoInfo impl glib::translate::FromGlibPtrNone<*mut ffi::GstVideoInfo> for VideoInfo { #[inline] unsafe fn from_glib_none(ptr: *mut ffi::GstVideoInfo) -> Self { - VideoInfo(ptr::read(ptr)) + Self(ptr::read(ptr)) } } diff --git a/gstreamer-video/src/video_rectangle.rs b/gstreamer-video/src/video_rectangle.rs index 77bee2ca4..378ca66d1 100644 --- a/gstreamer-video/src/video_rectangle.rs +++ b/gstreamer-video/src/video_rectangle.rs @@ -13,7 +13,7 @@ pub struct VideoRectangle { impl VideoRectangle { pub fn new(x: i32, y: i32, w: i32, h: i32) -> Self { skip_assert_initialized!(); - VideoRectangle { x, y, w, h } + Self { x, y, w, h } } } diff --git a/gstreamer-video/src/video_time_code.rs b/gstreamer-video/src/video_time_code.rs index 91b636d6b..5ebed82c3 100644 --- a/gstreamer-video/src/video_time_code.rs +++ b/gstreamer-video/src/video_time_code.rs @@ -20,12 +20,12 @@ pub struct VideoTimeCode(ffi::GstVideoTimeCode); pub struct ValidVideoTimeCode(ffi::GstVideoTimeCode); impl VideoTimeCode { - pub fn new_empty() -> VideoTimeCode { + pub fn new_empty() -> Self { assert_initialized_main_thread!(); unsafe { let mut v = mem::MaybeUninit::zeroed(); ffi::gst_video_time_code_clear(v.as_mut_ptr()); - VideoTimeCode(v.assume_init()) + Self(v.assume_init()) } } @@ -56,7 +56,7 @@ impl VideoTimeCode { field_count, ); - VideoTimeCode(v.assume_init()) + Self(v.assume_init()) } } @@ -67,7 +67,7 @@ impl VideoTimeCode { dt: &glib::DateTime, flags: VideoTimeCodeFlags, field_count: u32, - ) -> Result { + ) -> Result { assert_initialized_main_thread!(); assert!(*fps.denom() > 0); unsafe { @@ -84,7 +84,7 @@ impl VideoTimeCode { if res == glib::ffi::GFALSE { Err(glib::bool_error!("Failed to init video time code")) } else { - Ok(VideoTimeCode(v.assume_init())) + Ok(Self(v.assume_init())) } } } @@ -129,14 +129,14 @@ impl VideoTimeCode { impl TryFrom for ValidVideoTimeCode { type Error = VideoTimeCode; - fn try_from(v: VideoTimeCode) -> Result { + fn try_from(v: VideoTimeCode) -> Result { skip_assert_initialized!(); if v.is_valid() { // Use ManuallyDrop here to prevent the Drop impl of VideoTimeCode // from running as we don't move v.0 out here but copy it. // GstVideoTimeCode implements Copy. let v = mem::ManuallyDrop::new(v); - Ok(ValidVideoTimeCode(v.0)) + Ok(Self(v.0)) } else { Err(v) } @@ -195,7 +195,7 @@ impl ValidVideoTimeCode { pub fn add_interval( &self, tc_inter: &VideoTimeCodeInterval, - ) -> Result { + ) -> Result { unsafe { match from_glib_full(ffi::gst_video_time_code_add_interval( self.to_glib_none().0, @@ -207,7 +207,7 @@ impl ValidVideoTimeCode { } } - fn compare(&self, tc2: &ValidVideoTimeCode) -> i32 { + fn compare(&self, tc2: &Self) -> i32 { unsafe { ffi::gst_video_time_code_compare(self.to_glib_none().0, tc2.to_glib_none().0) } } @@ -520,13 +520,13 @@ impl Ord for ValidVideoTimeCode { } impl From for VideoTimeCode { - fn from(v: ValidVideoTimeCode) -> VideoTimeCode { + fn from(v: ValidVideoTimeCode) -> Self { skip_assert_initialized!(); // Use ManuallyDrop here to prevent the Drop impl of VideoTimeCode // from running as we don't move v.0 out here but copy it. // GstVideoTimeCode implements Copy. let v = mem::ManuallyDrop::new(v); - VideoTimeCode(v.0) + Self(v.0) } } diff --git a/gstreamer-video/src/video_time_code_interval.rs b/gstreamer-video/src/video_time_code_interval.rs index 4ec2f0cf7..7b5046221 100644 --- a/gstreamer-video/src/video_time_code_interval.rs +++ b/gstreamer-video/src/video_time_code_interval.rs @@ -17,7 +17,7 @@ impl VideoTimeCodeInterval { unsafe { let mut v = mem::MaybeUninit::zeroed(); ffi::gst_video_time_code_interval_init(v.as_mut_ptr(), hours, minutes, seconds, frames); - VideoTimeCodeInterval(v.assume_init()) + Self(v.assume_init()) } } @@ -160,7 +160,7 @@ impl FromGlibPtrNone<*mut ffi::GstVideoTimeCodeInterval> for VideoTimeCodeInterv #[inline] unsafe fn from_glib_none(ptr: *mut ffi::GstVideoTimeCodeInterval) -> Self { assert!(!ptr.is_null()); - VideoTimeCodeInterval(ptr::read(ptr)) + Self(ptr::read(ptr)) } } @@ -169,7 +169,7 @@ impl FromGlibPtrNone<*const ffi::GstVideoTimeCodeInterval> for VideoTimeCodeInte #[inline] unsafe fn from_glib_none(ptr: *const ffi::GstVideoTimeCodeInterval) -> Self { assert!(!ptr.is_null()); - VideoTimeCodeInterval(ptr::read(ptr)) + Self(ptr::read(ptr)) } } @@ -178,7 +178,7 @@ impl FromGlibPtrFull<*mut ffi::GstVideoTimeCodeInterval> for VideoTimeCodeInterv #[inline] unsafe fn from_glib_full(ptr: *mut ffi::GstVideoTimeCodeInterval) -> Self { assert!(!ptr.is_null()); - let res = VideoTimeCodeInterval(ptr::read(ptr)); + let res = Self(ptr::read(ptr)); ffi::gst_video_time_code_interval_free(ptr); res @@ -190,7 +190,7 @@ impl FromGlibPtrBorrow<*mut ffi::GstVideoTimeCodeInterval> for VideoTimeCodeInte #[inline] unsafe fn from_glib_borrow(ptr: *mut ffi::GstVideoTimeCodeInterval) -> Borrowed { assert!(!ptr.is_null()); - Borrowed::new(VideoTimeCodeInterval(ptr::read(ptr))) + Borrowed::new(Self(ptr::read(ptr))) } }