From: Anton Khirnov <anton@khirnov.net> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 07/38] lavu/opt: simplify printing option type in opt_list() Date: Fri, 23 Feb 2024 14:58:29 +0100 Message-ID: <20240223143115.16521-8-anton@khirnov.net> (raw) In-Reply-To: <20240223143115.16521-1-anton@khirnov.net> --- libavutil/opt.c | 107 +++++++++++++++++------------------------------- 1 file changed, 37 insertions(+), 70 deletions(-) diff --git a/libavutil/opt.c b/libavutil/opt.c index d13b1ab504..554916fbaf 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -1231,6 +1231,41 @@ static char *get_opt_flags_string(void *obj, const char *unit, int64_t value) return NULL; } +static void log_type(void *av_log_obj, const AVOption *o, + enum AVOptionType parent_type) +{ + const char *desc[] = { + [AV_OPT_TYPE_FLAGS] = "<flags>", + [AV_OPT_TYPE_INT] = "<int>", + [AV_OPT_TYPE_INT64] = "<int64>", + [AV_OPT_TYPE_UINT64] = "<uint64>", + [AV_OPT_TYPE_DOUBLE] = "<double>", + [AV_OPT_TYPE_FLOAT] = "<float>", + [AV_OPT_TYPE_STRING] = "<string>", + [AV_OPT_TYPE_RATIONAL] = "<rational>", + [AV_OPT_TYPE_BINARY] = "<binary>", + [AV_OPT_TYPE_DICT] = "<dictionary>", + [AV_OPT_TYPE_IMAGE_SIZE] = "<image_size>", + [AV_OPT_TYPE_VIDEO_RATE] = "<video_rate>", + [AV_OPT_TYPE_PIXEL_FMT] = "<pix_fmt>", + [AV_OPT_TYPE_SAMPLE_FMT] = "<sample_fmt>", + [AV_OPT_TYPE_DURATION] = "<duration>", + [AV_OPT_TYPE_COLOR] = "<color>", +#if FF_API_OLD_CHANNEL_LAYOUT + [AV_OPT_TYPE_CHANNEL_LAYOUT]= "<channel_layout>", +#endif + [AV_OPT_TYPE_CHLAYOUT] = "<channel_layout>", + [AV_OPT_TYPE_BOOL] = "<boolean>", + }; + + if (o->type == AV_OPT_TYPE_CONST && parent_type == AV_OPT_TYPE_INT) + av_log(av_log_obj, AV_LOG_INFO, "%-12"PRId64" ", o->default_val.i64); + else if (o->type < FF_ARRAY_ELEMS(desc) && desc[o->type]) + av_log(av_log_obj, AV_LOG_INFO, "%-12s ", desc[o->type]); + else + av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); +} + static void opt_list(void *obj, void *av_log_obj, const char *unit, int req_flags, int rej_flags, enum AVOptionType parent_type) { @@ -1259,76 +1294,8 @@ static void opt_list(void *obj, void *av_log_obj, const char *unit, (opt->flags & AV_OPT_FLAG_FILTERING_PARAM) ? " " : "-", opt->name); - switch (opt->type) { - case AV_OPT_TYPE_FLAGS: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<flags>"); - break; - case AV_OPT_TYPE_INT: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<int>"); - break; - case AV_OPT_TYPE_INT64: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<int64>"); - break; - case AV_OPT_TYPE_UINT64: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<uint64>"); - break; - case AV_OPT_TYPE_DOUBLE: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<double>"); - break; - case AV_OPT_TYPE_FLOAT: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<float>"); - break; - case AV_OPT_TYPE_STRING: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<string>"); - break; - case AV_OPT_TYPE_RATIONAL: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<rational>"); - break; - case AV_OPT_TYPE_BINARY: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<binary>"); - break; - case AV_OPT_TYPE_DICT: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<dictionary>"); - break; - case AV_OPT_TYPE_IMAGE_SIZE: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<image_size>"); - break; - case AV_OPT_TYPE_VIDEO_RATE: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<video_rate>"); - break; - case AV_OPT_TYPE_PIXEL_FMT: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<pix_fmt>"); - break; - case AV_OPT_TYPE_SAMPLE_FMT: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<sample_fmt>"); - break; - case AV_OPT_TYPE_DURATION: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<duration>"); - break; - case AV_OPT_TYPE_COLOR: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<color>"); - break; - case AV_OPT_TYPE_CHLAYOUT: -#if FF_API_OLD_CHANNEL_LAYOUT -FF_DISABLE_DEPRECATION_WARNINGS - case AV_OPT_TYPE_CHANNEL_LAYOUT: -FF_ENABLE_DEPRECATION_WARNINGS -#endif - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<channel_layout>"); - break; - case AV_OPT_TYPE_BOOL: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<boolean>"); - break; - case AV_OPT_TYPE_CONST: - if (parent_type == AV_OPT_TYPE_INT) - av_log(av_log_obj, AV_LOG_INFO, "%-12"PRId64" ", opt->default_val.i64); - else - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - default: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - } + log_type(av_log_obj, opt, parent_type); + av_log(av_log_obj, AV_LOG_INFO, "%c%c%c%c%c%c%c%c%c%c%c", (opt->flags & AV_OPT_FLAG_ENCODING_PARAM) ? 'E' : '.', (opt->flags & AV_OPT_FLAG_DECODING_PARAM) ? 'D' : '.', -- 2.42.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2024-02-23 14:36 UTC|newest] Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-02-23 13:58 [FFmpeg-devel] [PATCH] array AVOptions and side data preference Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 01/38] lavu/opt: cosmetics, change option flags to (1 << N) style Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 02/38] lavu/opt: cosmetics, move AV_OPT_FLAG_* out of AVOption Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 03/38] lavu/opt: document AVOption.flags Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 04/38] lavu/opt: cosmetics, group (un)init and management functions together Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 05/38] lavu/opt: cosmetics, group option setting function together Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 06/38] lavu/opt: cosmetics, group option reading " Anton Khirnov 2024-02-23 13:58 ` Anton Khirnov [this message] 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 08/38] lavu/opt: factor out printing option default from opt_list() Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 09/38] lavu/opt: drop useless handling of NULL return from get_bool_name() Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 10/38] lavu/opt: drop an always-NULL argument to get_number() Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 11/38] lavu/opt: simplify error handling in get_number() Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 12/38] lavu/opt: get rid of useless read_number() calls Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 13/38] lavu/opt: factor per-type dispatch out of av_opt_get() Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 14/38] lavu/opt: factor per-type dispatch out of av_opt_set() Anton Khirnov 2024-02-23 22:50 ` Michael Niedermayer 2024-02-24 22:41 ` James Almer 2024-03-05 23:08 ` Michael Niedermayer 2024-03-05 23:14 ` James Almer 2024-03-01 16:07 ` Anton Khirnov 2024-03-03 12:17 ` Anton Khirnov 2024-03-05 23:12 ` Michael Niedermayer 2024-03-05 23:21 ` James Almer 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 15/38] lavu/opt: add array options Anton Khirnov 2024-02-23 19:05 ` Marton Balint 2024-02-26 17:14 ` Anton Khirnov 2024-02-26 17:19 ` James Almer 2024-02-26 17:20 ` Andreas Rheinhardt 2024-02-26 19:38 ` Marton Balint 2024-03-03 14:55 ` Anton Khirnov 2024-03-03 15:53 ` Diederick C. Niehorster 2024-03-03 15:57 ` James Almer 2024-03-03 21:05 ` Marton Balint 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 16/38] lavc: add a decoder option for configuring side data preference Anton Khirnov 2024-02-23 17:51 ` Marton Balint 2024-02-23 17:53 ` James Almer 2024-02-23 18:34 ` James Almer 2024-02-26 17:08 ` Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 17/38] avcodec: add internal side data wrappers Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 18/38] lavc: add content light/mastering display " Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 19/38] avcodec/av1dec: respect side data preference Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 20/38] avcodec/cri: " Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 21/38] avcodec/h264_slice: " Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 22/38] lavc/hevcdec: pass an actual codec context to ff_h2645_sei_to_frame() Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 23/38] avcodec/hevcdec: respect side data preference Anton Khirnov 2024-02-23 19:11 ` Marton Balint 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 24/38] avcodec/libjxldec: " Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 25/38] avcodec/mjpegdec: " Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 26/38] avcodec/mpeg12dec: " Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 27/38] avcodec/pngdec: " Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 28/38] avcodec/tiff: " Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 29/38] avcodec/webp: " Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 30/38] avcodec/libdav1d: " Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 31/38] avcodec/dpx: " Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 32/38] avcodec/mpeg12dec: use ff_frame_new_side_data Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 33/38] avcodec/h2645_sei: use ff_frame_new_side_data_from_buf Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 34/38] avcodec/snowdec: use ff_frame_new_side_data Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 35/38] avcodec/mjpegdec: " Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 36/38] avcodec/hevcdec: switch to ff_frame_new_side_data_from_buf Anton Khirnov 2024-02-23 13:58 ` [FFmpeg-devel] [PATCH 37/38] lavc/*dec: use side data preference for mastering display/content light metadata Anton Khirnov 2024-02-23 13:59 ` [FFmpeg-devel] [PATCH 38/38] tests/fate/matroska: add tests for side data preference Anton Khirnov 2024-02-23 15:02 ` Anton Khirnov 2024-02-23 15:08 ` James Almer
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240223143115.16521-8-anton@khirnov.net \ --to=anton@khirnov.net \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git