MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / set_string_bool

Function set_string_bool

libavutil/opt.c:559–588  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

557}
558
559static int set_string_bool(void *obj, const AVOption *o, const char *val, int *dst)
560{
561 int n;
562
563 if (!val)
564 return 0;
565
566 if (!strcmp(val, "auto")) {
567 n = -1;
568 } else if (av_match_name(val, "true,y,yes,enable,enabled,on")) {
569 n = 1;
570 } else if (av_match_name(val, "false,n,no,disable,disabled,off")) {
571 n = 0;
572 } else {
573 char *end = NULL;
574 n = strtol(val, &end, 10);
575 if (val + strlen(val) != end)
576 goto fail;
577 }
578
579 if (n < o->min || n > o->max)
580 goto fail;
581
582 *dst = n;
583 return 0;
584
585fail:
586 av_log(obj, AV_LOG_ERROR, "Unable to parse \"%s\" option value \"%s\" as boolean\n", o->name, val);
587 return AVERROR(EINVAL);
588}
589
590static int set_string_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst,
591 int fmt_nb, int ((*get_fmt)(const char *)), const char *desc)

Callers 1

opt_set_elemFunction · 0.85

Calls 2

av_match_nameFunction · 0.85
av_logFunction · 0.85

Tested by

no test coverage detected