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
d1e31261
Commit
d1e31261
authored
Sep 24, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/{vorbis,flac}: move duplicate code to tag/VorbisComment.cxx
parent
05dd9acb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
79 additions
and
24 deletions
+79
-24
Makefile.am
Makefile.am
+1
-0
FlacMetadata.cxx
src/decoder/plugins/FlacMetadata.cxx
+2
-11
VorbisComments.cxx
src/decoder/plugins/VorbisComments.cxx
+1
-13
VorbisComment.cxx
src/tag/VorbisComment.cxx
+41
-0
VorbisComment.hxx
src/tag/VorbisComment.hxx
+34
-0
No files found.
Makefile.am
View file @
d1e31261
...
...
@@ -766,6 +766,7 @@ libtag_a_SOURCES =\
src/tag/TagPool.cxx src/tag/TagPool.hxx
\
src/tag/TagTable.cxx src/tag/TagTable.hxx
\
src/tag/Set.cxx src/tag/Set.hxx
\
src/tag/VorbisComment.cxx src/tag/VorbisComment.hxx
\
src/tag/ReplayGain.cxx src/tag/ReplayGain.hxx
\
src/tag/ApeLoader.cxx src/tag/ApeLoader.hxx
\
src/tag/ApeReplayGain.cxx src/tag/ApeReplayGain.hxx
\
...
...
src/decoder/plugins/FlacMetadata.cxx
View file @
d1e31261
...
...
@@ -25,6 +25,7 @@
#include "tag/TagTable.hxx"
#include "tag/TagBuilder.hxx"
#include "tag/Tag.hxx"
#include "tag/VorbisComment.hxx"
#include "ReplayGainInfo.hxx"
#include "util/ASCII.hxx"
#include "util/SplitString.hxx"
...
...
@@ -114,17 +115,7 @@ static const char *
flac_comment_value
(
const
FLAC__StreamMetadata_VorbisComment_Entry
*
entry
,
const
char
*
name
)
{
size_t
name_length
=
strlen
(
name
);
const
char
*
comment
=
(
const
char
*
)
entry
->
entry
;
if
(
!
StringEqualsCaseASCII
(
comment
,
name
,
name_length
))
return
nullptr
;
if
(
comment
[
name_length
]
==
'='
)
{
return
comment
+
name_length
+
1
;
}
return
nullptr
;
return
vorbis_comment_value
((
const
char
*
)
entry
->
entry
,
name
);
}
/**
...
...
src/decoder/plugins/VorbisComments.cxx
View file @
d1e31261
...
...
@@ -23,26 +23,14 @@
#include "tag/TagTable.hxx"
#include "tag/TagHandler.hxx"
#include "tag/TagBuilder.hxx"
#include "tag/VorbisComment.hxx"
#include "ReplayGainInfo.hxx"
#include "util/ASCII.hxx"
#include "util/SplitString.hxx"
#include <stddef.h>
#include <string.h>
#include <stdlib.h>
static
const
char
*
vorbis_comment_value
(
const
char
*
comment
,
const
char
*
needle
)
{
size_t
len
=
strlen
(
needle
);
if
(
StringEqualsCaseASCII
(
comment
,
needle
,
len
)
&&
comment
[
len
]
==
'='
)
return
comment
+
len
+
1
;
return
nullptr
;
}
bool
vorbis_comments_to_replay_gain
(
ReplayGainInfo
&
rgi
,
char
**
comments
)
{
...
...
src/tag/VorbisComment.cxx
0 → 100644
View file @
d1e31261
/*
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "VorbisComment.hxx"
#include "util/ASCII.hxx"
#include <assert.h>
#include <string.h>
const
char
*
vorbis_comment_value
(
const
char
*
entry
,
const
char
*
name
)
{
assert
(
entry
!=
nullptr
);
assert
(
name
!=
nullptr
);
assert
(
*
name
!=
0
);
const
size_t
length
=
strlen
(
name
);
if
(
StringEqualsCaseASCII
(
entry
,
name
,
length
)
&&
entry
[
length
]
==
'='
)
return
entry
+
length
+
1
;
return
nullptr
;
}
src/tag/VorbisComment.hxx
0 → 100644
View file @
d1e31261
/*
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_TAG_VORBIS_COMMENT_HXX
#define MPD_TAG_VORBIS_COMMENT_HXX
#include "check.h"
#include "Compiler.h"
/**
* Checks if the specified name matches the entry's name, and if yes,
* returns the comment value.
*/
gcc_pure
const
char
*
vorbis_comment_value
(
const
char
*
entry
,
const
char
*
name
);
#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