summaryrefslogtreecommitdiff
authorMichael Niedermayer <michaelni@gmx.at>2012-11-01 01:35:22 (GMT)
committer Michael Niedermayer <michaelni@gmx.at>2012-11-01 01:59:44 (GMT)
commit841bf0ef240f0d862b1f07076e079829456fb117 (patch)
tree9b18d2a23b11f7824b7e0e47c1f07fe33947a259
parent7139f0e6bef49b64c8432068990454bf3cbe34e9 (diff)
downloadffmpeg-841bf0ef240f0d862b1f07076e079829456fb117.zip
ffmpeg-841bf0ef240f0d862b1f07076e079829456fb117.tar.gz
ffmpeg-841bf0ef240f0d862b1f07076e079829456fb117.tar.bz2
cmdutils: allow specifying the file for -report
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat
-rw-r--r--cmdutils.c11
-rw-r--r--cmdutils.h2
-rw-r--r--cmdutils_common_opts.h1
3 files changed, 14 insertions, 0 deletions
diff --git a/cmdutils.c b/cmdutils.c
index f696700..248462f 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -528,6 +528,17 @@ int opt_loglevel(void *optctx, const char *opt, const char *arg)
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)
{
char filename[64];
diff --git a/cmdutils.h b/cmdutils.h
index 3885d94..4624f19 100644
--- a/cmdutils.h
+++ b/cmdutils.h
@@ -84,6 +84,8 @@ int opt_loglevel(void *optctx, const char *opt, const char *arg);
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_cpuflags(void *optctx, const char *opt, const char *arg);
diff --git a/cmdutils_common_opts.h b/cmdutils_common_opts.h
index bfd71fe..2e1cf7d 100644
--- a/cmdutils_common_opts.h
+++ b/cmdutils_common_opts.h
@@ -19,5 +19,6 @@
{ "debug" , 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_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" },
{ "cpuflags" , HAS_ARG | OPT_EXPERT, {.func_arg = opt_cpuflags}, "force specific cpu flags", "flags" },