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 0/8] [RFC] avtextformat: Transform text writing into an independent API
Date: Thu, 27 Feb 2025 14:01:32 +0000
Message-ID: <pull.56.ffstaging.FFmpeg.1740664900.ffmpegagent@gmail.com> (raw)

Hello everybody,

this is an effort to pull out the text writing code from ffprobe and shape
it as an independent API. To avoid any other big refacoring in the future,
this patchset is building it up as a public API in avutil, but it's not that
I would be insisting this to happen (or maybe not yet). It could very well
remain private and only shared by ffprobe and ffmpeg (filtergraph printing)
for the time being. Would like to know what people are thinking about -
specifically and in general.

This patchset doesn't aim to improve or change the API itself - that would
be a bit too much at once. The primary functional changes made were those
which were required to gain independence of the specific way of use inside
ffprobe - without causing any change to the output. Locally, I had some
failing FATE tests locally but the CI build with FATE (here on GitHub)
finished without error.

Non-functional changes are naming, made in the spirit of ramping up for
becoming a public API (possibly), and there's also a separation of
functionality: Currently, everything is called "writer" in some way, without
making any distinctions. The main change is that there are now:

 * Text Formatters: AVTextFormatter and AVTextFormatContext These are
   obviously in charge of formatting the output (csv, json, xml, compact,
   etc.)
 * Text Writers: AVTextWriter and AVTextWriterContext Responsible for
   writing the formatted text somewhere. Currently 3 writers exist
   * stdouwriter
   * aviowriter - can output to a file or to an existing avio context
   * bufferwriter - writes to a provided AVBprint buffer

I'll be happy about any hints or comments!

Known Issues

 * Mixes avutil and fftool changes in commits (I kept it preliminarily like
   that as it's easier to follow. Otherwise it would be a huge single commit
   to ffprobe.c)
 * No changelog, ApiChange entries and version bumps
 * Public API isn't documented yet
 * Some variables haven't been renamed yet (like wctx to tctx)
 * Not sure whether every single commit builds successfully, the final one
   does

Open Questions

 * I'm not sure about the best way to expose the formatters and writers to
   consumers Currently, there's still the register_formatter() way in
   ffprobe.c and writers are accessible only via creator functions (like
   avtextwriter_create_avio)
 * There are two header files (avtextformat.h, avtextwriters.h), reflecting
   the separation betwen formatters and writers and a separate code file for
   each formatter and writer, all in a subfolder named textformat. Not sure
   what the preferences are, it was hard to find a comparable precedence.
   Will change when asked to.
 * Do we want flags to be #defines always or can they be enums?
 * Will it need a public/private separation (like recently introduced for
   other entities)?

Thanks

softworkz (8):
  ffprobe/avtextformat: Rename and move writer structs
  ffprobe/avtextformat: Rename and move writer functions and options
  ffprobe/avtextformat: Generalize ffprobe specifics
  ffprobe/avtextformat: Rename flags and enums
  ffprobe/avtextformat: Move flags
  ffprobe/avtextformat: Rename writer to formatter
  ffprobe/avtextformat: Move formatters to avutil
  ffprobe/avtextformat: Split out text writers as independent classes

 fftools/ffprobe.c                   | 2188 ++++-----------------------
 libavutil/Makefile                  |   12 +
 libavutil/avtextformat.h            |  170 +++
 libavutil/avtextwriters.h           |   68 +
 libavutil/textformat/avtextformat.c |  641 ++++++++
 libavutil/textformat/tf_compact.c   |  285 ++++
 libavutil/textformat/tf_default.c   |  150 ++
 libavutil/textformat/tf_flat.c      |  177 +++
 libavutil/textformat/tf_ini.c       |  165 ++
 libavutil/textformat/tf_json.c      |  220 +++
 libavutil/textformat/tf_xml.c       |  224 +++
 libavutil/textformat/tw_avio.c      |  129 ++
 libavutil/textformat/tw_buffer.c    |   91 ++
 libavutil/textformat/tw_stdout.c    |   82 +
 14 files changed, 2737 insertions(+), 1865 deletions(-)
 create mode 100644 libavutil/avtextformat.h
 create mode 100644 libavutil/avtextwriters.h
 create mode 100644 libavutil/textformat/avtextformat.c
 create mode 100644 libavutil/textformat/tf_compact.c
 create mode 100644 libavutil/textformat/tf_default.c
 create mode 100644 libavutil/textformat/tf_flat.c
 create mode 100644 libavutil/textformat/tf_ini.c
 create mode 100644 libavutil/textformat/tf_json.c
 create mode 100644 libavutil/textformat/tf_xml.c
 create mode 100644 libavutil/textformat/tw_avio.c
 create mode 100644 libavutil/textformat/tw_buffer.c
 create mode 100644 libavutil/textformat/tw_stdout.c


base-commit: 99e2af4e7837ca09b97d93a562dc12947179fc48
Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-56%2Fsoftworkz%2Fsubmit_textformat-v1
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-56/softworkz/submit_textformat-v1
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/56
-- 
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".

             reply	other threads:[~2025-02-27 14:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-27 14:01 ffmpegagent [this message]
2025-02-27 14:01 ` [FFmpeg-devel] [PATCH 1/8] ffprobe/avtextformat: Rename and move writer structs softworkz
2025-02-27 14:01 ` [FFmpeg-devel] [PATCH 2/8] ffprobe/avtextformat: Rename and move writer functions and options softworkz
2025-02-27 14:01 ` [FFmpeg-devel] [PATCH 3/8] ffprobe/avtextformat: Generalize ffprobe specifics softworkz
2025-02-27 14:01 ` [FFmpeg-devel] [PATCH 4/8] ffprobe/avtextformat: Rename flags and enums softworkz
2025-02-27 14:01 ` [FFmpeg-devel] [PATCH 5/8] ffprobe/avtextformat: Move flags softworkz
2025-02-27 14:01 ` [FFmpeg-devel] [PATCH 6/8] ffprobe/avtextformat: Rename writer to formatter softworkz
2025-02-27 14:01 ` [FFmpeg-devel] [PATCH 7/8] ffprobe/avtextformat: Move formatters to avutil softworkz
2025-02-27 14:01 ` [FFmpeg-devel] [PATCH 8/8] ffprobe/avtextformat: Split out text writers as independent classes 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.56.ffstaging.FFmpeg.1740664900.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