mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 11:01:10 +00:00
pbutils: Move DiscovererStreamInfo
iterators to an extension trait
This way it can also be called directly on subclasses. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1273>
This commit is contained in:
parent
2becc79dfb
commit
b89b135c93
2 changed files with 11 additions and 5 deletions
|
@ -28,20 +28,25 @@ impl Iterator for Iter {
|
|||
}
|
||||
}
|
||||
|
||||
impl DiscovererStreamInfo {
|
||||
pub fn next_iter(&self) -> Iter {
|
||||
impl std::iter::FusedIterator for Iter {}
|
||||
|
||||
pub trait DiscovererStreamInfoExtManual: 'static {
|
||||
fn next_iter(&self) -> Iter;
|
||||
fn previous_iter(&self) -> Iter;
|
||||
}
|
||||
|
||||
impl<O: IsA<DiscovererStreamInfo>> DiscovererStreamInfoExtManual for O {
|
||||
fn next_iter(&self) -> Iter {
|
||||
Iter {
|
||||
stream_info: self.next(),
|
||||
direction_forward: true,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn previous_iter(&self) -> Iter {
|
||||
fn previous_iter(&self) -> Iter {
|
||||
Iter {
|
||||
stream_info: self.previous(),
|
||||
direction_forward: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::iter::FusedIterator for Iter {}
|
||||
|
|
|
@ -62,6 +62,7 @@ pub mod prelude {
|
|||
pub use crate::{
|
||||
audio_visualizer::*,
|
||||
auto::traits::*,
|
||||
discoverer_stream_info::DiscovererStreamInfoExtManual,
|
||||
encoding_profile::{
|
||||
EncodingProfileBuilder, EncodingProfileExtManual, EncodingProfileHasRestrictionGetter,
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue