aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-26 08:27:06 +0200
committerEric Wong <normalperson@yhbt.net>2008-08-30 18:29:24 -0700
commit0ab398363a14eb5a59a374697fbac80264d10087 (patch)
tree0e8113b981f1f48ae68e6088de9bfbc0dc95d897
parent7750e5b1e8f989513ef982c4c4dca4dbe4fe7a92 (diff)
downloadmpd-0ab398363a14eb5a59a374697fbac80264d10087.tar.gz
mpd-0ab398363a14eb5a59a374697fbac80264d10087.tar.xz
mpd-0ab398363a14eb5a59a374697fbac80264d10087.zip
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.
-rw-r--r--src/inputPlugins/audiofile_plugin.c51
1 files changed, 24 insertions, 27 deletions
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);