]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/af_afftfilt.c
avformat/avio: Add Metacube support
[ffmpeg] / libavfilter / af_afftfilt.c
index a14dd280e07fe3957872795370ee807df74b7459..6c1ddbe51fc2ffcae852fd02e4d4daa2afafb51d 100644 (file)
@@ -40,6 +40,7 @@ typedef struct AFFTFiltContext {
     FFTComplex **fft_data;
     FFTComplex **fft_temp;
     int nb_exprs;
+    int channels;
     int window_size;
     AVExpr **real;
     AVExpr **imag;
@@ -117,7 +118,7 @@ static double realf(void *priv, double x, double ch) { return getreal(priv, x, c
 static double imagf(void *priv, double x, double ch) { return getimag(priv, x, ch); }
 
 static const char *const func2_names[]    = { "real", "imag", NULL };
-double (*func2[])(void *, double, double) = {  realf,  imagf, NULL };
+static double (*const func2[])(void *, double, double) = {  realf,  imagf, NULL };
 
 static int config_input(AVFilterLink *inlink)
 {
@@ -129,6 +130,7 @@ static int config_input(AVFilterLink *inlink)
     char *args;
     const char *last_expr = "1";
 
+    s->channels = inlink->channels;
     s->pts  = AV_NOPTS_VALUE;
     s->fft_bits = av_log2(s->fft_size);
     s->fft  = av_fft_init(s->fft_bits, 0);
@@ -435,7 +437,7 @@ static av_cold void uninit(AVFilterContext *ctx)
     av_fft_end(s->fft);
     av_fft_end(s->ifft);
 
-    for (i = 0; i < s->nb_exprs; i++) {
+    for (i = 0; i < s->channels; i++) {
         if (s->fft_data)
             av_freep(&s->fft_data[i]);
         if (s->fft_temp)
@@ -474,7 +476,7 @@ static const AVFilterPad outputs[] = {
     { NULL }
 };
 
-AVFilter ff_af_afftfilt = {
+const AVFilter ff_af_afftfilt = {
     .name            = "afftfilt",
     .description     = NULL_IF_CONFIG_SMALL("Apply arbitrary expressions to samples in frequency domain."),
     .priv_size       = sizeof(AFFTFiltContext),