]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/af_stereotools.c
avfilter,swresample,swscale: use fabs, fabsf instead of FFABS
[ffmpeg] / libavfilter / af_stereotools.c
index f4030b7c4e0698b09200b4e0c0fe7f6541c76bd5..a22efb02eae7e010da49317591e86f01f081372f 100644 (file)
@@ -92,16 +92,15 @@ static int query_formats(AVFilterContext *ctx)
 {
     AVFilterFormats *formats = NULL;
     AVFilterChannelLayouts *layout = NULL;
+    int ret;
 
-    ff_add_format(&formats, AV_SAMPLE_FMT_DBL);
-    ff_set_common_formats(ctx, formats);
-    ff_add_channel_layout(&layout, AV_CH_LAYOUT_STEREO);
-    ff_set_common_channel_layouts(ctx, layout);
+    if ((ret = ff_add_format                 (&formats, AV_SAMPLE_FMT_DBL  )) < 0 ||
+        (ret = ff_set_common_formats         (ctx     , formats            )) < 0 ||
+        (ret = ff_add_channel_layout         (&layout , AV_CH_LAYOUT_STEREO)) < 0 ||
+        (ret = ff_set_common_channel_layouts (ctx     , layout             )) < 0)
+        return ret;
 
     formats = ff_all_samplerates();
-    if (!formats)
-        return AVERROR(ENOMEM);
-
     return ff_set_common_samplerates(ctx, formats);
 }
 
@@ -145,16 +144,16 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
     const int phase_l = floor(s->phase_l + 0.5);
     const int phase_r = floor(s->phase_r + 0.5);
     double *buffer = s->buffer;
-    AVFrame *out = NULL;
+    AVFrame *out;
     double *dst;
-    int nbuf = inlink->sample_rate * (FFABS(delay) / 1000.);
+    int nbuf = inlink->sample_rate * (fabs(delay) / 1000.);
     int n;
 
     nbuf -= nbuf % 2;
     if (av_frame_is_writable(in)) {
         out = in;
     } else {
-        AVFrame *out = ff_get_audio_buffer(inlink, in->nb_samples);
+        out = ff_get_audio_buffer(inlink, in->nb_samples);
         if (!out) {
             av_frame_free(&in);
             return AVERROR(ENOMEM);