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 EA8B44C30B for ; Sat, 8 Mar 2025 17:55:45 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 04A3868E683; Sat, 8 Mar 2025 19:55:44 +0200 (EET) Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2A07E68DCEF for ; Sat, 8 Mar 2025 19:55:42 +0200 (EET) Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-2239c066347so51612315ad.2 for ; Sat, 08 Mar 2025 09:55:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741456541; x=1742061341; 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=Kf/DGxMzZo63oh9mebTAgdnpEJP54opclMPdzz7nPIk=; b=mrbM1C6z14w33sWBiWcWYBg9FkQbznNep/24stfbXgBuJ+ReQlKazGlh7Sst0Bwtjn 8w4bDNAP+Oh0BGGM96/ooojj+uE5C0VH0vDFzDw/LwX6vRsIGQiT2ivJyP8p5c/RqpL6 TOSNCyW/IfBwfjCQQLGN0QVKy6W9iWiLQ7V7klw5ZIxUIMrVHBU5ZZV7say1WGy+xljI 2o5he4MXSV23ZavYXNhIGh4GNwYgsOlpGNtQydnTSfV10LkuW5ZQeyO4CfBrti7BSq+C 4swHjX/d+HtlWCVpFa5OxxPwvDjvsF/15Kte/9Fp6RK7UV+342Tw405d1mYqVtYG/tRh AUlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741456541; x=1742061341; 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=Kf/DGxMzZo63oh9mebTAgdnpEJP54opclMPdzz7nPIk=; b=hq3Uioo3MTkN7MWO0zHVFhknYEAez6waBfqfM6e3fzAbvKBVP7R8fg0RY5/BY6x4ng YRI9gCwoRJVxMa9lzu+V8SdQ+9k5atRTDFQGXNHgV4ItGgIuzygglwkHi+gpk/Ntq4Tf e5Y9cZMkP4bdbjNssjRs5dBQ1jPODiz4sg+4JbH8Y5fTM49i2PLOhXyzbGBIBsP2OjhF 1qUKIf7r+Lol82pLJvxSIflfzG330lRjJJ/VifqAzRwCLkJ7+5OTiZvAk461kRBDyS7k FghPSUdTQ22/ozk2/r78fjzjSfMMXJXBHdlD9nxTYVSgYcZ5vxcxOZuqULeUUJkYkUpv nYUg== X-Gm-Message-State: AOJu0Yx94BNimKsESXhLmdCMyjMCrJ/OSGNP+g9lKR2ksl5uXIo8byO/ Iqhr3w7bNEwQOhlQlxSYNMRWqZphxnbGbtmUbt0Q1SBqYmK/Mi2gr12P4A== X-Gm-Gg: ASbGncs3m+UfZ1R6t2XmsjQDZfyQgCXolwANRQHXZsVyMnbg8xlrbMhtIKDD+1pvm9c NgpCJ3xAhXvdIJL9cgcjnQocDvZ7ErccHiHRTOEOZnMeTxAYwIxD2o+G6Gz/Ev0yv6rDHxv0pTl wOnFkvyVRDxwvhn95yx6iF7O3ERI2+/H7MIvvAl2I/hNUdk3XFhODhPXd/StJ5gpkBZZpvK7Cp4 TsZpVjtON+xHWAutPjNU453Sl9eh8dFoZtQF0gCufbzWEqg3R5NfS11h1MNiK4OY9Lh4Zu5zk7k dSZ+3BrTuiE8NbhPxmFv+N3W154Kpy4WXgJgzTyeAjYhxxg/rLagLgdWyZnKteQ= X-Google-Smtp-Source: AGHT+IEQnThdj0GVcWCR5TCfGMfevGgdYo2FspHCfltZ8jVJgrC66FeMWwfaqZArEXoDeMzhCI0ExQ== X-Received: by 2002:a05:6a20:ac43:b0:1f5:63f9:9ea1 with SMTP id adf61e73a8af0-1f563f9a1a8mr2776723637.13.1741456541143; Sat, 08 Mar 2025 09:55:41 -0800 (PST) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af51c54c099sm1003749a12.44.2025.03.08.09.55.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 08 Mar 2025 09:55:40 -0800 (PST) Message-Id: In-Reply-To: References: From: ffmpegagent Date: Sat, 08 Mar 2025 17:55:27 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v5 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' 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 => tc) 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-v5 Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-52/softworkz/submit_print_graphs5-v5 Pull-Request: https://github.com/ffstaging/FFmpeg/pull/52 Range-diff vs v4: 1: 55bfc6c6a6 ! 1: b26a45ea0e fftools/textformat: Extract and generalize textformat api from ffprobe.c @@ Commit message ## fftools/textformat/avtextformat.c (new) ## @@ +/* -+ * Copyright (c) The ffmpeg developers ++ * Copyright (c) The FFmpeg developers + * + * This file is part of FFmpeg. + * @@ fftools/textformat/avtextformat.c (new) + { 1.125899906842624e15, 1e15, "Pi", "P" }, +}; + -+static const char *avtext_context_get_formatter_name(void *p) ++static const char *textcontext_get_formatter_name(void *p) +{ + AVTextFormatContext *tctx = p; + return tctx->formatter->name; @@ fftools/textformat/avtextformat.c (new) + { NULL } +}; + -+static void *trextcontext_child_next(void *obj, void *prev) ++static void *textcontext_child_next(void *obj, void *prev) +{ + AVTextFormatContext *ctx = obj; + if (!prev && ctx->formatter && ctx->formatter->priv_class && ctx->priv) @@ fftools/textformat/avtextformat.c (new) + +static const AVClass textcontext_class = { + .class_name = "AVTextContext", -+ .item_name = avtext_context_get_formatter_name, ++ .item_name = textcontext_get_formatter_name, + .option = textcontext_options, + .version = LIBAVUTIL_VERSION_INT, -+ .child_next = trextcontext_child_next, ++ .child_next = textcontext_child_next, +}; + +static void bprint_bytes(AVBPrint *bp, const uint8_t *ubuf, size_t ubuf_size) @@ fftools/textformat/avtextformat.c (new) + int ret = 0; + + if (!tctx) -+ return -1; ++ return EINVAL; + + av_hash_freep(&tctx->hash); + @@ fftools/textformat/avtextformat.c (new) + + 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); ++ ret = AVERROR(EINVAL); + goto fail; + } + @@ fftools/textformat/avtextformat.c (new) + av_bprint_finalize(&bp, NULL); +} + -+static const char *avtextwriter_context_get_writer_name(void *p) ++static const char *writercontext_get_writer_name(void *p) +{ + AVTextWriterContext *wctx = p; + return wctx->writer->name; @@ fftools/textformat/avtextformat.c (new) + +static const AVClass textwriter_class = { + .class_name = "AVTextWriterContext", -+ .item_name = avtextwriter_context_get_writer_name, ++ .item_name = writercontext_get_writer_name, + .version = LIBAVUTIL_VERSION_INT, + .child_next = writercontext_child_next, +}; @@ fftools/textformat/avtextformat.c (new) + int ret = 0; + + if (!wctx) -+ return -1; ++ return EINVAL; + + if (wctx->writer->uninit) + wctx->writer->uninit(wctx); @@ fftools/textformat/avtextformat.c (new) ## fftools/textformat/avtextformat.h (new) ## @@ +/* -+ * Copyright (c) The ffmpeg developers ++ * Copyright (c) The FFmpeg developers + * + * This file is part of FFmpeg. + * @@ fftools/textformat/avtextformat.h (new) +#define AV_TEXTFORMAT_PRINT_STRING_OPTIONAL 1 +#define AV_TEXTFORMAT_PRINT_STRING_VALIDATE 2 + -+int avtext_context_open(AVTextFormatContext **ptctx, const AVTextFormatter *formatter, AVTextWriterContext *writer, const char *args, ++int avtext_context_open(AVTextFormatContext **ptctx, const AVTextFormatter *formatter, AVTextWriterContext *writer_context, const char *args, + const struct AVTextFormatSection *sections, int nb_sections, + int show_value_unit, + int use_value_prefix, @@ fftools/textformat/avtextformat.h (new) ## fftools/textformat/avtextwriters.h (new) ## @@ +/* -+ * Copyright (c) The ffmpeg developers ++ * Copyright (c) The FFmpeg developers + * + * This file is part of FFmpeg. + * @@ fftools/textformat/avtextwriters.h (new) ## fftools/textformat/tf_compact.c (new) ## @@ +/* -+ * Copyright (c) The ffmpeg developers ++ * Copyright (c) The FFmpeg developers + * + * This file is part of FFmpeg. + * @@ fftools/textformat/tf_compact.c (new) ## fftools/textformat/tf_default.c (new) ## @@ +/* -+ * Copyright (c) The ffmpeg developers ++ * Copyright (c) The FFmpeg developers + * + * This file is part of FFmpeg. + * @@ fftools/textformat/tf_default.c (new) ## fftools/textformat/tf_flat.c (new) ## @@ +/* -+ * Copyright (c) The ffmpeg developers ++ * Copyright (c) The FFmpeg developers + * + * This file is part of FFmpeg. + * @@ fftools/textformat/tf_flat.c (new) ## fftools/textformat/tf_ini.c (new) ## @@ +/* -+ * Copyright (c) The ffmpeg developers ++ * Copyright (c) The FFmpeg developers + * + * This file is part of FFmpeg. + * @@ fftools/textformat/tf_ini.c (new) ## fftools/textformat/tf_json.c (new) ## @@ +/* -+ * Copyright (c) The ffmpeg developers ++ * Copyright (c) The FFmpeg developers + * + * This file is part of FFmpeg. + * @@ fftools/textformat/tf_json.c (new) ## fftools/textformat/tf_xml.c (new) ## @@ +/* -+ * Copyright (c) The ffmpeg developers ++ * Copyright (c) The FFmpeg developers + * + * This file is part of FFmpeg. + * @@ fftools/textformat/tf_xml.c (new) ## fftools/textformat/tw_avio.c (new) ## @@ +/* -+ * Copyright (c) The ffmpeg developers ++ * Copyright (c) The FFmpeg developers + * + * This file is part of FFmpeg. + * @@ fftools/textformat/tw_avio.c (new) ## fftools/textformat/tw_buffer.c (new) ## @@ +/* -+ * Copyright (c) The ffmpeg developers ++ * Copyright (c) The FFmpeg developers + * + * This file is part of FFmpeg. + * @@ fftools/textformat/tw_buffer.c (new) ## fftools/textformat/tw_stdout.c (new) ## @@ +/* -+ * Copyright (c) The ffmpeg developers ++ * Copyright (c) The FFmpeg developers + * + * This file is part of FFmpeg. + * 2: 1950903610 = 2: 2eb2b4ded5 fftools/ffprobe: Change to use textformat api 3: 01cc022c3b = 3: 5ab9ac2a28 fftools/ffprobe: Rename writer_print_section_* and WriterContext 4: aed98ad79d = 4: 85735035e4 fftools/ffmpeg_filter: Move some declaration to new header file 5: 4b8d7ee51b = 5: 811c5ab35c avfilter/avfilter: Add avfilter_link_get_hw_frames_ctx() 6: f43eb56f39 = 6: 8ae08a7006 fftools/ffmpeg_graphprint: Add options for filtergraph printing 7: c0cf4adcd9 = 7: 03663768dd fftools: Enable filtergraph printing and update docs -: ---------- > 8: 61dc171fa1 fftools/ffprobe: Rename AVTextFormatContext variables (w => tc) -- 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".