diff mbox series

[FFmpeg-devel,06/10] avutil/opt: Also warn for deprecated named constants

Message ID AM7PR03MB6660B5D1809BB48B6E679CB88FD99@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit 3ba1bbf8d0796bc5a4f9b78b02616b0fc9ff9048
Headers show
Series [FFmpeg-devel,01/10] avcodec/mpegvideo: Move startcodes to mpeg12.h
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 13, 2021, 1:53 p.m. UTC
Intended for the "truncated" AVCodecContext flag.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavutil/opt.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavutil/opt.c b/libavutil/opt.c
index 41284d4ecd..24b8899ca0 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -262,9 +262,12 @@  static int set_string_number(void *obj, void *target_obj, const AVOption *o, con
             const char * const_names[64];
             int search_flags = (o->flags & AV_OPT_FLAG_CHILD_CONSTS) ? AV_OPT_SEARCH_CHILDREN : 0;
             const AVOption *o_named = av_opt_find(target_obj, i ? buf : val, o->unit, 0, search_flags);
-            if (o_named && o_named->type == AV_OPT_TYPE_CONST)
+            if (o_named && o_named->type == AV_OPT_TYPE_CONST) {
                 d = DEFAULT_NUMVAL(o_named);
-            else {
+                if (o_named->flags & AV_OPT_FLAG_DEPRECATED)
+                    av_log(obj, AV_LOG_WARNING, "The \"%s\" option is deprecated: %s\n",
+                           o_named->name, o_named->help);
+            } else {
                 if (o->unit) {
                     for (o_named = NULL; o_named = av_opt_next(target_obj, o_named); ) {
                         if (o_named->type == AV_OPT_TYPE_CONST &&