aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-05-12 22:23:36 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-06-14 22:54:32 +0200
commitd82ecfce07d1fee314b5532b773ef019eefed9b6 (patch)
treef56f8ca4d35cf2b91dfa3c1a12b06beaaddb5c7f
parent3fc37a3d2f1338a2878eb883526b67645e79121c (diff)
downloadffmpeg-d82ecfce07d1fee314b5532b773ef019eefed9b6.tar.gz
cmdutils: implement FFREPORT=level=...
Fixes Ticket3057 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--cmdutils.c14
-rw-r--r--doc/fftools-common-opts.texi2
2 files changed, 14 insertions, 2 deletions
diff --git a/cmdutils.c b/cmdutils.c
index 63d64320eb..e7e8f639e6 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -66,6 +66,7 @@ AVDictionary *swr_opts;
AVDictionary *format_opts, *codec_opts, *resample_opts;
static FILE *report_file;
+static int report_file_level = AV_LOG_DEBUG;
int hide_banner = 0;
void init_opts(void)
@@ -104,8 +105,10 @@ static void log_callback_report(void *ptr, int level, const char *fmt, va_list v
av_log_default_callback(ptr, level, fmt, vl);
av_log_format_line(ptr, level, fmt, vl2, line, sizeof(line), &print_prefix);
va_end(vl2);
- fputs(line, report_file);
- fflush(report_file);
+ if (report_file_level >= level) {
+ fputs(line, report_file);
+ fflush(report_file);
+ }
}
static void (*program_exit)(int ret);
@@ -926,6 +929,13 @@ static int init_report(const char *env)
av_free(filename_template);
filename_template = val;
val = NULL;
+ } else if (!strcmp(key, "level")) {
+ char *tail;
+ report_file_level = strtol(val, &tail, 10);
+ if (*tail) {
+ av_log(NULL, AV_LOG_FATAL, "Invalid report file level\n");
+ exit_program(1);
+ }
} else {
av_log(NULL, AV_LOG_ERROR, "Unknown key '%s' in FFREPORT\n", key);
}
diff --git a/doc/fftools-common-opts.texi b/doc/fftools-common-opts.texi
index 6bc6852d92..ab627ca4a9 100644
--- a/doc/fftools-common-opts.texi
+++ b/doc/fftools-common-opts.texi
@@ -189,6 +189,8 @@ following option is recognized:
set the file name to use for the report; @code{%p} is expanded to the name
of the program, @code{%t} is expanded to a timestamp, @code{%%} is expanded
to a plain @code{%}
+@item level
+set the log level
@end table
Errors in parsing the environment variable are not fatal, and will not