* [FFmpeg-devel] [PATCH 2/5] fftools: add -lavfi_dump option
2022-03-02 18:40 [FFmpeg-devel] [PATCH 1/5] lavfi/graphdump: add plain listing output Nicolas George
@ 2022-03-02 18:40 ` Nicolas George
2022-03-02 18:40 ` [FFmpeg-devel] [PATCH 3/5] lavfi/(a)format: factor finding the delimiter Nicolas George
` (3 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Nicolas George @ 2022-03-02 18:40 UTC (permalink / raw)
To: ffmpeg-devel
Signed-off-by: Nicolas George <george@nsup.org>
---
doc/ffmpeg.texi | 4 ++++
fftools/ffmpeg.h | 1 +
fftools/ffmpeg_filter.c | 14 ++++++++++++++
fftools/ffmpeg_opt.c | 3 +++
4 files changed, 22 insertions(+)
Unchanged since last summer.
diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 164419cad3..1f6c416390 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -1864,6 +1864,10 @@ The default is the number of available CPUs.
Define a complex filtergraph, i.e. one with arbitrary number of inputs and/or
outputs. Equivalent to @option{-filter_complex}.
+@anchor{lavfi_dump option}
+@item -lavfi_dump (@emph{global})
+Dump the filter graphs and their negotiated formats to standard output.
+
@item -filter_complex_script @var{filename} (@emph{global})
This option is similar to @option{-filter_complex}, the only difference is that
its argument is the name of the file from which a complex filtergraph
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index cc8f767e5d..4b81cc19fa 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -635,6 +635,7 @@ extern char *filter_nbthreads;
extern int filter_complex_nbthreads;
extern int vstats_version;
extern int auto_conversion_filters;
+extern int dump_filtergraphs;
extern const AVIOInterruptCB int_cb;
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index b80d7189db..33ed91bf63 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -1070,6 +1070,20 @@ int configure_filtergraph(FilterGraph *fg)
avfilter_graph_set_auto_convert(fg->graph, AVFILTER_AUTO_CONVERT_NONE);
if ((ret = avfilter_graph_config(fg->graph, NULL)) < 0)
goto fail;
+ if (dump_filtergraphs) {
+ char *dump = avfilter_graph_dump(fg->graph, "f=tech");
+ if (!dump)
+ return AVERROR(ENOMEM);
+ if (simple) {
+ OutputStream *ost = fg->outputs[0]->ost;
+ printf("Dump of filter graph for output #%d:%d:", ost->file_index, ost->index);
+ } else {
+ printf("Dump of complex filter graph #%d:", fg->index);
+ }
+ printf("\n\n%s\n", dump);
+ av_free(dump);
+ fflush(stdout);
+ }
fg->is_meta = graph_is_meta(fg->graph);
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index bf1bbcae4c..9b09917bb3 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -167,6 +167,7 @@ char *filter_nbthreads;
int filter_complex_nbthreads = 0;
int vstats_version = 2;
int auto_conversion_filters = 1;
+int dump_filtergraphs = 0;
int64_t stats_period = 500000;
@@ -3670,6 +3671,8 @@ const OptionDef options[] = {
"number of threads for -filter_complex" },
{ "lavfi", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex },
"create a complex filtergraph", "graph_description" },
+ { "lavfi_dump", OPT_BOOL | OPT_EXPERT, { &dump_filtergraphs },
+ "dump filter graphs to standard output" },
{ "filter_complex_script", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex_script },
"read complex filtergraph description from a file", "filename" },
{ "auto_conversion_filters", OPT_BOOL | OPT_EXPERT, { &auto_conversion_filters },
--
2.34.1
_______________________________________________
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".
^ permalink raw reply [flat|nested] 9+ messages in thread
* [FFmpeg-devel] [PATCH 3/5] lavfi/(a)format: factor finding the delimiter
2022-03-02 18:40 [FFmpeg-devel] [PATCH 1/5] lavfi/graphdump: add plain listing output Nicolas George
2022-03-02 18:40 ` [FFmpeg-devel] [PATCH 2/5] fftools: add -lavfi_dump option Nicolas George
@ 2022-03-02 18:40 ` Nicolas George
2022-03-02 18:40 ` [FFmpeg-devel] [PATCH 4/5] lavfi/(a)format: support slash as a delimiter Nicolas George
` (2 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Nicolas George @ 2022-03-02 18:40 UTC (permalink / raw)
To: ffmpeg-devel
Signed-off-by: Nicolas George <george@nsup.org>
---
libavfilter/af_aformat.c | 8 +++++---
libavfilter/internal.h | 9 +++++++++
libavfilter/vf_format.c | 9 ++++-----
3 files changed, 18 insertions(+), 8 deletions(-)
Same as sent earlier today.
diff --git a/libavfilter/af_aformat.c b/libavfilter/af_aformat.c
index d2599431dc..0cdea2220f 100644
--- a/libavfilter/af_aformat.c
+++ b/libavfilter/af_aformat.c
@@ -65,10 +65,12 @@ do { \
char *next, *cur = str; \
int ret; \
\
- while (cur) { \
+ if (!cur) \
+ break; \
+ while (*cur) { \
type fmt; \
- next = strchr(cur, '|'); \
- if (next) \
+ next = ff_formats_list_find_delimiter(cur); \
+ if (*next) \
*next++ = 0; \
\
if ((fmt = get_fmt(cur)) == none) { \
diff --git a/libavfilter/internal.h b/libavfilter/internal.h
index 53883101a8..74037e5eb9 100644
--- a/libavfilter/internal.h
+++ b/libavfilter/internal.h
@@ -405,4 +405,13 @@ int ff_filter_process_command(AVFilterContext *ctx, const char *cmd,
int ff_filter_init_hw_frames(AVFilterContext *avctx, AVFilterLink *link,
int default_pool_size);
+/**
+ * Find the next delimiter in a string of formats.
+ * The delimiter is '|' or the end of the string.
+ */
+static inline char *ff_formats_list_find_delimiter(const char *str)
+{
+ return (char *)str + strcspn(str, "|");
+}
+
#endif /* AVFILTER_INTERNAL_H */
diff --git a/libavfilter/vf_format.c b/libavfilter/vf_format.c
index c78acbf87b..8940a0e427 100644
--- a/libavfilter/vf_format.c
+++ b/libavfilter/vf_format.c
@@ -67,10 +67,9 @@ static av_cold int init(AVFilterContext *ctx)
/* count the formats */
cur = s->pix_fmts;
- while ((cur = strchr(cur, '|'))) {
+ while (*(cur = ff_formats_list_find_delimiter(cur))) {
nb_formats++;
- if (*cur)
- cur++;
+ cur++;
}
s->formats = av_malloc_array(nb_formats + 1, sizeof(*s->formats));
@@ -80,8 +79,8 @@ static av_cold int init(AVFilterContext *ctx)
/* parse the list of formats */
cur = s->pix_fmts;
for (i = 0; i < nb_formats; i++) {
- sep = strchr(cur, '|');
- if (sep)
+ sep = ff_formats_list_find_delimiter(cur);
+ if (*sep)
*sep++ = 0;
if ((ret = ff_parse_pixel_format(&s->formats[i], cur, ctx)) < 0)
--
2.34.1
_______________________________________________
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".
^ permalink raw reply [flat|nested] 9+ messages in thread
* [FFmpeg-devel] [PATCH 4/5] lavfi/(a)format: support slash as a delimiter
2022-03-02 18:40 [FFmpeg-devel] [PATCH 1/5] lavfi/graphdump: add plain listing output Nicolas George
2022-03-02 18:40 ` [FFmpeg-devel] [PATCH 2/5] fftools: add -lavfi_dump option Nicolas George
2022-03-02 18:40 ` [FFmpeg-devel] [PATCH 3/5] lavfi/(a)format: factor finding the delimiter Nicolas George
@ 2022-03-02 18:40 ` Nicolas George
2022-03-02 18:40 ` [FFmpeg-devel] [PATCH 5/5] tests: add coverage for libavfilter's format negotiation Nicolas George
2022-03-04 1:45 ` [FFmpeg-devel] [PATCH 1/5] lavfi/graphdump: add plain listing output Andreas Rheinhardt
4 siblings, 0 replies; 9+ messages in thread
From: Nicolas George @ 2022-03-02 18:40 UTC (permalink / raw)
To: ffmpeg-devel
Unlike pipe, slash does not require escaping.
Signed-off-by: Nicolas George <george@nsup.org>
---
doc/filters.texi | 8 ++++----
libavfilter/internal.h | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
Same as sent earlier today.
diff --git a/doc/filters.texi b/doc/filters.texi
index 8cba7f744d..ac3091c010 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -1590,13 +1590,13 @@ It accepts the following parameters:
@table @option
@item sample_fmts, f
-A '|'-separated list of requested sample formats.
+A '|'- or '/'-separated list of requested sample formats.
@item sample_rates, r
-A '|'-separated list of requested sample rates.
+A '|'- or '/'-separated list of requested sample rates.
@item channel_layouts, cl
-A '|'-separated list of requested channel layouts.
+A '|'- or '/'-separated list of requested channel layouts.
See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
for the required syntax.
@@ -12811,7 +12811,7 @@ It accepts the following parameters:
@table @option
@item pix_fmts
-A '|'-separated list of pixel format names, such as
+A '|'- or '/'-separated list of pixel format names, such as
"pix_fmts=yuv420p|monow|rgb24".
@end table
diff --git a/libavfilter/internal.h b/libavfilter/internal.h
index 74037e5eb9..df94b9f3b3 100644
--- a/libavfilter/internal.h
+++ b/libavfilter/internal.h
@@ -411,7 +411,7 @@ int ff_filter_init_hw_frames(AVFilterContext *avctx, AVFilterLink *link,
*/
static inline char *ff_formats_list_find_delimiter(const char *str)
{
- return (char *)str + strcspn(str, "|");
+ return (char *)str + strcspn(str, "|/");
}
#endif /* AVFILTER_INTERNAL_H */
--
2.34.1
_______________________________________________
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".
^ permalink raw reply [flat|nested] 9+ messages in thread
* [FFmpeg-devel] [PATCH 5/5] tests: add coverage for libavfilter's format negotiation
2022-03-02 18:40 [FFmpeg-devel] [PATCH 1/5] lavfi/graphdump: add plain listing output Nicolas George
` (2 preceding siblings ...)
2022-03-02 18:40 ` [FFmpeg-devel] [PATCH 4/5] lavfi/(a)format: support slash as a delimiter Nicolas George
@ 2022-03-02 18:40 ` Nicolas George
2022-03-03 18:22 ` Paul B Mahol
2022-03-03 18:31 ` James Almer
2022-03-04 1:45 ` [FFmpeg-devel] [PATCH 1/5] lavfi/graphdump: add plain listing output Andreas Rheinhardt
4 siblings, 2 replies; 9+ messages in thread
From: Nicolas George @ 2022-03-02 18:40 UTC (permalink / raw)
To: ffmpeg-devel
Signed-off-by: Nicolas George <george@nsup.org>
---
tests/Makefile | 1 +
tests/fate-run.sh | 4 ++++
tests/fate/libavfilter.mak | 9 +++++++++
tests/ref/fate/libavfilter-negotiation-alpha | 20 ++++++++++++++++++++
4 files changed, 34 insertions(+)
create mode 100644 tests/fate/libavfilter.mak
create mode 100644 tests/ref/fate/libavfilter-negotiation-alpha
This is not to be the only test, I intend to cover all the logic in
pick_format() and the logic in swap_*().
But I would rather have you have a quick look at the makefile hackery
before writing too many tests that would need changing.
diff --git a/tests/Makefile b/tests/Makefile
index c4c31ae871..2bff4b339d 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -157,6 +157,7 @@ include $(SRC_PATH)/tests/fate/imf.mak
include $(SRC_PATH)/tests/fate/indeo.mak
include $(SRC_PATH)/tests/fate/libavcodec.mak
include $(SRC_PATH)/tests/fate/libavdevice.mak
+include $(SRC_PATH)/tests/fate/libavfilter.mak
include $(SRC_PATH)/tests/fate/libavformat.mak
include $(SRC_PATH)/tests/fate/libavutil.mak
include $(SRC_PATH)/tests/fate/libswresample.mak
diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index fbfc0a925d..82d40f5ebc 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -509,6 +509,10 @@ venc_data(){
run tools/venc_data_dump${EXECSUF} ${file} ${stream} ${frames} ${threads} ${thread_type}
}
+lavfi_dump(){
+ run ffmpeg${PROGSUF}${EXECSUF} -lavfi_dump -lavfi "$@" -f null -
+}
+
null(){
:
}
diff --git a/tests/fate/libavfilter.mak b/tests/fate/libavfilter.mak
new file mode 100644
index 0000000000..692f1d4960
--- /dev/null
+++ b/tests/fate/libavfilter.mak
@@ -0,0 +1,9 @@
+# avfiltergraph.c : pick_format() : video / don't lose alpha
+FATE_LIBAVFILTER_NEGOTIATION_VIDEO += fate-libavfilter-negotiation-alpha
+fate-libavfilter-negotiation-alpha: CMD = lavfi_dump testsrc2=d=0,format=rgba,scale,format=yuv444p/yuva444p
+
+FATE_LIBAVFILTER-$(call ALLYES, TESTSRC2_FILTER FORMAT_FILTER SCALE_FILTER) += $(FATE_LIBAVFILTER_NEGOTIATION_VIDEO)
+
+fate-libavfilter: $(FATE_LIBAVFILTER) $(FATE_LIBAVFILTER-yes)
+fate-libavfilter-negotiation: $(FATE_LIBAVFILTER_NEGOTIATION) $(FATE_LIBAVFILTER_NEGOTIATION-yes)
+FATE_FFMPEG += $(FATE_LIBAVFILTER-yes)
diff --git a/tests/ref/fate/libavfilter-negotiation-alpha b/tests/ref/fate/libavfilter-negotiation-alpha
new file mode 100644
index 0000000000..00175f65cb
--- /dev/null
+++ b/tests/ref/fate/libavfilter-negotiation-alpha
@@ -0,0 +1,20 @@
+Dump of complex filter graph #0:
+
+Filter: Parsed_testsrc2_0 (testsrc2)
+ out 0: default → Parsed_format_1.0:default [320x240 1:1 rgba]
+
+Filter: Parsed_format_1 (format)
+ in 0: default ← Parsed_testsrc2_0.0:default [320x240 1:1 rgba]
+ out 0: default → Parsed_scale_2.0:default [320x240 1:1 rgba]
+
+Filter: Parsed_scale_2 (scale)
+ in 0: default ← Parsed_format_1.0:default [320x240 1:1 rgba]
+ out 0: default → Parsed_format_3.0:default [320x240 1:1 yuva444p]
+
+Filter: Parsed_format_3 (format)
+ in 0: default ← Parsed_scale_2.0:default [320x240 1:1 yuva444p]
+ out 0: default → out_0_0.0:default [320x240 1:1 yuva444p]
+
+Filter: out_0_0 (buffersink)
+ in 0: default ← Parsed_format_3.0:default [320x240 1:1 yuva444p]
+
--
2.34.1
_______________________________________________
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".
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH 5/5] tests: add coverage for libavfilter's format negotiation
2022-03-02 18:40 ` [FFmpeg-devel] [PATCH 5/5] tests: add coverage for libavfilter's format negotiation Nicolas George
@ 2022-03-03 18:22 ` Paul B Mahol
2022-03-03 18:31 ` James Almer
1 sibling, 0 replies; 9+ messages in thread
From: Paul B Mahol @ 2022-03-03 18:22 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On 3/2/22, Nicolas George <george@nsup.org> wrote:
> Signed-off-by: Nicolas George <george@nsup.org>
> ---
> tests/Makefile | 1 +
> tests/fate-run.sh | 4 ++++
> tests/fate/libavfilter.mak | 9 +++++++++
> tests/ref/fate/libavfilter-negotiation-alpha | 20 ++++++++++++++++++++
> 4 files changed, 34 insertions(+)
> create mode 100644 tests/fate/libavfilter.mak
> create mode 100644 tests/ref/fate/libavfilter-negotiation-alpha
>
>
> This is not to be the only test, I intend to cover all the logic in
> pick_format() and the logic in swap_*().
>
> But I would rather have you have a quick look at the makefile hackery
> before writing too many tests that would need changing.
>
>
> diff --git a/tests/Makefile b/tests/Makefile
> index c4c31ae871..2bff4b339d 100644
> --- a/tests/Makefile
> +++ b/tests/Makefile
> @@ -157,6 +157,7 @@ include $(SRC_PATH)/tests/fate/imf.mak
> include $(SRC_PATH)/tests/fate/indeo.mak
> include $(SRC_PATH)/tests/fate/libavcodec.mak
> include $(SRC_PATH)/tests/fate/libavdevice.mak
> +include $(SRC_PATH)/tests/fate/libavfilter.mak
> include $(SRC_PATH)/tests/fate/libavformat.mak
> include $(SRC_PATH)/tests/fate/libavutil.mak
> include $(SRC_PATH)/tests/fate/libswresample.mak
> diff --git a/tests/fate-run.sh b/tests/fate-run.sh
> index fbfc0a925d..82d40f5ebc 100755
> --- a/tests/fate-run.sh
> +++ b/tests/fate-run.sh
> @@ -509,6 +509,10 @@ venc_data(){
> run tools/venc_data_dump${EXECSUF} ${file} ${stream} ${frames}
> ${threads} ${thread_type}
> }
>
> +lavfi_dump(){
> + run ffmpeg${PROGSUF}${EXECSUF} -lavfi_dump -lavfi "$@" -f null -
> +}
> +
> null(){
> :
> }
> diff --git a/tests/fate/libavfilter.mak b/tests/fate/libavfilter.mak
> new file mode 100644
> index 0000000000..692f1d4960
> --- /dev/null
> +++ b/tests/fate/libavfilter.mak
> @@ -0,0 +1,9 @@
> +# avfiltergraph.c : pick_format() : video / don't lose alpha
> +FATE_LIBAVFILTER_NEGOTIATION_VIDEO += fate-libavfilter-negotiation-alpha
> +fate-libavfilter-negotiation-alpha: CMD = lavfi_dump
> testsrc2=d=0,format=rgba,scale,format=yuv444p/yuva444p
> +
> +FATE_LIBAVFILTER-$(call ALLYES, TESTSRC2_FILTER FORMAT_FILTER SCALE_FILTER)
> += $(FATE_LIBAVFILTER_NEGOTIATION_VIDEO)
> +
> +fate-libavfilter: $(FATE_LIBAVFILTER) $(FATE_LIBAVFILTER-yes)
> +fate-libavfilter-negotiation: $(FATE_LIBAVFILTER_NEGOTIATION)
> $(FATE_LIBAVFILTER_NEGOTIATION-yes)
> +FATE_FFMPEG += $(FATE_LIBAVFILTER-yes)
> diff --git a/tests/ref/fate/libavfilter-negotiation-alpha
> b/tests/ref/fate/libavfilter-negotiation-alpha
> new file mode 100644
> index 0000000000..00175f65cb
> --- /dev/null
> +++ b/tests/ref/fate/libavfilter-negotiation-alpha
> @@ -0,0 +1,20 @@
> +Dump of complex filter graph #0:
> +
> +Filter: Parsed_testsrc2_0 (testsrc2)
> + out 0: default → Parsed_format_1.0:default [320x240 1:1 rgba]
> +
> +Filter: Parsed_format_1 (format)
> + in 0: default ← Parsed_testsrc2_0.0:default [320x240 1:1 rgba]
> + out 0: default → Parsed_scale_2.0:default [320x240 1:1 rgba]
> +
> +Filter: Parsed_scale_2 (scale)
> + in 0: default ← Parsed_format_1.0:default [320x240 1:1 rgba]
> + out 0: default → Parsed_format_3.0:default [320x240 1:1 yuva444p]
> +
> +Filter: Parsed_format_3 (format)
> + in 0: default ← Parsed_scale_2.0:default [320x240 1:1 yuva444p]
> + out 0: default → out_0_0.0:default [320x240 1:1 yuva444p]
> +
> +Filter: out_0_0 (buffersink)
> + in 0: default ← Parsed_format_3.0:default [320x240 1:1 yuva444p]
> +
> --
> 2.34.1
>
Changes in this set seems logical and useful.
_______________________________________________
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".
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH 5/5] tests: add coverage for libavfilter's format negotiation
2022-03-02 18:40 ` [FFmpeg-devel] [PATCH 5/5] tests: add coverage for libavfilter's format negotiation Nicolas George
2022-03-03 18:22 ` Paul B Mahol
@ 2022-03-03 18:31 ` James Almer
2022-03-03 18:37 ` Nicolas George
1 sibling, 1 reply; 9+ messages in thread
From: James Almer @ 2022-03-03 18:31 UTC (permalink / raw)
To: ffmpeg-devel
On 3/2/2022 3:40 PM, Nicolas George wrote:
> diff --git a/tests/fate/libavfilter.mak b/tests/fate/libavfilter.mak
> new file mode 100644
> index 0000000000..692f1d4960
> --- /dev/null
> +++ b/tests/fate/libavfilter.mak
> @@ -0,0 +1,9 @@
> +# avfiltergraph.c : pick_format() : video / don't lose alpha
> +FATE_LIBAVFILTER_NEGOTIATION_VIDEO += fate-libavfilter-negotiation-alpha
> +fate-libavfilter-negotiation-alpha: CMD = lavfi_dump testsrc2=d=0,format=rgba,scale,format=yuv444p/yuva444p
> +
> +FATE_LIBAVFILTER-$(call ALLYES, TESTSRC2_FILTER FORMAT_FILTER SCALE_FILTER) += $(FATE_LIBAVFILTER_NEGOTIATION_VIDEO)
> +
> +fate-libavfilter: $(FATE_LIBAVFILTER) $(FATE_LIBAVFILTER-yes)
> +fate-libavfilter-negotiation: $(FATE_LIBAVFILTER_NEGOTIATION) $(FATE_LIBAVFILTER_NEGOTIATION-yes)
> +FATE_FFMPEG += $(FATE_LIBAVFILTER-yes)
This can be simplified as such:
> # avfiltergraph.c : pick_format() : video / don't lose alpha
> FATE_LIBAVFILTER-$(call ALLYES, TESTSRC2_FILTER FORMAT_FILTER SCALE_FILTER) += fate-libavfilter-negotiation-alpha
> fate-libavfilter-negotiation-alpha: CMD = lavfi_dump testsrc2=d=0,format=rgba,scale,format=yuv444p/yuva444p
>
> fate-libavfilter: $(FATE_LIBAVFILTER-yes)
> FATE_FFMPEG += $(FATE_LIBAVFILTER-yes)
No need to add a fate-libavfilter-negotiation target until there are
more such tests.
_______________________________________________
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".
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH 5/5] tests: add coverage for libavfilter's format negotiation
2022-03-03 18:31 ` James Almer
@ 2022-03-03 18:37 ` Nicolas George
0 siblings, 0 replies; 9+ messages in thread
From: Nicolas George @ 2022-03-03 18:37 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 597 bytes --]
James Almer (12022-03-03):
> No need to add a fate-libavfilter-negotiation target until there are more
> such tests.
Thanks for the review. I know these targets are not necessary, but I
want them. I do intend to write more tests:
>> This is not to be the only test, I intend to cover all the logic in
>> pick_format() and the logic in swap_*().
And having submodule-specific fate targets is convenient even if there
are only one test.
Please read the code assuming there are several tests, including tests
using aresample rather than scale.
Regards,
--
Nicolas George
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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".
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/5] lavfi/graphdump: add plain listing output
2022-03-02 18:40 [FFmpeg-devel] [PATCH 1/5] lavfi/graphdump: add plain listing output Nicolas George
` (3 preceding siblings ...)
2022-03-02 18:40 ` [FFmpeg-devel] [PATCH 5/5] tests: add coverage for libavfilter's format negotiation Nicolas George
@ 2022-03-04 1:45 ` Andreas Rheinhardt
4 siblings, 0 replies; 9+ messages in thread
From: Andreas Rheinhardt @ 2022-03-04 1:45 UTC (permalink / raw)
To: ffmpeg-devel
Nicolas George:
> Signed-off-by: Nicolas George <george@nsup.org>
> ---
> libavfilter/avfilter.h | 5 ++-
> libavfilter/graphdump.c | 79 +++++++++++++++++++++++++++++++++++++++--
> 2 files changed, 80 insertions(+), 4 deletions(-)
>
>
> Unchanged since last summer.
> The last patch is what this is needed for.
>
>
> diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
> index b105dc3159..b338766609 100644
> --- a/libavfilter/avfilter.h
> +++ b/libavfilter/avfilter.h
> @@ -1153,7 +1153,10 @@ int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const
> * Dump a graph into a human-readable string representation.
> *
> * @param graph the graph to dump
> - * @param options formatting options; currently ignored
> + * @param options formatting options; can be NULL, empty
> + * or "f=aa" for clumsy ascii-art drawing,
> + * or "f=tech" for plain listing;
> + * other values silently ignored
> * @return a string, or NULL in case of memory allocation failure;
> * the string must be freed using av_free
> */
> diff --git a/libavfilter/graphdump.c b/libavfilter/graphdump.c
> index cf8914b558..80dbccc66a 100644
> --- a/libavfilter/graphdump.c
> +++ b/libavfilter/graphdump.c
> @@ -27,6 +27,9 @@
> #include "avfilter.h"
> #include "internal.h"
>
> +#define FORMAT_AA 0
> +#define FORMAT_TECH 1
> +
> static int print_link_prop(AVBPrint *buf, AVFilterLink *link)
> {
> const char *format;
> @@ -60,7 +63,51 @@ static int print_link_prop(AVBPrint *buf, AVFilterLink *link)
> return buf->len;
> }
>
> -static void avfilter_graph_dump_to_buf(AVBPrint *buf, AVFilterGraph *graph)
The name of avfilter_graph_dump_to_buf makes it seem as if this were a
public function due to its prefix. Given that you already change the
signature, you already change every occurence of
avfilter_graph_dump_to_buf. So could you also rename it to a name more
befitting of a static function?
> +static inline const char *fcname(const AVFilterContext *filter)
> +{
> + return filter->name ? filter->name : "<unnamed>";
> +}
> +
> +static void dump_tech(AVBPrint *buf, AVFilterGraph *graph)
> +{
> + unsigned i, j;
> +
> + for (i = 0; i < graph->nb_filters; i++) {
> + AVFilterContext *filter = graph->filters[i];
> +
> + if (i)
> + av_bprintf(buf, "\n");
> + av_bprintf(buf, "Filter: %s (%s)\n", fcname(filter), filter->filter->name);
> +
> + for (j = 0; j < filter->nb_inputs; j++) {
> + AVFilterPad *pad = &filter->input_pads[j];
> + AVFilterLink *link = filter->inputs[j];
> + AVFilterPad *ppad = link->srcpad;
> + AVFilterContext *peer = link->src;
> +
> + av_bprintf(buf, " in %d: %s ← %s.%d:%s ",
> + j, pad->name,
> + fcname(peer), FF_OUTLINK_IDX(link), ppad->name);
> + print_link_prop(buf, link);
> + av_bprintf(buf, "\n");
> + }
> +
> + for (j = 0; j < filter->nb_outputs; j++) {
> + AVFilterPad *pad = &filter->output_pads[j];
> + AVFilterLink *link = filter->outputs[j];
> + AVFilterPad *ppad = link->dstpad;
> + AVFilterContext *peer = link->dst;
> +
> + av_bprintf(buf, " out %d: %s → %s.%d:%s ",
> + j, pad->name,
> + fcname(peer), FF_INLINK_IDX(link), ppad->name);
> + print_link_prop(buf, link);
> + av_bprintf(buf, "\n");
> + }
> + }
> +}
> +
> +static void dump_ascii_art(AVBPrint *buf, AVFilterGraph *graph)
> {
> unsigned i, j, x, e;
>
> @@ -152,17 +199,43 @@ static void avfilter_graph_dump_to_buf(AVBPrint *buf, AVFilterGraph *graph)
> }
> }
>
> +static void avfilter_graph_dump_to_buf(AVBPrint *buf, AVFilterGraph *graph, const char *options)
> +{
> + unsigned format = FORMAT_AA;
> +
> + /* For a very long time, options was ignored.
> + Having a string for that task was a mistake, but it is not important.
> + It is not worth a proper parsing.
> + */
> + if (options && *options) {
> + if (!strcmp("f=aa", options)) {
> + format = FORMAT_AA;
> + } else if (!strcmp("f=tech", options)) {
> + format = FORMAT_TECH;
> + }
> + /* ignore other values */
> + }
> + switch (format) {
> + case FORMAT_AA:
> + dump_ascii_art(buf, graph);
> + break;
> + case FORMAT_TECH:
> + dump_tech(buf, graph);
> + break;
> + }
> +}
> +
> char *avfilter_graph_dump(AVFilterGraph *graph, const char *options)
> {
> AVBPrint buf;
> char *dump = NULL;
>
> av_bprint_init(&buf, 0, AV_BPRINT_SIZE_COUNT_ONLY);
> - avfilter_graph_dump_to_buf(&buf, graph);
> + avfilter_graph_dump_to_buf(&buf, graph, options);
> dump = av_malloc(buf.len + 1);
> if (!dump)
> return NULL;
> av_bprint_init_for_buffer(&buf, dump, buf.len + 1);
> - avfilter_graph_dump_to_buf(&buf, graph);
> + avfilter_graph_dump_to_buf(&buf, graph, options);
> return dump;
> }
_______________________________________________
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".
^ permalink raw reply [flat|nested] 9+ messages in thread