From 0ab398363a14eb5a59a374697fbac80264d10087 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 26 Aug 2008 08:27:06 +0200 Subject: audiofile: remove one indent level from audiofile plugin Anonymous code blocks just to declare variables look ugly. Move the variable declarations up and disband the code block. --- src/inputPlugins/audiofile_plugin.c | 51 +++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/inputPlugins/audiofile_plugin.c b/src/inputPlugins/audiofile_plugin.c index d32a99857..fcebf562b 100644 --- a/src/inputPlugins/audiofile_plugin.c +++ b/src/inputPlugins/audiofile_plugin.c @@ -47,6 +47,8 @@ static int audiofile_decode(char *path) int bits; mpd_uint16 bitRate; struct stat st; + int ret, current = 0; + char chunk[CHUNK_SIZE]; if (stat(path, &st) < 0) { ERROR("failed to stat: %s\n", path); @@ -84,34 +86,29 @@ static int audiofile_decode(char *path) fs = (int)afGetVirtualFrameSize(af_fp, AF_DEFAULT_TRACK, 1); - { - int ret, current = 0; - char chunk[CHUNK_SIZE]; - - while (1) { - if (dc_seek()) { - dc_action_begin(); - current = dc.seek_where * - dc.audio_format.sampleRate; - afSeekFrame(af_fp, AF_DEFAULT_TRACK, current); - dc_action_end(); - } - - ret = - afReadFrames(af_fp, AF_DEFAULT_TRACK, chunk, - CHUNK_SIZE / fs); - if (ret <= 0) + while (1) { + if (dc_seek()) { + dc_action_begin(); + current = dc.seek_where * + dc.audio_format.sampleRate; + afSeekFrame(af_fp, AF_DEFAULT_TRACK, current); + dc_action_end(); + } + + ret = + afReadFrames(af_fp, AF_DEFAULT_TRACK, chunk, + CHUNK_SIZE / fs); + if (ret <= 0) + break; + else { + current += ret; + ob_send(chunk, ret * fs, + (float)current / + (float)dc.audio_format.sampleRate, + bitRate, + NULL); + if (dc_intr()) break; - else { - current += ret; - ob_send(chunk, ret * fs, - (float)current / - (float)dc.audio_format.sampleRate, - bitRate, - NULL); - if (dc_intr()) - break; - } } } afCloseFile(af_fp); -- cgit v1.2.3