[FFmpeg-devel] [PATCH v2] Add option to log timing

Moritz Barsnick barsnick at gmx.net
Wed Sep 18 00:06:37 EEST 2019


On Tue, Sep 17, 2019 at 00:07:37 +0000, Soft Works wrote:
> This commit adds two logging flags: 'timing' and 'datetiming'.

I like the whole idea. I haven't tested yet, but I will in a moment.

> Usage:
> ffmpeg -loglevel +timing
> or
> ffmpeg -loglevel +datetiming

Have you considered what happens if you do
$ ffmpeg -loglevel +timing+datetiming
?

(It just seems a bit weird having one flag being a superset of another.
I don't mind otherwise.)

>  fftools/cmdutils.c | 14 ++++++++++++++
>  libavutil/log.c    | 37 ++++++++++++++++++++++++++++++++-----
>  libavutil/log.h    | 10 ++++++++++

You also need to add documentation for these options to
doc/fftools-common-opts.texi (section "@item -loglevel").

libavutil/log.h is part of the API, IIUC. So you should bump
libavutil's micro version, and even add an entry into doc/APIchanges.

> +        && ((flags & AV_LOG_PRINT_TIME) || (flags & AV_LOG_PRINT_DATETIME)))
> +        format_date_now(&part[4], flags & AV_LOG_PRINT_DATETIME);

According to the style of the other calls, you could express "&part[4]"
as "part+4".

>      if (*print_prefix && (level > AV_LOG_QUIET) && (flags & AV_LOG_PRINT_LEVEL))
>          av_bprintf(part+2, "[%s] ", get_level_str(level));

(As done here.)

Moritz


More information about the ffmpeg-devel mailing list