[FFmpeg-devel] [PATCH] av_log_missing_feature_once

Måns Rullgård mans
Thu Mar 18 23:11:04 CET 2010


Alexander Strange <astrange at ithinksw.com> writes:

> This prevents HE-AACv2 files from printing warnings about parametric
> stereo constantly.
>
> It was suggested that every av_log_missing_feature call should only
> happen once, but that would mean adding a variable for each one
> (whether static or a context variable) and I think most of them are
> rare anyway.
>
>
> From a154461cafd599107d68fc4eee6cd7de8aabeb30 Mon Sep 17 00:00:00 2001
> From: Alexander Strange <astrange at ithinksw.com>
> Date: Wed, 17 Mar 2010 14:51:20 -0400
> Subject: [PATCH 1/2] Add a macro to help avoid repeatedly printing missing feature warnings
>
> ---
>  libavcodec/avcodec.h |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 43a0695..25a60ab 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -3825,6 +3825,18 @@ int av_parse_video_frame_rate(AVRational *frame_rate, const char *str);
>  void av_log_missing_feature(void *avc, const char *feature, int want_sample);
>  
>  /**
> + * Log a generic warning message about a missing feature only once.
> + * @see av_log_missing_feature
> + */
> +#define av_log_missing_feature_once(avc, feature, want_sample)      \
> +    do { static int once=0;                                         \
> +         if (!once) {                                               \

Please indent like you would normally, i.e. newline after open-brace
and 4-space indent.

> +             av_log_missing_feature(avc, feature, want_sample);     \
> +             once = 1;                                              \
> +         }                                                          \
> +    } while (0)

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list