From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 2B46B48A19 for ; Sat, 22 Jun 2024 13:37:10 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D0C5268D58C; Sat, 22 Jun 2024 16:37:06 +0300 (EEST) Received: from alt2.a-painless.mh.aa.net.uk (unknown [81.187.30.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E27BE68D454 for ; Sat, 22 Jun 2024 16:37:00 +0300 (EEST) Received: from e.1.8.1.b.a.7.8.8.f.6.b.d.8.8.4.0.5.8.0.9.1.8.0.0.b.8.0.1.0.0.2.ip6.arpa ([2001:8b0:819:850:488d:b6f8:87ab:181e] helo=andrews-2024-laptop.sayers) by painless-a.thn.aa.net.uk with smtp (Exim 4.96) (envelope-from ) id 1sL0vM-004ww3-0L for ffmpeg-devel@ffmpeg.org; Sat, 22 Jun 2024 14:37:00 +0100 Date: Sat, 22 Jun 2024 14:36:58 +0100 From: Andrew Sayers To: FFmpeg development discussions and patches Message-ID: References: <20240622131533.1313814-1-ffmpeg-devel@pileofstuff.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH] avfilter/af_afade: fix opt_type for nb_samples/ns X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Sat, Jun 22, 2024 at 03:20:52PM +0200, Andreas Rheinhardt wrote: > Andrew Sayers: > > The actual value is an int64_t, and is accessed elsewhere as AV_OPT_TYPE_INT64. > > > > Accessing it as INT will likely cause bugs on some 32-bit architectures. > > Whether this works or not will depend upon endianness, not on whether > the architecture is 32-bit (as long as int is 32bits, which is mostly > true for 64-bit architectures). > > > --- > > libavfilter/af_afade.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/libavfilter/af_afade.c b/libavfilter/af_afade.c > > index 3a45873460..c79271ec92 100644 > > --- a/libavfilter/af_afade.c > > +++ b/libavfilter/af_afade.c > > @@ -452,8 +452,8 @@ const AVFilter ff_af_afade = { > > #if CONFIG_ACROSSFADE_FILTER > > > > static const AVOption acrossfade_options[] = { > > - { "nb_samples", "set number of samples for cross fade duration", OFFSET(nb_samples), AV_OPT_TYPE_INT, {.i64 = 44100}, 1, INT32_MAX/10, FLAGS }, > > - { "ns", "set number of samples for cross fade duration", OFFSET(nb_samples), AV_OPT_TYPE_INT, {.i64 = 44100}, 1, INT32_MAX/10, FLAGS }, > > + { "nb_samples", "set number of samples for cross fade duration", OFFSET(nb_samples), AV_OPT_TYPE_INT64, {.i64 = 44100}, 1, INT32_MAX/10, FLAGS }, > > + { "ns", "set number of samples for cross fade duration", OFFSET(nb_samples), AV_OPT_TYPE_INT64, {.i64 = 44100}, 1, INT32_MAX/10, FLAGS }, > > { "duration", "set cross fade duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0 }, 0, 60000000, FLAGS }, > > { "d", "set cross fade duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0 }, 0, 60000000, FLAGS }, > > { "overlap", "overlap 1st stream end with 2nd stream start", OFFSET(overlap), AV_OPT_TYPE_BOOL, {.i64 = 1 }, 0, 1, FLAGS }, > > LGTM. How did you find this? It was a side-effect of yet another attempt to understand the codebase - looking for struct members with more than one associated AVOptionType. FWIW, the other oddities uncovered were: * libavformat/rtsp.c treats stimeout as both INT64 and DURATION (should probably have been caught at the time, but fixing it would likely break scripts that expect the current CLI behaviour) * libavdevice/v4l2.c treats list_format as both INT and CONST (not a bug, but a comment explaining this clever trick would have been nice) * libavfilter/buffersrc.c lets you set w/h separately or as video_size (not a bug, and I assume there's a reason for doing it this way) _______________________________________________ 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".