[FFmpeg-devel] opt: print a deprecation indicator when listing options

Submitted by Rostislav Pehlivanov on May 5, 2018, 8:45 p.m.

Details

Message ID 20180505204526.13648-1-atomnuker@gmail.com
State New
Headers show

Commit Message

Rostislav Pehlivanov May 5, 2018, 8:45 p.m.
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
---
 libavutil/opt.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Michael Niedermayer May 6, 2018, 12:22 a.m.
On Sat, May 05, 2018 at 09:45:26PM +0100, Rostislav Pehlivanov wrote:
> Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
> ---
>  libavutil/opt.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavutil/opt.c b/libavutil/opt.c
> index 99282605f5..73295356a1 100644
> --- a/libavutil/opt.c
> +++ b/libavutil/opt.c
> @@ -1276,6 +1276,8 @@ static void opt_list(void *obj, void *av_log_obj, const char *unit,
>              }
>              av_log(av_log_obj, AV_LOG_INFO, ")");
>          }
> +        if (opt->flags & AV_OPT_FLAG_DEPRECATED)
> +            av_log(av_log_obj, AV_LOG_INFO, " (deprecated)");

Printing this together with the other flags as "%c" would reduce the
worst case width, leaving more space for the other fields

but maybe a bigger text as in this patch is better, i dont know

either way LGTM

thx

[...]
Clément Bœsch May 6, 2018, 12:12 p.m.
On Sat, May 05, 2018 at 09:45:26PM +0100, Rostislav Pehlivanov wrote:
> Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
> ---
>  libavutil/opt.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavutil/opt.c b/libavutil/opt.c
> index 99282605f5..73295356a1 100644
> --- a/libavutil/opt.c
> +++ b/libavutil/opt.c
> @@ -1276,6 +1276,8 @@ static void opt_list(void *obj, void *av_log_obj, const char *unit,
>              }
>              av_log(av_log_obj, AV_LOG_INFO, ")");
>          }
> +        if (opt->flags & AV_OPT_FLAG_DEPRECATED)
> +            av_log(av_log_obj, AV_LOG_INFO, " (deprecated)");
>  

does this fit well with the help message that is supposed to be updated to
say what to use instead of that deprecated field?

Patch hide | download patch | download mbox

diff --git a/libavutil/opt.c b/libavutil/opt.c
index 99282605f5..73295356a1 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -1276,6 +1276,8 @@  static void opt_list(void *obj, void *av_log_obj, const char *unit,
             }
             av_log(av_log_obj, AV_LOG_INFO, ")");
         }
+        if (opt->flags & AV_OPT_FLAG_DEPRECATED)
+            av_log(av_log_obj, AV_LOG_INFO, " (deprecated)");
 
         av_log(av_log_obj, AV_LOG_INFO, "\n");
         if (opt->unit && opt->type != AV_OPT_TYPE_CONST)