| 142 | } |
| 143 | |
| 144 | double parse_number_or_die(const char *context, const char *numstr, int type, |
| 145 | double min, double max) |
| 146 | { |
| 147 | char *tail; |
| 148 | const char *error; |
| 149 | double d = av_strtod(numstr, &tail); |
| 150 | if (*tail) |
| 151 | error = "Expected number for %s but found: %s\n"; |
| 152 | else if (d < min || d > max) |
| 153 | error = "The value for %s was %s which is not within %f - %f\n"; |
| 154 | else if (type == OPT_INT64 && (int64_t)d != d) |
| 155 | error = "Expected int64 for %s but found %s\n"; |
| 156 | else if (type == OPT_INT && (int)d != d) |
| 157 | error = "Expected int for %s but found %s\n"; |
| 158 | else |
| 159 | return d; |
| 160 | av_log(NULL, AV_LOG_FATAL, error, context, numstr, min, max); |
| 161 | exit_program(1); |
| 162 | return 0; |
| 163 | } |
| 164 | |
| 165 | int64_t parse_time_or_die(const char *context, const char *timestr, |
| 166 | int is_duration) |
no test coverage detected