lavfi: deprecate avfilter_link_free()

It never makes sense for this function to be called by users.
This commit is contained in:
Anton Khirnov 2024-03-04 16:23:31 +01:00
parent c0aee39412
commit 6b1f41e152
3 changed files with 15 additions and 3 deletions

View File

@ -192,7 +192,7 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad,
return 0; return 0;
} }
void avfilter_link_free(AVFilterLink **link) static void link_free(AVFilterLink **link)
{ {
FilterLinkInternal *li; FilterLinkInternal *li;
@ -207,6 +207,13 @@ void avfilter_link_free(AVFilterLink **link)
av_freep(link); av_freep(link);
} }
#if FF_API_LINK_PUBLIC
void avfilter_link_free(AVFilterLink **link)
{
link_free(link);
}
#endif
static void update_link_current_pts(FilterLinkInternal *li, int64_t pts) static void update_link_current_pts(FilterLinkInternal *li, int64_t pts)
{ {
AVFilterLink *const link = &li->l; AVFilterLink *const link = &li->l;
@ -763,7 +770,7 @@ static void free_link(AVFilterLink *link)
ff_formats_unref(&link->outcfg.samplerates); ff_formats_unref(&link->outcfg.samplerates);
ff_channel_layouts_unref(&link->incfg.channel_layouts); ff_channel_layouts_unref(&link->incfg.channel_layouts);
ff_channel_layouts_unref(&link->outcfg.channel_layouts); ff_channel_layouts_unref(&link->outcfg.channel_layouts);
avfilter_link_free(&link); link_free(&link);
} }
void avfilter_free(AVFilterContext *filter) void avfilter_free(AVFilterContext *filter)

View File

@ -676,10 +676,13 @@ struct AVFilterLink {
int avfilter_link(AVFilterContext *src, unsigned srcpad, int avfilter_link(AVFilterContext *src, unsigned srcpad,
AVFilterContext *dst, unsigned dstpad); AVFilterContext *dst, unsigned dstpad);
#if FF_API_LINK_PUBLIC
/** /**
* Free the link in *link, and set its pointer to NULL. * @deprecated this function should never be called by users
*/ */
attribute_deprecated
void avfilter_link_free(AVFilterLink **link); void avfilter_link_free(AVFilterLink **link);
#endif
/** /**
* Negotiate the media format, dimensions, etc of all inputs to a filter. * Negotiate the media format, dimensions, etc of all inputs to a filter.

View File

@ -35,4 +35,6 @@
* the public API and may change, break or disappear at any time. * the public API and may change, break or disappear at any time.
*/ */
#define FF_API_LINK_PUBLIC (LIBAVFILTER_VERSION_MAJOR < 11)
#endif /* AVFILTER_VERSION_MAJOR_H */ #endif /* AVFILTER_VERSION_MAJOR_H */