X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fmodules%2Fswfsound.c;h=3e5652b2358839494e22fd72b30d36a81e5ece71;hb=8526dcf3a698c688e2cc4430ae106b5ecf70677f;hp=a7ca0e1539068015180e5b20b8cc5bb1460fe5bb;hpb=133453cc112df7e7d5ce35f3dde5178303154da5;p=swftools.git diff --git a/lib/modules/swfsound.c b/lib/modules/swfsound.c index a7ca0e1..3e5652b 100644 --- a/lib/modules/swfsound.c +++ b/lib/modules/swfsound.c @@ -60,7 +60,7 @@ void swf_SetSoundStreamBlock(TAG*tag, S16*samples, int numsamples, char first) char*buf; int len = 0; - buf = malloc(init->bufferSize); + buf = rfx_alloc(init->bufferSize); if(!buf) return; @@ -73,7 +73,7 @@ void swf_SetSoundStreamBlock(TAG*tag, S16*samples, int numsamples, char first) swf_SetU16(tag, 0); // seek } swf_SetBlock(tag, buf, len); - free(buf); + rfx_free(buf); } #endif @@ -87,10 +87,15 @@ int swf_mp3_bitrate = 32; #ifdef HAVE_LAME #define HAVE_SOUND +#include #include "../lame/lame.h" static lame_global_flags*lame_flags; +void null_errorf(const char *format, va_list ap) +{ +} + static void initlame() { unsigned char buf[4096]; @@ -116,12 +121,14 @@ static void initlame() lame_init_params(lame_flags); lame_init_bitstream(lame_flags); + lame_set_errorf(lame_flags, null_errorf); /* The first two flush calls to lame always fail, for some reason. Do them here where they cause no damage. */ lame_encode_flush_nogap(lame_flags, buf, bufsize); //printf("init:flush_nogap():%d\n", len); lame_encode_flush(lame_flags, buf, bufsize); //printf("init:flush():%d\n", len); + lame_set_errorf(lame_flags, 0); } void swf_SetSoundStreamHead(TAG*tag, int avgnumsamples) @@ -157,7 +164,7 @@ void swf_SetSoundStreamBlock(TAG*tag, S16*samples, int seek, char first) int numsamples = (int)(((swf_mp3_out_samplerate > 22050) ? 1152 : 576) * ((double)swf_mp3_in_samplerate/swf_mp3_out_samplerate)); int fs = 0; - buf = malloc(bufsize); + buf = rfx_alloc(bufsize); if(!buf) return; @@ -177,7 +184,7 @@ void swf_SetSoundStreamBlock(TAG*tag, S16*samples, int seek, char first) fprintf(stderr, "ok: mp3 nonempty block, %d samples, first:%d, framesize:%d\n", numsamples, first, fs); }*/ - free(buf); + rfx_free(buf); } void swf_SetSoundStreamEnd(TAG*tag) @@ -219,7 +226,7 @@ void swf_SetSoundDefine(TAG*tag, S16*samples, int num) ((double)swf_mp3_in_samplerate/swf_mp3_out_samplerate)) // account for resampling ); - buf = malloc(bufsize); + buf = rfx_alloc(bufsize); if(!buf) return; @@ -236,7 +243,7 @@ void swf_SetSoundDefine(TAG*tag, S16*samples, int num) len = 0; } - free(buf); + rfx_free(buf); } #endif