From patchwork Fri Feb 23 13:58:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 46466 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:26a3:b0:19e:cdac:8cce with SMTP id h35csp992869pze; Fri, 23 Feb 2024 06:32:58 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWuhdxr9ia0IpqvOkQH6qsO4w+tewJGQhujP9Tju8XekHD8tAclmq5EDV8j5TO8K20yge7fzFM3wu8xD16tQTbQeG0KHmyL9IFJvg== X-Google-Smtp-Source: AGHT+IHlHdkLD99vr8C+VnU5rM5gB1sdIudSspS4hJa2kTgd+i3SuvQs5rF9XMU20zX8ENDDECiC X-Received: by 2002:a17:906:2b19:b0:a40:75e8:3891 with SMTP id a25-20020a1709062b1900b00a4075e83891mr743454ejg.7.1708698778567; Fri, 23 Feb 2024 06:32:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708698778; cv=none; d=google.com; s=arc-20160816; b=Cvpesm31TeR475vP2VQ+Va/yC1jl1ESewGppNdsy1KtOteXyLL0OHMLaCVwGi5q619 BetRA9QyqXIVbTV2Sg6MoEcwDegvBWtFe9GtpKLgWe2gcs4SrioNStQm2oP6GVNR3iPl ncyfzt71i3mQTy1sXCfyQKO8umU2vRS7rnv3yetw1IDljHF0AKBhWkESGg06+uBmCIaf mVLmpFrxkByOMHEieTkkU0o9bLhm2ISyKmYUQWbNCu0h9JE3tCW3o953U0/O6KbRkhlq ciLn6eXTqg6kSLwL/7O3snHCr07XC4Hswmuetr6U7STvGtY887/rR9bR3j/zxDoy/qCY k+CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=FyoFQLTu0Dfc3s32DRR8wLkwOa1ognTimoOgEocrSGc=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=d9rWTclbryWwXKB1/Ow3Vdqdv9UWBOElSidO5B+Q4WVZglKxAoyXqeZ9YEFDlef1l2 lxCyBgeMu/BrQGaa55j3czxVsCB0vFkdMeWixrI+8pcLeaNkcg7gYAZsd/YpvXTquE8M gLHkbx4lWi+mBioZITfdyDxd/0wgOfNjvXWGlvz6XY/5L6nYWQnGKG81+RB37ef8GCaT SVF6SWhoo9rb3MpuCtbo2iqlHLYFLqSrcAgscOJmgI9q5iiXyqNeo0sSR+tlACwQ6WsU YbSQCxI3KSkgckZriagQlCEq/fMXVTRss8jZSknK63cJFFifUZasm3a6/nTiexCRNKNE Vn+A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b=eMrY7ZUJ; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id k2-20020a170906128200b00a3d62b89211si6254727ejb.293.2024.02.23.06.32.58; Fri, 23 Feb 2024 06:32:58 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b=eMrY7ZUJ; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D935F68C91A; Fri, 23 Feb 2024 16:31:46 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8BD3768C613 for ; Fri, 23 Feb 2024 16:31:30 +0200 (EET) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=eMrY7ZUJ; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 3C5324CFF for ; Fri, 23 Feb 2024 15:31:30 +0100 (CET) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id ZUuXga63E6DA for ; Fri, 23 Feb 2024 15:31:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1708698687; bh=oMnmgXC5iywLqq7So1meVWDElbej3yMWcvMPyE/LmLk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=eMrY7ZUJxdJbePbg7ALyi7E+tylZ8cxpCHTxASUoS6slYcx8YSou928G2E54/H9+R SpwChNglHC2FFPTlYlXzkTcHveSvlzR1yzGEAvvcd4y255qb1sidCYSjnG3Y3H0oEm 7Nc/sU986Ah/Pouyww/XtTGvNBougL1ZA1OHnqHJDQ0pEsnxANTLwKj4C/HOghhO74 KalxLEX9X3m3Z+Lqr92P5pkPE1aJatsVmirmKnguRsaSDpz5WXrNBwJXhV3xQleebQ d2KpqHiEa1jms33kK8yeXe82UNkIaTv/xfW3RqLFJ+LK/J75O3O+/zstnFg65mT/jr DBTCOI4pgLgzg== Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (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 "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail1.khirnov.net (Postfix) with ESMTPS id 5AC844D22 for ; Fri, 23 Feb 2024 15:31:27 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 180183A0CB6 for ; Fri, 23 Feb 2024 15:31:22 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 23 Feb 2024 14:58:28 +0100 Message-ID: <20240223143115.16521-7-anton@khirnov.net> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240223143115.16521-1-anton@khirnov.net> References: <20240223143115.16521-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 06/38] lavu/opt: cosmetics, group option reading function together 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 3kFYB8FZhTNo --- libavutil/opt.h | 82 +++++++++++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 36 deletions(-) diff --git a/libavutil/opt.h b/libavutil/opt.h index 6ed19888a5..e34b8506f8 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -755,6 +755,11 @@ int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, in * @} */ +/** + * @defgroup opt_read Reading option values + * @{ + */ + /** * @defgroup opt_get_funcs Option getting functions * @{ @@ -831,42 +836,6 @@ int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational */ void *av_opt_ptr(const AVClass *avclass, void *obj, const char *name); -/** - * Free an AVOptionRanges struct and set it to NULL. - */ -void av_opt_freep_ranges(AVOptionRanges **ranges); - -/** - * Get a list of allowed ranges for the given option. - * - * The returned list may depend on other fields in obj like for example profile. - * - * @param flags is a bitmask of flags, undefined flags should not be set and should be ignored - * AV_OPT_SEARCH_FAKE_OBJ indicates that the obj is a double pointer to a AVClass instead of a full instance - * AV_OPT_MULTI_COMPONENT_RANGE indicates that function may return more than one component, @see AVOptionRanges - * - * The result must be freed with av_opt_freep_ranges. - * - * @return number of compontents returned on success, a negative errro code otherwise - */ -int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags); - -/** - * Get a default list of allowed ranges for the given option. - * - * This list is constructed without using the AVClass.query_ranges() callback - * and can be used as fallback from within the callback. - * - * @param flags is a bitmask of flags, undefined flags should not be set and should be ignored - * AV_OPT_SEARCH_FAKE_OBJ indicates that the obj is a double pointer to a AVClass instead of a full instance - * AV_OPT_MULTI_COMPONENT_RANGE indicates that function may return more than one component, @see AVOptionRanges - * - * The result must be freed with av_opt_free_ranges. - * - * @return number of compontents returned on success, a negative errro code otherwise - */ -int av_opt_query_ranges_default(AVOptionRanges **, void *obj, const char *key, int flags); - /** * Check if given option is set to its default value. * @@ -926,6 +895,47 @@ int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name) */ int av_opt_serialize(void *obj, int opt_flags, int flags, char **buffer, const char key_val_sep, const char pairs_sep); + +/** + * @} + */ + +/** + * Free an AVOptionRanges struct and set it to NULL. + */ +void av_opt_freep_ranges(AVOptionRanges **ranges); + +/** + * Get a list of allowed ranges for the given option. + * + * The returned list may depend on other fields in obj like for example profile. + * + * @param flags is a bitmask of flags, undefined flags should not be set and should be ignored + * AV_OPT_SEARCH_FAKE_OBJ indicates that the obj is a double pointer to a AVClass instead of a full instance + * AV_OPT_MULTI_COMPONENT_RANGE indicates that function may return more than one component, @see AVOptionRanges + * + * The result must be freed with av_opt_freep_ranges. + * + * @return number of compontents returned on success, a negative errro code otherwise + */ +int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags); + +/** + * Get a default list of allowed ranges for the given option. + * + * This list is constructed without using the AVClass.query_ranges() callback + * and can be used as fallback from within the callback. + * + * @param flags is a bitmask of flags, undefined flags should not be set and should be ignored + * AV_OPT_SEARCH_FAKE_OBJ indicates that the obj is a double pointer to a AVClass instead of a full instance + * AV_OPT_MULTI_COMPONENT_RANGE indicates that function may return more than one component, @see AVOptionRanges + * + * The result must be freed with av_opt_free_ranges. + * + * @return number of compontents returned on success, a negative errro code otherwise + */ +int av_opt_query_ranges_default(AVOptionRanges **, void *obj, const char *key, int flags); + /** * @} */