PcmConvert: Convert() returns ConstBuffer

This commit is contained in:
Max Kellermann
2014-08-12 16:36:07 +02:00
parent 4d5f610029
commit 56f61a6d59
5 changed files with 19 additions and 23 deletions

View File

@@ -31,6 +31,7 @@
#include "DetachedSong.hxx"
#include "input/InputStream.hxx"
#include "util/Error.hxx"
#include "util/ConstBuffer.hxx"
#include "Log.hxx"
#include <assert.h>
@@ -472,9 +473,8 @@ decoder_data(Decoder &decoder,
assert(dc.in_audio_format != dc.out_audio_format);
Error error;
data = decoder.convert->Convert(data, length,
&length,
error);
auto result = decoder.convert->Convert({data, length},
error);
if (data == nullptr) {
/* the PCM conversion has failed - stop
playback, since we have no better way to
@@ -482,6 +482,9 @@ decoder_data(Decoder &decoder,
LogError(error);
return DecoderCommand::STOP;
}
data = result.data;
length = result.size;
} else {
assert(dc.in_audio_format == dc.out_audio_format);
}