Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: ffmpegagent <ffmpegagent@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Cc: softworkz <softworkz@hotmail.com>
Subject: [FFmpeg-devel] [PATCH v6 0/8] print_graphs: Complete Filtergraph Printing
Date: Sat, 08 Mar 2025 20:16:26 +0000
Message-ID: <pull.52.v6.ffstaging.FFmpeg.1741464994.ffmpegagent@gmail.com> (raw)
In-Reply-To: <pull.52.v5.ffstaging.FFmpeg.1741456535.ffmpegagent@gmail.com>

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 <softworkz@hotmail.com>
      
       ## Commit message ##
     -    fftools/ffprobe: Rename AVTextFormatContext variables (w => tc)
     +    fftools/ffprobe: Rename AVTextFormatContext variables (w => tfc)
      
          Signed-off-by: softworkz <softworkz@hotmail.com>
      
     @@ 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".

  parent reply	other threads:[~2025-03-08 20:16 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-19  9:59 [FFmpeg-devel] [PATCH 0/3] " ffmpegagent
2025-02-19  9:59 ` [FFmpeg-devel] [PATCH 1/3] fftools/ffmpeg_filter: Move some declaration to new header file softworkz
2025-02-19  9:59 ` [FFmpeg-devel] [PATCH 2/3] fftools/ffmpeg_graphprint: Add options for filtergraph printing softworkz
2025-02-21  9:22   ` Andreas Rheinhardt
2025-02-21  9:42     ` Soft Works
2025-02-21 11:11       ` Andreas Rheinhardt
2025-02-21 11:25         ` Soft Works
2025-02-21 13:09   ` Nicolas George
2025-02-21 13:49     ` Soft Works
2025-02-24 10:41       ` Nicolas George
2025-02-24 13:19         ` Soft Works
2025-02-26 14:42           ` Nicolas George
2025-02-27 13:11             ` Soft Works
2025-02-19  9:59 ` [FFmpeg-devel] [PATCH 3/3] fftools: Enable filtergraph printing and update docs softworkz
2025-02-21 11:27 ` [FFmpeg-devel] [PATCH v2 0/4] print_graphs: Complete Filtergraph Printing ffmpegagent
2025-02-21 11:27   ` [FFmpeg-devel] [PATCH v2 1/4] fftools/ffmpeg_filter: Move some declaration to new header file softworkz
2025-02-21 11:27   ` [FFmpeg-devel] [PATCH v2 2/4] avfilter/avfilter Add avfilter_link_get_hw_frames_ctx() softworkz
2025-02-21 11:27   ` [FFmpeg-devel] [PATCH v2 3/4] fftools/ffmpeg_graphprint: Add options for filtergraph printing softworkz
2025-02-21 11:27   ` [FFmpeg-devel] [PATCH v2 4/4] fftools: Enable filtergraph printing and update docs softworkz
2025-03-01 10:01   ` [FFmpeg-devel] [PATCH v3 0/7] print_graphs: Complete Filtergraph Printing ffmpegagent
2025-03-01 10:01     ` [FFmpeg-devel] [PATCH v3 1/7] fftools/textformat: Extract and generalize textformat api from ffprobe.c softworkz
2025-03-02 17:54       ` Stefano Sabatini
2025-03-02 19:44         ` Soft Works
2025-03-05 20:20           ` Stefano Sabatini
2025-03-05 20:58             ` Soft Works
2025-03-08 14:00       ` Stefano Sabatini
2025-03-08 15:01         ` Soft Works
2025-03-08 14:36       ` Stefano Sabatini
2025-03-08 15:30         ` Soft Works
2025-03-08 18:12           ` Stefano Sabatini
2025-03-08 19:25             ` Soft Works
2025-03-09 18:55         ` Soft Works
2025-03-01 10:01     ` [FFmpeg-devel] [PATCH v3 2/7] fftools/ffprobe: Change to use textformat api softworkz
2025-03-08 14:18       ` Stefano Sabatini
2025-03-01 10:02     ` [FFmpeg-devel] [PATCH v3 3/7] fftools/ffprobe: Rename writer_print_section_* and WriterContext softworkz
2025-03-08 14:46       ` Stefano Sabatini
2025-03-08 15:46         ` Soft Works
2025-03-08 17:54         ` Soft Works
2025-03-01 10:02     ` [FFmpeg-devel] [PATCH v3 4/7] fftools/ffmpeg_filter: Move some declaration to new header file softworkz
2025-03-01 10:02     ` [FFmpeg-devel] [PATCH v3 5/7] avfilter/avfilter Add avfilter_link_get_hw_frames_ctx() softworkz
2025-03-01 10:02     ` [FFmpeg-devel] [PATCH v3 6/7] fftools/ffmpeg_graphprint: Add options for filtergraph printing softworkz
2025-03-01 10:02     ` [FFmpeg-devel] [PATCH v3 7/7] fftools: Enable filtergraph printing and update docs softworkz
2025-03-01 22:54     ` [FFmpeg-devel] [PATCH v4 0/7] print_graphs: Complete Filtergraph Printing ffmpegagent
2025-03-01 22:54       ` [FFmpeg-devel] [PATCH v4 1/7] fftools/textformat: Extract and generalize textformat api from ffprobe.c softworkz
2025-03-01 22:54       ` [FFmpeg-devel] [PATCH v4 2/7] fftools/ffprobe: Change to use textformat api softworkz
2025-03-01 22:54       ` [FFmpeg-devel] [PATCH v4 3/7] fftools/ffprobe: Rename writer_print_section_* and WriterContext softworkz
2025-03-01 22:54       ` [FFmpeg-devel] [PATCH v4 4/7] fftools/ffmpeg_filter: Move some declaration to new header file softworkz
2025-03-01 22:54       ` [FFmpeg-devel] [PATCH v4 5/7] avfilter/avfilter: Add avfilter_link_get_hw_frames_ctx() softworkz
2025-03-01 22:54       ` [FFmpeg-devel] [PATCH v4 6/7] fftools/ffmpeg_graphprint: Add options for filtergraph printing softworkz
2025-03-01 22:54       ` [FFmpeg-devel] [PATCH v4 7/7] fftools: Enable filtergraph printing and update docs softworkz
2025-03-08 17:55       ` [FFmpeg-devel] [PATCH v5 0/8] print_graphs: Complete Filtergraph Printing ffmpegagent
2025-03-08 17:55         ` [FFmpeg-devel] [PATCH v5 1/8] fftools/textformat: Extract and generalize textformat api from ffprobe.c softworkz
2025-03-08 19:08           ` Stefano Sabatini
2025-03-08 19:49             ` Soft Works
2025-03-08 17:55         ` [FFmpeg-devel] [PATCH v5 2/8] fftools/ffprobe: Change to use textformat api softworkz
2025-03-08 19:23           ` Stefano Sabatini
2025-03-08 17:55         ` [FFmpeg-devel] [PATCH v5 3/8] fftools/ffprobe: Rename writer_print_section_* and WriterContext softworkz
2025-03-08 19:24           ` Stefano Sabatini
2025-03-08 17:55         ` [FFmpeg-devel] [PATCH v5 4/8] fftools/ffmpeg_filter: Move some declaration to new header file softworkz
2025-03-08 17:55         ` [FFmpeg-devel] [PATCH v5 5/8] avfilter/avfilter: Add avfilter_link_get_hw_frames_ctx() softworkz
2025-03-08 17:55         ` [FFmpeg-devel] [PATCH v5 6/8] fftools/ffmpeg_graphprint: Add options for filtergraph printing softworkz
2025-03-08 17:55         ` [FFmpeg-devel] [PATCH v5 7/8] fftools: Enable filtergraph printing and update docs softworkz
2025-03-08 17:55         ` [FFmpeg-devel] [PATCH v5 8/8] fftools/ffprobe: Rename AVTextFormatContext variables (w => tc) softworkz
2025-03-08 19:30           ` Stefano Sabatini
2025-03-08 20:16         ` ffmpegagent [this message]
2025-03-08 20:16           ` [FFmpeg-devel] [PATCH v6 1/8] fftools/textformat: Extract and generalize textformat api from ffprobe.c softworkz
2025-03-08 20:16           ` [FFmpeg-devel] [PATCH v6 2/8] fftools/ffprobe: Change to use textformat api softworkz
2025-03-08 20:16           ` [FFmpeg-devel] [PATCH v6 3/8] fftools/ffprobe: Rename writer_print_section_* and WriterContext softworkz
2025-03-08 20:16           ` [FFmpeg-devel] [PATCH v6 4/8] fftools/ffmpeg_filter: Move some declaration to new header file softworkz
2025-03-08 20:16           ` [FFmpeg-devel] [PATCH v6 5/8] avfilter/avfilter: Add avfilter_link_get_hw_frames_ctx() softworkz
2025-03-08 20:16           ` [FFmpeg-devel] [PATCH v6 6/8] fftools/ffmpeg_graphprint: Add options for filtergraph printing softworkz
2025-03-08 20:16           ` [FFmpeg-devel] [PATCH v6 7/8] fftools: Enable filtergraph printing and update docs softworkz
2025-03-08 20:16           ` [FFmpeg-devel] [PATCH v6 8/8] fftools/ffprobe: Rename AVTextFormatContext variables (w => tfc) softworkz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.52.v6.ffstaging.FFmpeg.1741464994.ffmpegagent@gmail.com \
    --to=ffmpegagent@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    --cc=softworkz@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git