[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 20:10:09 CEST 2015


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?
> 

> 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



> I can almost understand that app authors ignore our deprecation markers
> now...
> 
> Ronald
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

What does censorship reveal? It reveals fear. -- Julian Assange
-------------- 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/46c9022c/attachment.sig>


More information about the ffmpeg-devel mailing list