diff options
author | Max Kellermann <max@duempel.org> | 2014-05-22 10:53:11 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-05-22 12:47:20 +0200 |
commit | ec162f265f6ea94414047335fada340151a000e0 (patch) | |
tree | 3a0e143dc641155b574791996a253e83787a69b2 /src | |
parent | ba99696771d09d1fb4e7d3549f9bd263c46dfdd7 (diff) | |
download | mpd-ec162f265f6ea94414047335fada340151a000e0.tar.gz mpd-ec162f265f6ea94414047335fada340151a000e0.tar.xz mpd-ec162f265f6ea94414047335fada340151a000e0.zip |
decoder/wavpack: move wavpack_input_init into struct WavpackInput
Diffstat (limited to 'src')
-rw-r--r-- | src/decoder/plugins/WavpackDecoderPlugin.cxx | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/src/decoder/plugins/WavpackDecoderPlugin.cxx b/src/decoder/plugins/WavpackDecoderPlugin.cxx index c5fc7ed6b..231f0766f 100644 --- a/src/decoder/plugins/WavpackDecoderPlugin.cxx +++ b/src/decoder/plugins/WavpackDecoderPlugin.cxx @@ -326,10 +326,13 @@ wavpack_scan_file(Path path_fs, /* This struct is needed for per-stream last_byte storage. */ struct WavpackInput { - Decoder *decoder; - InputStream *is; + Decoder *const decoder; + InputStream *const is; /* Needed for push_back_byte() */ int last_byte; + + constexpr WavpackInput(Decoder &_decoder, InputStream &_is) + :decoder(&_decoder), is(&_is), last_byte(EOF) {} }; /** @@ -429,15 +432,6 @@ static WavpackStreamReader mpd_is_reader = { nullptr /* no need to write edited tags */ }; -static void -wavpack_input_init(WavpackInput *isp, Decoder &decoder, - InputStream &is) -{ - isp->decoder = &decoder; - isp->is = &is; - isp->last_byte = EOF; -} - static WavpackInput * wavpack_open_wvc(Decoder &decoder, const char *uri) { @@ -456,9 +450,7 @@ wavpack_open_wvc(Decoder &decoder, const char *uri) if (is_wvc == nullptr) return nullptr; - WavpackInput *wpi = new WavpackInput(); - wavpack_input_init(wpi, decoder, *is_wvc); - return wpi; + return new WavpackInput(decoder, *is_wvc); } /* @@ -480,8 +472,7 @@ wavpack_streamdecode(Decoder &decoder, InputStream &is) open_flags |= OPEN_STREAMING; } - WavpackInput isp; - wavpack_input_init(&isp, decoder, is); + WavpackInput isp(decoder, is); char error[ERRORLEN]; WavpackContext *wpc = |