From: softworkz <ffmpegagent@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Cc: softworkz <softworkz@hotmail.com>
Subject: [FFmpeg-devel] [PATCH 2/2] ftools/opt_common: Print filter input/output formats in help output
Date: Tue, 11 Oct 2022 13:17:51 +0000
Message-ID: <c99d278881ffe1bfd72f1784ff58ced6d3518d22.1665494271.git.ffmpegagent@gmail.com> (raw)
In-Reply-To: <pull.43.ffstaging.FFmpeg.1665494271.ffmpegagent@gmail.com>
From: softworkz <softworkz@hotmail.com>
Exmaple command: ffmpeg -h filters=overlay
Output:
Filter overlay
Overlay a video source on top of the input.
slice threading supported
Inputs:
#0: main (video), Formats: Dynamic, Default: [yuv420p, yuvj420p,
yuva420p, nv12, nv21]
#1: overlay (video), Formats: Dynamic, Default: [yuva420p]
Outputs:
#0: default (video), Formats: Dynamic, Default: [yuv420p, yuvj420p,
yuva420p, nv12, nv21]
overlay AVOptions:
[...]
Signed-off-by: softworkz <softworkz@hotmail.com>
---
fftools/opt_common.c | 39 +++++++++++++++++++++++++++------------
1 file changed, 27 insertions(+), 12 deletions(-)
diff --git a/fftools/opt_common.c b/fftools/opt_common.c
index 8a06df82df..cb9de897a3 100644
--- a/fftools/opt_common.c
+++ b/fftools/opt_common.c
@@ -504,7 +504,8 @@ static void show_help_filter(const char *name)
{
#if CONFIG_AVFILTER
const AVFilter *f = avfilter_get_by_name(name);
- int i, count;
+ AVBPrint bp;
+ int i, count, ret;
if (!name) {
av_log(NULL, AV_LOG_ERROR, "No filter name specified.\n");
@@ -514,40 +515,54 @@ static void show_help_filter(const char *name)
return;
}
- printf("Filter %s\n", f->name);
+ av_bprint_init(&bp, 0, AV_BPRINT_SIZE_UNLIMITED);
+ av_log_set_callback(NULL);
+
+ av_bprintf(&bp, "Filter %s\n", f->name);
if (f->description)
- printf(" %s\n", f->description);
+ av_bprintf(&bp, " %s\n", f->description);
if (f->flags & AVFILTER_FLAG_SLICE_THREADS)
- printf(" slice threading supported\n");
+ av_bprintf(&bp, " slice threading supported\n");
- printf(" Inputs:\n");
+ av_bprintf(&bp, " Inputs:\n");
count = avfilter_filter_pad_count(f, 0);
for (i = 0; i < count; i++) {
- printf(" #%d: %s (%s)\n", i, avfilter_pad_get_name(f->inputs, i),
+ av_bprintf(&bp, " #%d: %s (%s), Formats: ", i, avfilter_pad_get_name(f->inputs, i),
av_get_media_type_string(avfilter_pad_get_type(f->inputs, i)));
+
+ avfilter_print_config_formats(&bp, f, 0, i);
+ av_bprintf(&bp, "\n");
}
if (f->flags & AVFILTER_FLAG_DYNAMIC_INPUTS)
- printf(" dynamic (depending on the options)\n");
+ av_bprintf(&bp, " dynamic (depending on the options)\n");
else if (!count)
- printf(" none (source filter)\n");
+ av_bprintf(&bp, " none (source filter)\n");
- printf(" Outputs:\n");
+ av_bprintf(&bp, " Outputs:\n");
count = avfilter_filter_pad_count(f, 1);
for (i = 0; i < count; i++) {
- printf(" #%d: %s (%s)\n", i, avfilter_pad_get_name(f->outputs, i),
+ av_bprintf(&bp, " #%d: %s (%s), Formats: ", i, avfilter_pad_get_name(f->outputs, i),
av_get_media_type_string(avfilter_pad_get_type(f->outputs, i)));
+
+ avfilter_print_config_formats(&bp, f, 1, i);
+ av_bprintf(&bp, "\n");
}
if (f->flags & AVFILTER_FLAG_DYNAMIC_OUTPUTS)
- printf(" dynamic (depending on the options)\n");
+ av_bprintf(&bp, " dynamic (depending on the options)\n");
else if (!count)
- printf(" none (sink filter)\n");
+ av_bprintf(&bp, " none (sink filter)\n");
+
+ av_log_set_callback(log_callback_help);
+ printf("%s\n", bp.str);
if (f->priv_class)
show_help_children(f->priv_class, AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM |
AV_OPT_FLAG_AUDIO_PARAM);
if (f->flags & AVFILTER_FLAG_SUPPORT_TIMELINE)
printf("This filter has support for timeline through the 'enable' option.\n");
+
+ av_bprint_finalize(&bp, NULL);
#else
av_log(NULL, AV_LOG_ERROR, "Build without libavfilter; "
"can not to satisfy request\n");
--
ffmpeg-codebot
_______________________________________________
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:[~2022-10-11 13:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-11 13:17 [FFmpeg-devel] [PATCH 0/2] " ffmpegagent
2022-10-11 13:17 ` [FFmpeg-devel] [PATCH 1/2] avfilter/avfilter: add avfilter_print_config_formats() softworkz
2022-11-03 9:58 ` Paul B Mahol
2022-11-03 22:34 ` Soft Works
2022-12-12 23:13 ` Soft Works
2022-12-26 20:24 ` Paul B Mahol
2022-10-11 13:17 ` softworkz [this message]
2022-10-11 21:38 ` [FFmpeg-devel] [PATCH v2 0/2] Print filter input/output formats in help output ffmpegagent
2022-10-11 21:38 ` [FFmpeg-devel] [PATCH v2 1/2] avfilter/avfilter: add avfilter_print_config_formats() softworkz
2022-10-11 21:38 ` [FFmpeg-devel] [PATCH v2 2/2] ftools/opt_common: Print filter input/output formats in help output softworkz
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=c99d278881ffe1bfd72f1784ff58ced6d3518d22.1665494271.git.ffmpegagent@gmail.com \
--to=ffmpegagent@gmail.com \
--cc=ffmpeg-devel@ffmpeg.org \
--cc=softworkz@hotmail.com \
/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