X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fmodules%2Fswfsound.c;h=7032b0202a832525f8cfc5b4733e66b274b895bc;hp=af1ef7e5e9d07fe21d9d4679d983b6bf49beba0b;hb=053e755a7308d49d9d00cfc8a24d2adfa5cc9a80;hpb=0097022d06fd03d385aea0226f27efbf2bb451eb diff --git a/lib/modules/swfsound.c b/lib/modules/swfsound.c index af1ef7e..7032b02 100644 --- a/lib/modules/swfsound.c +++ b/lib/modules/swfsound.c @@ -7,9 +7,19 @@ Copyright (c) 2001, 2002 Matthias Kramm - This file is distributed under the GPL, see file COPYING for details + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -*/ + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef RFXSWF_DISABLESOUND @@ -142,7 +152,7 @@ void swf_SetSoundStreamBlock(TAG*tag, S16*samples, int seek, char first) char*buf; int len = 0; int bufsize = 16384; - int numsamples = 576*(swf_mp3_in_samplerate/swf_mp3_out_samplerate); + 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); @@ -184,7 +194,7 @@ void swf_SetSoundDefine(TAG*tag, S16*samples, int num) char*buf; int oldlen=0,len = 0; int bufsize = 16384; - int blocksize = 576*(swf_mp3_in_samplerate/swf_mp3_out_samplerate); + int blocksize = (int)(((swf_mp3_out_samplerate > 22050) ? 1152 : 576) * ((double)swf_mp3_in_samplerate/swf_mp3_out_samplerate)); int t; int blocks; @@ -203,8 +213,8 @@ void swf_SetSoundDefine(TAG*tag, S16*samples, int num) swf_SetU8(tag,(compression<<4)|(rate<<2)|(size<<1)|type); - swf_SetU32(tag,blocks*blocksize / - (swf_mp3_in_samplerate/swf_mp3_out_samplerate) // account for resampling + swf_SetU32(tag, (int)(tag,blocks*blocksize / + ((double)swf_mp3_in_samplerate/swf_mp3_out_samplerate)) // account for resampling ); buf = malloc(bufsize);