Anonymous code blocks just to declare variables look ugly.  Move the
variable declarations up and disband the code block.
---

 src/inputPlugins/audiofile_plugin.c |   55 ++++++++++++++++-------------------
 1 files changed, 25 insertions(+), 30 deletions(-)

diff --git a/src/inputPlugins/audiofile_plugin.c 
b/src/inputPlugins/audiofile_plugin.c
index 6db342f..6b8e4e2 100644
--- a/src/inputPlugins/audiofile_plugin.c
+++ b/src/inputPlugins/audiofile_plugin.c
@@ -49,6 +49,8 @@ static int audiofile_decode(struct decoder * decoder, char 
*path)
        float total_time;
        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);
@@ -87,36 +89,29 @@ static int audiofile_decode(struct decoder * decoder, char 
*path)
 
        decoder_initialized(decoder, &audio_format, total_time);
 
-       {
-               int ret, current = 0;
-               char chunk[CHUNK_SIZE];
-
-               do {
-                       if (dc.command == DECODE_COMMAND_SEEK) {
-                               decoder_clear(decoder);
-                               current = dc.seekWhere *
-                                   audio_format.sampleRate;
-                               afSeekFrame(af_fp, AF_DEFAULT_TRACK, current);
-                               dc_command_finished();
-                       }
-
-                       ret =
-                           afReadFrames(af_fp, AF_DEFAULT_TRACK, chunk,
-                                        CHUNK_SIZE / fs);
-                       if (ret <= 0)
-
-                       current += ret;
-                       decoder_data(decoder, NULL,
-                                    1,
-                                    chunk, ret * fs,
-                                    (float)current /
-                                    (float)audio_format.
-                                    sampleRate, bitRate,
-                                    NULL);
-               } while (dc.command != DECODE_COMMAND_STOP);
-
-               decoder_flush(decoder);
-       }
+       do {
+               if (dc.command == DECODE_COMMAND_SEEK) {
+                       decoder_clear(decoder);
+                       current = dc.seekWhere *
+                               audio_format.sampleRate;
+                       afSeekFrame(af_fp, AF_DEFAULT_TRACK, current);
+                       dc_command_finished();
+               }
+
+               ret = afReadFrames(af_fp, AF_DEFAULT_TRACK, chunk,
+                                  CHUNK_SIZE / fs);
+               if (ret <= 0)
+                       break;
+
+               current += ret;
+               decoder_data(decoder, NULL, 1,
+                            chunk, ret * fs,
+                            (float)current / (float)audio_format.sampleRate,
+                            bitRate, NULL);
+       } while (dc.command != DECODE_COMMAND_STOP);
+
+       decoder_flush(decoder);
+
        afCloseFile(af_fp);
 
        return 0;


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to