[FFmpeg-devel] [PATCH v4 2/3] fftools/opt_common: add timing and datetiming log flags

epirat07 at gmail.com epirat07 at gmail.com
Fri Feb 7 08:46:01 EET 2025



On 7 Feb 2025, at 7:27, softworkz wrote:

> From: softworkz <softworkz at hotmail.com>
>
> This commit adds two logging flags: 'timing' and 'datetiming'.
>
> Usage:
>
> ffmpeg -loglevel +timing
>
> or
>
> ffmpeg -loglevel +datetiming

This commit message seems out of date regarding the actual commit contents
given the flags are time and datetime now?

>
> Setting av_log_set_flags(0) in term_exit in ffmpeg.c prevents
> timing to be printed when exiting.
>
> Signed-off-by: softworkz <softworkz at hotmail.com>
> ---
>  fftools/ffmpeg.c     |  1 +
>  fftools/opt_common.c | 12 ++++++++++++
>  2 files changed, 13 insertions(+)
>
> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> index dc321fb4a2..f4c717afaa 100644
> --- a/fftools/ffmpeg.c
> +++ b/fftools/ffmpeg.c
> @@ -130,6 +130,7 @@ static void term_exit_sigsafe(void)
>
>  void term_exit(void)
>  {
> +    av_log_set_flags(0);
>      av_log(NULL, AV_LOG_QUIET, "%s", "");
>      term_exit_sigsafe();
>  }
> diff --git a/fftools/opt_common.c b/fftools/opt_common.c
> index 34da2cee7d..317e8458c1 100644
> --- a/fftools/opt_common.c
> +++ b/fftools/opt_common.c
> @@ -1292,6 +1292,18 @@ int opt_loglevel(void *optctx, const char *opt, const char *arg)
>              } else {
>                  flags |= AV_LOG_PRINT_LEVEL;
>              }
> +        } else if (av_strstart(token, "time", &arg)) {
> +            if (cmd == '-') {
> +                flags &= ~AV_LOG_PRINT_TIME;
> +            } else {
> +                flags |= AV_LOG_PRINT_TIME;
> +            }
> +        } else if (av_strstart(token, "datetime", &arg)) {
> +            if (cmd == '-') {
> +                flags &= ~AV_LOG_PRINT_DATETIME;
> +            } else {
> +                flags |= AV_LOG_PRINT_DATETIME;
> +            }
>          } else {
>              break;
>          }
> -- 
> ffmpeg-codebot
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list