aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-04-23 23:28:34 +0200
committerMax Kellermann <max@duempel.org>2012-04-23 23:28:34 +0200
commitad83c7f704a644efcf92d49c82317b0f9aacecf6 (patch)
tree54d34f8d7d93008fc5cfbfb3f4a0c6f2d63fced4
parent6b52d040b1b0c6a1697d54274d56e61a4e383dca (diff)
downloadmpd-ad83c7f704a644efcf92d49c82317b0f9aacecf6.tar.gz
mpd-ad83c7f704a644efcf92d49c82317b0f9aacecf6.tar.xz
mpd-ad83c7f704a644efcf92d49c82317b0f9aacecf6.zip
tag_rva2: move code to rva2_apply_frame()
-rw-r--r--src/tag_rva2.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/tag_rva2.c b/src/tag_rva2.c
index 68ae9d5e5..a08e1eae5 100644
--- a/src/tag_rva2.c
+++ b/src/tag_rva2.c
@@ -86,24 +86,14 @@ rva2_apply_data(struct replay_gain_info *replay_gain_info,
return true;
}
-bool
-tag_rva2_parse(struct id3_tag *tag, struct replay_gain_info *replay_gain_info)
+static bool
+rva2_apply_frame(struct replay_gain_info *replay_gain_info,
+ const struct id3_frame *frame)
{
- struct id3_frame const * frame;
-
- id3_latin1_t const *id;
- id3_byte_t const *data;
+ const id3_latin1_t *id = id3_field_getlatin1(id3_frame_field(frame, 0));
id3_length_t length;
-
- /* relative volume adjustment information */
-
- frame = id3_tag_findframe(tag, "RVA2", 0);
- if (frame == NULL)
- return false;
-
- id = id3_field_getlatin1(id3_frame_field(frame, 0));
- data = id3_field_getbinarydata(id3_frame_field(frame, 1),
- &length);
+ const id3_byte_t *data =
+ id3_field_getbinarydata(id3_frame_field(frame, 1), &length);
if (id == NULL || data == NULL)
return false;
@@ -134,3 +124,10 @@ tag_rva2_parse(struct id3_tag *tag, struct replay_gain_info *replay_gain_info)
return false;
}
+
+bool
+tag_rva2_parse(struct id3_tag *tag, struct replay_gain_info *replay_gain_info)
+{
+ struct id3_frame const *frame = id3_tag_findframe(tag, "RVA2", 0);
+ return frame != NULL && rva2_apply_frame(replay_gain_info, frame);
+}