From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ffmpeg-devel-bounces@ffmpeg.org>
Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100])
	by master.gitmailbox.com (Postfix) with ESMTPS id 450BD4D1D6
	for <ffmpegdev@gitmailbox.com>; Wed, 16 Apr 2025 10:13:47 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6CCDA687DDC;
	Wed, 16 Apr 2025 13:12:57 +0300 (EEST)
Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com
 [209.85.210.170])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 57941687DD5
 for <ffmpeg-devel@ffmpeg.org>; Wed, 16 Apr 2025 13:12:56 +0300 (EEST)
Received: by mail-pf1-f170.google.com with SMTP id
 d2e1a72fcca58-7396f13b750so6791989b3a.1
 for <ffmpeg-devel@ffmpeg.org>; Wed, 16 Apr 2025 03:12:56 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1744798374; x=1745403174; darn=ffmpeg.org;
 h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date
 :references:in-reply-to:message-id:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=ywXaQjkabwx3/m98+c84KCr+qmvP3bIa/MhP9TgBuU0=;
 b=cHKYvCftzLKID4+BQhsroDz2Ks6YnZm2ilcMXb27eBjTHYIxIO5mpJeMUZ8NHTOBua
 9sEzBy4EyzHMq1qUnHbUxK37Y8sd0LF+5Q/ZA9MNqEIFNTE1NBB0hGtmKWnjpye6j8zw
 l/HF26VyIsrtNc9i07PARnUzbWck88c93oIkf4jO+/0SmtACObZUOHgsGmLQR/tfFIs+
 lCyyhnuoJK+bngyIeMuAyiBEvs1DS3w2hDrafAH+kLNpwkT++3AhVq8bJ5kICv/PJt86
 SCZgL4Jqm6PuGXqrS0I/tFfdpr+YUMTPUnvGf60v5hAOvoNlH8zKzkDlEcUQ8Vt6WbH4
 K3VQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1744798374; x=1745403174;
 h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date
 :references:in-reply-to:message-id:from:x-gm-message-state:from:to
 :cc:subject:date:message-id:reply-to;
 bh=ywXaQjkabwx3/m98+c84KCr+qmvP3bIa/MhP9TgBuU0=;
 b=u0dlEBQ9mAOF76drkSTyQD6yolOckjiMGpl02oZjewUqzbGLcryYqTxJpiF0F48Ahw
 GHR/BDDwGFyElXsFCiQyYL1G93elR1QQTeiGwtHqZIE2n/u6nPalO/k8ltRayAdM0+2u
 72eow7pTi4ARPDcfUIFYTBSYHMxNFMVDNv2WDu0IVySYC4z9QTJv54QM5eu/cfPvaxuA
 UPY/tlpsDgHkbUXdN8QGgjaEcA82MRhPJqrok4P5L99VbUdTb1FfMxmVk9BoGIdodSDw
 romH8TpET3Z6PWO6kVfRJ12RBR0kLaP2nDf7WvMypQk9L4ux3lJ/ZpHRxvSAbbJHKthg
 u66Q==
X-Gm-Message-State: AOJu0YwKrfPrStjSe/R6BxUDcvOXw+dMlrdfVNAtvfTT6z8rmF3jq3Df
 gWlXU8PqyXPePh5febg59vpBJiu8ra4DPVQJ/YRiNm6V5p9ruazp3II7WA==
X-Gm-Gg: ASbGncvh2M5ZOjSCxoHj/6GPndW/leJYH8Wz1v5XS0gLLJ6/d8EOh6w2UijA9iWR1h6
 ULzeXUY1V562taFmlzVwbaiiQjW1j+MLuTwNXz+F+fXiz1Ja/VRjUKvCDqdoHj4B37xJy3qQ7nE
 R9RIOQzKeWeGHXIpnFW82Msjk7B3LvuXhofoqq+mDCbozNM20ZxlamXMD9mR2B2ck1GrsxDPRnY
 k5if7eaureaaCD436TKBxJoyiKHAMhYvIZRCAUSyN5f1bStML+v8vt/lAunJ84hJ5dcrbYMZluo
 Pd7si/YOUZWdyvzrSwxI6THVrSw6KvRQt4fmrKR0QEwpUtwnMhNA/wLrfaY=
X-Google-Smtp-Source: AGHT+IHBke2M5myqAK/+Cnozn3FpMkHeT4Gky/8zacAOz3Xn1FeJv+5atyeGoKgtPWsJYwi0Fo/ozQ==
X-Received: by 2002:a05:6a20:e68b:b0:1f5:7c6f:6c96 with SMTP id
 adf61e73a8af0-203b3eea032mr1771336637.22.1744798374541; 
 Wed, 16 Apr 2025 03:12:54 -0700 (PDT)
Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50])
 by smtp.gmail.com with ESMTPSA id
 41be03b00d2f7-b0b220fb89csm933483a12.40.2025.04.16.03.12.54
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Wed, 16 Apr 2025 03:12:54 -0700 (PDT)
From: softworkz <ffmpegagent@gmail.com>
X-Google-Original-From: softworkz <softworkz@hotmail.com>
Message-Id: <4f6870ed4cbad85abe6deceba605542483b60e99.1744798340.git.ffmpegagent@gmail.com>
In-Reply-To: <pull.66.v2.ffstaging.FFmpeg.1744798340.ffmpegagent@gmail.com>
References: <pull.66.ffstaging.FFmpeg.1744634826.ffmpegagent@gmail.com>
 <pull.66.v2.ffstaging.FFmpeg.1744798340.ffmpegagent@gmail.com>
Date: Wed, 16 Apr 2025 10:12:15 +0000
Fcc: Sent
MIME-Version: 1.0
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH v2 05/10] fftools/textformat: Add function
 avtext_print_integer_flags()
X-BeenThere: ffmpeg-devel@ffmpeg.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org>
List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe>
List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel>
List-Post: <mailto:ffmpeg-devel@ffmpeg.org>
List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help>
List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe>
Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Cc: softworkz <softworkz@hotmail.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: ffmpeg-devel-bounces@ffmpeg.org
Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org>
Archived-At: <https://master.gitmailbox.com/ffmpegdev/4f6870ed4cbad85abe6deceba605542483b60e99.1744798340.git.ffmpegagent@gmail.com/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>

From: softworkz <softworkz@hotmail.com>

This function works analog to the avtext_print_string() which already
has a flags parameter.

Signed-off-by: softworkz <softworkz@hotmail.com>
---
 fftools/textformat/avtextformat.c | 21 +++++++++++++++++++++
 fftools/textformat/avtextformat.h |  2 ++
 2 files changed, 23 insertions(+)

diff --git a/fftools/textformat/avtextformat.c b/fftools/textformat/avtextformat.c
index 4c8def8e65..d96ced9b7d 100644
--- a/fftools/textformat/avtextformat.c
+++ b/fftools/textformat/avtextformat.c
@@ -311,6 +311,27 @@ void avtext_print_integer(AVTextFormatContext *tctx, const char *key, int64_t va
     }
 }
 
+void avtext_print_integer_flags(AVTextFormatContext *tctx, const char *key, int64_t val, int flags)
+{
+    const AVTextFormatSection *section;
+
+    if (!tctx || !key || tctx->level < 0 || tctx->level >= SECTION_MAX_NB_LEVELS)
+        return;
+
+    section = tctx->section[tctx->level];
+
+    if (tctx->show_optional_fields == SHOW_OPTIONAL_FIELDS_NEVER ||
+        (tctx->show_optional_fields == SHOW_OPTIONAL_FIELDS_AUTO
+            && (flags & AV_TEXTFORMAT_PRINT_STRING_OPTIONAL)
+            && !(tctx->formatter->flags & AV_TEXTFORMAT_FLAG_SUPPORTS_OPTIONAL_FIELDS)))
+        return;
+
+    if (section->show_all_entries || av_dict_get(section->entries_to_show, key, NULL, 0)) {
+        tctx->formatter->print_integer(tctx, key, val);
+        tctx->nb_item[tctx->level]++;
+    }
+}
+
 static inline int validate_string(AVTextFormatContext *tctx, char **dstp, const char *src)
 {
     const uint8_t *p, *endp, *srcp = (const uint8_t *)src;
diff --git a/fftools/textformat/avtextformat.h b/fftools/textformat/avtextformat.h
index aea691f351..16cd9b214f 100644
--- a/fftools/textformat/avtextformat.h
+++ b/fftools/textformat/avtextformat.h
@@ -139,6 +139,8 @@ void avtext_print_section_footer(AVTextFormatContext *tctx);
 
 void avtext_print_integer(AVTextFormatContext *tctx, const char *key, int64_t val);
 
+void avtext_print_integer_flags(AVTextFormatContext *tctx, const char *key, int64_t val, int flags);
+
 int avtext_print_string(AVTextFormatContext *tctx, const char *key, const char *val, int flags);
 
 void avtext_print_unit_int(AVTextFormatContext *tctx, const char *key, int value, const char *unit);
-- 
ffmpeg-codebot

_______________________________________________
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".