[FFmpeg-cvslog] lavu/opt: show default values

Paul B Mahol git at videolan.org
Wed Jul 3 22:47:32 CEST 2013


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue Jul  2 13:31:28 2013 +0000| [a64248d1ec154779473be90ce1608702cc4a6496] | committer: Paul B Mahol

lavu/opt: show default values

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a64248d1ec154779473be90ce1608702cc4a6496
---

 libavutil/opt.c |   34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index 4d06039..191ac2d 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -936,6 +936,40 @@ static void opt_list(void *obj, void *av_log_obj, const char *unit,
             av_opt_freep_ranges(&r);
         }
 
+        if (opt->type != AV_OPT_TYPE_CONST  &&
+            opt->type != AV_OPT_TYPE_BINARY &&
+                !((opt->type == AV_OPT_TYPE_COLOR      ||
+                   opt->type == AV_OPT_TYPE_IMAGE_SIZE ||
+                   opt->type == AV_OPT_TYPE_STRING     ||
+                   opt->type == AV_OPT_TYPE_VIDEO_RATE) &&
+                  !opt->default_val.str)) {
+            av_log(av_log_obj, AV_LOG_INFO, " (default ");
+            switch (opt->type) {
+            case AV_OPT_TYPE_FLAGS:
+                av_log(av_log_obj, AV_LOG_INFO, "%0llX", opt->default_val.i64);
+                break;
+            case AV_OPT_TYPE_DURATION:
+            case AV_OPT_TYPE_INT:
+            case AV_OPT_TYPE_INT64:
+                log_value(av_log_obj, AV_LOG_INFO, opt->default_val.i64);
+                break;
+            case AV_OPT_TYPE_DOUBLE:
+            case AV_OPT_TYPE_FLOAT:
+                log_value(av_log_obj, AV_LOG_INFO, opt->default_val.dbl);
+                break;
+            case AV_OPT_TYPE_RATIONAL: {
+                AVRational q = av_d2q(opt->default_val.dbl, INT_MAX);
+                av_log(av_log_obj, AV_LOG_INFO, "%d/%d", q.num, q.den); }
+                break;
+            case AV_OPT_TYPE_COLOR:
+            case AV_OPT_TYPE_IMAGE_SIZE:
+            case AV_OPT_TYPE_STRING:
+            case AV_OPT_TYPE_VIDEO_RATE:
+                av_log(av_log_obj, AV_LOG_INFO, "\"%s\"", opt->default_val.str);
+            }
+            av_log(av_log_obj, AV_LOG_INFO, ")");
+        }
+
         av_log(av_log_obj, AV_LOG_INFO, "\n");
         if (opt->unit && opt->type != AV_OPT_TYPE_CONST) {
             opt_list(obj, av_log_obj, opt->unit, req_flags, rej_flags);



More information about the ffmpeg-cvslog mailing list