mirror of
https://github.com/encounter/rust-ffmpeg.git
synced 2026-07-10 21:18:39 -07:00
fix(filter): adjust iterators to work without avfilter_pad_count, removed in 6.0
This commit is contained in:
@@ -47,7 +47,7 @@ impl Filter {
|
||||
None
|
||||
}
|
||||
else {
|
||||
Some(PadIter::new((*self.as_ptr()).inputs))
|
||||
Some(PadIter::new(ptr, (*self.as_ptr()).nb_inputs as usize))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,7 @@ impl Filter {
|
||||
None
|
||||
}
|
||||
else {
|
||||
Some(PadIter::new((*self.as_ptr()).outputs))
|
||||
Some(PadIter::new(ptr, (*self.as_ptr()).nb_outputs as usize))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -72,15 +72,17 @@ impl Filter {
|
||||
|
||||
pub struct PadIter<'a> {
|
||||
ptr: *const AVFilterPad,
|
||||
cur: isize,
|
||||
count: usize,
|
||||
cur: usize,
|
||||
|
||||
_marker: PhantomData<&'a ()>,
|
||||
}
|
||||
|
||||
impl<'a> PadIter<'a> {
|
||||
pub fn new(ptr: *const AVFilterPad) -> Self {
|
||||
pub fn new(ptr: *const AVFilterPad, count: usize) -> Self {
|
||||
PadIter {
|
||||
ptr,
|
||||
count,
|
||||
cur: 0,
|
||||
_marker: PhantomData,
|
||||
}
|
||||
@@ -92,7 +94,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;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -4,13 +4,13 @@ use crate::{ffi::*, media};
|
||||
|
||||
pub struct Pad<'a> {
|
||||
ptr: *const AVFilterPad,
|
||||
idx: isize,
|
||||
idx: usize,
|
||||
|
||||
_marker: PhantomData<&'a ()>,
|
||||
}
|
||||
|
||||
impl<'a> Pad<'a> {
|
||||
pub unsafe fn wrap(ptr: *const AVFilterPad, idx: isize) -> Self {
|
||||
pub unsafe fn wrap(ptr: *const AVFilterPad, idx: usize) -> Self {
|
||||
Pad {
|
||||
ptr,
|
||||
idx,
|
||||
|
||||
Reference in New Issue
Block a user