summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-06-07 00:30:32 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-06-07 00:30:32 +0000
commit954e9892f21f421b1d0fc287936cdbe5960659fc (patch)
treeb4572ad571064c54c8b401b6836df2b9f19a3dd2
parent6568365c1269b047eea002af40f62cf20da4a3b4 (diff)
downloadmpv-954e9892f21f421b1d0fc287936cdbe5960659fc.tar.bz2
mpv-954e9892f21f421b1d0fc287936cdbe5960659fc.tar.xz
disables those plugins that can't handle the audio format.
it also fixes a bug(and i'm pretty sure this _is_ a bug) where, when playing multiple files, after the first file only the first audio plugin is used. patch by Christian Ohm <chr.ohm@gmx.net> git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6320 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--libao2/ao_plugin.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/libao2/ao_plugin.c b/libao2/ao_plugin.c
index 53b6bde915..e2861930f0 100644
--- a/libao2/ao_plugin.c
+++ b/libao2/ao_plugin.c
@@ -116,13 +116,21 @@ int add_plugin(int i,char* cfg){
// open & setup audio device and plugins
// return: 1=success 0=fail
static int init(int rate,int channels,int format,int flags){
+ int use_plugin[NPL];
+ int x,npl,unused=0;
int ok=1;
+ char *config;
// Create list of plugins from cfg option
int i=0;
if(ao_plugin_cfg.plugin_list){
- if(!add_plugin(i,ao_plugin_cfg.plugin_list))
+ config = malloc(strlen(ao_plugin_cfg.plugin_list));
+ if(!config) return 0;
+ if(!strcpy(config, ao_plugin_cfg.plugin_list) || !add_plugin(i,config)){
+ free(config);
return 0;
+ }
+ free(config);
}
/* Set input parameters and itterate through plugins each plugin
@@ -139,11 +147,21 @@ static int init(int rate,int channels,int format,int flags){
ao_plugin_data.sz_fix=0;
ao_plugin_data.delay_mult=1;
ao_plugin_data.delay_fix=0;
- i=0;
- while(plugin(i)&&ok)
- ok=plugin(i++)->init();
-
- if(!ok) return 0;
+
+ for(i=0;i<NPL,plugin(i);i++){
+ use_plugin[i]=plugin(i)->init();
+ if(!use_plugin[i]) plugin(i)->uninit();
+ }
+ npl=i;
+ for(i=0;i<npl,plugin(i);i++)
+ if(!use_plugin[i+unused]){
+ unused++;
+ for(x=i;x<npl,plugin(x+1);x++) plugin(x)=plugin(x+1);
+ plugin(x)=NULL;
+ npl--;
+ i--;
+ }
+ i=npl;
// Calculate bps
ao_plugin_local_data.bps=(float)(ao_plugin_data.rate *