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

Function parse_value

libavformat/replaygain.c:38–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36#include "replaygain.h"
37
38static int32_t parse_value(const char *value, int32_t min)
39{
40 char *fraction;
41 int scale = 10000;
42 int32_t mb = 0;
43 int sign = 1;
44 int db;
45
46 if (!value)
47 return min;
48
49 value += strspn(value, " \t");
50
51 if (*value == '-')
52 sign = -1;
53
54 db = strtol(value, &fraction, 0);
55 if (*fraction++ == '.') {
56 while (av_isdigit(*fraction) && scale) {
57 mb += scale * (*fraction - '0');
58 scale /= 10;
59 fraction++;
60 }
61 }
62
63 if (llabs(db) > (INT32_MAX - mb) / 100000)
64 return min;
65
66 return db * 100000 + sign * mb;
67}
68
69int ff_replaygain_export_raw(AVStream *st, int32_t tg, uint32_t tp,
70 int32_t ag, uint32_t ap)

Callers 1

ff_replaygain_exportFunction · 0.85

Calls 1

av_isdigitFunction · 0.85

Tested by

no test coverage detected