From: Niklas Haas <g...@haasn.dev> Merely a convenience wrapper around sws_freeContext(). The name change is for parity with the other sws_* functions.
Sponsored-by: Sovereign Tech Fund Signed-off-by: Niklas Haas <g...@haasn.dev> --- libswscale/swscale.h | 7 +++++++ libswscale/utils.c | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/libswscale/swscale.h b/libswscale/swscale.h index b5dea09bef..f9fd340240 100644 --- a/libswscale/swscale.h +++ b/libswscale/swscale.h @@ -1,4 +1,5 @@ /* + * Copyright (C) 2024 Niklas Haas * Copyright (C) 2001-2011 Michael Niedermayer <michae...@gmx.at> * * This file is part of FFmpeg. @@ -78,6 +79,12 @@ const AVClass *sws_get_class(void); */ SwsContext *sws_alloc_context(void); +/** + * Free the context and everything associated with it, and write NULL + * to the provided pointer. + */ +void sws_free_context(SwsContext **ctx); + /* values for the flags, the stuff on the command line is different */ #define SWS_FAST_BILINEAR 1 #define SWS_BILINEAR 2 diff --git a/libswscale/utils.c b/libswscale/utils.c index 4b5106cb57..650785a989 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -2520,6 +2520,16 @@ void sws_freeContext(SwsContext *sws) av_free(sws); } +void sws_free_context(SwsContext **pctx) +{ + SwsContext *ctx = *pctx; + if (!ctx) + return; + + sws_freeContext(ctx); + *pctx = NULL; +} + SwsContext *sws_getCachedContext(SwsContext *sws, int srcW, int srcH, enum AVPixelFormat srcFormat, int dstW, int dstH, -- 2.46.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".