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 0798748838 for <ffmpegdev@gitmailbox.com>; Thu, 24 Apr 2025 01:14:25 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A31AA68B814; Thu, 24 Apr 2025 04:13:48 +0300 (EEST) Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 59BBA68B412 for <ffmpeg-devel@ffmpeg.org>; Thu, 24 Apr 2025 04:13:46 +0300 (EEST) Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-3015001f862so415293a91.3 for <ffmpeg-devel@ffmpeg.org>; Wed, 23 Apr 2025 18:13:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1745457224; x=1746062024; 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=cw7OLDHut0mFjGX4h6khBfYTkxTLXqhqxA3f6BGyYiU=; b=dPz+MCNI5vue/clhu+Ovqi39qbzZV+8vay/CKE2/DMCHCImpWuUtsH4ZEFZa2dseE0 ZomrgM6thB4F2hV3yHTuPqoj5NeRG+Bty9rLCgtpUPubfbL5AFREUU8+APWnxcrMx65g nReCSineb+VMmSarDOAUZkGGqemxVAkH4Ado8g/dZSZVwNzi/rn88chWtKlmSO80VfAL l22UhMKckMlm5ixbtp6vnrMmR6suzEMn63tzbLYYHIgdjCJRieVWoRNfFLG2Db1JjBIe d23ZPfByvc63mW64sceFyvdyXz50caXpZQkOvJEZPW1zeUUOv0fU6HBmNGoTFhRQ2GjX +uDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745457224; x=1746062024; 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=cw7OLDHut0mFjGX4h6khBfYTkxTLXqhqxA3f6BGyYiU=; b=UprzvWfD4+P415SKZXFdjvExGL8nImd5WDcJEC5kB1S4ceaf8zH6Ji3VpRGY5sBBQS Sv0NxgDCwYnPCfrFkqQpn5XUQ1w8Uph/szmsRFwvydh0yUfGUfLgZ3IExPqQAA9ja4UQ b/FIk6+sc2ajbaxkRjW8BR800ojfyPanLeafTSJz9MCXdtZu4V7PeD/DSXGO/1DByKPB ILiDKxRCIMUjbtn5BNeKvj0GatXoNHmVNgxGPhGTdrw0xQ1C5scKGi/fNi+9+rfNWIFm J1blExQmjHz4mbbStxZaoBsLI9oS49PpY+5iFCCvboJTwL4SIHqn3WIYpE9LlPxbtan/ AVhQ== X-Gm-Message-State: AOJu0Yz1TuaaYKvUqdAM94/qIzXAZzNtuLD9mzH/eSE1oleb7XtS7jUh Y31QnlOJbzqaASCRNN2OQD51238KAFN5pdfSnCsVVs3OjP7qHpSxA8OCdg== X-Gm-Gg: ASbGncvO7clhWTy9JgSm+8KxQCmXsnj1tQTuKYPL1dO35jc7AhrGK77VaTMb+xhVYhI fz+PeVPbTVSuhHCFnwwnnu3hrzO9aIwfUKPrUdNUSyN13wH83rfzTDkYEuyFHwEIsRU3bQSqdwl R+TOt/gyjXefclgfuCM7qZI2IA+gycKfaYXt9A2GzZTxmi7Qx3oz2i/ht/z7EmYYewD3Xkh7Ste t5DUBsrgUU+hmL9EeYuv4RMnOSprXdzwD4hGTWzpjq+/LUwJzWakFnGApRBGnGSbsX7Z3HW6dnP M+kDU1vLM12SIf5jvKcnaCtwB7KG/YkHwZTBHs8NRB/m7qVC/BbZWrOyFIE= X-Google-Smtp-Source: AGHT+IG05xb6dua5gkSuO798nXf9kPN9FtfjHfx6X7gWg28UcjgKszJQDk0X0TwxG8qq8LRfgjOBcw== X-Received: by 2002:a17:90b:52c8:b0:305:2d27:7c9f with SMTP id 98e67ed59e1d1-309ed2a3975mr1404372a91.16.1745457224541; Wed, 23 Apr 2025 18:13:44 -0700 (PDT) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-22db522216asm1093995ad.241.2025.04.23.18.13.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Apr 2025 18:13:44 -0700 (PDT) From: softworkz <ffmpegagent@gmail.com> X-Google-Original-From: softworkz <softworkz@hotmail.com> Message-Id: <97ab9e0426cc92c80c413dbf2c342b68b9e9730d.1745457192.git.ffmpegagent@gmail.com> In-Reply-To: <pull.66.v6.ffstaging.FFmpeg.1745457192.ffmpegagent@gmail.com> References: <pull.66.v5.ffstaging.FFmpeg.1745358943.ffmpegagent@gmail.com> <pull.66.v6.ffstaging.FFmpeg.1745457192.ffmpegagent@gmail.com> Date: Thu, 24 Apr 2025 01:13:02 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v6 04/13] 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/97ab9e0426cc92c80c413dbf2c342b68b9e9730d.1745457192.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 | 21 ++++++++------------- fftools/textformat/avtextformat.h | 16 +++++++++------- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index f5c83925b9..1277b1e4f9 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -3168,10 +3168,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 5ba427d6f2..b8e283d00c 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; @@ -155,11 +149,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); @@ -202,7 +196,7 @@ int avtext_context_open(AVTextFormatContext **ptctx, const AVTextFormatter *form av_dict_free(&opts); } - if (show_data_hash) + if (show_data_hash) { if ((ret = av_hash_alloc(&tctx->hash, show_data_hash)) < 0) { if (ret == AVERROR(EINVAL)) { const char *n; @@ -213,6 +207,7 @@ int avtext_context_open(AVTextFormatContext **ptctx, const AVTextFormatter *form } goto fail; } + } /* validate replace string */ { diff --git a/fftools/textformat/avtextformat.h b/fftools/textformat/avtextformat.h index aea691f351..071149c5be 100644 --- a/fftools/textformat/avtextformat.h +++ b/fftools/textformat/avtextformat.h @@ -118,17 +118,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".