Skip to content

Commit 2dd9b39

Browse files
committed
lavc show_encoder_help: print default values
1 parent df32754 commit 2dd9b39

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/video_compress/libavcodec.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1938,8 +1938,20 @@ void show_encoder_help(string const &name) {
19381938
return;
19391939
}
19401940
while (opt->name != nullptr) {
1941-
cout << (opt->offset == 0 ? "\t\t* " : "\t- ");
1942-
col() << SBOLD(opt->name) << (opt->help != nullptr && strlen(opt->help) > 0 ? " - "s + opt->help : ""s) << "\n";
1941+
string default_val;
1942+
if (opt->offset != 0) {
1943+
if (opt->type == AV_OPT_TYPE_FLOAT || opt->type == AV_OPT_TYPE_DOUBLE) {
1944+
default_val = to_string(opt->default_val.dbl) + "F";
1945+
} else if (opt->type == AV_OPT_TYPE_CONST || opt->type == AV_OPT_TYPE_INT64 || opt->type == AV_OPT_TYPE_INT || opt->type == AV_OPT_TYPE_BOOL) {
1946+
default_val = to_string(opt->default_val.i64);
1947+
} else if (opt->type == AV_OPT_TYPE_STRING && opt->default_val.str != nullptr) {
1948+
default_val = string("\"") + opt->default_val.str + "\"";
1949+
}
1950+
if (!default_val.empty()) {
1951+
default_val = ", default " + default_val;
1952+
}
1953+
}
1954+
col() << (opt->offset == 0 ? "\t\t* " : "\t- ") << SBOLD(opt->name) << (opt->help != nullptr && strlen(opt->help) > 0 ? " - "s + opt->help : ""s) << default_val << "\n";
19431955
opt++;
19441956
}
19451957
if (name == "libx264" || name == "libx265") {

0 commit comments

Comments
 (0)