*/
/**
- * @file opt.c
+ * @file libavcodec/opt.c
* AVOptions
* @author Michael Niedermayer <michaelni@gmx.at>
*/
return AVERROR(ENOENT);
if(o->max*den < num*intnum || o->min*den > num*intnum) {
- av_log(NULL, AV_LOG_ERROR, "Value %lf for parameter '%s' out of range\n", num, name);
+ av_log(obj, AV_LOG_ERROR, "Value %lf for parameter '%s' out of range\n", num, name);
return AVERROR(ERANGE);
}
const AVOption *o= av_find_opt(obj, name, NULL, 0, 0);
if (o_out)
*o_out = o;
- if(!o)
+ if(!o) {
+ av_log(obj, AV_LOG_ERROR, "Unknown option '%s'\n", name);
return AVERROR(ENOENT);
+ }
if(!val || o->offset<=0)
return AVERROR(EINVAL);
else if(!strcmp(buf, "all" )) d= ~0;
else {
if (error)
- av_log(NULL, AV_LOG_ERROR, "Unable to parse option value \"%s\": %s\n", val, error);
+ av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\": %s\n", val, error);
return AVERROR(EINVAL);
}
}
return 0;
}
+#if LIBAVCODEC_VERSION_MAJOR < 53
const AVOption *av_set_string2(void *obj, const char *name, const char *val, int alloc){
const AVOption *o;
if (av_set_string3(obj, name, val, alloc, &o) < 0)
}
const AVOption *av_set_string(void *obj, const char *name, const char *val){
- return av_set_string2(obj, name, val, 0);
+ const AVOption *o;
+ if (av_set_string3(obj, name, val, 0, &o) < 0)
+ return NULL;
+ return o;
}
+#endif
const AVOption *av_set_double(void *obj, const char *name, double n){
return av_set_number(obj, name, n, 1, 1);