annotate decoders/mpglib/main.c @ 423:c1db690b79ed

Updated.
author Ryan C. Gordon <icculus@icculus.org>
date Mon, 30 Sep 2002 08:03:10 +0000
parents 9b6e82f7c853
children
rev   line source
261
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
2 #include "mpg123_sdlsound.h"
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
3 #include "mpglib_sdlsound.h"
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
4
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
5 #error This is for example usage. Do not compile for SDL_sound.
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
6
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
7 char buf[16384];
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
8 struct mpstr mp;
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
9
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
10 int main(int argc,char **argv)
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
11 {
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
12 int size;
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
13 char out[8192];
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
14 int len,ret;
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
15
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
16
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
17 InitMP3(&mp);
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
18
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
19 while(1) {
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
20 len = read(0,buf,16384);
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
21 if(len <= 0)
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
22 break;
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
23 ret = decodeMP3(&mp,buf,len,out,8192,&size);
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
24 while(ret == MP3_OK) {
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
25 write(1,out,size);
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
26 ret = decodeMP3(&mp,NULL,0,out,8192,&size);
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
27 }
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
28 }
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
29
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
30 return 0;
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
31
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
32 }
9b6e82f7c853 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
33