When querying a range of formats of an avdevice, sometimes for a given format the queried option is not available. This is not an error as the user is asking for a valid capability, it just doesn't always apply to all the matching formats of the device. This is now communicated through a special value (like 0 or -1), but that is a problem (like always with special values). The is_set field alleviates the use of special values. This will be used when implementing the avdevice capabilities API for avdevice/dshow in a later commit
Signed-off-by: Diederick Niehorster <dcni...@gmail.com> --- libavutil/opt.c | 1 + libavutil/opt.h | 5 +++++ libavutil/version.h | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libavutil/opt.c b/libavutil/opt.c index 4124efd9b6..ab127b30fa 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -1865,6 +1865,7 @@ int av_opt_query_ranges_default(AVOptionRanges **ranges_arg, void *obj, const ch ranges->nb_ranges = 1; ranges->nb_components = 1; range->is_range = 1; + range->is_set = 1; range->value_min = field->min; range->value_max = field->max; diff --git a/libavutil/opt.h b/libavutil/opt.h index c2329e5589..ac0b4567a6 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -325,6 +325,11 @@ typedef struct AVOptionRange { * If set to 1 the struct encodes a range, if set to 0 a single value. */ int is_range; + /** + * Is set flag. + * If set to 1 the struct contains a value, if set to 0, the range is empty. + */ + int is_set; } AVOptionRange; /** diff --git a/libavutil/version.h b/libavutil/version.h index e11eaa20d0..34b83112de 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 57 -#define LIBAVUTIL_VERSION_MINOR 0 +#define LIBAVUTIL_VERSION_MINOR 1 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ -- 2.28.0.windows.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".