From 7037f6d8369ec6738402e57472d5cd0ce5973ece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 17 Oct 2021 11:24:33 +0300 Subject: [PATCH] video: Rename VideoOverlayComposition iterator struct --- gstreamer-video/src/lib.rs | 7 +++++-- gstreamer-video/src/video_overlay_composition.rs | 14 +++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/gstreamer-video/src/lib.rs b/gstreamer-video/src/lib.rs index fff44a987..a53814614 100644 --- a/gstreamer-video/src/lib.rs +++ b/gstreamer-video/src/lib.rs @@ -61,8 +61,11 @@ mod functions; pub use crate::functions::*; mod video_rectangle; pub use crate::video_rectangle::*; -mod video_overlay_composition; -pub use crate::video_overlay_composition::*; +pub mod video_overlay_composition; +pub use crate::video_overlay_composition::{ + VideoOverlayComposition, VideoOverlayCompositionRef, VideoOverlayRectangle, + VideoOverlayRectangleRef, +}; pub mod video_meta; #[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] diff --git a/gstreamer-video/src/video_overlay_composition.rs b/gstreamer-video/src/video_overlay_composition.rs index 1db2eca30..d88f9a636 100644 --- a/gstreamer-video/src/video_overlay_composition.rs +++ b/gstreamer-video/src/video_overlay_composition.rs @@ -288,8 +288,8 @@ impl VideoOverlayCompositionRef { } } - pub fn iter(&self) -> VideoOverlayCompositionIterator { - VideoOverlayCompositionIterator { + pub fn iter(&self) -> Iter { + Iter { composition: self, idx: 0, len: self.n_rectangles(), @@ -298,7 +298,7 @@ impl VideoOverlayCompositionRef { } impl<'a> IntoIterator for &'a VideoOverlayComposition { - type IntoIter = VideoOverlayCompositionIterator<'a>; + type IntoIter = Iter<'a>; type Item = VideoOverlayRectangle; fn into_iter(self) -> Self::IntoIter { @@ -306,13 +306,13 @@ impl<'a> IntoIterator for &'a VideoOverlayComposition { } } -pub struct VideoOverlayCompositionIterator<'a> { +pub struct Iter<'a> { composition: &'a VideoOverlayCompositionRef, idx: u32, len: u32, } -impl<'a> Iterator for VideoOverlayCompositionIterator<'a> { +impl<'a> Iterator for Iter<'a> { type Item = VideoOverlayRectangle; fn next(&mut self) -> Option { @@ -337,7 +337,7 @@ impl<'a> Iterator for VideoOverlayCompositionIterator<'a> { } } -impl<'a> DoubleEndedIterator for VideoOverlayCompositionIterator<'a> { +impl<'a> DoubleEndedIterator for Iter<'a> { fn next_back(&mut self) -> Option { if self.idx == self.len { return None; @@ -351,4 +351,4 @@ impl<'a> DoubleEndedIterator for VideoOverlayCompositionIterator<'a> { } } -impl<'a> ExactSizeIterator for VideoOverlayCompositionIterator<'a> {} +impl<'a> ExactSizeIterator for Iter<'a> {}