diff mbox

[FFmpeg-devel,1/2] lavu/opt: add AV_OPT_FLAG_DEPRECATED

Message ID 20180422143809.29617-1-u@pkh.me
State New
Headers show

Commit Message

Clément Bœsch April 22, 2018, 2:38 p.m. UTC
---
TODO: APIChanges + lavu minor bump (not done yet because it will
conflict with the threadmessage patch)
---
 libavutil/opt.c | 6 ++++++
 libavutil/opt.h | 1 +
 2 files changed, 7 insertions(+)

Comments

wm4 April 22, 2018, 3 p.m. UTC | #1
On Sun, 22 Apr 2018 16:38:08 +0200
Clément Bœsch <u@pkh.me> wrote:

> ---
> TODO: APIChanges + lavu minor bump (not done yet because it will
> conflict with the threadmessage patch)
> ---
>  libavutil/opt.c | 6 ++++++
>  libavutil/opt.h | 1 +
>  2 files changed, 7 insertions(+)
> 
> diff --git a/libavutil/opt.c b/libavutil/opt.c
> index 3b0aab4ee8..99282605f5 100644
> --- a/libavutil/opt.c
> +++ b/libavutil/opt.c
> @@ -463,6 +463,9 @@ int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
>      if (o->flags & AV_OPT_FLAG_READONLY)
>          return AVERROR(EINVAL);
>  
> +    if (o->flags & AV_OPT_FLAG_DEPRECATED)
> +        av_log(obj, AV_LOG_WARNING, "The \"%s\" option is deprecated: %s\n", name, o->help);
> +
>      dst = ((uint8_t *)target_obj) + o->offset;
>      switch (o->type) {
>      case AV_OPT_TYPE_BOOL:
> @@ -759,6 +762,9 @@ int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
>      if (!o || !target_obj || (o->offset<=0 && o->type != AV_OPT_TYPE_CONST))
>          return AVERROR_OPTION_NOT_FOUND;
>  
> +    if (o->flags & AV_OPT_FLAG_DEPRECATED)
> +        av_log(obj, AV_LOG_WARNING, "The \"%s\" option is deprecated: %s\n", name, o->help);
> +
>      dst = (uint8_t *)target_obj + o->offset;
>  
>      buf[0] = 0;
> diff --git a/libavutil/opt.h b/libavutil/opt.h
> index 07da68ea23..1352741fb6 100644
> --- a/libavutil/opt.h
> +++ b/libavutil/opt.h
> @@ -289,6 +289,7 @@ typedef struct AVOption {
>  #define AV_OPT_FLAG_READONLY        128
>  #define AV_OPT_FLAG_BSF_PARAM       (1<<8) ///< a generic parameter which can be set by the user for bit stream filtering
>  #define AV_OPT_FLAG_FILTERING_PARAM (1<<16) ///< a generic parameter which can be set by the user for filtering
> +#define AV_OPT_FLAG_DEPRECATED      (1<<17)
>  //FIXME think about enc-audio, ... style flags
>  
>      /**

Seems like a good idea.
Clément Bœsch April 26, 2018, 5:54 p.m. UTC | #2
On Sun, Apr 22, 2018 at 05:00:45PM +0200, wm4 wrote:
> On Sun, 22 Apr 2018 16:38:08 +0200
> Clément Bœsch <u@pkh.me> wrote:
> 
> > ---
> > TODO: APIChanges + lavu minor bump (not done yet because it will
> > conflict with the threadmessage patch)
> > ---
> >  libavutil/opt.c | 6 ++++++
> >  libavutil/opt.h | 1 +
> >  2 files changed, 7 insertions(+)
> > 
> > diff --git a/libavutil/opt.c b/libavutil/opt.c
> > index 3b0aab4ee8..99282605f5 100644
> > --- a/libavutil/opt.c
> > +++ b/libavutil/opt.c
> > @@ -463,6 +463,9 @@ int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
> >      if (o->flags & AV_OPT_FLAG_READONLY)
> >          return AVERROR(EINVAL);
> >  
> > +    if (o->flags & AV_OPT_FLAG_DEPRECATED)
> > +        av_log(obj, AV_LOG_WARNING, "The \"%s\" option is deprecated: %s\n", name, o->help);
> > +
> >      dst = ((uint8_t *)target_obj) + o->offset;
> >      switch (o->type) {
> >      case AV_OPT_TYPE_BOOL:
> > @@ -759,6 +762,9 @@ int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
> >      if (!o || !target_obj || (o->offset<=0 && o->type != AV_OPT_TYPE_CONST))
> >          return AVERROR_OPTION_NOT_FOUND;
> >  
> > +    if (o->flags & AV_OPT_FLAG_DEPRECATED)
> > +        av_log(obj, AV_LOG_WARNING, "The \"%s\" option is deprecated: %s\n", name, o->help);
> > +
> >      dst = (uint8_t *)target_obj + o->offset;
> >  
> >      buf[0] = 0;
> > diff --git a/libavutil/opt.h b/libavutil/opt.h
> > index 07da68ea23..1352741fb6 100644
> > --- a/libavutil/opt.h
> > +++ b/libavutil/opt.h
> > @@ -289,6 +289,7 @@ typedef struct AVOption {
> >  #define AV_OPT_FLAG_READONLY        128
> >  #define AV_OPT_FLAG_BSF_PARAM       (1<<8) ///< a generic parameter which can be set by the user for bit stream filtering
> >  #define AV_OPT_FLAG_FILTERING_PARAM (1<<16) ///< a generic parameter which can be set by the user for filtering
> > +#define AV_OPT_FLAG_DEPRECATED      (1<<17)
> >  //FIXME think about enc-audio, ... style flags
> >  
> >      /**
> 
> Seems like a good idea.

documented & applied.

thx
diff mbox

Patch

diff --git a/libavutil/opt.c b/libavutil/opt.c
index 3b0aab4ee8..99282605f5 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -463,6 +463,9 @@  int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
     if (o->flags & AV_OPT_FLAG_READONLY)
         return AVERROR(EINVAL);
 
+    if (o->flags & AV_OPT_FLAG_DEPRECATED)
+        av_log(obj, AV_LOG_WARNING, "The \"%s\" option is deprecated: %s\n", name, o->help);
+
     dst = ((uint8_t *)target_obj) + o->offset;
     switch (o->type) {
     case AV_OPT_TYPE_BOOL:
@@ -759,6 +762,9 @@  int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
     if (!o || !target_obj || (o->offset<=0 && o->type != AV_OPT_TYPE_CONST))
         return AVERROR_OPTION_NOT_FOUND;
 
+    if (o->flags & AV_OPT_FLAG_DEPRECATED)
+        av_log(obj, AV_LOG_WARNING, "The \"%s\" option is deprecated: %s\n", name, o->help);
+
     dst = (uint8_t *)target_obj + o->offset;
 
     buf[0] = 0;
diff --git a/libavutil/opt.h b/libavutil/opt.h
index 07da68ea23..1352741fb6 100644
--- a/libavutil/opt.h
+++ b/libavutil/opt.h
@@ -289,6 +289,7 @@  typedef struct AVOption {
 #define AV_OPT_FLAG_READONLY        128
 #define AV_OPT_FLAG_BSF_PARAM       (1<<8) ///< a generic parameter which can be set by the user for bit stream filtering
 #define AV_OPT_FLAG_FILTERING_PARAM (1<<16) ///< a generic parameter which can be set by the user for filtering
+#define AV_OPT_FLAG_DEPRECATED      (1<<17)
 //FIXME think about enc-audio, ... style flags
 
     /**