[FFmpeg-devel] [PATCH 5/6] Put FF_API_OLD_AVOPTIONS under last use of av_opt_set_defaults2().

Michael Niedermayer michael at niedermayer.cc
Mon Aug 17 19:35:38 CEST 2015


On Mon, Aug 17, 2015 at 11:52:18AM -0400, Ronald S. Bultje wrote:
> ---
>  libavcodec/options.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/libavcodec/options.c b/libavcodec/options.c
> index 37f3792..ed4d826 100644
> --- a/libavcodec/options.c
> +++ b/libavcodec/options.c
> @@ -91,7 +91,9 @@ static const AVClass av_codec_context_class = {
>  
>  int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec)
>  {
> +#if FF_API_OLD_AVOPTIONS
>      int flags=0;
> +#endif
>      memset(s, 0, sizeof(AVCodecContext));
>  
>      s->av_class = &av_codec_context_class;
> @@ -102,6 +104,7 @@ int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec)
>          s->codec_id = codec->id;
>      }
>  
> +#if FF_API_OLD_AVOPTIONS
>      if(s->codec_type == AVMEDIA_TYPE_AUDIO)
>          flags= AV_OPT_FLAG_AUDIO_PARAM;
>      else if(s->codec_type == AVMEDIA_TYPE_VIDEO)
> @@ -109,6 +112,9 @@ int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec)
>      else if(s->codec_type == AVMEDIA_TYPE_SUBTITLE)
>          flags= AV_OPT_FLAG_SUBTITLE_PARAM;
>      av_opt_set_defaults2(s, flags, flags);
> +#else
> +    av_opt_set_defaults(s);
> +#endif

i would prefer to keep av_opt_set_defaults2()
the avoption system marks options as being for video, for audio and
or subtitles
defaults can differ for video, audio and subtitles

also setting options that arent supposed to be used could result in
bugs being missed, like a video option marked as audio.

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No snowflake in an avalanche ever feels responsible. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150817/92179d40/attachment.sig>


More information about the ffmpeg-devel mailing list