[FFmpeg-devel] [PATCH 5/8] lavu: add a JSON writer API (WIP)

Anton Khirnov anton at khirnov.net
Sat Apr 29 12:41:51 EEST 2023


Quoting Nicolas George (2023-04-29 11:11:59)
> Nicolas George (12023-04-28):
> > Signed-off-by: Nicolas George <george at nsup.org>
> > ---
> >  libavutil/Makefile |   1 +
> >  libavutil/json.c   | 368 +++++++++++++++++++++++++++++++++++
> >  libavutil/json.h   | 470 +++++++++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 839 insertions(+)
> >  create mode 100644 libavutil/json.c
> >  create mode 100644 libavutil/json.h
> 
> I forgot to write: I wrote this code not only because we have half-baked
> JSON output in multiple places in the code

As far as I can see, there are exactly two places in the codebase that
produce JSON: af_loudnorm and ffprobe.

af_loudnorm:
* can optionally produce final filter stats as JSON output with av_log()
* the relevant code has ~25 lines and is unlikely to be simplified by
  this
* IMO the filter should not be doing this at all and instead produce some
  sort of a struct and let the users process it as they wish

ffprobe:
* is not one of the libraries, but rather their caller
* we are not in business of providing random non-multimedia-related
  services to callers, unless they are useful in our libraries;
  if this code is only useful in ffprobe then it should live in fftools/
* it is not at all obvious that switching ffprobe to this code would
  be an improvement; a patch actually demonstrating this would be most
  useful

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list