annotate decoders/mpglib/main.c @ 427:ba94ffe34a47

Upped version to 1.0.0.
author Ryan C. Gordon <icculus@icculus.org>
date Wed, 09 Oct 2002 16:10:11 +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