]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/af_headphone.c
avfilter/af_headphone: Remove always true check
[ffmpeg] / libavfilter / af_headphone.c
index 14cef0e1e75c117f72d449a9786d4064c8b318f6..1024ff57b19c3cdd21a59563ebd962707fed4395 100644 (file)
@@ -135,7 +135,7 @@ static void parse_map(AVFilterContext *ctx)
 
         p = NULL;
         if (parse_channel_name(s, s->nb_irs, &arg, &out_ch_id, buf)) {
-            av_log(ctx, AV_LOG_WARNING, "Failed to parse \'%s\' as channel name.\n", buf);
+            av_log(ctx, AV_LOG_WARNING, "Failed to parse \'%s\' as channel name.\n", arg);
             continue;
         }
         s->mapping[s->nb_irs] = out_ch_id;
@@ -418,12 +418,12 @@ static int convert_coeffs(AVFilterContext *ctx, AVFilterLink *inlink)
 
         av_fft_end(s->fft[0]);
         av_fft_end(s->fft[1]);
-        s->fft[0] = av_fft_init(log2(s->n_fft), 0);
-        s->fft[1] = av_fft_init(log2(s->n_fft), 0);
+        s->fft[0] = av_fft_init(av_log2(s->n_fft), 0);
+        s->fft[1] = av_fft_init(av_log2(s->n_fft), 0);
         av_fft_end(s->ifft[0]);
         av_fft_end(s->ifft[1]);
-        s->ifft[0] = av_fft_init(log2(s->n_fft), 1);
-        s->ifft[1] = av_fft_init(log2(s->n_fft), 1);
+        s->ifft[0] = av_fft_init(av_log2(s->n_fft), 1);
+        s->ifft[1] = av_fft_init(av_log2(s->n_fft), 1);
 
         if (!s->fft[0] || !s->fft[1] || !s->ifft[0] || !s->ifft[1]) {
             av_log(ctx, AV_LOG_ERROR, "Unable to create FFT contexts of size %d.\n", s->n_fft);
@@ -631,10 +631,8 @@ static int activate(AVFilterContext *ctx)
             if ((ret = check_ir(ctx->inputs[i], i)) < 0)
                 return ret;
 
-            if (!s->in[i].eof) {
                 if (ff_outlink_get_status(ctx->inputs[i]) == AVERROR_EOF)
                     s->in[i].eof = 1;
-            }
         }
 
         for (i = 1; i < s->nb_inputs; i++) {
@@ -698,33 +696,32 @@ static int query_formats(AVFilterContext *ctx)
     if (!layouts)
         return AVERROR(ENOMEM);
 
-    ret = ff_channel_layouts_ref(layouts, &ctx->inputs[0]->out_channel_layouts);
+    ret = ff_channel_layouts_ref(layouts, &ctx->inputs[0]->outcfg.channel_layouts);
     if (ret)
         return ret;
 
     ret = ff_add_channel_layout(&stereo_layout, AV_CH_LAYOUT_STEREO);
+    if (ret)
+        return ret;
+    ret = ff_channel_layouts_ref(stereo_layout, &ctx->outputs[0]->incfg.channel_layouts);
     if (ret)
         return ret;
 
     if (s->hrir_fmt == HRIR_MULTI) {
         hrir_layouts = ff_all_channel_counts();
         if (!hrir_layouts)
-            ret = AVERROR(ENOMEM);
-        ret = ff_channel_layouts_ref(hrir_layouts, &ctx->inputs[1]->out_channel_layouts);
+            return AVERROR(ENOMEM);
+        ret = ff_channel_layouts_ref(hrir_layouts, &ctx->inputs[1]->outcfg.channel_layouts);
         if (ret)
             return ret;
     } else {
         for (i = 1; i < s->nb_inputs; i++) {
-            ret = ff_channel_layouts_ref(stereo_layout, &ctx->inputs[i]->out_channel_layouts);
+            ret = ff_channel_layouts_ref(stereo_layout, &ctx->inputs[i]->outcfg.channel_layouts);
             if (ret)
                 return ret;
         }
     }
 
-    ret = ff_channel_layouts_ref(stereo_layout, &ctx->outputs[0]->in_channel_layouts);
-    if (ret)
-        return ret;
-
     formats = ff_all_samplerates();
     if (!formats)
         return AVERROR(ENOMEM);
@@ -812,7 +809,6 @@ static int config_output(AVFilterLink *outlink)
 static av_cold void uninit(AVFilterContext *ctx)
 {
     HeadphoneContext *s = ctx->priv;
-    int i;
 
     av_fft_end(s->ifft[0]);
     av_fft_end(s->ifft[1]);
@@ -834,11 +830,9 @@ static av_cold void uninit(AVFilterContext *ctx)
     av_freep(&s->data_hrtf[1]);
     av_freep(&s->fdsp);
 
-    for (i = 0; i < s->nb_inputs; i++) {
-        if (ctx->input_pads && i)
-            av_freep(&ctx->input_pads[i].name);
-    }
     av_freep(&s->in);
+    for (unsigned i = 1; i < ctx->nb_inputs; i++)
+        av_freep(&ctx->input_pads[i].name);
 }
 
 #define OFFSET(x) offsetof(HeadphoneContext, x)