1 /*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 /**
20 * @file
21 * replaygain tags parsing
22 */
23
24 #include <stdint.h>
25 #include <stdlib.h>
26 #include <string.h>
27
33
37
39 {
40 char *fraction;
43 int sign = 1;
44 int db;
45
48
50
52 sign = -1;
53
54 db = strtol(
value, &fraction, 0);
55 if (*fraction++ == '.') {
57 mb +=
scale * (*fraction -
'0');
59 fraction++;
60 }
61 }
62
63 if (llabs(db) > (INT32_MAX -
mb) / 100000)
65
66 return db * 100000 + sign *
mb;
67 }
68
71 {
73
74 if (
tg == INT32_MIN && ag == INT32_MIN)
75 return 0;
76
78 sizeof(*replaygain));
79 if (!replaygain)
81
86
87 return 0;
88 }
89
91 {
93
98
104 }