Mercurial > mplayer.hg
comparison libao2/audio_out.c @ 7563:e9e4398029de
audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
author | arpi |
---|---|
date | Sun, 29 Sep 2002 22:57:54 +0000 |
parents | 0398cb49fe5e |
children | 2ac457fb9c8c |
comparison
equal
deleted
inserted
replaced
7562:92188b57a062 | 7563:e9e4398029de |
---|---|
2 #include <stdlib.h> | 2 #include <stdlib.h> |
3 | 3 |
4 #include "../config.h" | 4 #include "../config.h" |
5 #include "audio_out.h" | 5 #include "audio_out.h" |
6 #include "afmt.h" | 6 #include "afmt.h" |
7 | |
8 #include "../mp_msg.h" | |
9 #include "../help_mp.h" | |
7 | 10 |
8 // there are some globals: | 11 // there are some globals: |
9 ao_data_t ao_data={0,0,0,0,OUTBURST,-1,0}; | 12 ao_data_t ao_data={0,0,0,0,OUTBURST,-1,0}; |
10 char *ao_subdevice = NULL; | 13 char *ao_subdevice = NULL; |
11 | 14 |
83 &audio_out_plugin, | 86 &audio_out_plugin, |
84 // &audio_out_pss, | 87 // &audio_out_pss, |
85 NULL | 88 NULL |
86 }; | 89 }; |
87 | 90 |
91 void list_audio_out(){ | |
92 int i=0; | |
93 mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AvailableAudioOutputDrivers); | |
94 while (audio_out_drivers[i]) { | |
95 const ao_info_t *info = audio_out_drivers[i++]->info; | |
96 printf("\t%s\t%s\n", info->short_name, info->name); | |
97 } | |
98 printf("\n"); | |
99 } | |
88 | 100 |
101 ao_functions_t* init_best_audio_out(char** ao_list,int use_plugin,int rate,int channels,int format,int flags){ | |
102 int i; | |
103 // first try the preferred drivers, with their optional subdevice param: | |
104 if(ao_list && ao_list[0]) | |
105 while(ao_list[0][0]){ | |
106 char* ao=strdup(ao_list[0]); | |
107 ao_subdevice=strchr(ao,':'); | |
108 if(ao_subdevice){ | |
109 ao_subdevice[0]=0; | |
110 ++ao_subdevice; | |
111 } | |
112 for(i=0;audio_out_drivers[i];i++){ | |
113 ao_functions_t* audio_out=audio_out_drivers[i]; | |
114 if(!strcmp(audio_out->info->short_name,ao)){ | |
115 // name matches, try it | |
116 if(use_plugin){ | |
117 audio_out_plugin.control(AOCONTROL_SET_PLUGIN_DRIVER,(int)audio_out); | |
118 audio_out=&audio_out_plugin; | |
119 } | |
120 if(audio_out->init(rate,channels,format,flags)) | |
121 return audio_out; // success! | |
122 } | |
123 } | |
124 // continue... | |
125 ++ao_list; | |
126 if(!(ao_list[0])) return NULL; // do NOT fallback to others | |
127 } | |
128 // now try the rest... | |
129 ao_subdevice=NULL; | |
130 for(i=0;audio_out_drivers[i];i++){ | |
131 ao_functions_t* audio_out=audio_out_drivers[i]; | |
132 if(use_plugin){ | |
133 audio_out_plugin.control(AOCONTROL_SET_PLUGIN_DRIVER,(int)audio_out); | |
134 audio_out=&audio_out_plugin; | |
135 } | |
136 if(audio_out->init(rate,channels,format,flags)) | |
137 return audio_out; // success! | |
138 } | |
139 return NULL; | |
140 } | |
89 | 141 |