[FFmpeg-devel] [PATCH] lavc/options: set all codec options to defaults

Lukasz Marek lukasz.m.luki2 at gmail.com
Wed Nov 12 22:40:54 CET 2014


On 11.11.2014 18:30, Lukasz Marek wrote:
> avcodec_get_context_defaults3() sets only specific options to default the values.
> This commit force all options to be set to the defaults.
> This improves effectiveness of new ffm format.
> In particular it fixes "bt" option being out of range when context is created for
> non-video media type. (it is 0, when min=1)
>
> Signed-off-by: Lukasz Marek <lukasz.m.luki2 at gmail.com>
> ---
>   libavcodec/options.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/libavcodec/options.c b/libavcodec/options.c
> index 461e4a1..bb472a9 100644
> --- a/libavcodec/options.c
> +++ b/libavcodec/options.c
> @@ -104,6 +104,9 @@ int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec)
>           flags= AV_OPT_FLAG_VIDEO_PARAM;
>       else if(s->codec_type == AVMEDIA_TYPE_SUBTITLE)
>           flags= AV_OPT_FLAG_SUBTITLE_PARAM;
> +    /* set all options to defaults */
> +    av_opt_set_defaults(s);
> +    /* some variables might be shared between different codec types so make sure correct ones are set. */
>       av_opt_set_defaults2(s, flags, flags);

No one commented on this. This is quite important, but as I said, I can 
move it if needed.



More information about the ffmpeg-devel mailing list