diff --git a/libavfilter/formats.c b/libavfilter/formats.c index 021e18abe7..3748030c0e 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -134,3 +134,15 @@ void avfilter_formats_unref(AVFilterFormats **ref) *ref = NULL; } +void avfilter_formats_changeref(AVFilterFormats **oldref, + AVFilterFormats **newref) +{ + int idx; + + if((idx = find_ref_index(oldref)) >= 0) { + (*oldref)->refs[idx] = newref; + *newref = *oldref; + *oldref = NULL; + } +} +