[FFmpeg-devel] [PATCH 24/35] avutil/opt: AVOptionRange gains is_set field.

Diederick C. Niehorster dcnieho at gmail.com
Fri Jun 11 19:46:34 EEST 2021


On Tue, Jun 8, 2021 at 1:45 AM Andreas Rheinhardt
<andreas.rheinhardt at outlook.com> wrote:
> This has absolutely nothing to do with full/limited range, but rather
> whether the AVOptionRange contains an interval or a single value.
> (Not that I know why this needs to be set explicitly and not implicitly
> via is_range = value_min < value_max.)

Hmm, instead of adding a new field, would a bit of documentation be a
good idea? There are three cases:
1. output is a range. Then value_min < value_max.
2. output is set but not a range (single value): Then
value_min==value_max. (We probably shouldn't remove the is_range flag?
OTOH, it is not used in the ffmpeg code base at all...)
3. output is not set: then value_min>value_max (and perhaps special
values value_min=0, value_max=-1. A pair of special values does not
have the problem that a single special value has: how to distinguish
it from an actual value)

Then users can easily determine themselves:
is_set = value_min > value_max (or preferrably value_min==0 && value_max==-1)
is_range = value_min < value_max

So two questions:
1. What do you think of documenting case 3 instead of adding a new field to API?
2. What do you think of removing is_range?

Cheers,
Dee


More information about the ffmpeg-devel mailing list