[FFmpeg-devel] [PATCH 3/4] swresample/swresample: Constify swr_convert()

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Wed Feb 28 21:07:30 EET 2024


Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 doc/APIchanges             | 3 +++
 libswresample/swresample.c | 7 ++++---
 libswresample/swresample.h | 4 ++--
 libswresample/version.h    | 2 +-
 4 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 2fca5b7ea8..7d34d12c62 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09
 
 API changes, most recent first:
 
+2024-02-28 - xxxxxxxxxx - swr   4.14.100 - swresample.h
+  swr_convert() now accepts arrays of const pointers (to input and output).
+
 2024-02-28 - xxxxxxxxxx - lavu 58.xx.100 - timestamp.h
   av_ts_make_time_string() now accepts a pointer to const AVRational.
 
diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index 1cf83a803f..6948892d76 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -563,7 +563,8 @@ static void copy(AudioData *out, AudioData *in,
         memcpy(out->ch[0], in->ch[0], count*out->ch_count*out->bps);
 }
 
-static void fill_audiodata(AudioData *out, uint8_t *in_arg [SWR_CH_MAX]){
+static void fill_audiodata(AudioData *out, uint8_t *const in_arg [SWR_CH_MAX])
+{
     int i;
     if(!in_arg){
         memset(out->ch, 0, sizeof(out->ch));
@@ -835,8 +836,8 @@ int swr_is_initialized(struct SwrContext *s) {
 }
 
 int attribute_align_arg swr_convert(struct SwrContext *s,
-                                          uint8_t **out_arg, int out_count,
-                                    const uint8_t **in_arg,  int in_count)
+                                          uint8_t * const *out_arg, int out_count,
+                                    const uint8_t * const *in_arg,  int in_count)
 {
     AudioData * in= &s->in;
     AudioData *out= &s->out;
diff --git a/libswresample/swresample.h b/libswresample/swresample.h
index d4dcaebdcf..78495a0d4c 100644
--- a/libswresample/swresample.h
+++ b/libswresample/swresample.h
@@ -340,8 +340,8 @@ void swr_close(struct SwrContext *s);
  *
  * @return number of samples output per channel, negative value on error
  */
-int swr_convert(struct SwrContext *s, uint8_t **out, int out_count,
-                                const uint8_t **in , int in_count);
+int swr_convert(struct SwrContext *s, uint8_t * const *out, int out_count,
+                                const uint8_t * const *in , int in_count);
 
 /**
  * Convert the next timestamp from input to output
diff --git a/libswresample/version.h b/libswresample/version.h
index 46a4e2fc62..dfaf6f8c42 100644
--- a/libswresample/version.h
+++ b/libswresample/version.h
@@ -30,7 +30,7 @@
 
 #include "version_major.h"
 
-#define LIBSWRESAMPLE_VERSION_MINOR  13
+#define LIBSWRESAMPLE_VERSION_MINOR  14
 #define LIBSWRESAMPLE_VERSION_MICRO 100
 
 #define LIBSWRESAMPLE_VERSION_INT  AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \
-- 
2.40.1



More information about the ffmpeg-devel mailing list