diff options
author | Max Kellermann <max@duempel.org> | 2014-07-11 21:51:07 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-07-11 22:03:26 +0200 |
commit | eaa9a1e33bd729560cec42abbdf3ef3902a7cb6f (patch) | |
tree | 0fbcb6fffb57312853942b02df577fe58dbc4dd9 /src/decoder | |
parent | 3e19298c9e6344c21c7e80e1837fe6a387e6c2c7 (diff) | |
download | mpd-eaa9a1e33bd729560cec42abbdf3ef3902a7cb6f.tar.gz mpd-eaa9a1e33bd729560cec42abbdf3ef3902a7cb6f.tar.xz mpd-eaa9a1e33bd729560cec42abbdf3ef3902a7cb6f.zip |
decoder/sndfile: make variables more local
Diffstat (limited to 'src/decoder')
-rw-r--r-- | src/decoder/plugins/SndfileDecoderPlugin.cxx | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/decoder/plugins/SndfileDecoderPlugin.cxx b/src/decoder/plugins/SndfileDecoderPlugin.cxx index 58fec5b7b..90a52b7f0 100644 --- a/src/decoder/plugins/SndfileDecoderPlugin.cxx +++ b/src/decoder/plugins/SndfileDecoderPlugin.cxx @@ -155,16 +155,12 @@ time_to_frame(float t, const AudioFormat *audio_format) static void sndfile_stream_decode(Decoder &decoder, InputStream &is) { - SNDFILE *sf; SF_INFO info; - size_t frame_size; - sf_count_t read_frames, num_frames; - int buffer[4096]; info.format = 0; SndfileInputStream sis{&decoder, is}; - sf = sf_open_virtual(&vio, SFM_READ, &info, &sis); + SNDFILE *const sf = sf_open_virtual(&vio, SFM_READ, &info, &sis); if (sf == nullptr) { LogWarning(sndfile_domain, "sf_open_virtual() failed"); return; @@ -185,12 +181,14 @@ sndfile_stream_decode(Decoder &decoder, InputStream &is) decoder_initialized(decoder, audio_format, info.seekable, frame_to_time(info.frames, &audio_format)); - frame_size = audio_format.GetFrameSize(); - read_frames = sizeof(buffer) / frame_size; + int buffer[4096]; + + const size_t frame_size = audio_format.GetFrameSize(); + const sf_count_t read_frames = sizeof(buffer) / frame_size; DecoderCommand cmd; do { - num_frames = sf_readf_int(sf, buffer, read_frames); + sf_count_t num_frames = sf_readf_int(sf, buffer, read_frames); if (num_frames <= 0) break; @@ -239,12 +237,11 @@ static bool sndfile_scan_file(Path path_fs, const struct tag_handler *handler, void *handler_ctx) { - SNDFILE *sf; SF_INFO info; info.format = 0; - sf = sf_open(path_fs.c_str(), SFM_READ, &info); + SNDFILE *const sf = sf_open(path_fs.c_str(), SFM_READ, &info); if (sf == nullptr) return false; |