Mercurial > mplayer.hg
comparison libao2/ao_plugin.c @ 4375:bd108c2796ab
Fixed sig 11 caused by buffer full in ao driver
author | anders |
---|---|
date | Sun, 27 Jan 2002 10:59:03 +0000 |
parents | 0a95c5074c50 |
children | 118ae69769be |
comparison
equal
deleted
inserted
replaced
4374:0a95c5074c50 | 4375:bd108c2796ab |
---|---|
215 static int play(void* data,int len,int flags){ | 215 static int play(void* data,int len,int flags){ |
216 int l,i=0; | 216 int l,i=0; |
217 // Limit length to avoid over flow in plugins | 217 // Limit length to avoid over flow in plugins |
218 int tmp = driver()->get_space(); | 218 int tmp = driver()->get_space(); |
219 int ret_len =(tmp<len)?tmp:len; | 219 int ret_len =(tmp<len)?tmp:len; |
220 // Filter data | 220 if(ret_len){ |
221 ao_plugin_data.len=ret_len; | 221 // Filter data |
222 ao_plugin_data.data=data; | 222 ao_plugin_data.len=ret_len; |
223 while(plugin(i)) | 223 ao_plugin_data.data=data; |
224 plugin(i++)->play(); | 224 while(plugin(i)){ |
225 // Copy data to output buffer | 225 printf("%i \n",ao_plugin_data.len); |
226 memcpy(ao_plugin_local_data.buf+ao_plugin_local_data.len, | 226 plugin(i++)->play(); |
227 ao_plugin_data.data,ao_plugin_data.len); | 227 printf("%i \n",ao_plugin_data.len); |
228 // Send data to output | 228 } |
229 l=driver()->play(ao_plugin_local_data.buf, | 229 // Copy data to output buffer |
230 ao_plugin_data.len+ao_plugin_local_data.len,flags); | 230 memcpy(ao_plugin_local_data.buf+ao_plugin_local_data.len, |
231 // Save away unsent data | 231 ao_plugin_data.data,ao_plugin_data.len); |
232 ao_plugin_local_data.len=ao_plugin_data.len+ao_plugin_local_data.len-l; | 232 // Send data to output |
233 memcpy(ao_plugin_local_data.buf,ao_plugin_local_data.buf+l, | 233 l=driver()->play(ao_plugin_local_data.buf, |
234 ao_plugin_local_data.len); | 234 ao_plugin_data.len+ao_plugin_local_data.len,flags); |
235 | 235 // Save away unsent data |
236 ao_plugin_local_data.len=ao_plugin_data.len+ao_plugin_local_data.len-l; | |
237 memcpy(ao_plugin_local_data.buf,ao_plugin_local_data.buf+l, | |
238 ao_plugin_local_data.len); | |
239 } | |
236 return ret_len; | 240 return ret_len; |
237 } | 241 } |
238 | 242 |
239 // return: delay in seconds between first and last sample in buffer | 243 // return: delay in seconds between first and last sample in buffer |
240 static float get_delay(){ | 244 static float get_delay(){ |