decoder/{vorbis,flac}: move duplicate code to tag/VorbisComment.cxx
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user