[FFmpeg-devel] [PATCH] Add --avlog-limit configure option.

Don Moir donmoir at comcast.net
Mon Sep 23 18:27:05 CEST 2013


>On 2013-09-22 17:03 +0200, Reimar Döffinger wrote:
>> This allows compiling out messages below a certain level.
>> Note that it might cause some strange behaviour with the
>> help printout of the command-line tools.
>>
>> Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
>> ---
>>  configure       | 26 ++++++++++++++++++++++++++
>>  libavutil/log.c |  1 +
>>  libavutil/log.h | 12 ++++++++++++
>>  libavutil/opt.c |  3 +++
>>  4 files changed, 42 insertions(+)
>>
>> diff --git a/configure b/configure
>> index a219c26..759b225 100755
>> --- a/configure
>> +++ b/configure
>> @@ -99,6 +99,9 @@ Configuration options:
>>    --disable-static         do not build static libraries [no]
>>    --enable-shared          build shared libraries [no]
>>    --enable-small           optimize for size instead of speed
>> +  --avlog-limit=value      do not compile in messages below this limit,
>> +                           reducing binary size. Can be a number or one of:
>> +                           debug verbose info warning error fatal panic quiet
>>    --disable-runtime-cpudetect disable detecting cpu capabilities at runtime (smaller binary)
>>    --enable-gray            enable full grayscale support (slower color)
>>    --disable-swscale-alpha  disable alpha channel support in swscale

>  IIUC with your latest changes to this patch you compile out the log
>calls in the libs only. If I am not mistaken this should be reflected
>more explicitly in the option description and in the commit message.

>> @@ -2486,6 +2489,23 @@ for opt do
>>          --enable-debug=*)
>>              debuglevel="$optval"
>>          ;;
>> +        --avlog-limit=*)
>> +            avloglimit="$optval"
>> +            case "$avloglimit" in
>> +            debug)   avloglimit=AV_LOG_DEBUG ;;
>> +            verbose) avloglimit=AV_LOG_VERBOSE ;;
>> +            info)    avloglimit=AV_LOG_INFO ;;
>> +            warning) avloglimit=AV_LOG_WARNING ;;
>> +            error)   avloglimit=AV_LOG_ERROR ;;
>> +            fatal)   avloglimit=AV_LOG_FATAL ;;
>> +            panic)   avloglimit=AV_LOG_PANIC ;;
>> +            quiet)   avloglimit=AV_LOG_QUIET ;;
>> +            AV_LOG_*) ;; # looks like a predefined constant, assume it is valid
>> +            -[0-9]*|[0-9]*) ;; # looks like a number, assume it is valid
>> +            '') ;; # empty string to unset
>> +            *) die "Invalid value '$avloglimit' for --avlog-limit"
>> +            esac
>> +        ;;

>  This is too flexible for my taste. I would just do (un-tested):

>  --avlog-limit=*)
>      avloglimit="$optval"
>      case "$avloglimit" in
>      AV_LOG_DEBUG)     ;;
>      AV_LOG_VERBOSE)   ;;
>      AV_LOG_INFO)      ;;
>      AV_LOG_WARNING)   ;;
>      AV_LOG_ERROR)     ;;
>      AV_LOG_FATAL)     ;;
>      AV_LOG_PANIC)     ;;
>      AV_LOG_QUIET)     ;;
>      '') ;; # empty string to unset
>      *) die "Invalid value '$avloglimit' for --avlog-limit"
>      esac
>  ;;

>  Usage errors will be caught immediately. If future extension
>will be needed it will be easy to do. Just a suggestion, maybe
>it is just me.

It will be more natural to use the exisitng AV_LOG_* values as parameters and better to make is less flexible like this. Was to easy 
to make a mistake the other way. Like with the other way this passes as valid --avlog_limit=-AV_LOG_WARNING and then you have a 
negative value. 



More information about the ffmpeg-devel mailing list