shithub: aacdec

Download patch

ref: cd2a605682181958d9d0f136f7c61b87674b9e59
parent: 24ab866538a0dd2aabd7423eaa484216c353544c
author: menno <menno>
date: Tue Mar 2 18:13:50 EST 2004

Fixed output to stdout

--- a/frontend/audio.c
+++ b/frontend/audio.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through [email protected].
 **
-** $Id: audio.c,v 1.21 2004/01/05 14:05:11 menno Exp $
+** $Id: audio.c,v 1.22 2004/03/02 23:13:49 menno Exp $
 **/
 
 #ifdef _WIN32
@@ -72,7 +72,9 @@
         setmode(fileno(stdout), O_BINARY);
 #endif
         aufile->sndfile = stdout;
+        aufile->toStdio = 1;
     } else {
+        aufile->toStdio = 0;
         aufile->sndfile = fopen(infile, "wb");
     }
 
@@ -125,7 +127,8 @@
             write_wav_header(aufile);
     }
 
-    fclose(aufile->sndfile);
+    if (aufile->toStdio == 0)
+        fclose(aufile->sndfile);
 
     if (aufile) free(aufile);
 }
--- a/frontend/audio.h
+++ b/frontend/audio.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through [email protected].
 **
-** $Id: audio.h,v 1.12 2004/01/05 14:05:11 menno Exp $
+** $Id: audio.h,v 1.15 2004/03/10 19:45:40 menno Exp $
 **/
 
 #ifndef AUDIO_H_INCLUDED
@@ -39,6 +39,7 @@
 
 typedef struct
 {
+    int toStdio;
     int outputFormat;
     FILE *sndfile;
     unsigned int fileType;
--- a/frontend/main.c
+++ b/frontend/main.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through [email protected].
 **
-** $Id: main.c,v 1.72 2004/03/02 20:09:58 menno Exp $
+** $Id: main.c,v 1.73 2004/03/02 23:13:50 menno Exp $
 **/
 
 #ifdef _WIN32
@@ -832,7 +832,7 @@
                 }
             }
         }
-        if (j > 0) printf("\n");
+        if (j > 0) fprintf(stderr, "\n");
 #endif
     }
 
@@ -1163,6 +1163,12 @@
     {
         usage();
         return 1;
+    }
+
+    /* only allow raw data on stdio */
+    if (writeToStdio == 1)
+    {
+        format = 2;
     }
 
     /* point to the specified file name */