aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/oggvorbis_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-14 23:15:14 +0100
committerMax Kellermann <max@duempel.org>2009-01-14 23:15:14 +0100
commit69b033757f422d6472315f7892c303f92da495b6 (patch)
tree184807bcd0aeb04c3ddf6ec6b64dd41de940c8b0 /src/decoder/oggvorbis_plugin.c
parent25cf3333551c59ae518b1ecc4e68197ff1766670 (diff)
downloadmpd-69b033757f422d6472315f7892c303f92da495b6.tar.gz
mpd-69b033757f422d6472315f7892c303f92da495b6.tar.xz
mpd-69b033757f422d6472315f7892c303f92da495b6.zip
oggvorbis: moved code to vorbis_copy_comment()
Diffstat (limited to '')
-rw-r--r--src/decoder/oggvorbis_plugin.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/decoder/oggvorbis_plugin.c b/src/decoder/oggvorbis_plugin.c
index 772526225..c1fb799f0 100644
--- a/src/decoder/oggvorbis_plugin.c
+++ b/src/decoder/oggvorbis_plugin.c
@@ -141,10 +141,29 @@ vorbis_comments_to_replay_gain(char **comments)
static const char *VORBIS_COMMENT_TRACK_KEY = "tracknumber";
static const char *VORBIS_COMMENT_DISC_KEY = "discnumber";
+/**
+ * Check if the comment's name equals the passed name, and if so, copy
+ * the comment value into the tag.
+ */
+static bool
+vorbis_copy_comment(struct tag *tag, const char *comment,
+ const char *name, enum tag_type tag_type)
+{
+ const char *value;
+
+ value = vorbis_comment_value(comment, name);
+ if (value != NULL) {
+ tag_add_item(tag, tag_type, value);
+ return true;
+ }
+
+ return false;
+}
+
static bool
vorbis_parse_comment(struct tag *tag, char *comment, enum tag_type tag_type)
{
- const char *needle, *value;
+ const char *needle;
assert(tag != NULL);
@@ -159,14 +178,7 @@ vorbis_parse_comment(struct tag *tag, char *comment, enum tag_type tag_type)
needle = mpdTagItemKeys[tag_type];
}
- value = vorbis_comment_value(comment, needle);
- if (value != NULL) {
- tag_add_item(tag, tag_type, value);
-
- return true;
- }
-
- return false;
+ return vorbis_copy_comment(tag, comment, needle, tag_type);
}
static struct tag *