decoder/Client: pass std::span to SubmitData()
This commit is contained in:
@@ -63,23 +63,21 @@ ChromaprintDecoderClient::Ready(AudioFormat audio_format, bool,
|
||||
}
|
||||
|
||||
DecoderCommand
|
||||
ChromaprintDecoderClient::SubmitData(InputStream *,
|
||||
const void *_data, size_t length,
|
||||
uint16_t) noexcept
|
||||
ChromaprintDecoderClient::SubmitAudio(InputStream *,
|
||||
std::span<const std::byte> audio,
|
||||
uint16_t) noexcept
|
||||
{
|
||||
assert(ready);
|
||||
|
||||
if (length > remaining_bytes)
|
||||
if (audio.size() > remaining_bytes)
|
||||
remaining_bytes = 0;
|
||||
else
|
||||
remaining_bytes -= length;
|
||||
|
||||
std::span<const std::byte> src{(const std::byte *)_data, length};
|
||||
remaining_bytes -= audio.size();
|
||||
|
||||
if (convert)
|
||||
src = convert->Convert(src);
|
||||
audio = convert->Convert(audio);
|
||||
|
||||
chromaprint.Feed(FromBytesStrict<const int16_t>(src));
|
||||
chromaprint.Feed(FromBytesStrict<const int16_t>(audio));
|
||||
|
||||
return GetCommand();
|
||||
}
|
||||
|
@@ -93,9 +93,9 @@ public:
|
||||
void *buffer, size_t length) noexcept override;
|
||||
|
||||
void SubmitTimestamp(FloatDuration) noexcept override {}
|
||||
DecoderCommand SubmitData(InputStream *is,
|
||||
const void *data, size_t length,
|
||||
uint16_t kbit_rate) noexcept override;
|
||||
DecoderCommand SubmitAudio(InputStream *is,
|
||||
std::span<const std::byte> audio,
|
||||
uint16_t kbit_rate) noexcept override;
|
||||
|
||||
DecoderCommand SubmitTag(InputStream *, Tag &&) noexcept override {
|
||||
return GetCommand();
|
||||
|
Reference in New Issue
Block a user