diff options
author | wm4 <wm4@nowhere> | 2018-02-13 05:04:59 +0100 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2018-02-13 17:45:29 -0800 |
commit | ceca1602e9360564a780036597dfe904566611ff (patch) | |
tree | 4bbf59f3a4754eb2d6facf093501fb3ccb375e92 | |
parent | 223821d91c7ace8a4f7f726f1868bf2ae76b90ba (diff) | |
download | mpv-ceca1602e9360564a780036597dfe904566611ff.tar.bz2 mpv-ceca1602e9360564a780036597dfe904566611ff.tar.xz |
f_lavfi: extend filter help output
Also print type and help string. Also print AV_OPT_TYPE_CONST, which are
like the mpv choice option type, except different. Print them as
separate lines because FFmpeg usually has help strings for them too.
-rw-r--r-- | filters/f_lavfi.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/filters/f_lavfi.c b/filters/f_lavfi.c index 745d1699a7..dc594e7381 100644 --- a/filters/f_lavfi.c +++ b/filters/f_lavfi.c @@ -914,6 +914,35 @@ static void dump_list(struct mp_log *log, int media_type) } } +static const char *get_avopt_type_name(enum AVOptionType type) +{ + switch (type) { + case AV_OPT_TYPE_FLAGS: return "flags"; + case AV_OPT_TYPE_INT: return "int"; + case AV_OPT_TYPE_INT64: return "int64"; + case AV_OPT_TYPE_DOUBLE: return "double"; + case AV_OPT_TYPE_FLOAT: return "float"; + case AV_OPT_TYPE_STRING: return "string"; + case AV_OPT_TYPE_RATIONAL: return "rational"; + case AV_OPT_TYPE_BINARY: return "binary"; + case AV_OPT_TYPE_DICT: return "dict"; + case AV_OPT_TYPE_UINT64: return "uint64"; + case AV_OPT_TYPE_IMAGE_SIZE: return "imagesize"; + case AV_OPT_TYPE_PIXEL_FMT: return "pixfmt"; + case AV_OPT_TYPE_SAMPLE_FMT: return "samplefmt"; + case AV_OPT_TYPE_VIDEO_RATE: return "fps"; + case AV_OPT_TYPE_DURATION: return "duration"; + case AV_OPT_TYPE_COLOR: return "color"; + case AV_OPT_TYPE_CHANNEL_LAYOUT: return "channellayout"; + case AV_OPT_TYPE_BOOL: return "bool"; + case AV_OPT_TYPE_CONST: // fallthrough + default: + return NULL; + } +} + +#define NSTR(s) ((s) ? (s) : "") + void print_lavfi_help(struct mp_log *log, const char *name, int media_type) { const AVFilter *f = avfilter_get_by_name(name); @@ -939,7 +968,18 @@ void print_lavfi_help(struct mp_log *log, const char *name, int media_type) continue; offset = o->offset; - mp_info(log, " %s\n", o->name); + const char *t = get_avopt_type_name(o->type); + char *tstr = t ? mp_tprintf(30, "<%s>", t) : "?"; + mp_info(log, " %-10s %-12s %s\n", o->name, tstr, NSTR(o->help)); + + const AVOption *sub = o; + while (1) { + sub = av_opt_next(c, sub); + if (!sub || sub->type != AV_OPT_TYPE_CONST) + break; + mp_info(log, " %3s%-23s %s\n", "", sub->name, NSTR(sub->help)); + } + count++; } mp_info(log, "\nTotal: %d options\n", count); |