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 2637C4E532 for <ffmpegdev@gitmailbox.com>; Sun, 4 May 2025 02:59:32 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B255D68BBF4; Sun, 4 May 2025 05:58:25 +0300 (EEST) Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C1CF268BBAD for <ffmpeg-devel@ffmpeg.org>; Sun, 4 May 2025 05:58:23 +0300 (EEST) Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-7390d21bb1cso3481126b3a.2 for <ffmpeg-devel@ffmpeg.org>; Sat, 03 May 2025 19:58:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746327502; x=1746932302; 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=WvXPrzt8PSNqxLdQ3SpO+LrpslrPHmFwpusVbiKR7II=; b=VNLoEH9JaWzFqnp5kjbkNT1XvfIv7CcqQuEyt8Wg0vv7M8PlOoOAPNHrQk72KWaWSZ Jghmisy2+ofVW610U4tRVg/C9czN3cDZjlneGt+XIG56JPj2RvDVVgAKtuUbsnPLdBjQ CeHGQaKThYYZ1rXRbPj5uY0wVOJ3HQk8S5G6kXHdowWgfCIumoMEBW0hDu48k8dQ8WgE FHPCqt7h1SBz6drg9s/qTRRho0IVmY8IEg2+roo7c6xJlvYDfoxVxPZL3/pV5slLHK9i Y61Nnz/x4s95eMfZgKHhsX9k2/s9tOS8bLBh4G1dDJ14Cf1TffxhOc4ipz9ye3Ahq6Is +09w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746327502; x=1746932302; 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=WvXPrzt8PSNqxLdQ3SpO+LrpslrPHmFwpusVbiKR7II=; b=rbDCqDwHnEkLVsLvWzZ44F3N9pgQGu4CAZlZwBWs8pKB1DIm40oH8RiNCwRCA9lDTa jpDqOFMnOxgEQR05q6N1DFmF4C39ZerlzQujW4gyZ3opTYOCaYZP5IG/yx50Opo4ZdKh RUc2xTNYzp4a9m/YlJ4jPwd06sT9QF15D9+KhdyBbR0KoEliukVtl85Tep30nHa+xqHv J7Pffa9S0OI+vJrzQ5Nq1FzuQ/D1J3bHPp1taArMGN/WO5UgspgIwPrHmurzbloQD6Sc cTlo1i+etY+kKnCIMktuQmrVXfnbLLj3GQav3yuvhzT8di6sfhrdSByLjTqFGm8smynX +iRw== X-Gm-Message-State: AOJu0YyJUhPxCQi/8skmcQBhY8L2xLJIFKX9aJ34oVveolJOfLfvMG60 AxV1r1x1vk3DHQN8FJQMjfoTnYcZe/Fe+C0G5EZVynpKLxIkYwJn5koVVw== X-Gm-Gg: ASbGncu3qUAfEMuI29LN60vonz5der1YoR276oRwRhKCJHQpCjpstFeIpqXts+1Ky7G F3x6Lfc1Smeqtha48yTrZzMl2o8QoOjcep2iltoQHbrvrSaljx99hxb/eoRon/WBY4MYQECj7HK Tg4LVmsAsILzyvbv7zMxrvPmIdcZwud1wmW6xaoQYcd+O/3bKFpCfKcRk+3pY+CHGZGH9QAnLPd ciplZ0P51oPRCSy+EI8XK9BSCq06AvDLoyYmNyMPyaEdKcJ5bZcCM25hMDKgwUYxE55NF1M2XP5 GBcgT9Ahmm9GTsd2Ut1iS4HYo79LJIQkDFpVe7qwd18JFwznR9aDvzhr3Bzhj8pRoohU3A== X-Google-Smtp-Source: AGHT+IHOERFyNn3+U8UXkpPbrK6pTw4lEF1jgt96Kokb2uOhOgLekZSQoupVUMlDp/+dIqx358qyHg== X-Received: by 2002:a05:6a00:301f:b0:736:9e40:13b1 with SMTP id d2e1a72fcca58-74058b25ab3mr12038578b3a.23.1746327501982; Sat, 03 May 2025 19:58:21 -0700 (PDT) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-74059021067sm4210689b3a.107.2025.05.03.19.58.21 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 03 May 2025 19:58:21 -0700 (PDT) From: softworkz <ffmpegagent@gmail.com> X-Google-Original-From: softworkz <softworkz@hotmail.com> Message-Id: <7d28b0f03c493d5cf49f6866ce6a02b0269da6d0.1746327446.git.ffmpegagent@gmail.com> In-Reply-To: <pull.66.v10.ffstaging.FFmpeg.1746327446.ffmpegagent@gmail.com> References: <pull.66.v9.ffstaging.FFmpeg.1746260565.ffmpegagent@gmail.com> <pull.66.v10.ffstaging.FFmpeg.1746327446.ffmpegagent@gmail.com> Date: Sun, 04 May 2025 02:57:20 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v10 09/15] fftools/textformat: Add flags param to function avtext_print_integer() 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/7d28b0f03c493d5cf49f6866ce6a02b0269da6d0.1746327446.git.ffmpegagent@gmail.com/> List-Archive: <https://master.gitmailbox.com/ffmpegdev/> List-Post: <mailto:ffmpegdev@gitmailbox.com> From: softworkz <softworkz@hotmail.com> Make this function work analog to avtext_print_string() which already has a flags parameter. Signed-off-by: softworkz <softworkz@hotmail.com> --- fftools/ffprobe.c | 2 +- fftools/textformat/avtextformat.c | 24 ++++++++++++++++++------ fftools/textformat/avtextformat.h | 2 +- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index 1277b1e4f9..444810cf43 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -422,7 +422,7 @@ static void log_callback(void *ptr, int level, const char *fmt, va_list vl) avtext_print_string(tfc, k, pbuf.str, 0); \ } while (0) -#define print_int(k, v) avtext_print_integer(tfc, k, v) +#define print_int(k, v) avtext_print_integer(tfc, k, v, 0) #define print_q(k, v, s) avtext_print_rational(tfc, k, v, s) #define print_str(k, v) avtext_print_string(tfc, k, v, 0) #define print_str_opt(k, v) avtext_print_string(tfc, k, v, AV_TEXTFORMAT_PRINT_STRING_OPTIONAL) diff --git a/fftools/textformat/avtextformat.c b/fftools/textformat/avtextformat.c index 91469ef576..5b0f92d5cb 100644 --- a/fftools/textformat/avtextformat.c +++ b/fftools/textformat/avtextformat.c @@ -290,10 +290,20 @@ void avtext_print_section_footer(AVTextFormatContext *tctx) tctx->level--; } -void avtext_print_integer(AVTextFormatContext *tctx, const char *key, int64_t val) +void avtext_print_integer(AVTextFormatContext *tctx, const char *key, int64_t val, int flags) { const AVTextFormatSection *section; + av_assert0(tctx); + + if (tctx->show_optional_fields == SHOW_OPTIONAL_FIELDS_NEVER) + return; + + if (tctx->show_optional_fields == SHOW_OPTIONAL_FIELDS_AUTO + && (flags & AV_TEXTFORMAT_PRINT_STRING_OPTIONAL) + && !(tctx->formatter->flags & AV_TEXTFORMAT_FLAG_SUPPORTS_OPTIONAL_FIELDS)) + return; + av_assert0(key && tctx->level >= 0 && tctx->level < SECTION_MAX_NB_LEVELS); section = tctx->section[tctx->level]; @@ -445,10 +455,12 @@ int avtext_print_string(AVTextFormatContext *tctx, const char *key, const char * 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))) + if (tctx->show_optional_fields == SHOW_OPTIONAL_FIELDS_NEVER) + return 0; + + if (tctx->show_optional_fields == SHOW_OPTIONAL_FIELDS_AUTO + && (flags & AV_TEXTFORMAT_PRINT_STRING_OPTIONAL) + && !(tctx->formatter->flags & AV_TEXTFORMAT_FLAG_SUPPORTS_OPTIONAL_FIELDS)) return 0; if (section->show_all_entries || av_dict_get(section->entries_to_show, key, NULL, 0)) { @@ -504,7 +516,7 @@ void avtext_print_ts(AVTextFormatContext *tctx, const char *key, int64_t ts, int if ((!is_duration && ts == AV_NOPTS_VALUE) || (is_duration && ts == 0)) avtext_print_string(tctx, key, "N/A", AV_TEXTFORMAT_PRINT_STRING_OPTIONAL); else - avtext_print_integer(tctx, key, ts); + avtext_print_integer(tctx, key, ts, 0); } void avtext_print_data(AVTextFormatContext *tctx, const char *key, diff --git a/fftools/textformat/avtextformat.h b/fftools/textformat/avtextformat.h index 87f57d8c24..8f406de322 100644 --- a/fftools/textformat/avtextformat.h +++ b/fftools/textformat/avtextformat.h @@ -138,7 +138,7 @@ void avtext_print_section_header(AVTextFormatContext *tctx, const void *data, in void avtext_print_section_footer(AVTextFormatContext *tctx); -void avtext_print_integer(AVTextFormatContext *tctx, const char *key, int64_t val); +void avtext_print_integer(AVTextFormatContext *tctx, const char *key, int64_t val, int flags); int avtext_print_string(AVTextFormatContext *tctx, const char *key, const char *val, int flags); -- 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".