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

Function parse_number

fftools/cmdutils.c:84–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84int parse_number(const char *context, const char *numstr, enum OptionType type,
85 double min, double max, double *dst)
86{
87 char *tail;
88 const char *error;
89 double d = av_strtod(numstr, &tail);
90 if (*tail)
91 error = "Expected number for %s but found: %s\n";
92 else if (d < min || d > max)
93 error = "The value for %s was %s which is not within %f - %f\n";
94 else if (type == OPT_TYPE_INT64 && (int64_t)d != d)
95 error = "Expected int64 for %s but found %s\n";
96 else if (type == OPT_TYPE_INT && (int)d != d)
97 error = "Expected int for %s but found %s\n";
98 else {
99 *dst = d;
100 return 0;
101 }
102
103 av_log(NULL, AV_LOG_FATAL, error, context, numstr, min, max);
104 return AVERROR(EINVAL);
105}
106
107void show_help_options(const OptionDef *options, const char *msg, int req_flags,
108 int rej_flags)

Callers 7

opt_widthFunction · 0.85
opt_heightFunction · 0.85
opt_show_modeFunction · 0.85
parse_and_set_vsyncFunction · 0.85
opt_timelimitFunction · 0.85
opt_show_optional_fieldsFunction · 0.85
write_optionFunction · 0.85

Calls 2

av_strtodFunction · 0.85
av_logFunction · 0.85

Tested by

no test coverage detected