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
8a7ff6a6
Commit
8a7ff6a6
authored
Sep 24, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/flac: move code to tag/MixRamp.cxx
parent
6c48aa5f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
35 deletions
+29
-35
FlacMetadata.cxx
src/decoder/plugins/FlacMetadata.cxx
+10
-35
MixRamp.cxx
src/tag/MixRamp.cxx
+16
-0
MixRamp.hxx
src/tag/MixRamp.hxx
+3
-0
No files found.
src/decoder/plugins/FlacMetadata.cxx
View file @
8a7ff6a6
...
...
@@ -27,32 +27,11 @@
#include "tag/Tag.hxx"
#include "tag/VorbisComment.hxx"
#include "tag/ReplayGain.hxx"
#include "tag/MixRamp.hxx"
#include "ReplayGainInfo.hxx"
#include "util/ASCII.hxx"
#include "util/SplitString.hxx"
#include <string.h>
static
const
char
*
vorbis_comment_value
(
const
FLAC__StreamMetadata
*
block
,
const
char
*
name
)
{
int
offset
=
FLAC__metadata_object_vorbiscomment_find_entry_from
(
block
,
0
,
name
);
if
(
offset
<
0
)
return
nullptr
;
size_t
name_length
=
strlen
(
name
);
const
FLAC__StreamMetadata_VorbisComment_Entry
&
vc
=
block
->
data
.
vorbis_comment
.
comments
[
offset
];
const
char
*
comment
=
(
const
char
*
)
vc
.
entry
;
/* 1 is for '=' */
return
comment
+
name_length
+
1
;
}
bool
flac_parse_replay_gain
(
ReplayGainInfo
&
rgi
,
const
FLAC__StreamMetadata_VorbisComment
&
vc
)
...
...
@@ -70,23 +49,19 @@ flac_parse_replay_gain(ReplayGainInfo &rgi,
return
found
;
}
gcc_pure
static
std
::
string
flac_find_string_comment
(
const
FLAC__StreamMetadata
*
block
,
const
char
*
cmnt
)
{
const
char
*
value
=
vorbis_comment_value
(
block
,
cmnt
);
if
(
value
==
nullptr
)
return
std
::
string
();
return
std
::
string
(
value
);
}
MixRampInfo
flac_parse_mixramp
(
const
FLAC__StreamMetadata
*
block
)
{
const
FLAC__StreamMetadata_VorbisComment
&
vc
=
block
->
data
.
vorbis_comment
;
MixRampInfo
mix_ramp
;
mix_ramp
.
SetStart
(
flac_find_string_comment
(
block
,
"mixramp_start"
));
mix_ramp
.
SetEnd
(
flac_find_string_comment
(
block
,
"mixramp_end"
));
const
auto
*
comments
=
vc
.
comments
;
for
(
FLAC__uint32
i
=
0
,
n
=
vc
.
num_comments
;
i
<
n
;
++
i
)
ParseMixRampVorbis
(
mix_ramp
,
(
const
char
*
)
comments
[
i
].
entry
);
return
mix_ramp
;
}
...
...
src/tag/MixRamp.cxx
View file @
8a7ff6a6
...
...
@@ -19,6 +19,7 @@
#include "config.h"
#include "MixRamp.hxx"
#include "VorbisComment.hxx"
#include "MixRampInfo.hxx"
#include "util/ASCII.hxx"
...
...
@@ -61,3 +62,18 @@ ParseMixRampTag(MixRampInfo &info, const char *name, const char *value)
return
ParseMixRampTagTemplate
(
info
,
NameValue
{
name
,
value
});
}
bool
ParseMixRampVorbis
(
MixRampInfo
&
info
,
const
char
*
entry
)
{
struct
VorbisCommentEntry
{
const
char
*
entry
;
gcc_pure
const
char
*
operator
[](
const
char
*
n
)
const
{
return
vorbis_comment_value
(
entry
,
n
);
}
};
return
ParseMixRampTagTemplate
(
info
,
VorbisCommentEntry
{
entry
});
}
src/tag/MixRamp.hxx
View file @
8a7ff6a6
...
...
@@ -27,4 +27,7 @@ class MixRampInfo;
bool
ParseMixRampTag
(
MixRampInfo
&
info
,
const
char
*
name
,
const
char
*
value
);
bool
ParseMixRampVorbis
(
MixRampInfo
&
info
,
const
char
*
entry
);
#endif
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