Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
9f4fc8ad
Commit
9f4fc8ad
authored
Sep 24, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tag/ReplayGain: move code to template function
parent
d1e31261
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
8 deletions
+30
-8
ReplayGain.cxx
src/tag/ReplayGain.cxx
+30
-8
No files found.
src/tag/ReplayGain.cxx
View file @
9f4fc8ad
...
@@ -25,24 +25,46 @@
...
@@ -25,24 +25,46 @@
#include <assert.h>
#include <assert.h>
#include <stdlib.h>
#include <stdlib.h>
bool
template
<
typename
T
>
ParseReplayGainTag
(
ReplayGainInfo
&
info
,
const
char
*
name
,
const
char
*
value
)
static
bool
ParseReplayGainTagTemplate
(
ReplayGainInfo
&
info
,
const
T
t
)
{
{
assert
(
name
!=
nullptr
);
const
char
*
value
;
assert
(
value
!=
nullptr
);
if
(
StringEqualsCaseASCII
(
name
,
"replaygain_track_gain"
)
)
{
if
(
(
value
=
t
[
"replaygain_track_gain"
])
!=
nullptr
)
{
info
.
tuples
[
REPLAY_GAIN_TRACK
].
gain
=
atof
(
value
);
info
.
tuples
[
REPLAY_GAIN_TRACK
].
gain
=
atof
(
value
);
return
true
;
return
true
;
}
else
if
(
StringEqualsCaseASCII
(
name
,
"replaygain_album_gain"
)
)
{
}
else
if
(
(
value
=
t
[
"replaygain_album_gain"
])
!=
nullptr
)
{
info
.
tuples
[
REPLAY_GAIN_ALBUM
].
gain
=
atof
(
value
);
info
.
tuples
[
REPLAY_GAIN_ALBUM
].
gain
=
atof
(
value
);
return
true
;
return
true
;
}
else
if
(
StringEqualsCaseASCII
(
name
,
"replaygain_track_peak"
)
)
{
}
else
if
(
(
value
=
t
[
"replaygain_track_peak"
])
!=
nullptr
)
{
info
.
tuples
[
REPLAY_GAIN_TRACK
].
peak
=
atof
(
value
);
info
.
tuples
[
REPLAY_GAIN_TRACK
].
peak
=
atof
(
value
);
return
true
;
return
true
;
}
else
if
(
StringEqualsCaseASCII
(
name
,
"replaygain_album_peak"
)
)
{
}
else
if
(
(
value
=
t
[
"replaygain_album_peak"
])
!=
nullptr
)
{
info
.
tuples
[
REPLAY_GAIN_ALBUM
].
peak
=
atof
(
value
);
info
.
tuples
[
REPLAY_GAIN_ALBUM
].
peak
=
atof
(
value
);
return
true
;
return
true
;
}
else
}
else
return
false
;
return
false
;
}
bool
ParseReplayGainTag
(
ReplayGainInfo
&
info
,
const
char
*
name
,
const
char
*
value
)
{
assert
(
name
!=
nullptr
);
assert
(
value
!=
nullptr
);
struct
NameValue
{
const
char
*
name
;
const
char
*
value
;
gcc_pure
const
char
*
operator
[](
const
char
*
n
)
const
{
return
StringEqualsCaseASCII
(
name
,
n
)
?
value
:
nullptr
;
}
};
return
ParseReplayGainTagTemplate
(
info
,
NameValue
{
name
,
value
});
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment