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 {
74
75 if (tg == INT32_MIN && ag == INT32_MIN)
76 return 0;
77
81 sizeof(*replaygain), 0);
82 if (!sd)
84
90
91 return 0;
92 }
93
95 {
97
102
108 }