mirror of
https://github.com/mpv-player/mpv
synced 2024-12-23 23:32:26 +00:00
dump to file
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@815 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
845189da4d
commit
0866effef1
@ -1,4 +1,6 @@
|
||||
|
||||
#define DUMP_PCM
|
||||
|
||||
// gcc test.c -I.. -L. -lMP3 -o test -O4
|
||||
|
||||
#include <stdio.h>
|
||||
@ -33,6 +35,10 @@ int main(int argc,char* argv[]){
|
||||
int total=0;
|
||||
unsigned int time1;
|
||||
float length;
|
||||
#ifdef DUMP_PCM
|
||||
FILE *f=NULL;
|
||||
f=fopen("test.pcm","wb");
|
||||
#endif
|
||||
|
||||
mp3file=fopen((argc>1)?argv[1]:"test.mp3","rb");
|
||||
if(!mp3file){ printf("file not found\n"); exit(1); }
|
||||
@ -46,9 +52,12 @@ int main(int argc,char* argv[]){
|
||||
MP3_samplerate=MP3_channels=0;
|
||||
|
||||
time1=GetTimer();
|
||||
while((len=MP3_DecodeFrame(buffer,-1))>0){
|
||||
while((len=MP3_DecodeFrame(buffer,-1))>0 && total<2000000){
|
||||
total+=len;
|
||||
// play it
|
||||
#ifdef DUMP_PCM
|
||||
fwrite(buffer,len,1,f);
|
||||
#endif
|
||||
//putchar('.');fflush(stdout);
|
||||
}
|
||||
time1=GetTimer()-time1;
|
||||
|
Loading…
Reference in New Issue
Block a user