From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 7D8E14E154 for ; Sat, 8 Mar 2025 20:16:52 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1DB8768E64E; Sat, 8 Mar 2025 22:16:48 +0200 (EET) Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E18C068DD72 for ; Sat, 8 Mar 2025 22:16:41 +0200 (EET) Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-2234e4b079cso52907535ad.1 for ; Sat, 08 Mar 2025 12:16:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741465000; x=1742069800; darn=ffmpeg.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=nYWH9o+wrpufeLMpww7tVeVe6JKrXxW1EynxBnkY0Dw=; b=InkzK8l3b6OQdR2BlHm4wn8sXDpwQ5DR/c+Yl0xa0wMjhIWDV2TTmpfsq3aDouKg42 JK8vlYLLaM8qhxHQTPr/gPBX0Fi8cpOtrkMZGg0SJGlTGnySQKNSkcfVjcgIh+UOUzSC lmR45ux27K8ST9HPhQLQ8opW6OvC4Nwzqkz/t8TDVezyVRE9d1hvUOF4fZkYnJMznluu MODRYqo+K+9XCA9YfiTmHdn8LVSn+bJaHPwUP3kzZCMIWigQVVZ1Ay1PR2DivKFAJFpv h+i0muaxJuuk9+7usIkROX+ixIvq+FsZkI699ssS/H7QcyGaFqJJOvhWi+a44b4fxuvf pmUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741465000; x=1742069800; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nYWH9o+wrpufeLMpww7tVeVe6JKrXxW1EynxBnkY0Dw=; b=sXIRjVlK20FhpT8qfBWghoUqETm4nYGR7Qd5idvpTrY9bzewHK73wITA5bdgjL6Hw8 GrJDjTtmyzdrYFn2crfTcTNjjxdQugRYX1qRfNAN2ica96V+i4a7Esy2dpPb9Jf3KSf5 AklzKcYKE1NbppKQffuYPoc47GtwdNwqqDrcndIQiPNaAXlG7ASwpIfvCtolxbgm2nAp BsRsts7VonCmeMIR4Pqhyq9CyQ61RwiqcfIopU8qkmhXQVJCH4qvse0DhlswKqjRl+rU RBoJqD9bYwQ4xeiy6gbKErQNoaGzM2IO76Kow3GSYfaqhfRqGitCfEiDo3ADihWoxhdZ 8Kqw== X-Gm-Message-State: AOJu0YwV7A4M1gCu2QWfHdy727xgI02qAj1N6+FzB1ziQsjQg6zkXiqU RzbVkJxkNf6jLIXDNSafDC3W5J7OdNOKiJU7pQGjO95YokKDNVqw7/31dOSZ X-Gm-Gg: ASbGnctMAoEkrxQkWyB422IAWBbmCqS/wkv9IYl8Fl05FkM/OzWPuTM8MfO6xVA0BhD N7i1y6liV44mjtHdmMoO3dSn7RXlBia1SZexnCeh58aH6MnVy3PlbcWnqfOD3ezEwY0CnDKrKwP SOGgbAzaXRJBsALKRLZeZ9wtnEcnDdfDweKd/DXE7P3uH8H/81FEt6017/7tbW0GS2wdfgyM/6H MTi4cQP0rSGMlF2zEdsw+cBWfpwq+bCOh2undA0f+BmOsW2NYb05b8xMEwtcsQ/1daxDxLDIGGB /USZGXv3xdKDmIw9PiSud1XPN8XAQGBfUhqUNrF4NyKnOmL8+vqbdUJ5GacWCQA= X-Google-Smtp-Source: AGHT+IHGi3TeN8H6P638J8RMjFulLh5QpTVOdtBhHH9Uu9hw77YvQDuBQTFnqxSvXZB+OzULQXkbUg== X-Received: by 2002:a17:903:40cb:b0:21f:61a9:be7d with SMTP id d9443c01a7336-22428c0d519mr135625435ad.49.1741464999911; Sat, 08 Mar 2025 12:16:39 -0800 (PST) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-736af3a69b2sm3417491b3a.6.2025.03.08.12.16.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 08 Mar 2025 12:16:39 -0800 (PST) Message-Id: In-Reply-To: References: From: ffmpegagent Date: Sat, 08 Mar 2025 20:16:26 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v6 0/8] print_graphs: Complete Filtergraph Printing X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: softworkz Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: This new version of the patchset starts by extracting the text formatting and writing APIs from ffprobe.c into a subfolder under fftools. The type naming follows public API naming style, ramping up for making it a public API in the future without another big renaming. The extraction of the text formatting APIs can be followed in smaller steps in the recent patchset "[RFC] avtextformat: Transform text writing into an independent API". To make this more review-friendly, the ffprobe changes are done in two steps. The 2nd commit includes all essential changes while the large part of renamings is deferred to the 3rd commit (containing renamings only). The graph-printing uses the extracted APIs. It supports all ffprobe output formats now. Otherwise it's functional equivalent to the previous version: * Different to other graph printing methods, this is outputting: * both, simple and complex filtergraphs * all graphs with runtime state (including auto-inserted filters) * each graph with its inputs and outputs * all filters with their in- and output pads * all connections between all input- and output pads * for each connection: * the runtime-negotiated format and media type * the hw context * if video hw context, both: hw pixfmt + sw pixfmt * Output can either be printed to stdout or written to specified file * Output is machine-readable Right after filtergraph configuration, the connection details are often not complete yet. On the other side, when waiting too long or if an error occurs somewhere, the graph info might never be printed. Experience has shown, that the most suitable and realiable point in time for printing graph information is right before cleanup. Due to the changes for multi-threading, this is no longer doable as easy as before, so the following method is used: Each filtergraph initiates its own graph printing short before cleanup into a buffer. Before final cleanup in ffmpeg.c, the outputs from the individual graphs are pieced together for the actual output to file or console. (the structure according to the output format remains valid) Example output: https://gist.github.com/softworkz/2a9e8699b288f5d40fa381c2a496e165 Update V2 * Change NULL checks to match common code style * Add Add avfilter_link_get_hw_frames_ctx() function to avoid importing filters.h * Do the same without including avfilter/filters.h (as per note from Andreas Reinhardt) Update V3 * Includes extraction and generalization of the text formatting APIs * All output formats supported now Update V4 * Fix "new warnings" were generated * Fix missing colon in commit message * Rebase due to changesin ApiChanges Update V5 * Fix copyright headers * Return proper error codes rather than -1 * Fix misnamed local functions * Fix typo * Rename 'w' in ffprobe.c to 'tfc' Update V6 * Fix commit message (8) * Revert renaming of context in main() softworkz (8): fftools/textformat: Extract and generalize textformat api from ffprobe.c fftools/ffprobe: Change to use textformat api fftools/ffprobe: Rename writer_print_section_* and WriterContext fftools/ffmpeg_filter: Move some declaration to new header file avfilter/avfilter: Add avfilter_link_get_hw_frames_ctx() fftools/ffmpeg_graphprint: Add options for filtergraph printing fftools: Enable filtergraph printing and update docs fftools/ffprobe: Rename AVTextFormatContext variables (w => tfc) doc/APIchanges | 3 + doc/ffmpeg.texi | 10 + fftools/Makefile | 23 + fftools/ffmpeg.c | 4 + fftools/ffmpeg.h | 3 + fftools/ffmpeg_filter.c | 193 +-- fftools/ffmpeg_filter.h | 232 +++ fftools/ffmpeg_graphprint.c | 518 +++++++ fftools/ffmpeg_graphprint.h | 35 + fftools/ffmpeg_opt.c | 12 + fftools/ffprobe.c | 2296 +++++----------------------- fftools/textformat/avtextformat.c | 672 ++++++++ fftools/textformat/avtextformat.h | 171 +++ fftools/textformat/avtextwriters.h | 68 + fftools/textformat/tf_compact.c | 282 ++++ fftools/textformat/tf_default.c | 145 ++ fftools/textformat/tf_flat.c | 174 +++ fftools/textformat/tf_ini.c | 160 ++ fftools/textformat/tf_json.c | 215 +++ fftools/textformat/tf_xml.c | 221 +++ fftools/textformat/tw_avio.c | 129 ++ fftools/textformat/tw_buffer.c | 92 ++ fftools/textformat/tw_stdout.c | 82 + libavfilter/avfilter.c | 9 + libavfilter/avfilter.h | 12 + libavfilter/version.h | 2 +- 26 files changed, 3630 insertions(+), 2133 deletions(-) create mode 100644 fftools/ffmpeg_filter.h create mode 100644 fftools/ffmpeg_graphprint.c create mode 100644 fftools/ffmpeg_graphprint.h create mode 100644 fftools/textformat/avtextformat.c create mode 100644 fftools/textformat/avtextformat.h create mode 100644 fftools/textformat/avtextwriters.h create mode 100644 fftools/textformat/tf_compact.c create mode 100644 fftools/textformat/tf_default.c create mode 100644 fftools/textformat/tf_flat.c create mode 100644 fftools/textformat/tf_ini.c create mode 100644 fftools/textformat/tf_json.c create mode 100644 fftools/textformat/tf_xml.c create mode 100644 fftools/textformat/tw_avio.c create mode 100644 fftools/textformat/tw_buffer.c create mode 100644 fftools/textformat/tw_stdout.c base-commit: 0245e9382c748eba91645b65a377c4c9c4a44849 Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-52%2Fsoftworkz%2Fsubmit_print_graphs5-v6 Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-52/softworkz/submit_print_graphs5-v6 Pull-Request: https://github.com/ffstaging/FFmpeg/pull/52 Range-diff vs v5: 1: b26a45ea0e = 1: b26a45ea0e fftools/textformat: Extract and generalize textformat api from ffprobe.c 2: 2eb2b4ded5 = 2: 2eb2b4ded5 fftools/ffprobe: Change to use textformat api 3: 5ab9ac2a28 = 3: 5ab9ac2a28 fftools/ffprobe: Rename writer_print_section_* and WriterContext 4: 85735035e4 = 4: 85735035e4 fftools/ffmpeg_filter: Move some declaration to new header file 5: 811c5ab35c = 5: 811c5ab35c avfilter/avfilter: Add avfilter_link_get_hw_frames_ctx() 6: 8ae08a7006 = 6: 8ae08a7006 fftools/ffmpeg_graphprint: Add options for filtergraph printing 7: 03663768dd = 7: 03663768dd fftools: Enable filtergraph printing and update docs 8: 61dc171fa1 ! 8: 0caab91adc fftools/ffprobe: Rename AVTextFormatContext variables (w => tc) @@ Metadata Author: softworkz ## Commit message ## - fftools/ffprobe: Rename AVTextFormatContext variables (w => tc) + fftools/ffprobe: Rename AVTextFormatContext variables (w => tfc) Signed-off-by: softworkz @@ fftools/ffprobe.c: static void ffprobe_show_pixel_formats(AVTextFormatContext *w } static int opt_show_optional_fields(void *optctx, const char *opt, const char *arg) -@@ fftools/ffprobe.c: static inline int check_section_show_entries(int section_id) - int main(int argc, char **argv) - { - const AVTextFormatter *f; -- AVTextFormatContext *tctx; -+ AVTextFormatContext *tfc; - AVTextWriterContext *wctx; - char *buf; - char *f_name = NULL, *f_args = NULL; -@@ fftools/ffprobe.c: int main(int argc, char **argv) - if (ret < 0) - goto end; - -- if ((ret = avtext_context_open(&tctx, f, wctx, f_args, -+ if ((ret = avtext_context_open(&tfc, f, wctx, f_args, - sections, FF_ARRAY_ELEMS(sections), show_value_unit, - use_value_prefix, use_byte_value_binary_prefix, use_value_sexagesimal_format, - show_optional_fields, show_data_hash)) >= 0) { - if (f == &avtextformatter_xml) -- tctx->string_validation_utf8_flags |= AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES; -+ tfc->string_validation_utf8_flags |= AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES; - -- avtext_print_section_header(tctx, NULL, SECTION_ID_ROOT); -+ avtext_print_section_header(tfc, NULL, SECTION_ID_ROOT); - - if (do_show_program_version) -- ffprobe_show_program_version(tctx); -+ ffprobe_show_program_version(tfc); - if (do_show_library_versions) -- ffprobe_show_library_versions(tctx); -+ ffprobe_show_library_versions(tfc); - if (do_show_pixel_formats) -- ffprobe_show_pixel_formats(tctx); -+ ffprobe_show_pixel_formats(tfc); - - if (!input_filename && - ((do_show_format || do_show_programs || do_show_stream_groups || do_show_streams || do_show_chapters || do_show_packets || do_show_error) || -@@ fftools/ffprobe.c: int main(int argc, char **argv) - av_log(NULL, AV_LOG_ERROR, "Use -h to get full help or, even better, run 'man %s'.\n", program_name); - ret = AVERROR(EINVAL); - } else if (input_filename) { -- ret = probe_file(tctx, input_filename, print_input_filename); -+ ret = probe_file(tfc, input_filename, print_input_filename); - if (ret < 0 && do_show_error) -- show_error(tctx, ret); -+ show_error(tfc, ret); - } - - input_ret = ret; - -- avtext_print_section_footer(tctx); -+ avtext_print_section_footer(tfc); - - ret = avtextwriter_context_close(&wctx); - if (ret < 0) - av_log(NULL, AV_LOG_ERROR, "Writing output failed (closing writer): %s\n", av_err2str(ret)); - -- ret = avtext_context_close(&tctx); -+ ret = avtext_context_close(&tfc); - if (ret < 0) - av_log(NULL, AV_LOG_ERROR, "Writing output failed (closing formatter): %s\n", av_err2str(ret)); - -- 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".