Mercurial > mplayer.hg
view mp3lib/test.c @ 8078:26a2ae540b04
bugfixes :
- It seems the CONF_TYPE_SUBCONFIG array for the "mode" option eats
all other -xvidencopts parameters. With it it wasn't possible to set
the bitrate or in fact any other parameter beside "mode".
- xvidencopts_conf wasn't properly initialised for some of the
lines. Probably didn't cause bugs but at least this shaves a few gcc
warnings.
- Rewrote initialisation code & defaults according to
xvidcore/docs/xvid-encoder.txt in XViD CVS tree. Some of the defaults
where bad. Done with the help of Markus Liebl < lieblm at web dot de >
modified features:
- Changed "debug" default to 0. Use the "debug" flag to enable it.
- Changed the interpretation of "br" to be consistent with lavc (now
in kbits/s if <16000, else bits/s). Should be backward compatible.
- Now use "-xvidopts pass=(1|2)" instead of "-xvidopts mode=2pass-(1|2)".
- Use the "-passtmpfile" global option instead of a hardwired name.
- Use the same motion presets as XViD's vfw CVS code (which is the
source of the windows codec I assume).
coding style etc...:
- Use static variables instead of a big struct for individual options,
easier to initialize.
- [f]printf() ->> mp_msg()
added features:
- Added "lumi_mask", "mpeg_quant", "hintedme" and "hintfile" options,
all off by default.
author | rguyom |
---|---|
date | Sun, 03 Nov 2002 12:43:30 +0000 |
parents | 93304e7353c8 |
children | 17554a75a654 |
line wrap: on
line source
#define DUMP_PCM // gcc test.c -I.. -L. -lMP3 -lm -o test1 -O4 #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/time.h> #include "mp3lib/mp3.h" #include "config.h" static inline unsigned int GetTimer(){ struct timeval tv; struct timezone tz; // float s; gettimeofday(&tv,&tz); // s=tv.tv_usec;s*=0.000001;s+=tv.tv_sec; return (tv.tv_sec*1000000+tv.tv_usec); } static FILE* mp3file=NULL; int mplayer_audio_read(char *buf,int size){ return fread(buf,1,size,mp3file); } #define BUFFLEN 4608 static unsigned char buffer[BUFFLEN]; int main(int argc,char* argv[]){ int len; 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); } // MPEG Audio: #ifdef USE_FAKE_MONO MP3_Init(0); #else MP3_Init(); #endif MP3_samplerate=MP3_channels=0; time1=GetTimer(); 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; length=(float)total/(float)(MP3_samplerate*MP3_channels*2); printf("\nDecoding time: %8.6f\n",(float)time1*0.000001f); printf("Uncompressed size: %d bytes (%8.3f secs)\n",total,length); printf("CPU usage at normal playback: %5.2f %\n",time1*0.0001f/length); fclose(mp3file); }