@ -47,7 +47,10 @@ impl Filter {
|
||||
if ptr.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(PadIter::new((*self.as_ptr()).inputs))
|
||||
Some(PadIter::new(
|
||||
(*self.as_ptr()).inputs,
|
||||
(*self.as_ptr()).nb_inputs as isize,
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -59,7 +62,10 @@ impl Filter {
|
||||
if ptr.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(PadIter::new((*self.as_ptr()).outputs))
|
||||
Some(PadIter::new(
|
||||
(*self.as_ptr()).outputs,
|
||||
(*self.as_ptr()).nb_outputs as isize,
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -71,15 +77,17 @@ impl Filter {
|
||||
|
||||
pub struct PadIter<'a> {
|
||||
ptr: *const AVFilterPad,
|
||||
count: isize,
|
||||
cur: isize,
|
||||
|
||||
_marker: PhantomData<&'a ()>,
|
||||
}
|
||||
|
||||
impl<'a> PadIter<'a> {
|
||||
pub fn new(ptr: *const AVFilterPad) -> Self {
|
||||
pub fn new(ptr: *const AVFilterPad, count: isize) -> Self {
|
||||
PadIter {
|
||||
ptr,
|
||||
count,
|
||||
cur: 0,
|
||||
_marker: PhantomData,
|
||||
}
|
||||
@ -91,7 +99,7 @@ impl<'a> Iterator for PadIter<'a> {
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
unsafe {
|
||||
if self.cur >= avfilter_pad_count(self.ptr) as isize {
|
||||
if self.cur >= self.count {
|
||||
return None;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user