Skip to content

Commit 2f6c495

Browse files
committed
Replace FFmpeg version macro with direct API call
1 parent 3cb9b63 commit 2f6c495

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

av/filter/pad.pyx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,7 @@ cdef tuple alloc_filter_pads(Filter filter, const lib.AVFilterPad *ptr, bint is_
7272
cdef int i = 0
7373
cdef int count
7474
if context is None:
75-
# This is a custom function defined using a macro in avfilter.pxd. Its usage
76-
# can be changed after we stop supporting FFmpeg < 5.0.
77-
count = lib.pyav_get_num_pads(filter.ptr, not is_input, ptr)
75+
count = lib.avfilter_filter_pad_count(filter.ptr, not is_input)
7876
else:
7977
count = (context.ptr.nb_inputs if is_input else context.ptr.nb_outputs)
8078

include/libavfilter/avfilter.pxd

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
1-
21
cdef extern from "libavfilter/avfilter.h" nogil:
3-
"""
4-
#if (LIBAVFILTER_VERSION_INT >= 525156)
5-
// avfilter_filter_pad_count is available since version 8.3.100 of libavfilter (FFmpeg 5.0)
6-
#define _avfilter_get_num_pads(filter, is_output, pads) (avfilter_filter_pad_count(filter, is_output))
7-
#else
8-
// avfilter_filter_pad_count has been deprecated as of version 8.3.100 of libavfilter (FFmpeg 5.0)
9-
#define _avfilter_get_num_pads(filter, is_output, pads) (avfilter_pad_count(pads))
10-
#endif
11-
"""
122
cdef int avfilter_version()
133
cdef char* avfilter_configuration()
144
cdef char* avfilter_license()
@@ -20,10 +10,9 @@ cdef extern from "libavfilter/avfilter.h" nogil:
2010
const char* avfilter_pad_get_name(const AVFilterPad *pads, int index)
2111
AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int index)
2212

23-
int pyav_get_num_pads "_avfilter_get_num_pads" (const AVFilter *filter, int is_output, const AVFilterPad *pads)
13+
cdef unsigned avfilter_filter_pad_count(const AVFilter *filter, int is_output)
2414

2515
cdef struct AVFilter:
26-
2716
AVClass *priv_class
2817

2918
const char *name
@@ -48,7 +37,6 @@ cdef extern from "libavfilter/avfilter.h" nogil:
4837
cdef struct AVFilterLink # Defined later.
4938

5039
cdef struct AVFilterContext:
51-
5240
AVClass *av_class
5341
AVFilter *filter
5442

@@ -68,7 +56,6 @@ cdef extern from "libavfilter/avfilter.h" nogil:
6856
cdef AVClass* avfilter_get_class()
6957

7058
cdef struct AVFilterLink:
71-
7259
AVFilterContext *src
7360
AVFilterPad *srcpad
7461
AVFilterContext *dst

0 commit comments

Comments
 (0)