From: Marton Balint <cus@passwd.hu> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Subject: Re: [FFmpeg-devel] [PATCH] avutil/opt: add AV_OPT_FLAG_FORCE_CONST Date: Sun, 14 Apr 2024 22:30:13 +0200 (CEST) Message-ID: <4c7d22f2-1323-fffa-39ae-158a501f5f84@passwd.hu> (raw) In-Reply-To: <20240414195720.21646-1-timo@rothenpieler.org> On Sun, 14 Apr 2024, Timo Rothenpieler wrote: > --- > doc/APIchanges | 3 +++ > libavutil/opt.c | 14 ++++++++++++++ > libavutil/opt.h | 5 +++++ > libavutil/version.h | 2 +- > 4 files changed, 23 insertions(+), 1 deletion(-) Where do you intend to use this flag? So some justification or description of your plans is missing from the commit message. > > diff --git a/doc/APIchanges b/doc/APIchanges > index 63e7a47126..da2c87909b 100644 > --- a/doc/APIchanges > +++ b/doc/APIchanges > @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07 > > API changes, most recent first: > > +2024-04-xx - xxxxxxxxxx - lavu 59.15.101 - opt.h > + Add AV_OPT_FLAG_FORCE_CONST. > + > 2024-04-11 - xxxxxxxxxx - lavc 61.5.102 - avcodec.h > AVCodecContext.decoded_side_data may now be set by libavcodec after > calling avcodec_open2(). > diff --git a/libavutil/opt.c b/libavutil/opt.c > index d11e9d2ac5..9e51fa47f9 100644 > --- a/libavutil/opt.c > +++ b/libavutil/opt.c > @@ -365,6 +365,20 @@ static int set_string_number(void *obj, void *target_obj, const AVOption *o, con > if (o_named->flags & AV_OPT_FLAG_DEPRECATED) > av_log(obj, AV_LOG_WARNING, "The \"%s\" option is deprecated: %s\n", > o_named->name, o_named->help); > + } else if (o->flags & AV_OPT_FLAG_FORCE_CONST) { > + av_log(obj, AV_LOG_ERROR, "The \"%s\" option only accepts one of its pre-defined constant values", > + o->name); > + buf[0] = ':'; buf[1] = ' '; buf[2] = 0; > + for (o_named = NULL; o_named = av_opt_next(target_obj, o_named); ) { > + if (o_named->type == AV_OPT_TYPE_CONST && > + o_named->unit && o->unit && > + !strcmp(o_named->unit, o->unit)) { > + av_log(obj, AV_LOG_ERROR, "%s%s", buf, o_named->name); > + buf[0] = ','; > + } > + } > + av_log(obj, AV_LOG_ERROR, "\n"); > + return AVERROR(EINVAL); > } else { > if (o->unit) { > for (o_named = NULL; o_named = av_opt_next(target_obj, o_named); ) { > diff --git a/libavutil/opt.h b/libavutil/opt.h > index e6013662f6..67e2b687b2 100644 > --- a/libavutil/opt.h > +++ b/libavutil/opt.h > @@ -305,6 +305,11 @@ enum AVOptionType{ > * Set if option constants can also reside in child objects. > */ > #define AV_OPT_FLAG_CHILD_CONSTS (1 << 18) > +/** > + * The option will only accept AV_OPT_TYPE_CONST values. > + * Any other user supplied values will be rejected. > + */ What about built-in named constants, such as min/max/default? > +#define AV_OPT_FLAG_FORCE_CONST (1 << 19) > > /** > * May be set as default_val for AV_OPT_TYPE_FLAG_ARRAY options. > diff --git a/libavutil/version.h b/libavutil/version.h > index 1f2bddc022..5de2d92146 100644 > --- a/libavutil/version.h > +++ b/libavutil/version.h > @@ -80,7 +80,7 @@ > > #define LIBAVUTIL_VERSION_MAJOR 59 > #define LIBAVUTIL_VERSION_MINOR 15 > -#define LIBAVUTIL_VERSION_MICRO 100 > +#define LIBAVUTIL_VERSION_MICRO 101 > > #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ > LIBAVUTIL_VERSION_MINOR, \ > -- > 2.34.1 Regards, Marton _______________________________________________ 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".
next prev parent reply other threads:[~2024-04-14 20:30 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-04-14 19:57 Timo Rothenpieler 2024-04-14 20:30 ` Marton Balint [this message] 2024-04-14 20:35 ` Timo Rothenpieler 2024-04-16 0:07 ` Michael Niedermayer 2024-04-16 8:30 ` Timo Rothenpieler
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=4c7d22f2-1323-fffa-39ae-158a501f5f84@passwd.hu \ --to=cus@passwd.hu \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git