]> git.alsa-project.org Git - alsa-tools.git/commitdiff
Fix for piped AC3 stream
authorJaroslav Kysela <perex@perex.cz>
Tue, 26 Jun 2001 15:23:21 +0000 (15:23 +0000)
committerJaroslav Kysela <perex@perex.cz>
Tue, 26 Jun 2001 15:23:21 +0000 (15:23 +0000)
ac3dec/ac3dec.c

index d813e471ad4ad7f5d3cd6c24823e0d5840323f54..443005cd799f5fc50d8fdfd63e466c3efc17eb51 100644 (file)
@@ -40,6 +40,7 @@ init_spdif(void);
 int
 output_spdif(uint_8 *data_start, uint_8 *data_end, int quiet);
 
+static int end_flag = 0;
 static int quiet = 0;
 
 static void help(void)
@@ -68,12 +69,10 @@ ssize_t fill_buffer(uint_8 **start,uint_8 **end)
 
        bytes_read = fread(*start,1,CHUNK_SIZE,in_file);
 
-       if (feof(in_file))
-               return EOF;
-       if (ferror(in_file))
-               return EOF;
-       if(bytes_read < CHUNK_SIZE)
+       if (feof(in_file) || ferror(in_file) || bytes_read < CHUNK_SIZE) {
+               end_flag = 1;
                return EOF;
+       }
 
        *end = *start + bytes_read;
        return bytes_read;
@@ -170,7 +169,7 @@ int main(int argc,char *argv[])
 
        while (1) {
                if (argc - optind <= 0) {
-                       if (loop)
+                       if (loop || end_flag)
                                break;
                        in_file = stdin;
                } else {