Support ffmpeg 6.0

Closes #6
This commit is contained in:
Josh Holmer
2023-03-07 13:21:39 -05:00
parent 83a831befb
commit c6dd54003e
10 changed files with 231 additions and 7 deletions

View File

@ -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;
}