mirror of https://github.com/mpv-player/mpv
Fixed sig 11 caused by resampling plugin, some cosmetic changes and speed improvements
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4375 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
3764d12de6
commit
c045148761
|
@ -159,7 +159,7 @@ static int init(int rate,int channels,int format,int flags){
|
||||||
|
|
||||||
if(!ok) return 0;
|
if(!ok) return 0;
|
||||||
|
|
||||||
// Allocate output buffer */
|
// Allocate output buffer
|
||||||
if(ao_plugin_local_data.buf)
|
if(ao_plugin_local_data.buf)
|
||||||
free(ao_plugin_local_data.buf);
|
free(ao_plugin_local_data.buf);
|
||||||
ao_plugin_local_data.buf=malloc(MAX_OUTBURST);
|
ao_plugin_local_data.buf=malloc(MAX_OUTBURST);
|
||||||
|
|
|
@ -101,18 +101,16 @@ static void reset(){
|
||||||
// processes 'ao_plugin_data.len' bytes of 'data'
|
// processes 'ao_plugin_data.len' bytes of 'data'
|
||||||
// called for every block of data
|
// called for every block of data
|
||||||
static int play(){
|
static int play(){
|
||||||
int i=0;
|
|
||||||
int j=0;
|
|
||||||
int k=0;
|
|
||||||
// Copy end of prev block to begining of buffer
|
// Copy end of prev block to begining of buffer
|
||||||
for(i=0;i<ao_plugin_cfg.pl_delay_len;i++,j++)
|
memcpy(pl_delay.data,pl_delay.delay,ao_plugin_cfg.pl_delay_len);
|
||||||
((char*)pl_delay.data)[j]=((char*)pl_delay.delay)[i];
|
|
||||||
// Copy current block except end
|
// Copy current block except end
|
||||||
for(i=0;i<ao_plugin_data.len-ao_plugin_cfg.pl_delay_len;i++,j++,k++)
|
memcpy(pl_delay.data+ao_plugin_cfg.pl_delay_len,
|
||||||
((char*)pl_delay.data)[j]=((char*)ao_plugin_data.data)[k];
|
ao_plugin_data.data,
|
||||||
|
ao_plugin_data.len-ao_plugin_cfg.pl_delay_len);
|
||||||
// Save away end of current block for next call
|
// Save away end of current block for next call
|
||||||
for(i=0;i<ao_plugin_cfg.pl_delay_len;i++,k++)
|
memcpy(pl_delay.delay,
|
||||||
((char*)pl_delay.delay)[i]=((char*)ao_plugin_data.data)[k];
|
ao_plugin_data.data+ao_plugin_data.len-ao_plugin_cfg.pl_delay_len,
|
||||||
|
ao_plugin_cfg.pl_delay_len);
|
||||||
// Set output data block
|
// Set output data block
|
||||||
ao_plugin_data.data=pl_delay.data;
|
ao_plugin_data.data=pl_delay.data;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -91,8 +91,8 @@ static int control(int cmd,int arg){
|
||||||
if(!pl_resample.data)
|
if(!pl_resample.data)
|
||||||
return CONTROL_ERROR;
|
return CONTROL_ERROR;
|
||||||
ao_plugin_data.len = (int)((double)ao_plugin_data.len *
|
ao_plugin_data.len = (int)((double)ao_plugin_data.len *
|
||||||
((double)pl_resample.up)/
|
((double)pl_resample.dn)/
|
||||||
((double)pl_resample.dn));
|
((double)pl_resample.up));
|
||||||
return CONTROL_OK;
|
return CONTROL_OK;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in New Issue