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
e2a14f5b
Commit
e2a14f5b
authored
Jun 21, 2006
by
J. Alexander Treuman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup id3 ReplayGain parsing code.
git-svn-id:
https://svn.musicpd.org/mpd/trunk@4280
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
fd6696e4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
13 deletions
+19
-13
mp3_plugin.c
src/inputPlugins/mp3_plugin.c
+19
-13
No files found.
src/inputPlugins/mp3_plugin.c
View file @
e2a14f5b
...
...
@@ -209,15 +209,15 @@ int fillMp3InputBuffer(mp3DecodeData * data) {
}
#ifdef HAVE_ID3TAG
void
mp3_getReplayGainInfo
(
struct
id3_tag
*
tag
,
ReplayGainInfo
**
infoPtr
)
{
static
ReplayGainInfo
*
parseId3ReplayGainInfo
(
struct
id3_tag
*
tag
)
{
int
i
;
char
*
key
;
char
*
value
;
struct
id3_frame
*
frame
;
int
found
=
0
;
ReplayGainInfo
*
replayGainInfo
;
if
(
*
infoPtr
)
freeReplayGainInfo
(
*
infoPtr
);
*
infoPtr
=
newReplayGainInfo
();
replayGainInfo
=
newReplayGainInfo
();
for
(
i
=
0
;(
frame
=
id3_tag_findframe
(
tag
,
"TXXX"
,
i
));
i
++
)
{
if
(
frame
->
nfields
<
3
)
continue
;
...
...
@@ -226,31 +226,29 @@ void mp3_getReplayGainInfo(struct id3_tag * tag, ReplayGainInfo ** infoPtr) {
value
=
(
char
*
)
id3_ucs4_latin1duplicate
(
id3_field_getstring
(
&
frame
->
fields
[
2
]));
if
(
strcmp
(
key
,
"replaygain_track_gain"
)
==
0
)
{
(
*
infoPtr
)
->
trackGain
=
atof
(
value
);
replayGainInfo
->
trackGain
=
atof
(
value
);
found
=
1
;
}
else
if
(
strcmp
(
key
,
"replaygain_album_gain"
)
==
0
)
{
(
*
infoPtr
)
->
albumGain
=
atof
(
value
);
replayGainInfo
->
albumGain
=
atof
(
value
);
found
=
1
;
}
else
if
(
strcmp
(
key
,
"replaygain_track_peak"
)
==
0
)
{
(
*
infoPtr
)
->
trackPeak
=
atof
(
value
);
replayGainInfo
->
trackPeak
=
atof
(
value
);
found
=
1
;
}
else
if
(
strcmp
(
key
,
"replaygain_album_peak"
)
==
0
)
{
(
*
infoPtr
)
->
albumPeak
=
atof
(
value
);
replayGainInfo
->
albumPeak
=
atof
(
value
);
found
=
1
;
}
free
(
key
);
free
(
value
);
}
if
(
!
found
)
{
freeReplayGainInfo
(
*
infoPtr
);
*
infoPtr
=
NULL
;
}
if
(
found
)
return
replayGainInfo
;
freeReplayGainInfo
(
replayGainInfo
);
return
NULL
;
}
#endif
...
...
@@ -261,6 +259,7 @@ static void mp3_parseId3Tag(mp3DecodeData * data, signed long tagsize, MpdTag **
id3_byte_t
const
*
id3_data
;
id3_byte_t
*
allocated
=
NULL
;
MpdTag
*
tmpMpdTag
;
ReplayGainInfo
*
tmpReplayGainInfo
;
count
=
data
->
stream
.
bufend
-
data
->
stream
.
this_frame
;
...
...
@@ -307,7 +306,14 @@ static void mp3_parseId3Tag(mp3DecodeData * data, signed long tagsize, MpdTag **
}
}
if
(
replayGainInfo
)
mp3_getReplayGainInfo
(
id3Tag
,
replayGainInfo
);
if
(
replayGainInfo
)
{
tmpReplayGainInfo
=
parseId3ReplayGainInfo
(
id3Tag
);
if
(
tmpReplayGainInfo
)
{
if
(
*
replayGainInfo
)
freeReplayGainInfo
(
*
replayGainInfo
);
*
replayGainInfo
=
tmpReplayGainInfo
;
}
}
id3_tag_delete
(
id3Tag
);
fail:
if
(
allocated
)
free
(
allocated
);
...
...
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