[FFmpeg-devel] [PATCH] Fix opt_default()

Stefano Sabatini stefano.sabatini-lala
Tue Dec 16 09:14:06 CET 2008


On date Tuesday 2008-12-16 02:34:51 +0100, Michael Niedermayer encoded:
> On Tue, Dec 16, 2008 at 01:49:50AM +0100, Stefano Sabatini wrote:
> > On date Tuesday 2008-12-16 00:31:02 +0100, Stefano Sabatini encoded:
> > [...]
> > > > > Index: ffmpeg/libavcodec/opt.h
> > > > > ===================================================================
> > > > > --- ffmpeg.orig/libavcodec/opt.h	2008-12-14 23:17:27.000000000 +0100
> > > > > +++ ffmpeg/libavcodec/opt.h	2008-12-14 23:21:18.000000000 +0100
> > > > 
> > > > > @@ -105,6 +105,14 @@
> > > > >  attribute_deprecated const AVOption *av_set_string(void *obj, const char *name, const char *val);
> > > > >  
> > > > >  /**
> > > > > + * @return a pointer to the AVOption corresponding to the field set or
> > > > > + * NULL if no matching AVOption exists, or if the value \p val is not
> > > > > + * valid
> > > > > + * @see av_set_string3()
> > > > > + */
> > > > > +const AVOption *av_set_string2(void *obj, const char *name, const char *val, int alloc);
> > > > > +
> > > > 
> > > > this should be under #ifdefs to remove it with the next major bump
> > > 
> > > So I think it should be deprecated and ifdeffed at the same time. See
> > > the attached patches (unfortunately there is still a warning which I
> > > think we cannot avoid).
> > 
> > No, that wasn't true.
[...]
> > Index: ffmpeg/libavcodec/opt.h
> > ===================================================================
> > --- ffmpeg.orig/libavcodec/opt.h	2008-12-15 23:33:10.000000000 +0100
> > +++ ffmpeg/libavcodec/opt.h	2008-12-16 01:14:20.000000000 +0100
> 
> > @@ -105,6 +105,14 @@
> >  attribute_deprecated const AVOption *av_set_string(void *obj, const char *name, const char *val);
> >  
> >  /**
> > + * @return a pointer to the AVOption corresponding to the field set or
> > + * NULL if no matching AVOption exists, or if the value \p val is not
> > + * valid
> > + * @see av_set_string3()
> > + */
> > +const AVOption *av_set_string2(void *obj, const char *name, const char *val, int alloc);
> > +
> > +/**
> >   * Sets the field of obj with the given name to value.
> >   *
> >   * @param[in] obj A struct whose first element is a pointer to an
> 
> where is the #if version?

I think it is better to follow the path:
* define the new function;
* replace all the uses of the old function
* deprecate + ifdef the old function

implemented by the patchset.

And I think that if you want to ifdef a function then you have also to
deprecate it, so is nicer to first remove the old function use thus
avoiding warnings.

But if you prefer the other way (define av_set_string3() *and*
ifdef/deprecate av_set_string2() at once) I'm fine with it too.

Regards.
-- 
FFmpeg = Freak and Faboulous Martial Patchable Evangelical Gospel




More information about the ffmpeg-devel mailing list