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

wm4 nfxjfg at googlemail.com
Mon Aug 17 23:41:53 CEST 2015


On Mon, 17 Aug 2015 20:10:09 +0200
Michael Niedermayer <michael at niedermayer.cc> wrote:

> On Mon, Aug 17, 2015 at 01:44:43PM -0400, Ronald S. Bultje wrote:
> > 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?
> > 

+1

> > 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?
> 
> there are codec specific defaults, see AVCodecDefault
> 
> 
> > 
> > And then lastly, why was this marked as deprecated if you intended to keep
> > it?
> 
> the deprecation came in from a merge.
> I did not know what other changes would follow and
> probably saw no clear reason to change te deprecation back then

FFmpeg development. What the fuck.

Can we give BBB a bit of leeway to get this stuff done? Why does BBB
have to figure out this stuff?

We can smooth out the details later. You're welcome to send patches to
fix your favorite pet-peeves caused by the deprecation. (The
deprecation which you have accepted for YEARS, and even merged
yourself.)


More information about the ffmpeg-devel mailing list