[FFmpeg-devel] [PATCH v12 00/15] Execution Graph Printing
ffmpegagent
ffmpegagent at gmail.com
Thu May 8 04:36:41 EEST 2025
Shortest cover letter for my longest-running FFmpeg patchset:
* Apply
* Build
* Add the "-sg" switch to any FFmpeg command line
* Press 'q' when you don't want to wait
SG = Show Graph
Documentation and examples can be found here:
https://github.com/softworkz/ffmpeg_output_apis/wiki
Version Updates
===============
V2
==
* Rebased on top of Andreas' improvements
* Applied changes from review (thanks, Andreas)
V3
==
* Fixed all "new warnings"
* Fixed out-of-tree building (thanks, Michael)
V4
==
* Resolved merge conflict
* Fixed build on MinGW (missing include due to WIN32_LEAN_AND_MEAN being
defined) (thanks, Michael)
V5
==
* Applied changes as per review from Stefano (thanks!)
* Introduced AVTextFormatOptions struct for options in
avtext_context_open()
V6
==
* Fix "new warning" in 2nd last commit
* Squash patches 04 and 05 (they weren't truely independent)
* Applied changes as per review from Stefano (thanks!)
V7
==
* Bitten by OOT builds once again (thanks, Michael)
V8
==
* New commit Remove void (*print_rational) from AVTextFormatter (unused)
* New commit fftools/textformat: Rename name param to key for API
consistency
* print_int Extend existing function instead of adding print_int_flags
* Fix registered_formatters[] array size
* avtextwriters.h: Remove unused includes
* graphprint.c: Make BPrint inits consistent
* tf_json: Check nesting level for value printing
* And other review suggestions by Stefano (thanks!)
V9
==
* Handle cases where no zlib is available (thanks, Michael)
and provide configure switch (--disable-resource-compression)
V10
===
* Fix shared build by not using private URL API from avformat (thanks,
Michael)
V11
===
* Resubmit because Patchwork was broken
V12
===
* Apply requested changes from review (thanks, Stefano)
.
softworkz (15):
fftools/textformat: Apply formatting and whitespace changes
fftools/textformat: Apply quality improvements
fftools/textformat: Remove unused print_rational() pointer from
AVTextFormatter
fftools/textformat: Rename name param to key for API consistency
fftools/avtextformat: Re-use BPrint in loop
fftools/textformat: Introduce AVTextFormatOptions for
avtext_context_open()
fftools/textformat: Introduce common header and deduplicate code
fftools/tf_internal: Use av_default_item_name
fftools/textformat: Add flags param to function avtext_print_integer()
fftools/ffmpeg_filter: Move some declaration to new header file
avfilter/avfilter: Add avfilter_link_get_hw_frames_ctx()
fftools/resources: Add resource manager files with build-time
compression
fftools/ffmpeg_mux: Make ms_from_ost() inline
fftools/graphprint: Add execution graph printing
fftools/graphprint: Now, make it a Killer-Feature!
configure | 5 +
doc/APIchanges | 3 +
doc/ffmpeg.texi | 14 +
ffbuild/common.mak | 43 +-
fftools/Makefile | 22 +-
fftools/ffmpeg.c | 4 +
fftools/ffmpeg.h | 4 +
fftools/ffmpeg_filter.c | 195 +----
fftools/ffmpeg_filter.h | 234 ++++++
fftools/ffmpeg_mux.h | 2 +-
fftools/ffmpeg_opt.c | 17 +
fftools/ffprobe.c | 15 +-
fftools/graph/filelauncher.c | 205 +++++
fftools/graph/graphprint.c | 1153 ++++++++++++++++++++++++++++
fftools/graph/graphprint.h | 62 ++
fftools/resources/.gitignore | 4 +
fftools/resources/Makefile | 13 +
fftools/resources/graph.css | 353 +++++++++
fftools/resources/graph.html | 86 +++
fftools/resources/resman.c | 231 ++++++
fftools/resources/resman.h | 50 ++
fftools/textformat/avtextformat.c | 239 +++---
fftools/textformat/avtextformat.h | 78 +-
fftools/textformat/avtextwriters.h | 16 +-
fftools/textformat/tf_compact.c | 117 +--
fftools/textformat/tf_default.c | 55 +-
fftools/textformat/tf_flat.c | 51 +-
fftools/textformat/tf_ini.c | 62 +-
fftools/textformat/tf_internal.h | 81 ++
fftools/textformat/tf_json.c | 64 +-
fftools/textformat/tf_mermaid.c | 658 ++++++++++++++++
fftools/textformat/tf_mermaid.h | 41 +
fftools/textformat/tf_xml.c | 68 +-
fftools/textformat/tw_avio.c | 18 +-
fftools/textformat/tw_buffer.c | 9 +-
fftools/textformat/tw_stdout.c | 10 +-
libavfilter/avfilter.c | 9 +
libavfilter/avfilter.h | 12 +
38 files changed, 3724 insertions(+), 579 deletions(-)
create mode 100644 fftools/ffmpeg_filter.h
create mode 100644 fftools/graph/filelauncher.c
create mode 100644 fftools/graph/graphprint.c
create mode 100644 fftools/graph/graphprint.h
create mode 100644 fftools/resources/.gitignore
create mode 100644 fftools/resources/Makefile
create mode 100644 fftools/resources/graph.css
create mode 100644 fftools/resources/graph.html
create mode 100644 fftools/resources/resman.c
create mode 100644 fftools/resources/resman.h
create mode 100644 fftools/textformat/tf_internal.h
create mode 100644 fftools/textformat/tf_mermaid.c
create mode 100644 fftools/textformat/tf_mermaid.h
base-commit: 1b643e3f65d75a4e6a25986466254bdd4fc1a01a
Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-66%2Fsoftworkz%2Fsubmit_print_execution_graph-v12
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-66/softworkz/submit_print_execution_graph-v12
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/66
Range-diff vs v11:
1: 7e8fddd1b8 ! 1: 52f1c392b3 fftools/textformat: Formatting and whitespace changes
@@ Metadata
Author: softworkz <softworkz at hotmail.com>
## Commit message ##
- fftools/textformat: Formatting and whitespace changes
+ fftools/textformat: Apply formatting and whitespace changes
Reviewed-by: Stefano Sabatini <stefasab at gmail.com>
Signed-off-by: softworkz <softworkz at hotmail.com>
@@ fftools/textformat/avtextformat.c: void avtext_context_close(AVTextFormatContext
int use_value_prefix,
int use_byte_value_binary_prefix,
@@ fftools/textformat/avtextformat.c: int avtext_context_open(AVTextFormatContext **ptctx, const AVTextFormatter *form
- av_dict_free(&opts);
- }
-
-- if (show_data_hash) {
-+ if (show_data_hash)
- if ((ret = av_hash_alloc(&tctx->hash, show_data_hash)) < 0) {
- if (ret == AVERROR(EINVAL)) {
- const char *n;
-@@ fftools/textformat/avtextformat.c: int avtext_context_open(AVTextFormatContext **ptctx, const AVTextFormatter *form
+ av_log(NULL, AV_LOG_ERROR, " %s", n);
+ av_log(NULL, AV_LOG_ERROR, "\n");
}
- return ret;
+- return ret;
++ goto fail;
}
-- }
+ }
- /* validate replace string */
- {
@@ fftools/textformat/avtextformat.c: int avtext_context_open(AVTextFormatContext **ptctx, const AVTextFormatter *form
if (ret < 0) {
AVBPrint bp;
@@ fftools/textformat/avtextformat.c: fail:
{
tctx->level++;
av_assert0(tctx->level < SECTION_MAX_NB_LEVELS);
-@@ fftools/textformat/avtextformat.c: void avtext_print_section_header(AVTextFormatContext *tctx,
- void avtext_print_section_footer(AVTextFormatContext *tctx)
+@@ fftools/textformat/avtextformat.c: void avtext_print_section_footer(AVTextFormatContext *tctx)
{
int section_id = tctx->section[tctx->level]->id;
-- int parent_section_id = tctx->level ?
+ int parent_section_id = tctx->level ?
- tctx->section[tctx->level-1]->id : SECTION_ID_NONE;
-+ int parent_section_id = tctx->level
-+ ? tctx->section[tctx->level - 1]->id
-+ : SECTION_ID_NONE;
++ tctx->section[tctx->level - 1]->id : SECTION_ID_NONE;
if (parent_section_id != SECTION_ID_NONE) {
tctx->nb_item[tctx->level - 1]++;
@@ fftools/textformat/tf_compact.c: static void compact_print_section_header(AVText
if (section->flags & AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE) {
// add /TYPE to prefix
@@ fftools/textformat/tf_compact.c: static void compact_print_section_header(AVTextFormatContext *wctx, const void *
- char c =
- (*p >= '0' && *p <= '9') ||
- (*p >= 'a' && *p <= 'z') ||
-- (*p >= 'A' && *p <= 'Z') ? av_tolower(*p) : '_';
-+ (*p >= 'A' && *p <= 'Z')
-+ ? (char)(char)av_tolower(*p)
-+ : '_';
- av_bprint_chars(section_pbuf, c, 1);
- }
}
av_bprint_chars(section_pbuf, ':', 1);
2: 86ea1c4df5 ! 2: 0499b73c87 fftools/textformat: Apply quality improvements
@@ fftools/textformat/avtextformat.c: int avtext_context_open(AVTextFormatContext *
ret = AVERROR(ENOMEM);
goto fail;
@@ fftools/textformat/avtextformat.c: int avtext_context_open(AVTextFormatContext **ptctx, const AVTextFormatter *form
- av_log(NULL, AV_LOG_ERROR, " %s", n);
- av_log(NULL, AV_LOG_ERROR, "\n");
- }
-- return ret;
-+ goto fail;
- }
/* validate replace string */
{
@@ fftools/textformat/avtextformat.c: void avtext_print_section_header(AVTextFormat
+ }
+
int section_id = tctx->section[tctx->level]->id;
- int parent_section_id = tctx->level
- ? tctx->section[tctx->level - 1]->id
+ int parent_section_id = tctx->level ?
+ tctx->section[tctx->level - 1]->id : SECTION_ID_NONE;
@@ fftools/textformat/avtextformat.c: void avtext_print_section_footer(AVTextFormatContext *tctx)
void avtext_print_integer(AVTextFormatContext *tctx, const char *key, int64_t val)
3: 455c13c6ff ! 3: 5b2106ad0d fftools/textformat: Remove unused print_rational() pointer from AVTextFormatter
@@ Metadata
## Commit message ##
fftools/textformat: Remove unused print_rational() pointer from AVTextFormatter
+ Reviewed-by: Stefano Sabatini <stefasab at gmail.com>
Signed-off-by: softworkz <softworkz at hotmail.com>
## fftools/textformat/avtextformat.h ##
4: 624ac50f29 ! 4: e599979391 fftools/textformat: Rename name param to key for API consistency
@@ Metadata
## Commit message ##
fftools/textformat: Rename name param to key for API consistency
+ Reviewed-by: Stefano Sabatini <stefasab at gmail.com>
Signed-off-by: softworkz <softworkz at hotmail.com>
## fftools/textformat/avtextformat.c ##
5: 26af65e6f2 ! 5: da6a27182d fftools/avtextformat: Re-use BPrint in loop
@@ Metadata
## Commit message ##
fftools/avtextformat: Re-use BPrint in loop
- Instead of initializing a new BPrint in each iteration of
- the loop, re-use the same BPrint struct and just clear it
+ Instead of initializing a new BPrint in case of UTF decode error,
+ re-use the same BPrint struct and just clear it
for each iteration.
+ Reviewed-by: Stefano Sabatini <stefasab at gmail.com>
Signed-off-by: softworkz <softworkz at hotmail.com>
## fftools/textformat/avtextformat.c ##
@@ fftools/textformat/avtextformat.c: void avtext_print_integer(AVTextFormatContext
- const uint8_t *p, *endp;
+ const uint8_t *p, *endp, *srcp = (const uint8_t *)src;
AVBPrint dstbuf;
-+ AVBPrint bp_invalid_seq;
++ AVBPrint invalid_seq;
int invalid_chars_nb = 0, ret = 0;
+ *dstp = NULL;
av_bprint_init(&dstbuf, 0, AV_BPRINT_SIZE_UNLIMITED);
-+ av_bprint_init(&bp_invalid_seq, 0, AV_BPRINT_SIZE_UNLIMITED);
++ av_bprint_init(&invalid_seq, 0, AV_BPRINT_SIZE_UNLIMITED);
- endp = src + strlen(src);
- for (p = src; *p;) {
@@ fftools/textformat/avtextformat.c: void avtext_print_integer(AVTextFormatContext
- av_log(tctx, AV_LOG_DEBUG,
- "Invalid UTF-8 sequence %s found in string '%s'\n", bp.str, src);
+
-+ av_bprint_clear(&bp_invalid_seq);
++ av_bprint_clear(&invalid_seq);
+
-+ bprint_bytes(&bp_invalid_seq, p0, p - p0);
++ bprint_bytes(&invalid_seq, p0, p - p0);
+
-+ av_log(tctx, AV_LOG_DEBUG, "Invalid UTF-8 sequence %s found in string '%s'\n", bp_invalid_seq.str, src);
++ av_log(tctx, AV_LOG_DEBUG, "Invalid UTF-8 sequence '%s' found in string '%s'\n", invalid_seq.str, src);
invalid = 1;
}
@@ fftools/textformat/avtextformat.c: static inline int validate_string(AVTextForma
end:
av_bprint_finalize(&dstbuf, dstp);
-+ av_bprint_finalize(&bp_invalid_seq, NULL);
++ av_bprint_finalize(&invalid_seq, NULL);
return ret;
}
6: 3aa16bc39f ! 6: 4c0452cff7 fftools/textformat: Introduce AVTextFormatOptions for avtext_context_open()
@@ fftools/textformat/avtextformat.c: int avtext_context_open(AVTextFormatContext *
if (nb_sections > SECTION_MAX_NB_SECTIONS) {
av_log(tctx, AV_LOG_ERROR, "The number of section definitions (%d) is larger than the maximum allowed (%d)\n", nb_sections, SECTION_MAX_NB_SECTIONS);
-@@ fftools/textformat/avtextformat.c: int avtext_context_open(AVTextFormatContext **ptctx, const AVTextFormatter *form
- av_dict_free(&opts);
- }
-
-- if (show_data_hash)
-+ if (show_data_hash) {
- if ((ret = av_hash_alloc(&tctx->hash, show_data_hash)) < 0) {
- if (ret == AVERROR(EINVAL)) {
- const char *n;
-@@ fftools/textformat/avtextformat.c: int avtext_context_open(AVTextFormatContext **ptctx, const AVTextFormatter *form
- }
- goto fail;
- }
-+ }
-
- /* validate replace string */
- {
## fftools/textformat/avtextformat.h ##
@@ fftools/textformat/avtextformat.h: struct AVTextFormatContext {
7: 10c5e71cd1 = 7: dfbcbfaef9 fftools/textformat: Introduce common header and deduplicate code
8: 4c1471f65c = 8: 43189acea0 fftools/tf_internal: Use av_default_item_name
9: 7d28b0f03c = 9: 4d4748bb4c fftools/textformat: Add flags param to function avtext_print_integer()
10: a0d38f429a = 10: 493ed24e9e fftools/ffmpeg_filter: Move some declaration to new header file
11: 53db985728 = 11: 997d93b0b4 avfilter/avfilter: Add avfilter_link_get_hw_frames_ctx()
12: 2405f535bf = 12: ed92ac7577 fftools/resources: Add resource manager files with build-time compression
13: a7576bbbfc = 13: 32887c68e8 fftools/ffmpeg_mux: Make ms_from_ost() inline
14: 1bdd305940 = 14: 2ba841ad80 fftools/graphprint: Add execution graph printing
15: 4e04962fb4 = 15: f1cfa5fc2a fftools/graphprint: Now, make it a Killer-Feature!
--
ffmpeg-codebot
More information about the ffmpeg-devel
mailing list