10 #include "../help_mp.h"
12 // there are some globals:
13 ao_data_t ao_data
={0,0,0,0,OUTBURST
,-1,0};
14 char *ao_subdevice
= NULL
;
17 extern ao_functions_t audio_out_oss
;
20 extern ao_functions_t audio_out_arts
;
23 extern ao_functions_t audio_out_esd
;
25 extern ao_functions_t audio_out_null
;
27 extern ao_functions_t audio_out_alsa5
;
30 extern ao_functions_t audio_out_alsa9
;
33 extern ao_functions_t audio_out_alsa1x
;
36 extern ao_functions_t audio_out_nas
;
39 extern ao_functions_t audio_out_sdl
;
42 extern ao_functions_t audio_out_sun
;
45 extern ao_functions_t audio_out_sgi
;
47 #ifdef HAVE_WIN32WAVEOUT
48 extern ao_functions_t audio_out_win32
;
51 extern ao_functions_t audio_out_macosx
;
54 extern ao_functions_t audio_out_dxr2
;
56 extern ao_functions_t audio_out_mpegpes
;
57 extern ao_functions_t audio_out_pcm
;
58 extern ao_functions_t audio_out_pss
;
59 extern ao_functions_t audio_out_plugin
;
61 ao_functions_t
* audio_out_drivers
[] =
63 // vo-related: will fail unless you also do -vo mpegpes/dxr2
69 #ifdef HAVE_WIN32WAVEOUT
107 // should not be auto-selected:
113 void list_audio_out(){
115 mp_msg(MSGT_AO
, MSGL_INFO
, MSGTR_AvailableAudioOutputDrivers
);
116 while (audio_out_drivers
[i
]) {
117 const ao_info_t
*info
= audio_out_drivers
[i
++]->info
;
118 printf("\t%s\t%s\n", info
->short_name
, info
->name
);
123 ao_functions_t
* init_best_audio_out(char** ao_list
,int use_plugin
,int rate
,int channels
,int format
,int flags
){
125 // first try the preferred drivers, with their optional subdevice param:
126 if(ao_list
&& ao_list
[0])
127 while(ao_list
[0][0]){
128 char* ao
=strdup(ao_list
[0]);
129 ao_subdevice
=strchr(ao
,':');
134 for(i
=0;audio_out_drivers
[i
];i
++){
135 ao_functions_t
* audio_out
=audio_out_drivers
[i
];
136 if(!strcmp(audio_out
->info
->short_name
,ao
)){
137 // name matches, try it
139 audio_out_plugin
.control(AOCONTROL_SET_PLUGIN_DRIVER
,audio_out
);
140 audio_out
=&audio_out_plugin
;
142 if(audio_out
->init(rate
,channels
,format
,flags
))
143 return audio_out
; // success!
148 if(!(ao_list
[0])) return NULL
; // do NOT fallback to others
150 // now try the rest...
152 for(i
=0;audio_out_drivers
[i
];i
++){
153 ao_functions_t
* audio_out
=audio_out_drivers
[i
];
155 audio_out_plugin
.control(AOCONTROL_SET_PLUGIN_DRIVER
,audio_out
);
156 audio_out
=&audio_out_plugin
;
158 if(audio_out
->init(rate
,channels
,format
,flags
))
159 return audio_out
; // success!