]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/af_adelay.c
avfilter: Constify all AVFilters
[ffmpeg] / libavfilter / af_adelay.c
index 6ac81c2a3e04cf77b8fd8af577f5b3cccf8a8d14..c6450cb2b9bf0ca8eb5e66c782c533a64d51d0b0 100644 (file)
@@ -28,9 +28,9 @@
 #include "internal.h"
 
 typedef struct ChanDelay {
-    int delay;
-    unsigned delay_index;
-    unsigned index;
+    int64_t delay;
+    size_t delay_index;
+    size_t index;
     uint8_t *samples;
 } ChanDelay;
 
@@ -152,7 +152,7 @@ static int config_input(AVFilterLink *inlink)
 
         p = NULL;
 
-        ret = av_sscanf(arg, "%d%c", &d->delay, &type);
+        ret = av_sscanf(arg, "%"SCNd64"%c", &d->delay, &type);
         if (ret != 2 || type != 'S') {
             div = type == 's' ? 1.0 : 1000.0;
             if (av_sscanf(arg, "%f", &delay) != 1) {
@@ -194,6 +194,11 @@ static int config_input(AVFilterLink *inlink)
         if (!d->delay)
             continue;
 
+        if (d->delay > SIZE_MAX) {
+            av_log(ctx, AV_LOG_ERROR, "Requested delay is too big.\n");
+            return AVERROR(EINVAL);
+        }
+
         d->samples = av_malloc_array(d->delay, s->block_align);
         if (!d->samples)
             return AVERROR(ENOMEM);
@@ -345,7 +350,7 @@ static const AVFilterPad adelay_outputs[] = {
     { NULL }
 };
 
-AVFilter ff_af_adelay = {
+const AVFilter ff_af_adelay = {
     .name          = "adelay",
     .description   = NULL_IF_CONFIG_SMALL("Delay one or more audio channels."),
     .query_formats = query_formats,