source: sssp/trunk/src/plugin/codec/mp3/mpg123/mpglib/main.c @ 531

Revision 531, 1.2 KB checked in by mocean, 7 years ago (diff)
Line 
1/*
2   mpglib - Mpeg Audio Decoder Library
3   Copyright (C) 1995-2005  The Mpg123 Project, All rights reserved.
4 
5    This library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9 
10    This library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14 
15    You should have received a copy of the GNU Lesser General Public
16    License along with this library; if not, write to the Free Software
17    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18*/
19
20
21#include "mpg123.h"
22#include "mpglib.h"
23
24char buf[16384];
25struct mpstr mp;
26
27void main(void)
28{
29   int size;
30   char out[8192];
31   int len,ret;
32   
33
34   InitMP3(&mp);
35
36   while(1) {
37      len = read(0,buf,16384);
38      if(len <= 0)
39         break;
40      ret = decodeMP3(&mp,buf,len,out,8192,&size);
41      while(ret == MP3_OK) {
42         write(1,out,size);
43         ret = decodeMP3(&mp,NULL,0,out,8192,&size);
44      }
45   }
46
47}
48
Note: See TracBrowser for help on using the repository browser.