Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Thilo Borgmann <thilo.borgmann@mail.de>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH v4 1/6] lavu/opt: Allow options to be arguments of other options
Date: Mon, 19 Sep 2022 11:45:59 +0200
Message-ID: <20220919094604.4645-2-thilo.borgmann@mail.de> (raw)
In-Reply-To: <20220919094604.4645-1-thilo.borgmann@mail.de>

Adds AV_OPT_FLAG_ARGUMENT for options being used as arguments for other options.
Adds av_arg_show() to allow printing of such arguments in help output.
---
 doc/APIchanges      |  4 ++++
 libavutil/opt.c     | 14 +++++++++++++-
 libavutil/opt.h     |  8 ++++++++
 libavutil/version.h |  4 ++--
 4 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 729f56be7b..e4b2fc8799 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,10 @@ libavutil:     2021-04-27
 
 API changes, most recent first:
 
+2022-09-19 - xxxxxxxxxx - lavu 57.37.100 - opt.h
+  Add AV_OPT_FLAG_ARGUMENT.
+  Add av_arg_show() to print arguments to options.
+
 2022-09-03 - xxxxxxxxxx - lavu 57.36.100 - pixfmt.h
   Add AV_PIX_FMT_P012, AV_PIX_FMT_Y212, AV_PIX_FMT_XV30, AV_PIX_FMT_XV36
 
diff --git a/libavutil/opt.c b/libavutil/opt.c
index a3940f47fb..89ef111690 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -1256,7 +1256,7 @@ static void opt_list(void *obj, void *av_log_obj, const char *unit,
             av_log(av_log_obj, AV_LOG_INFO, "     %-15s ", opt->name);
         else
             av_log(av_log_obj, AV_LOG_INFO, "  %s%-17s ",
-                   (opt->flags & AV_OPT_FLAG_FILTERING_PARAM) ? " " : "-",
+                   (opt->flags & (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_ARGUMENT)) ? " " : "-",
                    opt->name);
 
         switch (opt->type) {
@@ -1329,6 +1329,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
                 av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "");
                 break;
         }
+        if (!(opt->flags & AV_OPT_FLAG_ARGUMENT)) {
         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' : '.',
@@ -1341,6 +1342,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
                (opt->flags & AV_OPT_FLAG_BSF_PARAM)       ? 'B' : '.',
                (opt->flags & AV_OPT_FLAG_RUNTIME_PARAM)   ? 'T' : '.',
                (opt->flags & AV_OPT_FLAG_DEPRECATED)      ? 'P' : '.');
+        }
 
         if (opt->help)
             av_log(av_log_obj, AV_LOG_INFO, " %s", opt->help);
@@ -1456,6 +1458,16 @@ int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags)
     return 0;
 }
 
+int av_arg_show(void *obj, void *av_log_obj)
+{
+    if (!obj)
+        return -1;
+
+    opt_list(obj, av_log_obj, NULL, AV_OPT_FLAG_ARGUMENT, 0, -1);
+
+    return 0;
+}
+
 void av_opt_set_defaults(void *s)
 {
     av_opt_set_defaults2(s, 0, 0);
diff --git a/libavutil/opt.h b/libavutil/opt.h
index 461b5d3b6b..dce3483237 100644
--- a/libavutil/opt.h
+++ b/libavutil/opt.h
@@ -297,6 +297,7 @@ typedef struct AVOption {
 #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) ///< set if option is deprecated, users should refer to AVOption.help text for more information
 #define AV_OPT_FLAG_CHILD_CONSTS    (1<<18) ///< set if option constants can also reside in child objects
+#define AV_OPT_FLAG_ARGUMENT        (1<<19) ///< set if option is an argument to another option
 //FIXME think about enc-audio, ... style flags
 
     /**
@@ -386,6 +387,13 @@ typedef struct AVOptionRanges {
  */
 int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags);
 
+/**
+ * Show the obj arguments.
+ *
+ * @param av_log_obj log context to use for showing the options
+ */
+int av_arg_show(void *obj, void *av_log_obj);
+
 /**
  * Set the values of all AVOption fields to their default values.
  *
diff --git a/libavutil/version.h b/libavutil/version.h
index 0585fa7b80..9c44cef6aa 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,8 +79,8 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  57
-#define LIBAVUTIL_VERSION_MINOR  36
-#define LIBAVUTIL_VERSION_MICRO 102
+#define LIBAVUTIL_VERSION_MINOR  37
+#define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
                                                LIBAVUTIL_VERSION_MINOR, \
-- 
2.20.1 (Apple Git-117)

_______________________________________________
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".

  reply	other threads:[~2022-09-19  9:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-19  9:45 [FFmpeg-devel] [PATCH v4 0/6] Add display_matrix option Thilo Borgmann
2022-09-19  9:45 ` Thilo Borgmann [this message]
2022-09-19  9:46 ` [FFmpeg-devel] [PATCH v4 2/6] fftools/cmdutils: Print arguments of options Thilo Borgmann
2022-09-19  9:46 ` [FFmpeg-devel] [PATCH v4 3/6] fftools: Add support for dictionary options Thilo Borgmann
2022-09-19  9:46 ` [FFmpeg-devel] [PATCH v4 4/6] lavu/display: Add horizontal and vertical scaling to the display matrix Thilo Borgmann
2022-09-19 13:37   ` Andreas Rheinhardt
2022-09-19  9:46 ` [FFmpeg-devel] [PATCH v4 5/6] ffmpeg: Add display_matrix option Thilo Borgmann
2022-09-19  9:46 ` [FFmpeg-devel] [PATCH v4 6/6] ffmpeg: Deprecate display rotation override with a metadata key Thilo Borgmann
2022-09-20  8:36 ` [FFmpeg-devel] [PATCH v4 0/6] Add display_matrix option Anton Khirnov
2022-09-20  9:05   ` Nicolas George
2022-09-20  9:23     ` Anton Khirnov

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=20220919094604.4645-2-thilo.borgmann@mail.de \
    --to=thilo.borgmann@mail.de \
    --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