changeset 274:9e7f9e09ea0e

Removed fprintf() calls. Replaced with SNDDBG() and Sound_SetError() calls.
author Ryan C. Gordon <icculus@icculus.org>
date Sun, 10 Mar 2002 19:15:25 +0000
parents e1429f96aded
children da9c762c55e4
files decoders/mpglib/common.c decoders/mpglib/interface.c decoders/mpglib/layer3.c
diffstat 3 files changed, 22 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/decoders/mpglib/common.c	Sun Mar 10 19:04:46 2002 +0000
+++ b/decoders/mpglib/common.c	Sun Mar 10 19:15:25 2002 +0000
@@ -96,7 +96,7 @@
 
     if(!fr->bitrate_index)
     {
-      fprintf(stderr,"Free format not supported.\n");
+      Sound_SetError("MPGLIB: Free format not supported.");
       return (0);
     }
 
@@ -112,7 +112,7 @@
         fr->framesize /= freqs[fr->sampling_frequency];
         fr->framesize  = ((fr->framesize+fr->padding)<<2)-4;
 #else
-        fprintf(stderr,"Not supported!\n");
+        Sound_SetError("MPGLIB: Not supported!");
 #endif
         break;
       case 2:
@@ -125,7 +125,7 @@
         fr->framesize /= freqs[fr->sampling_frequency];
         fr->framesize += fr->padding - 4;
 #else
-        fprintf(stderr,"Not supported!\n");
+        Sound_SetError("MPGLIB: Not supported!");
 #endif
         break;
       case 3:
@@ -146,7 +146,7 @@
           fr->framesize = fr->framesize + fr->padding - 4;
         break; 
       default:
-        fprintf(stderr,"Sorry, unknown layer type.\n"); 
+        Sound_SetError("MPGLIB: Unknown layer type.");
         return (0);
     }
     return 1;
--- a/decoders/mpglib/interface.c	Sun Mar 10 19:04:46 2002 +0000
+++ b/decoders/mpglib/interface.c	Sun Mar 10 19:15:25 2002 +0000
@@ -57,7 +57,7 @@
 
 	nbuf = malloc( sizeof(struct buf) );
 	if(!nbuf) {
-		fprintf(stderr,"Out of memory!\n");
+		Sound_SetError("MPGLIB: Out of memory!");
 		return NULL;
 	}
 	nbuf->pnt = malloc(size);
@@ -161,7 +161,7 @@
 	gmp = mp;
 
 	if(osize < 4608) {
-		fprintf(stderr,"To less out space\n");
+		Sound_SetError("MPGLIB: Not enough output space for decoding!");
 		return MP3_ERR;
 	}
 
@@ -237,7 +237,7 @@
 {
   unsigned char *bsbufold;
   if(gmp->fsizeold < 0 && backstep > 0) {
-    fprintf(stderr,"Can't step back %ld!\n",backstep);
+    Sound_SetError("MPGLIB: Can't step back!"); /* FIXME: need formatting: %ld!\n",backstep); */
     return MP3_ERR;
   }
   bsbufold = gmp->bsspace[gmp->bsnum] + 512;
--- a/decoders/mpglib/layer3.c	Sun Mar 10 19:04:46 2002 +0000
+++ b/decoders/mpglib/layer3.c	Sun Mar 10 19:15:25 2002 +0000
@@ -6,6 +6,12 @@
  */ 
 
 #include <stdlib.h>
+
+#include "SDL_sound.h"
+
+#define __SDL_SOUND_INTERNAL__
+#include "SDL_sound_internal.h"
+
 #include "mpg123_sdlsound.h"
 #include "mpglib_sdlsound.h"
 #include "huffman.h"
@@ -320,7 +326,7 @@
        gr_info->part2_3_length = getbits(12);
        gr_info->big_values = getbits_fast(9);
        if(gr_info->big_values > 288) {
-          fprintf(stderr,"big_values too large!\n");
+          SNDDBG("MPGLIB: big_values too large!\n");
           gr_info->big_values = 288;
        }
        gr_info->pow2gain = gainpow2+256 - getbits_fast(8) + powdiff;
@@ -344,7 +350,7 @@
            gr_info->full_gain[i] = gr_info->pow2gain + (getbits_fast(3)<<3);
 
          if(gr_info->block_type == 0) {
-           fprintf(stderr,"Blocktype == 0 and window-switching == 1 not allowed.\n");
+           Sound_SetError("MPGLIB: Blocktype == 0 and window-switching == 1 not allowed.");
            return 0;
          }
          /* region_count/start parameters are implicit in this case. */       
@@ -394,7 +400,7 @@
        gr_info->part2_3_length = getbits(12);
        gr_info->big_values = getbits_fast(9);
        if(gr_info->big_values > 288) {
-         fprintf(stderr,"big_values too large!\n");
+         SNDDBG("MPGLIB: big_values too large!\n");
          gr_info->big_values = 288;
        }
        gr_info->pow2gain = gainpow2+256 - getbits_fast(8) + powdiff;
@@ -418,7 +424,7 @@
            gr_info->full_gain[i] = gr_info->pow2gain + (getbits_fast(3)<<3);
 
          if(gr_info->block_type == 0) {
-           fprintf(stderr,"Blocktype == 0 and window-switching == 1 not allowed.\n");
+           Sound_SetError("MPGLIB: Blocktype == 0 and window-switching == 1 not allowed.");
            return 0;
          }
          /* region_count/start parameters are implicit in this case. */       
@@ -953,7 +959,7 @@
   if(part2remain > 0)
     getbits(part2remain);
   else if(part2remain < 0) {
-    fprintf(stderr,"mpg123: Can't rewind stream by %d bits!\n",-part2remain);
+    Sound_SetError("MPGLIB: Can't rewind stream!"); /* !!! FIXME: Need formatting: by %d bits!\n",-part2remain);*/
     return 1; /* -> error */
   }
   return 0;
@@ -1364,7 +1370,7 @@
   if(part2remain > 0 )
     getbits(part2remain);
   else if(part2remain < 0) {
-    fprintf(stderr,"mpg123_ms: Can't rewind stream by %d bits!\n",-part2remain);
+    Sound_SetError("MPGLIB: Can't rewind stream!"); /* !!! FIXME: Need formatting: by %d bits!\n",-part2remain); */
     return 1; /* -> error */
   }
   return 0;
@@ -1902,7 +1908,7 @@
     if(!III_get_side_info_1(&sideinfo,stereo,ms_stereo,sfreq,single))
       return -1;
 #else
-    fprintf(stderr,"Not supported\n");
+    Sound_SetError("MPGLIB: Not supported!");
 #endif
   }
 
@@ -1923,7 +1929,7 @@
 #ifdef MPEG1
         part2bits = III_get_scale_factors_1(scalefacs[0],gr_info);
 #else
-	fprintf(stderr,"Not supported\n");
+    Sound_SetError("MPGLIB: Not supported!");
 #endif
       }
       if(III_dequantize_sample(hybridIn[0], scalefacs[0],gr_info,sfreq,part2bits))
@@ -1938,7 +1944,7 @@
 #ifdef MPEG1
         part2bits = III_get_scale_factors_1(scalefacs[1],gr_info);
 #else
-	fprintf(stderr,"Not supported\n");
+    Sound_SetError("MPGLIB: Not supported!");
 #endif
       }