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) . 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 | 1148 ++++++++++++++++++++++++++++ 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 | 232 ++++++ 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, 3725 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-v9 Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-66/softworkz/submit_print_execution_graph-v9 Pull-Request: https://github.com/ffstaging/FFmpeg/pull/66 Range-diff vs v8: 1: ad156d4853 = 1: 7e8fddd1b8 fftools/textformat: Formatting and whitespace changes 2: fd59be673d = 2: 86ea1c4df5 fftools/textformat: Apply quality improvements 3: 4727f424d3 = 3: 455c13c6ff fftools/textformat: Remove unused print_rational() pointer from AVTextFormatter 4: 43d00310c4 = 4: 624ac50f29 fftools/textformat: Rename name param to key for API consistency 5: 606fa7866a = 5: 26af65e6f2 fftools/avtextformat: Re-use BPrint in loop 6: 95ef1f0919 = 6: 3aa16bc39f fftools/textformat: Introduce AVTextFormatOptions for avtext_context_open() 7: dafd10253d = 7: 10c5e71cd1 fftools/textformat: Introduce common header and deduplicate code 8: a4b1fb9cc0 = 8: 4c1471f65c fftools/tf_internal: Use av_default_item_name 9: a18ccba001 = 9: 7d28b0f03c fftools/textformat: Add flags param to function avtext_print_integer() 10: 456423f436 = 10: a0d38f429a fftools/ffmpeg_filter: Move some declaration to new header file 11: 07c0d5b09b = 11: 53db985728 avfilter/avfilter: Add avfilter_link_get_hw_frames_ctx() 12: 249899886e ! 12: abc273dd0a fftools/resources: Add resource manager files @@ Metadata Author: softworkz <softwo...@hotmail.com> ## Commit message ## - fftools/resources: Add resource manager files + fftools/resources: Add resource manager files with build-time compression + + Compression requires zlib to be available, otherwise resources will + be included uncompressed - in either case via BIN2C. + + It can also be disabled via + + ./configure --disable-resource-compression + + Size figures: + + graph.css 7752 + graph.css.min 6655 (css is always minified) + graph.html 2153 + + No Compression + + graph.css.c 40026 + graph.css.o 9344 (6688) + graph.html.c 13016 + graph.html.o 4848 (2186) + + With Compression + + graph.css.c 10206 + graph.css.o 4368 (1718) + graph.html.c 5725 + graph.html.o 3632 (971) + + Numbers in brackets: .rodata size from 'size -Ax -d *.o' Signed-off-by: softworkz <softwo...@hotmail.com> + ## configure ## +@@ configure: Developer options (useful when working on FFmpeg itself): + --enable-macos-kperf enable macOS kperf (private) API + --disable-large-tests disable tests that use a large amount of memory + --disable-ptx-compression don't compress CUDA PTX code even when possible ++ --disable-resource-compression don't compress resources even when possible + --disable-version-tracking don't include the git/release version in the build + + NOTE: Object files are built at the place where configure is launched. +@@ configure: CONFIG_LIST=" + ossfuzz + pic + ptx_compression ++ resource_compression + thumb + valgrind_backtrace + xmm_clobber_test +@@ configure: enable iamf + enable large_tests + enable optimizations + enable ptx_compression ++enable resource_compression + enable runtime_cpudetect + enable safe_bitstream_reader + enable static +@@ configure: EOF + + enabled zlib_gzip && enabled gzip || disable ptx_compression + ++enabled zlib_gzip && enabled gzip || disable resource_compression ++ + # On some systems dynamic loading requires no extra linker flags + check_lib libdl dlfcn.h "dlopen dlsym" || check_lib libdl dlfcn.h "dlopen dlsym" -ldl + + ## ffbuild/common.mak ## @@ ffbuild/common.mak: else $(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst .,_,$(basename $(notdir $@))) @@ ffbuild/common.mak: else + | sed 's/^ //; s/ $$//' \ + > $@ + ++ifdef CONFIG_RESOURCE_COMPRESSION ++ +# 2) Gzip the minified CSS +%.css.min.gz: %.css.min -+ $(M)gzip -nc9 $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) >$@ ++ $(M)gzip -nc9 $< > $@ + +# 3) Convert the gzipped CSS to a .c array +%.css.c: %.css.min.gz $(BIN2CEXE) -+ $(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst .,_,$(basename $(notdir $@))) ++ $(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@))) + +# 4) Gzip the HTML file (no minification needed) -+%.html.gz: TAG = GZIP +%.html.gz: %.html -+ $(M)gzip -nc9 $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) > $@ ++ $(M)gzip -nc9 $< > $@ + +# 5) Convert the gzipped HTML to a .c array +%.html.c: %.html.gz $(BIN2CEXE) -+ $(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst .,_,$(basename $(notdir $@))) ++ $(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@))) ++ ++else # NO COMPRESSION ++ ++# 2) Convert the minified CSS to a .c array ++%.css.c: %.css.min $(BIN2CEXE) ++ $(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@))) ++ ++# 3) Convert the plain HTML to a .c array ++%.html.c: %.html $(BIN2CEXE) ++ $(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@))) ++endif + clean:: $(RM) $(BIN2CEXE) $(CLEANSUFFIXES:%=ffbuild/%) +@@ ffbuild/common.mak: SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-) + SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%) + HOBJS = $(filter-out $(SKIPHEADERS:.h=.h.o),$(ALLHEADERS:.h=.h.o)) + PTXOBJS = $(filter %.ptx.o,$(OBJS)) ++RESOURCEOBJS = $(filter %.css.o %.html.o,$(OBJS)) + $(HOBJS): CCFLAGS += $(CFLAGS_HEADERS) + checkheaders: $(HOBJS) +-.SECONDARY: $(HOBJS:.o=.c) $(PTXOBJS:.o=.c) $(PTXOBJS:.o=.gz) $(PTXOBJS:.o=) ++.SECONDARY: $(HOBJS:.o=.c) $(PTXOBJS:.o=.c) $(PTXOBJS:.o=.gz) $(PTXOBJS:.o=) $(RESOURCEOBJS:.o=.c) $(RESOURCEOBJS:%.css.o=%.css.min) $(RESOURCEOBJS:%.css.o=%.css.min.gz) $(RESOURCEOBJS:%.html.o=%.html.gz) $(RESOURCEOBJS:.o=) + + alltools: $(TOOLS) + @@ ffbuild/common.mak: $(TOOLOBJS): | tools OUTDIRS := $(OUTDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(SLIBOBJS) $(SHLIBOBJS) $(STLIBOBJS) $(TESTOBJS)) @@ fftools/resources/Makefile (new) +clean:: + $(RM) $(CLEANSUFFIXES:%=fftools/resources/%) + ++vpath %.html $(SRC_PATH) ++vpath %.css $(SRC_PATH) + -+HTML_RESOURCES := $(SRC_PATH)/fftools/resources/graph.html \ -+ -+# .html => (gzip) .html.gz => (bin2c) .html.c => (cc) .o -+HTML_RESOURCES_GZ := $(HTML_RESOURCES:.html=.html.gz) -+HTML_RESOURCES_C := $(HTML_RESOURCES_GZ:.html.gz=.html.c) -+HTML_RESOURCES_OBJS := $(HTML_RESOURCES_C:.c=.o) -+ -+CSS_RESOURCES := $(SRC_PATH)/fftools/resources/graph.css \ -+ -+# .css => (sh) .css.min => (gzip) .css.min.gz => (bin2c) .css.c => (cc) .o -+CSS_RESOURCES_MIN := $(CSS_RESOURCES:.css=.css.min) -+CSS_RESOURCES_GZ := $(CSS_RESOURCES_MIN:.css.min=.css.min.gz) -+CSS_RESOURCES_C := $(CSS_RESOURCES_GZ:.css.min.gz=.css.c) -+CSS_RESOURCES_OBJS := $(CSS_RESOURCES_C:.c=.o) -+ -+# Uncomment to prevent deletion ++# Uncomment to prevent deletion during build +#.PRECIOUS: %.css.c %.css.min %.css.gz %.css.min.gz %.html.gz %.html.c + -+OBJS-resman += \ -+ fftools/resources/resman.o \ -+ $(HTML_RESOURCES_OBJS) \ -+ $(CSS_RESOURCES_OBJS) \ -+ ++OBJS-resman += \ ++ fftools/resources/resman.o \ ++ fftools/resources/graph.html.o \ ++ fftools/resources/graph.css.o \ ## fftools/resources/graph.css (new) ## @@ @@ fftools/resources/resman.c (new) +#include "config.h" + +#include <string.h> ++ ++#if CONFIG_RESOURCE_COMPRESSION +#include <zlib.h> ++#endif ++ +#include "resman.h" +#include <libavformat/url.h> +#include "fftools/ffmpeg_filter.h" @@ fftools/resources/resman.c (new) +ResourceManagerContext *resman_ctx = NULL; + + ++#if CONFIG_RESOURCE_COMPRESSION ++ +static int decompress_gzip(ResourceManagerContext *ctx, uint8_t *in, unsigned in_len, char **out, size_t *out_len) +{ + z_stream strm; @@ fftools/resources/resman.c (new) + *out = (char *)buf; + return Z_OK; +} ++#endif + +static ResourceManagerContext *get_resman_context(void) +{ @@ fftools/resources/resman.c (new) + dic_entry = av_dict_get(ctx->resource_dic, resource_definition.name, NULL, 0); + + if (!dic_entry) { ++ int dict_ret; ++ ++#if CONFIG_RESOURCE_COMPRESSION ++ + char *out = NULL; + size_t out_len; -+ int dict_ret; + + int ret = decompress_gzip(ctx, (uint8_t *)resource_definition.data, *resource_definition.data_len, &out, &out_len); + @@ fftools/resources/resman.c (new) + } + + av_freep(&out); ++#else ++ ++ dict_ret = av_dict_set(&ctx->resource_dic, resource_definition.name, (const char *)resource_definition.data, 0); ++ if (dict_ret < 0) { ++ av_log(NULL, AV_LOG_ERROR, "Failed to store resource in dictionary: %d\n", dict_ret); ++ goto end; ++ } ++ ++#endif + dic_entry = av_dict_get(ctx->resource_dic, resource_definition.name, NULL, 0); + + if (!dic_entry) { 13: 58c7b1c142 = 13: 690752591e fftools/ffmpeg_mux: Make ms_from_ost() inline 14: 3a090c9e60 = 14: adbf4840ef fftools/graphprint: Add execution graph printing 15: 578373f8c2 = 15: b4ca4db8fd fftools/graphprint: Now, make it a Killer-Feature! -- 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-requ...@ffmpeg.org with subject "unsubscribe".