[Ffmpeg-devel] [PATCH] fix -ab default

Benoit Fouet benoit.fouet
Tue Mar 6 21:07:44 CET 2007


Hi,


Michael Niedermayer wrote:
> Index: libavcodec/utils.c
> ===================================================================
> --- libavcodec/utils.c	(revision 8273)
> +++ libavcodec/utils.c	(working copy)
> @@ -411,7 +411,8 @@
>  #define AV_CODEC_DEFAULT_BITRATE 200*1000
>  
>  static const AVOption options[]={
> -{"b", "set bitrate (in bits/s)", OFFSET(bit_rate), FF_OPT_TYPE_INT, AV_CODEC_DEFAULT_BITRATE, INT_MIN, INT_MAX, V|A|E},
> +{"b", "set bitrate (in bits/s)", OFFSET(bit_rate), FF_OPT_TYPE_INT, AV_CODEC_DEFAULT_BITRATE, INT_MIN, INT_MAX, V|E},
> +{"ab", "set bitrate (in bits/s)", OFFSET(bit_rate), FF_OPT_TYPE_INT, 64*1000, INT_MIN, INT_MAX, A|E},
>   
why not a define, as for video one ?

>  {"bt", "set video bitrate tolerance (in bits/s)", OFFSET(bit_rate_tolerance), FF_OPT_TYPE_INT, AV_CODEC_DEFAULT_BITRATE*20, 1, INT_MAX, V|E},
>  {"flags", NULL, OFFSET(flags), FF_OPT_TYPE_FLAGS, DEFAULT, INT_MIN, INT_MAX, V|A|E|D, "flags"},
>  {"mv4", "use four motion vector by macroblock (mpeg4)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_4MV, INT_MIN, INT_MAX, V|E, "flags"},
> @@ -731,12 +732,17 @@
>  
>  static AVClass av_codec_context_class = { "AVCodecContext", context_to_name, options };
>  
> -void avcodec_get_context_defaults(AVCodecContext *s){
> +void avcodec_get_context_defaults2(AVCodecContext *s, enum CodecType codec_type){
> +    int flags=0;
>      memset(s, 0, sizeof(AVCodecContext));
>  
>      s->av_class= &av_codec_context_class;
>  
> -    av_opt_set_defaults(s);
> +    if(codec_type == CODEC_TYPE_AUDIO)
> +        flags= AV_OPT_FLAG_AUDIO_PARAM;
> +    else if(codec_type == CODEC_TYPE_VIDEO)
> +        flags= AV_OPT_FLAG_VIDEO_PARAM;
> +    av_opt_set_defaults2(s, flags);
>   
no AV_OPT_FLAG_SUBTITLE_PARAM handling ?

Ben





More information about the ffmpeg-devel mailing list