[FFmpeg-devel] [PATCH v10 00/15] Execution Graph Printing
ffmpegagent
ffmpegagent at gmail.com
Sun May 4 05:57:11 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)
.
softworkz (15):
fftools/textformat: 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 | 242 +++---
fftools/textformat/avtextformat.h | 78 +-
fftools/textformat/avtextwriters.h | 16 +-
fftools/textformat/tf_compact.c | 121 +--
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, 3729 insertions(+), 581 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: 33d0d1c672e8d21f625eeea42444a018dbc616bb
Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-66%2Fsoftworkz%2Fsubmit_print_execution_graph-v10
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-66/softworkz/submit_print_execution_graph-v10
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/66
Range-diff vs v9:
1: 7e8fddd1b8 = 1: 7e8fddd1b8 fftools/textformat: Formatting and whitespace changes
2: 86ea1c4df5 = 2: 86ea1c4df5 fftools/textformat: Apply quality improvements
3: 455c13c6ff = 3: 455c13c6ff fftools/textformat: Remove unused print_rational() pointer from AVTextFormatter
4: 624ac50f29 = 4: 624ac50f29 fftools/textformat: Rename name param to key for API consistency
5: 26af65e6f2 = 5: 26af65e6f2 fftools/avtextformat: Re-use BPrint in loop
6: 3aa16bc39f = 6: 3aa16bc39f fftools/textformat: Introduce AVTextFormatOptions for avtext_context_open()
7: 10c5e71cd1 = 7: 10c5e71cd1 fftools/textformat: Introduce common header and deduplicate code
8: 4c1471f65c = 8: 4c1471f65c fftools/tf_internal: Use av_default_item_name
9: 7d28b0f03c = 9: 7d28b0f03c fftools/textformat: Add flags param to function avtext_print_integer()
10: a0d38f429a = 10: a0d38f429a fftools/ffmpeg_filter: Move some declaration to new header file
11: 53db985728 = 11: 53db985728 avfilter/avfilter: Add avfilter_link_get_hw_frames_ctx()
12: abc273dd0a ! 12: 2405f535bf fftools/resources: Add resource manager files with build-time compression
@@ fftools/resources/resman.c (new)
+#endif
+
+#include "resman.h"
-+#include <libavformat/url.h>
+#include "fftools/ffmpeg_filter.h"
+#include "libavutil/avassert.h"
+#include "libavutil/pixdesc.h"
13: 690752591e = 13: a7576bbbfc fftools/ffmpeg_mux: Make ms_from_ost() inline
14: adbf4840ef ! 14: 1bdd305940 fftools/graphprint: Add execution graph printing
@@ fftools/graph/graphprint.c (new)
+
+#include "graphprint.h"
+
-+#include <libavformat/url.h>
-+
+#include "fftools/ffmpeg_filter.h"
+#include "fftools/ffmpeg_mux.h"
+
@@ fftools/graph/graphprint.c (new)
+
+static char *get_extension(const char *url)
+{
-+ const char *ext;
-+ URLComponents uc;
-+ int ret;
-+ char scratchpad[128];
++ const char *dot = NULL;
++ const char *sep = NULL;
++ const char *end;
+
+ if (!url)
-+ return 0;
-+
-+ ret = ff_url_decompose(&uc, url, NULL);
-+ if (ret < 0)
+ return NULL;
-+ for (ext = uc.query; *ext != '.' && ext > uc.path; ext--) {
++
++ /* Stop at the first query ('?') or fragment ('#') delimiter so they
++ * are not considered part of the path. */
++ end = strpbrk(url, "?#");
++ if (!end)
++ end = url + strlen(url);
++
++ /* Scan the path component only. */
++ for (const char *p = url; p < end; p++) {
++ if (*p == '.')
++ dot = p;
++ else if (*p == '/' || *p == '\\')
++ sep = p;
+ }
+
-+ if (*ext != '.')
-+ return 0;
-+ if (uc.query - ext > sizeof(scratchpad))
-+ return NULL; //not enough memory in our scratchpad
-+ av_strlcpy(scratchpad, ext + 1, uc.query - ext);
++ /* Validate that we have a proper extension. */
++ if (dot && dot != url && (!sep || dot > sep + 1) && (dot + 1) < end) {
++ /* Use FFmpeg helper to duplicate the substring. */
++ return av_strndup(dot + 1, end - (dot + 1));
++ }
+
-+ return av_strdup(scratchpad);
++ return NULL;
+}
+
+static void print_hwdevicecontext(const GraphPrintContext *gpc, const AVHWDeviceContext *hw_device_context)
15: b4ca4db8fd ! 15: 6d7ec02265 fftools/graphprint: Now, make it a Killer-Feature!
@@ Metadata
## Commit message ##
fftools/graphprint: Now, make it a Killer-Feature!
- remember this: -sg <= show-graph
+ remember this: -sg <= means Show Graph
Signed-off-by: softworkz <softworkz at hotmail.com>
--
ffmpeg-codebot
More information about the ffmpeg-devel
mailing list