| 948 | } |
| 949 | |
| 950 | static int set_format(void *obj, const char *name, int fmt, int search_flags, |
| 951 | enum AVOptionType type, const char *desc, int nb_fmts) |
| 952 | { |
| 953 | const AVOption *o; |
| 954 | int *dst; |
| 955 | int min, max, ret; |
| 956 | |
| 957 | ret = opt_set_init(obj, name, search_flags, type, NULL, &o, (void**)&dst); |
| 958 | if (ret < 0) |
| 959 | return ret; |
| 960 | |
| 961 | min = FFMAX(o->min, -1); |
| 962 | max = FFMIN(o->max, nb_fmts-1); |
| 963 | |
| 964 | if (fmt < min || fmt > max) { |
| 965 | av_log(obj, AV_LOG_ERROR, |
| 966 | "Value %d for parameter '%s' out of %s format range [%d - %d]\n", |
| 967 | fmt, name, desc, min, max); |
| 968 | return AVERROR(ERANGE); |
| 969 | } |
| 970 | *dst = fmt; |
| 971 | return 0; |
| 972 | } |
| 973 | |
| 974 | int av_opt_set_pixel_fmt(void *obj, const char *name, enum AVPixelFormat fmt, int search_flags) |
| 975 | { |
no test coverage detected