avutil/opt: Fix max/min checking in av_opt_set() for AV_OPT_TYPE_VIDEO_RATE

Fixes Ticket5618

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2016-06-09 05:01:26 +02:00
parent 4888932c4d
commit 37bb600405
2 changed files with 8 additions and 3 deletions

View File

@ -76,7 +76,7 @@ static const AVOption test_options[]= {
{"size", "set size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, { .str="200x300" }, 0, 0, 1 },
{"pix_fmt", "set pixfmt", OFFSET(pix_fmt), AV_OPT_TYPE_PIXEL_FMT, { .i64 = AV_PIX_FMT_0BGR }, -1, INT_MAX, 1 },
{"sample_fmt", "set samplefmt", OFFSET(sample_fmt), AV_OPT_TYPE_SAMPLE_FMT, { .i64 = AV_SAMPLE_FMT_S16 }, -1, INT_MAX, 1 },
{"video_rate", "set videorate", OFFSET(video_rate), AV_OPT_TYPE_VIDEO_RATE, { .str = "25" }, 0, 0, 1 },
{"video_rate", "set videorate", OFFSET(video_rate), AV_OPT_TYPE_VIDEO_RATE, { .str = "25" }, 0, INT_MAX, 1 },
{"duration", "set duration", OFFSET(duration), AV_OPT_TYPE_DURATION, { .i64 = 1000 }, 0, INT64_MAX, 1 },
{"color", "set color", OFFSET(color), AV_OPT_TYPE_COLOR, { .str = "pink" }, 0, 0, 1 },
{"cl", "set channel layout", OFFSET(channel_layout), AV_OPT_TYPE_CHANNEL_LAYOUT, { .i64 = AV_CH_LAYOUT_HEXAGONAL }, 0, INT64_MAX, 1 },

View File

@ -462,8 +462,13 @@ int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
return set_string_number(obj, target_obj, o, val, dst);
case AV_OPT_TYPE_IMAGE_SIZE:
return set_string_image_size(obj, o, val, dst);
case AV_OPT_TYPE_VIDEO_RATE:
return set_string_video_rate(obj, o, val, dst);
case AV_OPT_TYPE_VIDEO_RATE: {
AVRational tmp;
ret = set_string_video_rate(obj, o, val, &tmp);
if (ret < 0)
return ret;
return write_number(obj, o, dst, 1, tmp.den, tmp.num);
}
case AV_OPT_TYPE_PIXEL_FMT:
return set_string_pixel_fmt(obj, o, val, dst);
case AV_OPT_TYPE_SAMPLE_FMT: