diff options
author | Niklas Haas <[email protected]> | 2024-10-09 23:15:48 +0200 |
---|---|---|
committer | Niklas Haas <[email protected]> | 2024-10-23 23:04:04 +0200 |
commit | 87baf9ab2c2465034a90a59308fab34e2801f2b3 (patch) | |
tree | 27c72ad41551d0aea21ad80a2f2964143e7c19f6 | |
parent | 3bf12beae9eea20b4b6270a9228c877223e81157 (diff) |
swscale: add sws_free_context()
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 <[email protected]>
-rw-r--r-- | doc/APIchanges | 3 | ||||
-rw-r--r-- | libswscale/swscale.h | 7 | ||||
-rw-r--r-- | libswscale/utils.c | 10 | ||||
-rw-r--r-- | libswscale/version.h | 4 |
4 files changed, 22 insertions, 2 deletions
diff --git a/doc/APIchanges b/doc/APIchanges index e71ca57119..c1336d4e40 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07 API changes, most recent first: +2024-10-23 - xxxxxxxxxx - lsws 8.7.100 - swscale.h + Add sws_free_context(). + 2024-10-23 - xxxxxxxxxx - lavu 59.45.100 - pixfmt.h Add AV_PIX_FMT_Y216. diff --git a/libswscale/swscale.h b/libswscale/swscale.h index ef62c540a2..763c1dbccf 100644 --- a/libswscale/swscale.h +++ b/libswscale/swscale.h @@ -1,4 +1,5 @@ /* + * Copyright (C) 2024 Niklas Haas * Copyright (C) 2001-2011 Michael Niedermayer <[email protected]> * * 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 5980597776..0c9e8d58fc 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -2515,6 +2515,16 @@ void sws_freeContext(SwsContext *c) av_free(c); } +void sws_free_context(SwsContext **pctx) +{ + SwsContext *ctx = *pctx; + if (!ctx) + return; + + sws_freeContext(ctx); + *pctx = NULL; +} + SwsContext *sws_getCachedContext(SwsContext *context, int srcW, int srcH, enum AVPixelFormat srcFormat, int dstW, int dstH, diff --git a/libswscale/version.h b/libswscale/version.h index 0fa41f77d2..4c6af261e6 100644 --- a/libswscale/version.h +++ b/libswscale/version.h @@ -28,8 +28,8 @@ #include "version_major.h" -#define LIBSWSCALE_VERSION_MINOR 6 -#define LIBSWSCALE_VERSION_MICRO 101 +#define LIBSWSCALE_VERSION_MINOR 7 +#define LIBSWSCALE_VERSION_MICRO 100 #define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \ LIBSWSCALE_VERSION_MINOR, \ |