]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/af_amix.c
lavfi/scale: accept named options, make parsing more robust
[ffmpeg] / libavfilter / af_amix.c
index 9d0f998f628a619050425ef216b278578cca4170..a93adddf3481f82e0eb7e67d276ae34a56cd9eed 100644 (file)
@@ -280,8 +280,10 @@ static int output_frame(AVFilterLink *outlink, int nb_samples)
         return AVERROR(ENOMEM);
 
     in_buf = ff_get_audio_buffer(outlink, AV_PERM_WRITE, nb_samples);
-    if (!in_buf)
+    if (!in_buf) {
+        avfilter_unref_buffer(out_buf);
         return AVERROR(ENOMEM);
+    }
 
     for (i = 0; i < s->nb_inputs; i++) {
         if (s->input_state[i] == INPUT_ON) {
@@ -540,6 +542,16 @@ static int query_formats(AVFilterContext *ctx)
     return 0;
 }
 
+static const AVFilterPad avfilter_af_amix_outputs[] = {
+    {
+        .name          = "default",
+        .type          = AVMEDIA_TYPE_AUDIO,
+        .config_props  = config_output,
+        .request_frame = request_frame
+    },
+    { NULL }
+};
+
 AVFilter avfilter_af_amix = {
     .name          = "amix",
     .description   = NULL_IF_CONFIG_SMALL("Audio mixing."),
@@ -550,10 +562,6 @@ AVFilter avfilter_af_amix = {
     .query_formats  = query_formats,
 
     .inputs    = NULL,
-    .outputs   = (const AVFilterPad[]) {{ .name          = "default",
-                                          .type          = AVMEDIA_TYPE_AUDIO,
-                                          .config_props  = config_output,
-                                          .request_frame = request_frame },
-                                        { .name = NULL}},
+    .outputs   = avfilter_af_amix_outputs,
     .priv_class = &amix_class,
 };