[FFmpeg-devel] [PATCH 5/6] Put FF_API_OLD_AVOPTIONS under last use of av_opt_set_defaults2().
Ronald S. Bultje
rsbultje at gmail.com
Mon Aug 17 19:44:43 CEST 2015
Hi,
On Mon, Aug 17, 2015 at 1:35 PM, Michael Niedermayer <michael at niedermayer.cc
> wrote:
> 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
So I'm open for this discussion, but this is a hugely obscure and limiting
way to do it. For example, why do we need "ab" for audio bit "b" for video?
Why aren't both called "b"? (And "ab" handled in ffmpeg.c.)
Why do we have this HUUUUUUUUUUGE AVCodecContext instead of several derived
structs that each are only for audio, only for video, only for subtitles,
etc., and each have their own media-type-specific options or
media-type-specific defaults for common options?
What about codec-specific defaults? JPEG has higher bitrates than MPEG for
the same quality, for obvious reasons. It's easy to come up with other
examples. Does that work?
And then lastly, why was this marked as deprecated if you intended to keep
it? I can almost understand that app authors ignore our deprecation markers
now...
Ronald
More information about the ffmpeg-devel
mailing list