Lines Matching refs:val

189 static int set_string_binary(void *obj, const AVOption *o, const char *val, uint8_t **dst)
198 if (!val || !(len = strlen(val)))
208 while (*val) {
209 int a = hexchar2int(*val++);
210 int b = hexchar2int(*val++);
223 static int set_string(void *obj, const AVOption *o, const char *val, uint8_t **dst)
226 *dst = av_strdup(val);
238 static int set_string_number(void *obj, void *target_obj, const AVOption *o, const char *val, void *dst)
245 if (sscanf(val, "%d%*1[:/]%d%c", &num, &den, &c) == 2) {
260 if (*val == '+' || *val == '-')
261 cmd = *(val++);
262 for (; i < sizeof(buf) - 1 && val[i] && val[i] != '+' && val[i] != '-'; i++)
263 buf[i] = val[i];
273 const AVOption *o_named = av_opt_find(target_obj, i ? buf : val, o->unit, 0, search_flags);
307 res = av_expr_parse_and_eval(&d, i ? buf : val, const_names,
310 av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\"\n", val);
325 val += i;
326 if (!i || !*val)
331 static int set_string_image_size(void *obj, const AVOption *o, const char *val, int *dst)
335 if (!val || !strcmp(val, "none")) {
340 ret = av_parse_video_size(dst, dst + 1, val);
342 av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as image size\n", val);
346 static int set_string_video_rate(void *obj, const AVOption *o, const char *val, AVRational *dst)
348 int ret = av_parse_video_rate(dst, val);
350 av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as video rate\n", val);
354 static int set_string_color(void *obj, const AVOption *o, const char *val, uint8_t *dst)
358 if (!val) {
361 ret = av_parse_color(dst, val, -1, obj);
363 av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as color\n", val);
369 static const char *get_bool_name(int val)
371 if (val < 0)
373 return val ? "true" : "false";
376 static int set_string_bool(void *obj, const AVOption *o, const char *val, int *dst)
380 if (!val)
383 if (!strcmp(val, "auto")) {
385 } else if (av_match_name(val, "true,y,yes,enable,enabled,on")) {
387 } else if (av_match_name(val, "false,n,no,disable,disabled,off")) {
391 n = strtol(val, &end, 10);
392 if (val + strlen(val) != end)
403 av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as boolean\n", val);
407 static int set_string_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst,
412 if (!val || !strcmp(val, "none")) {
415 fmt = get_fmt(val);
418 fmt = strtol(val, &tail, 0);
421 "Unable to parse option value \"%s\" as %s\n", val, desc);
447 static int set_string_pixel_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst)
449 return set_string_fmt(obj, o, val, dst,
453 static int set_string_sample_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst)
455 return set_string_fmt(obj, o, val, dst,
459 static int set_string_dict(void *obj, const AVOption *o, const char *val, uint8_t **dst)
463 if (val) {
464 int ret = av_dict_parse_string(&options, val, "=", ":", 0);
478 const char *val, void *dst)
482 if (!val)
484 return av_channel_layout_from_string(channel_layout, val);
487 int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
495 if (!val && (o->type != AV_OPT_TYPE_STRING &&
515 return set_string_bool(obj, o, val, dst);
517 return set_string(obj, o, val, dst);
519 return set_string_binary(obj, o, val, dst);
527 return set_string_number(obj, target_obj, o, val, dst);
529 return set_string_image_size(obj, o, val, dst);
532 ret = set_string_video_rate(obj, o, val, &tmp);
538 return set_string_pixel_fmt(obj, o, val, dst);
540 return set_string_sample_fmt(obj, o, val, dst);
544 if (val) {
545 if ((ret = av_parse_time(&usecs, val, 1)) < 0) {
546 av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as duration\n", val);
559 return set_string_color(obj, o, val, dst);
563 if (!val || !strcmp(val, "none")) {
566 int64_t cl = av_get_channel_layout(val);
568 av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as channel layout\n", val);
578 ret = set_string_channel_layout(obj, o, val, dst);
580 av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as channel layout\n", val);
585 return set_string_dict(obj, o, val, dst);
594 const char *val, vartype *name ## _out) \
598 return set_string_number(obj, obj, o, val, name ## _out); \
624 int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)
626 return set_number(obj, name, 1, 1, val, search_flags);
629 int av_opt_set_double(void *obj, const char *name, double val, int search_flags)
631 return set_number(obj, name, val, 1, 1, search_flags);
634 int av_opt_set_q(void *obj, const char *name, AVRational val, int search_flags)
636 return set_number(obj, name, val.num, val.den, 1, search_flags);
639 int av_opt_set_bin(void *obj, const char *name, const uint8_t *val, int len, int search_flags)
664 memcpy(ptr, val, len);
691 int av_opt_set_video_rate(void *obj, const char *name, AVRational val, int search_flags)
703 if (val.num <= 0 || val.den <= 0)
705 return set_number(obj, name, val.num, val.den, 1, search_flags);
767 int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val,
781 av_dict_copy(dst, val, 0);
1496 double val;
1497 val = opt->default_val.dbl;
1498 write_number(s, opt, dst, val, 1, 1);
1502 AVRational val;
1503 val = av_d2q(opt->default_val.dbl, INT_MAX);
1504 write_number(s, opt, dst, 1, val.den, val.num);
1556 char *val;
1564 val = av_get_token(buf, pairs_sep);
1565 if (!val) {
1575 av_log(ctx, AV_LOG_DEBUG, "Setting entry with key '%s' to value '%s'\n", key, val);
1577 ret = av_opt_set(ctx, key, val, AV_OPT_SEARCH_CHILDREN);
1582 av_free(val);
1650 char *key = NULL, *val;
1656 if (!(val = av_get_token(&opts, pairs_sep))) {
1662 *rval = val;