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 20F594E82F
	for <ffmpegdev@gitmailbox.com>; Thu,  8 May 2025 01:38:34 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 19A6768C21A;
	Thu,  8 May 2025 04:38:16 +0300 (EEST)
Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com
 [209.85.215.173])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 46DBF68C121
 for <ffmpeg-devel@ffmpeg.org>; Thu,  8 May 2025 04:37:38 +0300 (EEST)
Received: by mail-pg1-f173.google.com with SMTP id
 41be03b00d2f7-af908bb32fdso450750a12.1
 for <ffmpeg-devel@ffmpeg.org>; Wed, 07 May 2025 18:37:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1746668256; x=1747273056; 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=epW30tsXdj8EyQMeNTrkLKePapI0AqiopNaZ4pjiW3I=;
 b=hcjqjW5P7s5SpdUUmSLIFPCoUmW1WtIQK5l01Mxrt7pKdIVeAC0aCuGXIAe38Ix+ST
 klRhRDjAhB3bPjicxRkYKQVE8AEl635IloXnbzJO0FcbaW31ZmuwjiDd7TUGzNv86qqE
 g/b+qhuNHoWD0VmhGyH4/wsp5OvJWa4PEMlnqyzS5cGntkVBpvI5jmp70jsfENMDoQkB
 Q7ZpedVO8zkPMnIEaGLu+lJNmm3rDA8WzFs/O1cOJdRDRS8dFjLDh0gA68O40YJfKe7K
 kD6/JAtjB7EfyVEYug1eASuIwqkfRbGVyxWQ3WKlrWX5my4bT5Ye9lvaFJNl9kc12GzN
 sLcg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1746668256; x=1747273056;
 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=epW30tsXdj8EyQMeNTrkLKePapI0AqiopNaZ4pjiW3I=;
 b=tP7DTb6g5orSsdF1Fu2WejyaBbPMN3D8WK7Fj6U21SjuW0HBbErbqqPBsxJZ2Z8t2U
 BFwMAX+20AcMkASgDGWOki+50Ru2LfUnlFBmC0OLRY/q5Jm3dbrHfWef8e/+6v/aQXxf
 Fc3ABbhzybqaSU7eVA+tZ9fhxvwZa3u7CIRuqj7r1PqakHJEAav0g1ZD7sOm/rrByTpq
 +g9G+65Cj6Ia9EinxOF+Fo39bottoy79UsRCYmUuk1l0KN9OpAH2EGvqCnHtKpZBue5/
 qdxCRD0QjL10Py8XucS7Et7GZgITVUCDr3YpxPguUDqBOFyUHXghQ8g+d4F+iU+v51qT
 V/MA==
X-Gm-Message-State: AOJu0YzTotLaX6PhoHJ0CzFnST/2EEdj1vj9UOYbiXWajY/6I+SyzHlC
 P7FEPXkcV0yz0GlGshTuYV9HdcQ3CShvj2BotwX14rvYU2JcdyOlmV4mqw==
X-Gm-Gg: ASbGnctNI/fbcjX7M0oPqVwxcnOEMRpiI6fZHyjYOAe7crq3Xynvd/noLp/fYGfKqg7
 BnzrMEnthgkvvtjd/NABwu6FKrRXsTGsFmuZwj8psJtt9DwMPlDApJN6Stjv6oDeg9WkQ5gzfdq
 8SK7/Gpj1nPY2GSP475DhxurJ64tqi/RKVzF4KSMTXq7zhExMiiZRVEDmjTEY5FXDrNFCatEPXz
 eZVpgB8C5o71C04hTUAKbCEe30JG61VKigjU+sV6uXIzIasgtu0J01B97kjYH2w5m3184PGN1M+
 yEnLIm/YGLlgqXrd/YN6Se9UbNFXHWVbyF3oJKXjuPzfOgcE9LZDKY2NW0uILu1wOzZUOA==
X-Google-Smtp-Source: AGHT+IEduzOAsBjHPk8vSf3OHE1ndVqE3W5XBeyTX9/i1l9dIQMSC1tLm6wXDqfQ5cTT5chxDj1+5g==
X-Received: by 2002:a05:6a20:3184:b0:1f0:e2d0:fb65 with SMTP id
 adf61e73a8af0-21599f8c394mr1817463637.2.1746668256086; 
 Wed, 07 May 2025 18:37:36 -0700 (PDT)
Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50])
 by smtp.gmail.com with ESMTPSA id
 d2e1a72fcca58-740590207e3sm12389953b3a.94.2025.05.07.18.37.35
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Wed, 07 May 2025 18:37:35 -0700 (PDT)
From: softworkz <ffmpegagent@gmail.com>
X-Google-Original-From: softworkz <softworkz@hotmail.com>
Message-Id: <4c0452cff799ede06ef2ac893473ae53db66483d.1746668216.git.ffmpegagent@gmail.com>
In-Reply-To: <pull.66.v12.ffstaging.FFmpeg.1746668216.ffmpegagent@gmail.com>
References: <pull.66.v11.ffstaging.FFmpeg.1746398104.ffmpegagent@gmail.com>
 <pull.66.v12.ffstaging.FFmpeg.1746668216.ffmpegagent@gmail.com>
Date: Thu, 08 May 2025 01:36:47 +0000
Fcc: Sent
MIME-Version: 1.0
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH v12 06/15] fftools/textformat: Introduce
 AVTextFormatOptions for avtext_context_open()
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/4c0452cff799ede06ef2ac893473ae53db66483d.1746668216.git.ffmpegagent@gmail.com/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>

From: softworkz <softworkz@hotmail.com>

This allows future addition of options without
changes to the signature of avtext_context_open().

Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: softworkz <softworkz@hotmail.com>
---
 fftools/ffprobe.c                 | 13 +++++++++----
 fftools/textformat/avtextformat.c | 18 ++++++------------
 fftools/textformat/avtextformat.h | 16 +++++++++-------
 3 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index f33531fd84..cb8b5e17f9 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -3167,10 +3167,15 @@ int main(int argc, char **argv)
     if (ret < 0)
         goto end;
 
-    if ((ret = avtext_context_open(&tctx, f, wctx, f_args,
-                           sections, FF_ARRAY_ELEMS(sections), show_value_unit,
-                            use_value_prefix, use_byte_value_binary_prefix, use_value_sexagesimal_format,
-                            show_optional_fields, show_data_hash)) >= 0) {
+    AVTextFormatOptions tf_options = {
+        .show_optional_fields = show_optional_fields,
+        .show_value_unit = show_value_unit,
+        .use_value_prefix = use_value_prefix,
+        .use_byte_value_binary_prefix = use_byte_value_binary_prefix,
+        .use_value_sexagesimal_format = use_value_sexagesimal_format,
+    };
+
+    if ((ret = avtext_context_open(&tctx, f, wctx, f_args, sections, FF_ARRAY_ELEMS(sections), tf_options, show_data_hash)) >= 0) {
         if (f == &avtextformatter_xml)
             tctx->string_validation_utf8_flags |= AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES;
 
diff --git a/fftools/textformat/avtextformat.c b/fftools/textformat/avtextformat.c
index ec167e3bf1..dd595f15ba 100644
--- a/fftools/textformat/avtextformat.c
+++ b/fftools/textformat/avtextformat.c
@@ -125,13 +125,7 @@ void avtext_context_close(AVTextFormatContext **ptctx)
 
 
 int avtext_context_open(AVTextFormatContext **ptctx, const AVTextFormatter *formatter, AVTextWriterContext *writer_context, const char *args,
-                        const AVTextFormatSection *sections, int nb_sections,
-                        int show_value_unit,
-                        int use_value_prefix,
-                        int use_byte_value_binary_prefix,
-                        int use_value_sexagesimal_format,
-                        int show_optional_fields,
-                        char *show_data_hash)
+                        const AVTextFormatSection *sections, int nb_sections, AVTextFormatOptions options, char *show_data_hash)
 {
     AVTextFormatContext *tctx;
     int i, ret = 0;
@@ -154,11 +148,11 @@ int avtext_context_open(AVTextFormatContext **ptctx, const AVTextFormatter *form
         goto fail;
     }
 
-    tctx->show_value_unit = show_value_unit;
-    tctx->use_value_prefix = use_value_prefix;
-    tctx->use_byte_value_binary_prefix = use_byte_value_binary_prefix;
-    tctx->use_value_sexagesimal_format = use_value_sexagesimal_format;
-    tctx->show_optional_fields = show_optional_fields;
+    tctx->show_value_unit = options.show_value_unit;
+    tctx->use_value_prefix = options.use_value_prefix;
+    tctx->use_byte_value_binary_prefix = options.use_byte_value_binary_prefix;
+    tctx->use_value_sexagesimal_format = options.use_value_sexagesimal_format;
+    tctx->show_optional_fields = options.show_optional_fields;
 
     if (nb_sections > SECTION_MAX_NB_SECTIONS) {
         av_log(tctx, AV_LOG_ERROR, "The number of section definitions (%d) is larger than the maximum allowed (%d)\n", nb_sections, SECTION_MAX_NB_SECTIONS);
diff --git a/fftools/textformat/avtextformat.h b/fftools/textformat/avtextformat.h
index 8ff503401a..87f57d8c24 100644
--- a/fftools/textformat/avtextformat.h
+++ b/fftools/textformat/avtextformat.h
@@ -117,17 +117,19 @@ struct AVTextFormatContext {
     unsigned int string_validation_utf8_flags;
 };
 
+typedef struct AVTextFormatOptions {
+    int show_optional_fields;
+    int show_value_unit;
+    int use_value_prefix;
+    int use_byte_value_binary_prefix;
+    int use_value_sexagesimal_format;
+} AVTextFormatOptions;
+
 #define AV_TEXTFORMAT_PRINT_STRING_OPTIONAL 1
 #define AV_TEXTFORMAT_PRINT_STRING_VALIDATE 2
 
 int avtext_context_open(AVTextFormatContext **ptctx, const AVTextFormatter *formatter, AVTextWriterContext *writer_context, const char *args,
-                        const AVTextFormatSection *sections, int nb_sections,
-                        int show_value_unit,
-                        int use_value_prefix,
-                        int use_byte_value_binary_prefix,
-                        int use_value_sexagesimal_format,
-                        int show_optional_fields,
-                        char *show_data_hash);
+                        const AVTextFormatSection *sections, int nb_sections, AVTextFormatOptions options, char *show_data_hash);
 
 void avtext_context_close(AVTextFormatContext **tctx);
 
-- 
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".