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_nas
;
36 extern ao_functions_t audio_out_sdl
;
39 extern ao_functions_t audio_out_sun
;
42 extern ao_functions_t audio_out_sgi
;
44 #ifdef HAVE_WIN32WAVEOUT
45 extern ao_functions_t audio_out_win32
;
48 extern ao_functions_t audio_out_macosx
;
51 extern ao_functions_t audio_out_dxr2
;
53 extern ao_functions_t audio_out_mpegpes
;
54 extern ao_functions_t audio_out_pcm
;
55 extern ao_functions_t audio_out_pss
;
56 extern ao_functions_t audio_out_plugin
;
58 ao_functions_t
* audio_out_drivers
[] =
60 // vo-related: will fail unless you also do -vo mpegpes/dxr2
66 #ifdef HAVE_WIN32WAVEOUT
101 // should not be auto-selected:
107 void list_audio_out(){
109 mp_msg(MSGT_AO
, MSGL_INFO
, MSGTR_AvailableAudioOutputDrivers
);
110 while (audio_out_drivers
[i
]) {
111 const ao_info_t
*info
= audio_out_drivers
[i
++]->info
;
112 printf("\t%s\t%s\n", info
->short_name
, info
->name
);
117 ao_functions_t
* init_best_audio_out(char** ao_list
,int use_plugin
,int rate
,int channels
,int format
,int flags
){
119 // first try the preferred drivers, with their optional subdevice param:
120 if(ao_list
&& ao_list
[0])
121 while(ao_list
[0][0]){
122 char* ao
=strdup(ao_list
[0]);
123 ao_subdevice
=strchr(ao
,':');
128 for(i
=0;audio_out_drivers
[i
];i
++){
129 ao_functions_t
* audio_out
=audio_out_drivers
[i
];
130 if(!strcmp(audio_out
->info
->short_name
,ao
)){
131 // name matches, try it
133 audio_out_plugin
.control(AOCONTROL_SET_PLUGIN_DRIVER
,audio_out
);
134 audio_out
=&audio_out_plugin
;
136 if(audio_out
->init(rate
,channels
,format
,flags
))
137 return audio_out
; // success!
142 if(!(ao_list
[0])) return NULL
; // do NOT fallback to others
144 // now try the rest...
146 for(i
=0;audio_out_drivers
[i
];i
++){
147 ao_functions_t
* audio_out
=audio_out_drivers
[i
];
149 audio_out_plugin
.control(AOCONTROL_SET_PLUGIN_DRIVER
,audio_out
);
150 audio_out
=&audio_out_plugin
;
152 if(audio_out
->init(rate
,channels
,format
,flags
))
153 return audio_out
; // success!