X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=src%2Fwav2swf.c;h=72919e5d3e8739ddd2d2e35d2eb09ef90619a3d3;hp=70d51b1d6ff4dc8c9e926f09452d13878a306939;hb=f29d8006b1d8253c50808d6eb4941bdeb808c601;hpb=f92afaf4b15ed78999cd87e0e7b36ce8d5d7f299 diff --git a/src/wav2swf.c b/src/wav2swf.c index 70d51b1..72919e5 100644 --- a/src/wav2swf.c +++ b/src/wav2swf.c @@ -24,7 +24,7 @@ #include "../lib/rfxswf.h" #include "../lib/log.h" #include "../lib/args.h" -#include "wav.h" +#include "../lib/wav.h" char * filename = 0; char * outputname = "output.swf"; @@ -40,7 +40,6 @@ static struct options_t options[] = { {"o", "output"}, {"r", "framerate"}, {"s", "samplerate"}, -{"b", "bitrate"}, {"d", "definesound"}, {"l", "loop"}, {"C", "cgi"}, @@ -114,7 +113,7 @@ int args_callback_option(char*name,char*val) samplerate = 44100; else { fprintf(stderr, "Invalid samplerate: %d\n", samplerate); - fprintf(stderr, "Allowed values: 11025, 22050, 44100\n", samplerate); + fprintf(stderr, "Allowed values: 11025, 22050, 44100\n"); exit(1); } return 1; @@ -163,7 +162,6 @@ void args_callback_usage(char *name) printf("-o , --output Explicitly specify output file. (Otherwise, output will go to output.swf)\n"); printf("-r , --framerate Set file framerate to frames per second.\n"); printf("-s , --samplerate Set samplerate to frames per second (default: 11025).\n"); - printf("-b , --bitrate bps Set mp3 bitrate to .\n"); printf("-d , --definesound Generate a DefineSound tag instead of streaming sound.\n"); printf("-l , --loop n (Only used with -d)\n"); printf("-C , --cgi For use as CGI- prepend http header, write to stdout.\n"); @@ -229,17 +227,24 @@ int main (int argc,char ** argv) exit(1); } - if(!readWAV(filename, &wav)) + if(!wav_read(&wav, filename)) { msg(" Error reading %s", filename); exit(1); } - convertWAV2mono(&wav,&wav2, samplerate); - //printWAVInfo(&wav); - //printWAVInfo(&wav2); + wav_convert2mono(&wav,&wav2, samplerate); + //wav_print(&wav); + //wav_print(&wav2); samples = (U16*)wav2.data; numsamples = wav2.size/2; +#ifdef WORDS_BIGENDIAN + /* swap bytes */ + for(t=0;t>8)&0xff | (samples[t]<<8)&0xff00; + } +#endif + if(numsamples%blocksize != 0) { // apply padding, so that block is a multiple of blocksize