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

@@ -117,12 +117,9 @@ PcmConvert::Close()
#endif
}
const void *
PcmConvert::Convert(const void *src, size_t src_size,
size_t *dest_size_r,
Error &error)
ConstBuffer<void>
PcmConvert::Convert(ConstBuffer<void> buffer, Error &error)
{
ConstBuffer<void> buffer(src, src_size);
AudioFormat format = src_format;
if (format.format == SampleFormat::DSD) {
@@ -164,6 +161,5 @@ PcmConvert::Convert(const void *src, size_t src_size,
format.channels = dest_format.channels;
}
*dest_size_r = buffer.size;
return buffer.data;
return buffer;
}

View File

@@ -70,16 +70,12 @@ public:
*
* @param src_format the source audio format
* @param src the source PCM buffer
* @param src_size the size of #src in bytes
* @param dest_format the requested destination audio format
* @param dest_size_r returns the number of bytes of the destination buffer
* @param error_r location to store the error occurring, or nullptr to
* ignore errors
* @return the destination buffer, or nullptr on error
*/
const void *Convert(const void *src, size_t src_size,
size_t *dest_size_r,
Error &error);
ConstBuffer<void> Convert(ConstBuffer<void> src, Error &error);
};
bool