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 8F99E4D915 for ; Wed, 26 Feb 2025 14:42:54 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1689868CF6F; Wed, 26 Feb 2025 16:42:50 +0200 (EET) Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0899C68CF3D for ; Wed, 26 Feb 2025 16:42:42 +0200 (EET) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 51QEggwU010246 for ; Wed, 26 Feb 2025 15:42:42 +0100 Received: by phare.normalesup.org (Postfix, from userid 1001) id 424742EFDF; Wed, 26 Feb 2025 15:42:42 +0100 (CET) Date: Wed, 26 Feb 2025 15:42:42 +0100 From: Nicolas George To: FFmpeg development discussions and patches Message-ID: References: <0750b971f9ae0fc38917e0a3b3ccb7ad2e8cd221.1739959172.git.ffmpegagent@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Wed, 26 Feb 2025 15:42:42 +0100 (CET) Subject: Re: [FFmpeg-devel] [PATCH 2/3] fftools/ffmpeg_graphprint: Add options for 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 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: Soft Works (HE12025-02-24): > Accepted. I'll outfactor the writers first. It's a valid point of course; > I just wasn't sure whether you would dislike me doing it. I dislike the fact that it will be done on top of a pedestrian or clumsy strings API, but I know precisely where to lay the blame for that absurdity and it is not you. > Should each writer go into a separate code file, or all in one? The writers in ffprobe are an ad-hoc construction to turn the shallow data structures produced by ffprobe into a common denominator of JSON, XML, CSV and a few custom formats. It is not a good candidate to be turned into an API. The writes make arbitrary decisions about how the data will be represented. Not much in JSON, but for XML the choices of what is an attribute and what is an element are very arbitrary. The XML writer in ffprobe cannot output any (basic) XML file. That part of the code is not duplicated in your patch anyway. What is duplicated is the low-level code. So this is where you would be better off starting. That would mean something like this: Move the low-level JSON writing code into lavu, with a low-level API specific to JSON. Bonus points if the API can be used without dynamic allocations when the data structure is not too deep. Use the newly introduced av_json_write API in ffprobe; the JSON writer becomes a trivial wrapper around it. Also use it in your patch. Later, possibly somebody else: do the same with XML. The low-level API will need to be a little more complex, because XML has more room for tweaks. At some point in the future: unify the JSON, XML and other writers in libavutil under a common API, but one that can be tweaked for any kind of input data structure, not just a list of streams/packets/frames with flat attributes. Regards, -- Nicolas George _______________________________________________ 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".