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 ESMTP id BE7D540BE9 for ; Tue, 8 Mar 2022 12:53:41 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D701968B0A6; Tue, 8 Mar 2022 14:53:38 +0200 (EET) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F22F668AB64 for ; Tue, 8 Mar 2022 14:53:31 +0200 (EET) Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 5550B435FE for ; Tue, 8 Mar 2022 13:53:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1646744011; bh=FnS2G3fbv33j5uWOFlm2d+Y5Xe9DfmQoMHW2ITaMnnU=; h=Date:From:To:Subject:In-Reply-To:References:From; b=W3Mzfuo30RXDn+JBOfBc3NM6qbsrludhAdEmbU+i6t02D/joCIKxMYC3LkjiEcx9C TElqmyqUVnGZGW8+lMlUqQa4+2W2RZnOwKAHkcVsCuFiZx6nPqsLTy9bS3XyD1GDbp XCLn+/DKrzREFFX3Ls48WAqJb8H288vo6NitWDkg= Date: Tue, 8 Mar 2022 13:53:31 +0100 Message-ID: <20220308135331.GC28717@haasn.xyz> From: Niklas Haas To: FFmpeg development discussions and patches In-Reply-To: <164674011536.19727.522116367172581993@lain.red.khirnov.net> References: <20220304150307.61769-1-ffmpeg@haasn.xyz> <164674011536.19727.522116367172581993@lain.red.khirnov.net> MIME-Version: 1.0 Content-Disposition: inline Subject: Re: [FFmpeg-devel] [PATCH 1/2] lavu: add syntax for loading AV_OPT_TYPE_BINARY from files 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: On Tue, 08 Mar 2022 12:48:35 +0100 Anton Khirnov wrote: > Quoting Niklas Haas (2022-03-04 16:03:06) > > From: Niklas Haas > > > > I arbitrarily decided to use the syntax 'opt=@filename' to match e.g. > > `curl -Ffield=@filename`, and also because @ is not a valid hex > > character, nor does it conflict with any other common shell or ffmpeg > > syntax. > > > > This is arguably somewhat clunky because it does not round-trip with > > av_opt_get - you will get back a hex interpretation of the loaded file, > > rather than the filename it was loaded from. It also implies a (perhaps > > unnecessary) memcpy from mapped file memory into a allocated memory. > > This is unfortunately necessary because there's no way for us to know > > whether av_free or av_file_unmap is needed to clean up previous option > > values. > > > > The motivating use case was the introduction of several new binary > > options for vf_libplacebo, but other filters that currently rely on > > manual file-path loading could benefit from it as well. > > Sorry, I think having an arbitrary file loader in the options parser > will be an endless security nightmare. > > The alternative I had in mind was having ffmpeg.c itself do the file > loading. This will be require some modification of the options parsing > code in cmdutils.c and also extending the mechanisms we use to pass > options to filters. > > I can try to make a POC in a few days. I think that is the better approach, too. I went for this approach because it was the easiest to implement, not because it makes the most sense. I do think that it's fine for ffmpeg.c to do this, but springing it upon unsuspecting API users *in general* is, well, in retrospect, not something I want to have my name attached to. I think that I would drop the second half of this commit (keeping only the introduction of `av_set_string_from_filepath`), and then make ffmpeg.c use it for cmdlist arguments starting with '@' as a separate commit. _______________________________________________ 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".