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 A008A4E736 for <ffmpegdev@gitmailbox.com>; Thu, 8 May 2025 00:05:59 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 794B568C02D; Thu, 8 May 2025 03:05:54 +0300 (EEST) Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9018F68BC1C for <ffmpeg-devel@ffmpeg.org>; Thu, 8 May 2025 03:05:47 +0300 (EEST) Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-39c1ef4acf2so360969f8f.0 for <ffmpeg-devel@ffmpeg.org>; Wed, 07 May 2025 17:05:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746662746; x=1747267546; darn=ffmpeg.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=I6XCqUzOwftcw/zzd+ChHLPiwmRAhz9VFgYF9rGSQ3Q=; b=c1aQMouUWHOcjC3TPavc8nN/lsTahY3PQ1RGc/NxhjJriwJ0Wb8RljPC5jpC41nVcd eu32JV3Wnq+HGC5tIzfgzBIV+ajOQxG1aG0EsfUvwr0gd3unhB/hOpCUuY0V9VEZaUzs ZwHaepdtdonOG7GKkHyu5s8zH8DN/2HI4UDTLxGT9u6y4ZvT9qiIb6QGSzk2xQmAZo3q v4iMfaN0DcTBSQEw381VabtnEWa3lIEz0nVfX+Dv6y3lFRrSfR7+SrXSlzr7xxJeFxpk P8Jd+Il5frDZ8laFC+PySM1jOHkEzBjbER15bN274WC24816JymuXiP/JJKMv5s8+JIP YNIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746662746; x=1747267546; h=user-agent:in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=I6XCqUzOwftcw/zzd+ChHLPiwmRAhz9VFgYF9rGSQ3Q=; b=SZJXK6m2Apls8RveE/dHwe4iFE2/dn3YzveucqLI2FrYG0LXuDhcmV4uzVpOOqeOXa K9MNszkPt7u8eksPp/9FX8xAO/0fgZLE7vwbG3V1h5n5dpZNXPdjMAeT4eU1JvNA9YpT 2zKvXOMBUm5dkMn4y7t99JJX8YqhR2cuEDpAon0M9yfaljY8TetQRCy07HviO2+HDsgj 4HTKpcRh6pqI3qTE8TTdoqi0PU1epGpiYRGYNarV8rifCSqOpJflO4WGxvPaAyR8CK6s ZxMWld06Ho5Ftu6OdljaHLo61Boss2IMJlScpeuYmuMtItxccQZ3zOY1a2hxkPGfFU7t ZkMg== X-Gm-Message-State: AOJu0YzwoARV1CUCJ96srTQbOuDwTMZqPQwYYz6JgSxwLTOSfZWY0Nsb KSpIEpuMNksLVd2coGQJBWai6qZbQZlvQaTDA5Zdmh76LqaP+/yF42eDfA== X-Gm-Gg: ASbGncsvUbCB1K7C6YbXfpJEil90I+44NA7evkKLLv/VarFCKynofyY0lWDXtjjQHAG SVNvB5BBmCQsNMyCN1HFPdfglY9D1YucgYZWX/K0hpD0cmXdDSyZR6Tr4BFizgNgv89AxQDTVSU bL6dwsx2UQuhsu3N01W+0v264Ixy6s0TT5u2gIemB5nglSrKUsMoKPCblDBRhbgxm9+oLNJi1xb mURx+RpfKGlowJsKq5zC0MVjPIvEFUXE2ob5CpWU+6EtqB/6SH/6qrybWY8AQi1mtDKT+16jNkB NnwTEvL0youEaHybgwC8rOh3aNAlXKuFUebT4tygf03u7Aa0OJQm3pKbR3//A71Zk7uctBFrUY5 Y+u9k X-Google-Smtp-Source: AGHT+IFLm7lfjQlTUWSNrnDrtctzTNOIsQKb2yV0I4A4Znpzb+dAIGmcfWzjcu9G5yZUu6p1haT8mg== X-Received: by 2002:a05:6000:188f:b0:39c:1257:dbaa with SMTP id ffacd0b85a97d-3a0ba106b69mr533465f8f.58.1746662746355; Wed, 07 May 2025 17:05:46 -0700 (PDT) Received: from mariano (dynamic-adsl-84-220-189-10.clienti.tiscali.it. [84.220.189.10]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a0b4acc0e8sm4105969f8f.6.2025.05.07.17.05.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 May 2025 17:05:45 -0700 (PDT) Received: by mariano (Postfix, from userid 1000) id D0E9CBFCE8; Thu, 8 May 2025 02:05:43 +0200 (CEST) Date: Thu, 8 May 2025 02:05:43 +0200 From: Stefano Sabatini <stefasab@gmail.com> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Message-ID: <aBv1V3pmE0iRt7Lq@mariano> Mail-Followup-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>, softworkz <softworkz-at-hotmail.com@ffmpeg.org> References: <pull.66.v9.ffstaging.FFmpeg.1746260565.ffmpegagent@gmail.com> <pull.66.v10.ffstaging.FFmpeg.1746327446.ffmpegagent@gmail.com> <3aa16bc39f30554808c946673dd3862380314788.1746327446.git.ffmpegagent@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <3aa16bc39f30554808c946673dd3862380314788.1746327446.git.ffmpegagent@gmail.com> User-Agent: Mutt/2.1.4 (2021-12-11) Subject: Re: [FFmpeg-devel] [PATCH v10 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/aBv1V3pmE0iRt7Lq@mariano/> List-Archive: <https://master.gitmailbox.com/ffmpegdev/> List-Post: <mailto:ffmpegdev@gitmailbox.com> On date Sunday 2025-05-04 02:57:17 +0000, softworkz wrote: > 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 b2c3aa3fc7..91469ef576 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); > @@ -201,7 +195,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; > @@ -212,6 +206,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 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; I'm not yet convinced this is needed - why not to use a flags field as in most other places? Also if we go with this we should use bool since it's used already in other places. _______________________________________________ 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".