261
|
1
|
|
2 #include "mpg123_sdlsound.h"
|
|
3 #include "mpglib_sdlsound.h"
|
|
4
|
|
5 #error This is for example usage. Do not compile for SDL_sound.
|
|
6
|
|
7 char buf[16384];
|
|
8 struct mpstr mp;
|
|
9
|
|
10 int main(int argc,char **argv)
|
|
11 {
|
|
12 int size;
|
|
13 char out[8192];
|
|
14 int len,ret;
|
|
15
|
|
16
|
|
17 InitMP3(&mp);
|
|
18
|
|
19 while(1) {
|
|
20 len = read(0,buf,16384);
|
|
21 if(len <= 0)
|
|
22 break;
|
|
23 ret = decodeMP3(&mp,buf,len,out,8192,&size);
|
|
24 while(ret == MP3_OK) {
|
|
25 write(1,out,size);
|
|
26 ret = decodeMP3(&mp,NULL,0,out,8192,&size);
|
|
27 }
|
|
28 }
|
|
29
|
|
30 return 0;
|
|
31
|
|
32 }
|
|
33
|