[FFmpeg-devel] [PATCH] cmdutils: make the "-help filter=" output less confusing
Michael Niedermayer
michaelni at gmx.at
Wed Apr 17 14:32:31 CEST 2013
Example:
Filter overlay
Overlay a video source on top of the input.
Inputs:
1st: main (video)
2nd: overlay (video)
Outputs:
1st: default (video)
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
cmdutils.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/cmdutils.c b/cmdutils.c
index 2b5ba33..3464b7a 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -1635,6 +1635,20 @@ static void show_help_muxer(const char *name)
show_help_children(fmt->priv_class, AV_OPT_FLAG_ENCODING_PARAM);
}
+static const char* ordinal_suffix(int i)
+{
+ av_assert0(i >= 0);
+ if (i/10%10 != 1) {
+ switch(i%10) {
+ case 1: return "st";
+ case 2: return "nd";
+ case 3: return "rd";
+ }
+ }
+
+ return "th";
+}
+
#if CONFIG_AVFILTER
static void show_help_filter(const char *name)
{
@@ -1656,7 +1670,7 @@ static void show_help_filter(const char *name)
printf(" Inputs:\n");
count = avfilter_pad_count(f->inputs);
for (i = 0; i < count; i++) {
- printf(" %d %s (%s)\n", i, avfilter_pad_get_name(f->inputs, i),
+ printf(" %d%s: %s (%s)\n", i+1, ordinal_suffix(i+1), avfilter_pad_get_name(f->inputs, i),
media_type_string(avfilter_pad_get_type(f->inputs, i)));
}
if (f->flags & AVFILTER_FLAG_DYNAMIC_INPUTS)
@@ -1667,7 +1681,7 @@ static void show_help_filter(const char *name)
printf(" Outputs:\n");
count = avfilter_pad_count(f->outputs);
for (i = 0; i < count; i++) {
- printf(" %d %s (%s)\n", i, avfilter_pad_get_name(f->outputs, i),
+ printf(" %d%s: %s (%s)\n", i+1, ordinal_suffix(i+1), avfilter_pad_get_name(f->outputs, i),
media_type_string(avfilter_pad_get_type(f->outputs, i)));
}
if (f->flags & AVFILTER_FLAG_DYNAMIC_OUTPUTS)
--
1.7.9.5
More information about the ffmpeg-devel
mailing list