Commit cf93cd93 authored by Max Kellermann's avatar Max Kellermann

decoder/wavpack: convert WavpackInput::client to pointer

parent f40816e0
...@@ -249,12 +249,12 @@ wavpack_decode(DecoderClient &client, WavpackContext *wpc, bool can_seek) ...@@ -249,12 +249,12 @@ wavpack_decode(DecoderClient &client, WavpackContext *wpc, bool can_seek)
/* This struct is needed for per-stream last_byte storage. */ /* This struct is needed for per-stream last_byte storage. */
struct WavpackInput { struct WavpackInput {
DecoderClient &client; DecoderClient *const client;
InputStream &is; InputStream &is;
/* Needed for push_back_byte() */ /* Needed for push_back_byte() */
int last_byte; int last_byte;
constexpr WavpackInput(DecoderClient &_client, InputStream &_is) constexpr WavpackInput(DecoderClient *_client, InputStream &_is)
:client(_client), is(_is), last_byte(EOF) {} :client(_client), is(_is), last_byte(EOF) {}
int32_t ReadBytes(void *data, size_t bcount); int32_t ReadBytes(void *data, size_t bcount);
...@@ -292,7 +292,7 @@ WavpackInput::ReadBytes(void *data, size_t bcount) ...@@ -292,7 +292,7 @@ WavpackInput::ReadBytes(void *data, size_t bcount)
/* wavpack fails if we return a partial read, so we just wait /* wavpack fails if we return a partial read, so we just wait
until the buffer is full */ until the buffer is full */
while (bcount > 0) { while (bcount > 0) {
size_t nbytes = decoder_read(&client, is, buf, bcount); size_t nbytes = decoder_read(client, is, buf, bcount);
if (nbytes == 0) { if (nbytes == 0) {
/* EOF, error or a decoder command */ /* EOF, error or a decoder command */
break; break;
...@@ -443,14 +443,14 @@ wavpack_streamdecode(DecoderClient &client, InputStream &is) ...@@ -443,14 +443,14 @@ wavpack_streamdecode(DecoderClient &client, InputStream &is)
open_flags |= OPEN_WVC; open_flags |= OPEN_WVC;
can_seek &= wvc->is.IsSeekable(); can_seek &= wvc->is.IsSeekable();
wvc.reset(new WavpackInput(client, *is_wvc)); wvc.reset(new WavpackInput(&client, *is_wvc));
} }
if (!can_seek) { if (!can_seek) {
open_flags |= OPEN_STREAMING; open_flags |= OPEN_STREAMING;
} }
WavpackInput isp(client, is); WavpackInput isp(&client, is);
auto *wpc = WavpackOpenInput(&mpd_is_reader, &isp, wvc.get(), auto *wpc = WavpackOpenInput(&mpd_is_reader, &isp, wvc.get(),
open_flags, 0); open_flags, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment