DecoderAPI: add function decoder_read_full()

Move code from the "mad" plugin.
This commit is contained in:
Max Kellermann
2013-12-14 12:43:06 +01:00
parent cb336ff666
commit d37b788ea8
5 changed files with 67 additions and 12 deletions

View File

@@ -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;