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

Function av_parse_ratio

libavutil/parseutils.c:45–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43#endif
44
45int av_parse_ratio(AVRational *q, const char *str, int max,
46 int log_offset, void *log_ctx)
47{
48 char c;
49 int ret;
50
51 if (sscanf(str, "%d:%d%c", &q->num, &q->den, &c) != 2) {
52 double d;
53 ret = av_expr_parse_and_eval(&d, str, NULL, NULL,
54 NULL, NULL, NULL, NULL,
55 NULL, log_offset, log_ctx);
56 if (ret < 0)
57 return ret;
58 *q = av_d2q(d, max);
59 } else {
60 av_reduce(&q->num, &q->den, q->num, q->den, max);
61 }
62
63 return 0;
64}
65
66typedef struct VideoSizeAbbr {
67 const char *abbr;

Callers 3

new_stream_videoFunction · 0.85
ost_addFunction · 0.85
get_aspect_ratioFunction · 0.85

Calls 3

av_expr_parse_and_evalFunction · 0.85
av_d2qFunction · 0.85
av_reduceFunction · 0.85

Tested by 1

get_aspect_ratioFunction · 0.68