[FFmpeg-cvslog] swscale: add sws_free_context()
Niklas Haas
git at videolan.org
Thu Oct 24 00:15:02 EEST 2024
ffmpeg | branch: master | Niklas Haas <git at haasn.dev> | Wed Oct 9 23:15:48 2024 +0200| [87baf9ab2c2465034a90a59308fab34e2801f2b3] | committer: Niklas Haas
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 <git at haasn.dev>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=87baf9ab2c2465034a90a59308fab34e2801f2b3
---
doc/APIchanges | 3 +++
libswscale/swscale.h | 7 +++++++
libswscale/utils.c | 10 ++++++++++
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 <michaelni at 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 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, \
More information about the ffmpeg-cvslog
mailing list