Commit 841bf0ef authored by Michael Niedermayer's avatar Michael Niedermayer

cmdutils: allow specifying the file for -report

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 7139f0e6
...@@ -528,6 +528,17 @@ int opt_loglevel(void *optctx, const char *opt, const char *arg) ...@@ -528,6 +528,17 @@ int opt_loglevel(void *optctx, const char *opt, const char *arg)
return 0; return 0;
} }
int opt_report_file(void *optctx, const char *opt, const char *arg)
{
report_file = fopen(arg, "w");
if (!report_file) {
av_log(NULL, AV_LOG_ERROR, "Failed to open report \"%s\": %s\n",
arg, strerror(errno));
return AVERROR(errno);
}
return 0;
}
int opt_report(const char *opt) int opt_report(const char *opt)
{ {
char filename[64]; char filename[64];
......
...@@ -84,6 +84,8 @@ int opt_loglevel(void *optctx, const char *opt, const char *arg); ...@@ -84,6 +84,8 @@ int opt_loglevel(void *optctx, const char *opt, const char *arg);
int opt_report(const char *opt); int opt_report(const char *opt);
int opt_report_file(void *optctx, const char *opt, const char *arg);
int opt_max_alloc(void *optctx, const char *opt, const char *arg); int opt_max_alloc(void *optctx, const char *opt, const char *arg);
int opt_cpuflags(void *optctx, const char *opt, const char *arg); int opt_cpuflags(void *optctx, const char *opt, const char *arg);
......
...@@ -19,5 +19,6 @@ ...@@ -19,5 +19,6 @@
{ "debug" , HAS_ARG, {.func_arg = opt_codec_debug}, "set debug flags", "flags" }, { "debug" , HAS_ARG, {.func_arg = opt_codec_debug}, "set debug flags", "flags" },
{ "fdebug" , HAS_ARG, {.func_arg = opt_codec_debug}, "set debug flags", "flags" }, { "fdebug" , HAS_ARG, {.func_arg = opt_codec_debug}, "set debug flags", "flags" },
{ "report" , 0, {(void*)opt_report}, "generate a report" }, { "report" , 0, {(void*)opt_report}, "generate a report" },
{ "report_file", HAS_ARG, {.func_arg = opt_report_file}, "filename for storing the report" },
{ "max_alloc" , HAS_ARG, {.func_arg = opt_max_alloc}, "set maximum size of a single allocated block", "bytes" }, { "max_alloc" , HAS_ARG, {.func_arg = opt_max_alloc}, "set maximum size of a single allocated block", "bytes" },
{ "cpuflags" , HAS_ARG | OPT_EXPERT, {.func_arg = opt_cpuflags}, "force specific cpu flags", "flags" }, { "cpuflags" , HAS_ARG | OPT_EXPERT, {.func_arg = opt_cpuflags}, "force specific cpu flags", "flags" },
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment