diff mbox

[FFmpeg-devel] avfilter/xstack: set better error msg for missing layout

Message ID 091bfce1-99c2-583a-dd6c-52efdee64d45@gyani.pro
State Accepted
Commit b3b7ba623f95224557bd67a060adf4ca7ee94dde
Headers show

Commit Message

Gyan Doshi May 7, 2019, 10:56 a.m. UTC
Set a better error msg than the current failure to configure output pad.
From 119516fe777e1e026503a6ba176a662680d711bd Mon Sep 17 00:00:00 2001
From: Gyan Doshi <ffmpeg@gyani.pro>
Date: Tue, 7 May 2019 16:00:40 +0530
Subject: [PATCH] avfilter/xstack: set better error msg for missing layout

---
 libavfilter/vf_stack.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Paul B Mahol May 7, 2019, 11:08 a.m. UTC | #1
On 5/7/19, Gyan <ffmpeg@gyani.pro> wrote:
> Set a better error msg than the current failure to configure output pad.
>

Please apply, but with: avfilter/vf_xstack: set better error msg for
missing layout
Gyan Doshi May 7, 2019, 11:12 a.m. UTC | #2
On 07-05-2019 04:38 PM, Paul B Mahol wrote:
> On 5/7/19, Gyan <ffmpeg@gyani.pro> wrote:
>> Set a better error msg than the current failure to configure output pad.
>>
> Please apply, but with: avfilter/vf_xstack: set better error msg for
> missing layout
Will do.

Thanks,
Gyan
Gyan Doshi May 7, 2019, 11:20 a.m. UTC | #3
On 07-05-2019 04:42 PM, Gyan wrote:
>
>
> On 07-05-2019 04:38 PM, Paul B Mahol wrote:
>> On 5/7/19, Gyan <ffmpeg@gyani.pro> wrote:
>>> Set a better error msg than the current failure to configure output 
>>> pad.
>>>
>> Please apply, but with: avfilter/vf_xstack: set better error msg for
>> missing layout
> Will do.
>
> Thanks,
> Gyan

Pushed as b3b7ba623f95224557bd67a060adf4ca7ee94dde

Gyan
Moritz Barsnick May 7, 2019, 12:15 p.m. UTC | #4
On Tue, May 07, 2019 at 16:26:01 +0530, Gyan wrote:
>      { "inputs", "set number of inputs", OFFSET(nb_inputs), AV_OPT_TYPE_INT, {.i64=2}, 2, INT_MAX, .flags = FLAGS },
> -    { "layout", "set custom layout", OFFSET(layout), AV_OPT_TYPE_STRING, {.str="0_0|w0_0"}, 0, 0, .flags = FLAGS },
> +    { "layout", "set custom layout", OFFSET(layout), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, .flags = FLAGS },
>      { "shortest", "force termination when the shortest input terminates", OFFSET(shortest), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, .flags = FLAGS },

Because the default is no longer self-documenting ("ffmpeg -h
filter=xstack"), filters.texi should be updated to mention the default.

Cheers,
Moritz
Gyan Doshi May 7, 2019, 12:27 p.m. UTC | #5
On 07-05-2019 05:45 PM, Moritz Barsnick wrote:
> On Tue, May 07, 2019 at 16:26:01 +0530, Gyan wrote:
>>       { "inputs", "set number of inputs", OFFSET(nb_inputs), AV_OPT_TYPE_INT, {.i64=2}, 2, INT_MAX, .flags = FLAGS },
>> -    { "layout", "set custom layout", OFFSET(layout), AV_OPT_TYPE_STRING, {.str="0_0|w0_0"}, 0, 0, .flags = FLAGS },
>> +    { "layout", "set custom layout", OFFSET(layout), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, .flags = FLAGS },
>>       { "shortest", "force termination when the shortest input terminates", OFFSET(shortest), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, .flags = FLAGS },
> Because the default is no longer self-documenting ("ffmpeg -h
> filter=xstack"), filters.texi should be updated to mention the default.
Done. Pushed as a0328f05dc02e61e8173f981cd578d0a36d7c0fc

Thanks,
Gyan
diff mbox

Patch

diff --git a/libavfilter/vf_stack.c b/libavfilter/vf_stack.c
index b836d96bf0..1455f196a7 100644
--- a/libavfilter/vf_stack.c
+++ b/libavfilter/vf_stack.c
@@ -83,6 +83,15 @@  static av_cold int init(AVFilterContext *ctx)
         return AVERROR(ENOMEM);
 
     if (!strcmp(ctx->filter->name, "xstack")) {
+        if (!s->layout) {
+            if (s->nb_inputs == 2)
+                s->layout = "0_0|w0_0";
+            else {
+                av_log(ctx, AV_LOG_ERROR, "No layout specified.\n");
+                return AVERROR(EINVAL);
+            }
+        }
+
         s->items = av_calloc(s->nb_inputs, sizeof(*s->items));
         if (!s->items)
             return AVERROR(ENOMEM);
@@ -385,7 +394,7 @@  AVFilter ff_vf_vstack = {
 
 static const AVOption xstack_options[] = {
     { "inputs", "set number of inputs", OFFSET(nb_inputs), AV_OPT_TYPE_INT, {.i64=2}, 2, INT_MAX, .flags = FLAGS },
-    { "layout", "set custom layout", OFFSET(layout), AV_OPT_TYPE_STRING, {.str="0_0|w0_0"}, 0, 0, .flags = FLAGS },
+    { "layout", "set custom layout", OFFSET(layout), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, .flags = FLAGS },
     { "shortest", "force termination when the shortest input terminates", OFFSET(shortest), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, .flags = FLAGS },
     { NULL },
 };