]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/af_volumedetect.c
lavfi/deshake: small align prettifying.
[ffmpeg] / libavfilter / af_volumedetect.c
index ab77a9cbef3b0cfb69e2434be1f58b5a44bed505..01f30a64310ed2ed3e0ce242d895ca58ef86184b 100644 (file)
@@ -49,7 +49,7 @@ static int query_formats(AVFilterContext *ctx)
     return 0;
 }
 
-static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samples)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *samples)
 {
     AVFilterContext *ctx = inlink->dst;
     VolDetectContext *vd = ctx->priv;
@@ -70,7 +70,7 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samples)
             vd->histogram[pcm[i] + 0x8000]++;
     }
 
-    return ff_filter_samples(inlink->dst->outputs[0], samples);
+    return ff_filter_frame(inlink->dst->outputs[0], samples);
 }
 
 #define MAX_DB 91
@@ -131,6 +131,25 @@ static void uninit(AVFilterContext *ctx)
     print_stats(ctx);
 }
 
+static const AVFilterPad volumedetect_inputs[] = {
+    {
+        .name             = "default",
+        .type             = AVMEDIA_TYPE_AUDIO,
+        .get_audio_buffer = ff_null_get_audio_buffer,
+        .filter_frame     = filter_frame,
+        .min_perms        = AV_PERM_READ,
+    },
+    { NULL }
+};
+
+static const AVFilterPad volumedetect_outputs[] = {
+    {
+        .name = "default",
+        .type = AVMEDIA_TYPE_AUDIO,
+    },
+    { NULL }
+};
+
 AVFilter avfilter_af_volumedetect = {
     .name          = "volumedetect",
     .description   = NULL_IF_CONFIG_SMALL("Detect audio volume."),
@@ -138,18 +157,6 @@ AVFilter avfilter_af_volumedetect = {
     .priv_size     = sizeof(VolDetectContext),
     .query_formats = query_formats,
     .uninit        = uninit,
-
-    .inputs    = (const AVFilterPad[]) {
-        { .name             = "default",
-          .type             = AVMEDIA_TYPE_AUDIO,
-          .get_audio_buffer = ff_null_get_audio_buffer,
-          .filter_samples   = filter_samples,
-          .min_perms        = AV_PERM_READ, },
-        { .name = NULL }
-    },
-    .outputs   = (const AVFilterPad[]) {
-        { .name = "default",
-          .type = AVMEDIA_TYPE_AUDIO, },
-        { .name = NULL }
-    },
+    .inputs        = volumedetect_inputs,
+    .outputs       = volumedetect_outputs,
 };