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 E645D43288 for ; Mon, 23 Jan 2023 11:34:46 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E8EBD68BD81; Mon, 23 Jan 2023 13:34:42 +0200 (EET) Received: from mail0.khirnov.net (unknown [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2BAB868BD5F for ; Mon, 23 Jan 2023 13:34:36 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 805CF2404EC for ; Mon, 23 Jan 2023 12:34:35 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id wq6Tgjd4bEDV for ; Mon, 23 Jan 2023 12:34:34 +0100 (CET) Received: from lain.khirnov.net (lain.khirnov.net [IPv6:2001:67c:1138:4306::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "lain.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id B94C9240178 for ; Mon, 23 Jan 2023 12:34:34 +0100 (CET) Received: by lain.khirnov.net (Postfix, from userid 1000) id 383281601B2; Mon, 23 Jan 2023 12:34:32 +0100 (CET) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: <20230120193132.21597-5-anton@khirnov.net> References: <20230120193132.21597-1-anton@khirnov.net> <20230120193132.21597-5-anton@khirnov.net> Mail-Followup-To: FFmpeg development discussions and patches Date: Mon, 23 Jan 2023 12:34:32 +0100 Message-ID: <167447367219.4503.1890244457637866011@lain.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 5/5] fftools/ffmpeg: add special syntax for loading filter options 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: Quoting Anton Khirnov (2023-01-20 20:31:32) > +static int filter_opt_apply(AVFilterContext *f, const char *key, const char *val) > +{ > + const AVOption *o; > + int ret; > + > + ret = av_opt_set(f, key, val, AV_OPT_SEARCH_CHILDREN); > + if (ret >= 0) > + return 0; > + > + if (ret == AVERROR_OPTION_NOT_FOUND && key[0] == '/') > + o = av_opt_find(f, key + 1, NULL, 0, AV_OPT_SEARCH_CHILDREN); > + if (!o) > + goto err_apply; > + > + // key is a valid option name prefixed with '/' > + // interpret value as a path from which to load the actual option value > + key++; > + > + if (o->type == AV_OPT_TYPE_BINARY) { > + uint8_t *data; > + int len; > + > + ret = read_binary(val, &data, &len); > + if (ret < 0) > + goto err_load; > + > + ret = av_opt_set_bin(f, key, data, len, AV_OPT_SEARCH_CHILDREN); > + av_freep(&data); > + } else { > + char *data = file_read(val); > + if (!val) { should be s/val/data/ fixed locally -- Anton Khirnov _______________________________________________ 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".