aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/MadDecoderPlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-12-14 12:43:06 +0100
committerMax Kellermann <max@duempel.org>2014-07-09 19:03:58 +0200
commit0759421d119d8d3d829978ede81683ca54d65d69 (patch)
treeecb6968a7842e6b12de5f2c8b1e194358d697872 /src/decoder/MadDecoderPlugin.cxx
parentbf7417981f2527348fb261f40f4de15f9b350db5 (diff)
downloadmpd-0759421d119d8d3d829978ede81683ca54d65d69.tar.gz
mpd-0759421d119d8d3d829978ede81683ca54d65d69.tar.xz
mpd-0759421d119d8d3d829978ede81683ca54d65d69.zip
DecoderAPI: add function decoder_read_full()
Move code from the "mad" plugin.
Diffstat (limited to '')
-rw-r--r--src/decoder/MadDecoderPlugin.cxx14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/decoder/MadDecoderPlugin.cxx b/src/decoder/MadDecoderPlugin.cxx
index 7afc8ef8f..6f619b34b 100644
--- a/src/decoder/MadDecoderPlugin.cxx
+++ b/src/decoder/MadDecoderPlugin.cxx
@@ -353,18 +353,8 @@ MadDecoder::ParseId3(size_t tagsize, Tag **mpd_tag)
memcpy(allocated, stream.this_frame, count);
mad_stream_skip(&(stream), count);
- while (count < tagsize) {
- size_t len;
-
- len = decoder_read(decoder, input_stream,
- allocated + count, tagsize - count);
- if (len == 0)
- break;
- else
- count += len;
- }
-
- if (count != tagsize) {
+ if (!decoder_read_full(decoder, input_stream,
+ allocated + count, tagsize - count)) {
LogDebug(mad_domain, "error parsing ID3 tag");
g_free(allocated);
return;