mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-24 08:12:44 +00:00
avutil/opt: print more meaningful default flags values
Example: % ./ffmpeg -h encoder=gif [...] GIF encoder AVOptions: -gifflags <flags> E..V.... set GIF flags (default offsetting+transdiff) offsetting E..V.... enable picture offsetting transdiff E..V.... enable transparency detection between frames
This commit is contained in:
parent
559603dae1
commit
6b5412cbfa
@ -941,6 +941,27 @@ static const char *get_opt_const_name(void *obj, const char *unit, int64_t value
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *get_opt_flags_string(void *obj, const char *unit, int64_t value)
|
||||||
|
{
|
||||||
|
const AVOption *opt = NULL;
|
||||||
|
char flags[512];
|
||||||
|
|
||||||
|
flags[0] = 0;
|
||||||
|
if (!unit)
|
||||||
|
return NULL;
|
||||||
|
while ((opt = av_opt_next(obj, opt))) {
|
||||||
|
if (opt->type == AV_OPT_TYPE_CONST && !strcmp(opt->unit, unit) &&
|
||||||
|
opt->default_val.i64 & value) {
|
||||||
|
if (flags[0])
|
||||||
|
av_strlcatf(flags, sizeof(flags), "+");
|
||||||
|
av_strlcatf(flags, sizeof(flags), "%s", opt->name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (flags[0])
|
||||||
|
return av_strdup(flags);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void opt_list(void *obj, void *av_log_obj, const char *unit,
|
static void opt_list(void *obj, void *av_log_obj, const char *unit,
|
||||||
int req_flags, int rej_flags)
|
int req_flags, int rej_flags)
|
||||||
{
|
{
|
||||||
@ -1066,9 +1087,16 @@ static void opt_list(void *obj, void *av_log_obj, const char *unit,
|
|||||||
case AV_OPT_TYPE_BOOL:
|
case AV_OPT_TYPE_BOOL:
|
||||||
av_log(av_log_obj, AV_LOG_INFO, "%s", (char *)av_x_if_null(get_bool_name(opt->default_val.i64), "invalid"));
|
av_log(av_log_obj, AV_LOG_INFO, "%s", (char *)av_x_if_null(get_bool_name(opt->default_val.i64), "invalid"));
|
||||||
break;
|
break;
|
||||||
case AV_OPT_TYPE_FLAGS:
|
case AV_OPT_TYPE_FLAGS: {
|
||||||
av_log(av_log_obj, AV_LOG_INFO, "%"PRIX64, opt->default_val.i64);
|
char *def_flags = get_opt_flags_string(obj, opt->unit, opt->default_val.i64);
|
||||||
|
if (def_flags) {
|
||||||
|
av_log(av_log_obj, AV_LOG_INFO, "%s", def_flags);
|
||||||
|
av_freep(&def_flags);
|
||||||
|
} else {
|
||||||
|
av_log(av_log_obj, AV_LOG_INFO, "%"PRIX64, opt->default_val.i64);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case AV_OPT_TYPE_DURATION:
|
case AV_OPT_TYPE_DURATION:
|
||||||
log_value(av_log_obj, AV_LOG_INFO, opt->default_val.i64);
|
log_value(av_log_obj, AV_LOG_INFO, opt->default_val.i64);
|
||||||
break;
|
break;
|
||||||
|
@ -23,7 +23,7 @@ TestContext AVOptions:
|
|||||||
-rational <rational> E....... set rational (from 0 to 10) (default 1/1)
|
-rational <rational> E....... set rational (from 0 to 10) (default 1/1)
|
||||||
-string <string> E....... set string (default "default")
|
-string <string> E....... set string (default "default")
|
||||||
-escape <string> E....... set escape str (default "\=,")
|
-escape <string> E....... set escape str (default "\=,")
|
||||||
-flags <flags> E....... set flags (default 1)
|
-flags <flags> E....... set flags (default cool)
|
||||||
cool E....... set cool flag
|
cool E....... set cool flag
|
||||||
lame E....... set lame flag
|
lame E....... set lame flag
|
||||||
mu E....... set mu flag
|
mu E....... set mu flag
|
||||||
|
Loading…
Reference in New Issue
Block a user